lib Library API Documentation

tkcoloractions.h

00001 #ifndef TKCOLORACTION_H 00002 #define TKCOLORACTION_H 00003 00004 #include "tkaction.h" 00005 00006 #include <kpopupmenu.h> 00007 #include <qdict.h> 00008 00009 class QGridLayout; 00010 class TKColorPanel; 00011 class TKSelectColorActionPrivate; 00012 00013 class TKColorPopupMenu : public KPopupMenu 00014 { Q_OBJECT 00015 public: 00016 TKColorPopupMenu( QWidget* parent = 0, const char* name = 0 ); 00017 ~TKColorPopupMenu(); 00018 00019 public slots: 00020 void updateItemSize(); 00021 }; 00022 /****************************************************************************************/ 00023 class TKSelectColorAction : public TKAction 00024 { Q_OBJECT 00025 public: 00026 enum Type { 00027 TextColor, 00028 LineColor, 00029 FillColor, 00030 Color 00031 }; 00032 00033 TKSelectColorAction( const QString& text, Type type, QObject* parent, const char* name, bool menuDefaultColor=false); 00034 TKSelectColorAction( const QString& text, Type type, 00035 QObject* receiver, const char* slot, 00036 QObject* parent, const char* name,bool menuDefaultColor=false ); 00037 00038 virtual ~TKSelectColorAction(); 00039 00040 QColor color() const { return m_pCurrentColor; } 00041 00042 KPopupMenu* popupMenu() const { return m_pMenu; } 00043 void setDefaultColor(const QColor &_col); 00044 00045 00046 public slots: 00047 void setCurrentColor( const QColor& ); 00048 void setActiveColor( const QColor& ); 00049 virtual void activate(); 00050 00051 signals: 00052 void colorSelected( const QColor& ); 00053 00054 protected slots: 00055 void selectColorDialog(); 00056 void panelColorSelected( const QColor& ); 00057 void panelReject(); 00058 virtual void slotActivated(); 00059 void defaultColor(); 00060 00061 protected: 00062 void init(); 00063 virtual void initToolBarButton(TKToolBarButton*); 00064 void updatePixmap(); 00065 void updatePixmap(TKToolBarButton*); 00066 00067 protected: 00068 TKColorPopupMenu* m_pMenu; 00069 TKColorPanel* m_pStandardColor; 00070 TKColorPanel* m_pRecentColor; 00071 int m_type; 00072 00073 QColor m_pCurrentColor; 00074 00075 private: 00076 TKSelectColorActionPrivate *d; 00077 }; 00078 /****************************************************************************************/ 00079 class TKColorPanelButton : public QFrame 00080 { Q_OBJECT 00081 public: 00082 TKColorPanelButton( const QColor&, QWidget* parent, const char* name = 0 ); 00083 ~TKColorPanelButton(); 00084 00085 void setActive( bool ); 00086 00087 QColor panelColor() const { return m_Color; } 00088 00089 signals: 00090 void selected( const QColor& ); 00091 00092 protected: 00093 virtual void paintEvent( QPaintEvent* ); 00094 virtual void enterEvent( QEvent* ); 00095 virtual void leaveEvent( QEvent* ); 00096 virtual void mouseReleaseEvent( QMouseEvent* ); 00097 00098 QColor m_Color; 00099 bool m_bActive; 00100 00101 private: 00102 class TKColorPanelButtonPrivate; 00103 TKColorPanelButtonPrivate *d; 00104 }; 00105 /****************************************************************************************/ 00106 class TKColorPanel : public QWidget 00107 { Q_OBJECT 00108 00109 public: 00110 TKColorPanel( QWidget* parent = 0L, const char* name = 0 ); 00111 ~TKColorPanel(); 00112 00113 void setActiveColor( const QColor& ); 00114 void setNumCols( int col ); 00115 void clear(); 00116 00117 public slots: 00118 void insertColor( const QColor& ); 00119 void insertColor( const QColor&, const QString& ); 00120 void selected( const QColor& ); 00121 00122 signals: 00123 void colorSelected( const QColor& ); 00124 void reject(); 00125 void sizeChanged(); 00126 00127 protected: 00128 void addToGrid( TKColorPanelButton* ); 00129 void resetGrid(); 00130 00131 virtual void mouseReleaseEvent( QMouseEvent* ); 00132 virtual void showEvent( QShowEvent *e ); 00133 00134 QGridLayout* m_pLayout; 00135 int m_iWidth; 00136 int m_iX; 00137 int m_iY; 00138 00139 QColor m_activeColor; 00140 QDict<TKColorPanelButton> m_pColorDict; 00141 00142 private: 00143 void fillPanel(); 00144 00145 class TKColorPanelPrivate; 00146 TKColorPanelPrivate *d; 00147 }; 00148 00149 #endif
KDE Logo
This file is part of the documentation for lib Library Version 1.3.5.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Nov 17 06:54:20 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003