krita
kis_palette_widget.h
00001 /* 00002 * Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org> 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_PALETTE_WIDGET_H__ 00020 #define __KIS_PALETTE_WIDGET_H__ 00021 00022 #include <qdict.h> 00023 #include "kis_palette_view.h" 00024 00025 class QComboBox; 00026 class QLineEdit; 00027 class KListBox; 00028 class KisPalette; 00029 class KisResource; 00030 class KisColor; 00031 00039 class KisPaletteWidget : public QWidget 00040 { 00041 Q_OBJECT 00042 public: 00043 KisPaletteWidget( QWidget *parent, int minWidth=210, int cols = 16); 00044 virtual ~KisPaletteWidget(); 00045 00046 QString palette() const; 00047 KisPaletteEntry currentEntry() const { return m_view->currentEntry(); } 00048 00049 public slots: 00050 void setPalette(const QString &paletteName); 00051 00052 signals: 00053 void colorSelected(const KisColor &); 00054 void colorSelected(const QColor&); 00055 void colorDoubleClicked( const KisColor &, const QString &); 00056 00057 protected slots: 00058 void slotSetPalette( const QString &_paletteName ); 00059 00060 public slots: 00061 // Called by the resource server whenever a palette is loaded. 00062 void slotAddPalette(KisResource * palette); 00063 00064 protected: 00065 void readNamedColor( void ); 00066 00067 protected: 00068 KisPaletteView* m_view; 00069 QDict<KisPalette> m_namedPaletteMap; 00070 KisPalette * m_currentPalette; 00071 QComboBox *combo; 00072 QScrollView *sv; 00073 int mMinWidth; 00074 int mCols; 00075 bool init; 00076 }; 00077 00078 #endif 00079