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 enter(QEvent *e);
00067     virtual void leave(QEvent *e);
00068     virtual void buttonPress(KisButtonPressEvent *e);
00069     virtual void move(KisMoveEvent *e);
00070     virtual void buttonRelease(KisButtonReleaseEvent *e);
00071     virtual void doubleClick(KisDoubleClickEvent *e);
00072     virtual void keyPress(QKeyEvent *e);
00073     virtual void keyRelease(QKeyEvent *e);
00074 
00075     virtual QCursor cursor();
00076     virtual void setCursor(const QCursor& cursor);
00077     virtual QWidget* createOptionWidget(QWidget* parent);
00078     virtual QWidget* optionWidget();
00079     virtual void addOptionWidgetOption(QWidget *control, QWidget *label = 0);
00080 
00081 public slots:
00082     virtual void activate();
00083     virtual void deactivate();
00084 
00085     void slotSetOpacity(int opacityPerCent);
00086     void slotSetCompositeMode(const KisCompositeOp& compositeOp);
00087     void slotPopupQuickHelp();
00088 
00089 protected:
00090     void notifyModified() const;
00091 
00092     // Add the tool-specific layout to the default option widget's layout.
00093     void addOptionWidgetLayout(QLayout *layout);
00094 
00095 private:
00096     void updateCompositeOpComboBox();
00097 
00098 protected:
00099     KisCanvasSubject *m_subject;
00100     QRect m_dirtyRect;
00101     Q_UINT8 m_opacity;
00102     KisCompositeOp m_compositeOp;
00103     bool m_paintOutline;
00104 
00105 private:
00106     QString m_UIName;
00107 
00108     QCursor m_cursor;
00109 
00110     QWidget *m_optionWidget;
00111     QGridLayout *m_optionWidgetLayout;
00112 
00113     QLabel *m_lbOpacity;
00114     KisIntSpinbox *m_slOpacity;
00115     QLabel *m_lbComposite;
00116     KisCmbComposite *m_cmbComposite;
00117 };
00118 
00119 #endif // KIS_TOOL_PAINT_H_
00120 
KDE Home | KDE Accessibility Home | Description of Access Keys