krita

kis_tool_paint.h

00001 /*
00002  *  Copyright (c) 2003 Boudewijn Rempt
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  */
00018 
00019 #ifndef KIS_TOOL_PAINT_H_
00020 #define KIS_TOOL_PAINT_H_
00021 
00022 #include <qcursor.h>
00023 #include <qlayout.h>
00024 
00025 #include <koffice_export.h>
00026 
00027 #include "kis_tool.h"
00028 #include "kis_composite_op.h"
00029 
00030 class QCheckBox;
00031 class QEvent;
00032 class QKeyEvent;
00033 class QComboBox;
00034 class QPaintEvent;
00035 class QRect;
00036 class QGridLayout;
00037 class KDialog;
00038 class KisCanvasSubject;
00039 class QLabel;
00040 class KisCmbComposite;
00041 class KisIntSpinbox;
00042         
00043 enum enumBrushMode {
00044     PAINT,
00045     PAINT_STYLUS,
00046     ERASE,
00047     ERASE_STYLUS,
00048     HOVER
00049 };
00050 
00051 class KRITACORE_EXPORT KisToolPaint : public KisTool {
00052 
00053     Q_OBJECT
00054     typedef KisTool super;
00055 
00056 public:
00057     KisToolPaint(const QString& UIName);
00058     virtual ~KisToolPaint();
00059 
00060 public:
00061     virtual void update(KisCanvasSubject *subject);
00062 
00063     virtual void paint(KisCanvasPainter& gc);
00064     virtual void paint(KisCanvasPainter& gc, const QRect& rc);
00065 
00066     virtual void buttonPress(KisButtonPressEvent *e);
00067     virtual void move(KisMoveEvent *e);
00068     virtual void buttonRelease(KisButtonReleaseEvent *e);
00069     virtual void doubleClick(KisDoubleClickEvent *e);
00070     virtual void keyPress(QKeyEvent *e);
00071     virtual void keyRelease(QKeyEvent *e);
00072 
00073     virtual QCursor cursor();
00074     virtual void setCursor(const QCursor& cursor);
00075     virtual QWidget* createOptionWidget(QWidget* parent);
00076     virtual QWidget* optionWidget();
00077     virtual void addOptionWidgetOption(QWidget *control, QWidget *label = 0);
00078 
00079 public slots:
00080     virtual void activate();
00081     virtual void deactivate();
00082 
00083     void slotSetOpacity(int opacityPerCent);
00084     void slotSetCompositeMode(const KisCompositeOp& compositeOp);
00085     void slotPopupQuickHelp();
00086 
00087 protected:
00088     void notifyModified() const;
00089 
00090     // Add the tool-specific layout to the default option widget's layout.
00091     void addOptionWidgetLayout(QLayout *layout);
00092 
00093 private:
00094     void updateCompositeOpComboBox();
00095 
00096 protected:
00097     KisCanvasSubject *m_subject;
00098     QRect m_dirtyRect;
00099     Q_UINT8 m_opacity;
00100     KisCompositeOp m_compositeOp;
00101     bool m_paintOutline;
00102 
00103 private:
00104     QString m_UIName;
00105 
00106     QCursor m_cursor;
00107 
00108     QWidget *m_optionWidget;
00109     QGridLayout *m_optionWidgetLayout;
00110 
00111     QLabel *m_lbOpacity;
00112     KisIntSpinbox *m_slOpacity;
00113     QLabel *m_lbComposite;
00114     KisCmbComposite *m_cmbComposite;
00115 };
00116 
00117 #endif // KIS_TOOL_PAINT_H_
00118 
KDE Home | KDE Accessibility Home | Description of Access Keys