colorcombo.h

00001 /***************************************************************************
00002  *   Copyright (C) 2005 by David Saxton                                    *
00003  *   david@bluehaze.org                                                    *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  ***************************************************************************/
00010 
00011 #ifndef COLORCOMBO_H
00012 #define COLORCOMBO_H
00013 
00014 #include <qcolor.h>
00015 #include <qcombobox.h>
00016 
00023 class ColorCombo : public QComboBox
00024 {
00025         Q_OBJECT
00026         Q_PROPERTY( QColor color READ color WRITE setColor )
00027 
00028         public:
00029                 enum ColorScheme
00030                 {
00031                         QtStandard = 0,
00032                         LED = 1,
00033                         NumberOfSchemes = 2, 
00034                 };
00035                 
00039                 ColorCombo( ColorScheme colorScheme, QWidget *parent, const char *name = 0 );
00040                 ~ColorCombo();
00041 
00045                 void setColor( const QColor & col );
00049                 QColor color() const { return internalColor; }
00050 
00051         signals:
00055                 void activated( const QColor &col );
00059                 void highlighted( const QColor &col );
00060                 
00061         protected slots:
00062                 void slotActivated( int index );
00063                 void slotHighlighted( int index );
00064 
00065         protected:
00066                 virtual void resizeEvent( QResizeEvent *re );
00067                 void addColors();
00068                 void createPalettes();
00069                 
00070                 QColor customColor;
00071                 QColor internalColor;
00072                 ColorScheme m_colorScheme;
00073                 
00074                 static bool createdPalettes;
00075                 static QColor * palette[ NumberOfSchemes ];
00076                 static int paletteSize[ NumberOfSchemes ];
00077 };
00078 
00079 #endif

Generated on Tue May 8 17:05:28 2007 for KTechLab by  doxygen 1.5.1