chalk

kis_tool_paint.h
1/*
2 * Copyright (c) 2003 Boudewijn Rempt
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19#ifndef KIS_TOOL_PAINT_H_
20#define KIS_TOOL_PAINT_H_
21
22#include <tqcursor.h>
23#include <tqlayout.h>
24
25#include <koffice_export.h>
26
27#include "kis_tool.h"
28#include "kis_composite_op.h"
29
30class TQCheckBox;
31class TQEvent;
32class TQKeyEvent;
33class TQComboBox;
34class TQPaintEvent;
35class TQRect;
36class TQGridLayout;
37class KDialog;
39class TQLabel;
40class KisCmbComposite;
41class KisIntSpinbox;
42
43enum enumBrushMode {
44 PAINT,
45 PAINT_STYLUS,
46 ERASE,
47 ERASE_STYLUS,
48 HOVER
49};
50
51class KRITACORE_EXPORT KisToolPaint : public KisTool {
52
53 TQ_OBJECT
54
55 typedef KisTool super;
56
57public:
58 KisToolPaint(const TQString& UIName);
59 virtual ~KisToolPaint();
60
61public:
62 virtual void update(KisCanvasSubject *subject);
63
64 virtual void paint(KisCanvasPainter& gc);
65 virtual void paint(KisCanvasPainter& gc, const TQRect& rc);
66
67 virtual void buttonPress(KisButtonPressEvent *e);
68 virtual void move(KisMoveEvent *e);
69 virtual void buttonRelease(KisButtonReleaseEvent *e);
70 virtual void doubleClick(KisDoubleClickEvent *e);
71 virtual void keyPress(TQKeyEvent *e);
72 virtual void keyRelease(TQKeyEvent *e);
73
74 virtual TQCursor cursor();
75 virtual void setCursor(const TQCursor& cursor);
76 virtual TQWidget* createOptionWidget(TQWidget* parent);
77 virtual TQWidget* optionWidget();
78 virtual void addOptionWidgetOption(TQWidget *control, TQWidget *label = 0);
79
80public slots:
81 virtual void activate();
82 virtual void deactivate();
83
84 void slotSetOpacity(int opacityPerCent);
85 void slotSetCompositeMode(const KisCompositeOp& compositeOp);
86 void slotPopupQuickHelp();
87
88protected:
89 void notifyModified() const;
90
91 // Add the tool-specific layout to the default option widget's layout.
92 void addOptionWidgetLayout(TQLayout *layout);
93
94private:
95 void updateCompositeOpComboBox();
96
97protected:
98 KisCanvasSubject *m_subject;
99 TQRect m_dirtyRect;
100 TQ_UINT8 m_opacity;
101 KisCompositeOp m_compositeOp;
102 bool m_paintOutline;
103
104private:
105 TQString m_UIName;
106
107 TQCursor m_cursor;
108
109 TQWidget *m_optionWidget;
110 TQGridLayout *m_optionWidgetLayout;
111
112 TQLabel *m_lbOpacity;
113 KisIntSpinbox *m_slOpacity;
114 TQLabel *m_lbComposite;
115 KisCmbComposite *m_cmbComposite;
116};
117
118#endif // KIS_TOOL_PAINT_H_
119
virtual void update(KisCanvasSubject *subject)=0
Implement this function to query the KisCanvasSubject implementation about state that may be interest...
KisCanvasSubject is part of the Observer pattern.
A combobox filled with the various composition strategies defined in kis_global.
An input widget for integer numbers, consisting of a spinbox and a dropdown slider.