krita

kis_paintop_box.h

00001 /*
00002  *  kis_paintop_box.h - part of KImageShop/Krayon/Krita
00003  *
00004  *  Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  */
00020 
00021 #ifndef KIS_PAINTOP_BOX_H_
00022 #define KIS_PAINTOP_BOX_H_
00023 
00024 #include <map>
00025 
00026 #include <qwidget.h>
00027 #include <qcombobox.h>
00028 #include <qvaluelist.h>
00029 
00030 #include "kis_input_device.h"
00031 
00032 class QString;
00033 
00034 class KWidgetAction;
00035 class KisView;
00036 class KisCanvasController;
00037 class KisID;
00038 class KisColorSpace;
00039 
00050 class KisPaintopBox : public QWidget {
00051 
00052     Q_OBJECT
00053 
00054     typedef QWidget super;
00055 
00056 public:
00057     KisPaintopBox (KisView * view,  QWidget * parent, const char * name = 0);
00058 
00059     ~KisPaintopBox();
00060 
00061     
00062 signals:
00063 
00064     void selected(const KisID & id, const KisPaintOpSettings *settings);
00065 
00066 private slots:
00067 
00068     void addItem(const KisID & paintop, const QString & category = "");
00069 
00070 private slots:
00071 
00072     void slotItemSelected(int index);
00073     void colorSpaceChanged(KisColorSpace *cs);
00074     void slotInputDeviceChanged(const KisInputDevice & inputDevice);
00075 
00076 private:
00077     QPixmap paintopPixmap(const KisID & paintop);
00078     void updateOptionWidget();
00079     const KisID & currentPaintop();
00080     void setCurrentPaintop(const KisID & paintop);
00081     KisID defaultPaintop(const KisInputDevice& inputDevice);
00082     const KisPaintOpSettings *paintopSettings(const KisID & paintop, const KisInputDevice & inputDevice);
00083 
00084 private:
00085     KisCanvasController *m_canvasController;
00086     QComboBox * m_cmbPaintops;
00087     QHBoxLayout * m_layout;
00088     QWidget * m_optionWidget;
00089     
00090     QValueList<KisID> * m_paintops;
00091     QValueList<KisID> * m_displayedOps;
00092 
00093     typedef std::map<KisInputDevice, KisID> InputDevicePaintopMap;
00094     InputDevicePaintopMap m_currentID;
00095 
00096     typedef std::map<KisInputDevice, QValueVector<KisPaintOpSettings *> > InputDevicePaintopSettingsMap;
00097     InputDevicePaintopSettingsMap m_inputDevicePaintopSettings;
00098 };
00099 
00100 
00101 
00102 #endif //KIS_PAINTOP_BOX_H_
00103 
KDE Home | KDE Accessibility Home | Description of Access Keys