20#ifndef _kotoolbutton_h_
21#define _kotoolbutton_h_
23#include <tdetoolbarbutton.h>
29class KoColorPanel : public TQWidget
34 KoColorPanel( TQWidget* parent = 0, const char* name = 0 );
35 virtual ~KoColorPanel();
37 virtual TQSize sizeHint() const;
38 virtual TQSize minimumSizeHint() const;
40 enum MenuStyle { Plain, CustomColors };
41 static TQPopupMenu* createColorPopup( MenuStyle style, const TQColor& defaultColor,
42 const TQObject* receiver, const char* slot,
43 TQWidget* parent, const char* name );
47 void insertColor( const TQColor& color );
48 void insertColor( const TQColor& color, const TQString& toolTip );
49 void insertDefaultColors();
52 void colorSelected( const TQColor& color );
55 virtual void mousePressEvent( TQMouseEvent* e );
56 virtual void mouseReleaseEvent( TQMouseEvent* e );
57 virtual void mouseMoveEvent( TQMouseEvent* e );
58 virtual void paintEvent( TQPaintEvent* e );
59 virtual void keyPressEvent( TQKeyEvent* e );
60 virtual void focusInEvent( TQFocusEvent* e );
61 virtual void dragEnterEvent( TQDragEnterEvent* e );
62 virtual void dropEvent( TQDropEvent* e );
67 Position() : x( -1 ), y( -1 ) {}
68 Position( short x_, short y_ ) : x( x_ ), y( y_ ) {}
73 friend bool operator<( const KoColorPanel::Position& lhs, const KoColorPanel::Position& rhs );
75 void finalizeInsertion( const Position& pos );
76 bool insertColor( const TQColor& color, bool checking );
77 bool insertColor( const TQColor& color, const TQString& toolTip, bool checking );
78 bool isAvailable( const TQColor& color );
80 Position mapToPosition( const TQPoint& point ) const;
81 TQColor mapToColor( const TQPoint& point ) const;
82 TQColor mapToColor( const Position& position ) const;
83 TQRect mapFromPosition( const Position& position ) const;
84 Position validPosition( const Position& position );
87 void paintArea( const TQRect& rect, int& startRow, int& endRow, int& startCol, int& endCol ) const;
88 void updateFocusPosition( const Position& newPosition );
89 void paint( const Position& position );
92 Position m_nextPosition, m_focusPosition;
93 TQMap<Position, TQColor> m_colorMap;
99bool operator<( const KoColorPanel::Position& lhs, const KoColorPanel::Position& rhs );
106class KoColorPopupProxy : public TQObject
111 KoColorPopupProxy( const TQColor& defaultColor, KoColorPanel* recentColors, TQObject* parent, const char* name );
112 virtual ~KoColorPopupProxy() {}
114 void setRecentColorPanel( KoColorPanel* recentColors );
117 void slotDefaultColor();
118 void slotMoreColors();
121 void colorSelected( const TQColor& color );
124 TQColor m_defaultColor;
125 KoColorPanel* m_recentColors;
146 KoToolButton( const TQString& icon, int id, TQWidget* parent,
147 const char* name = 0L, const TQString& txt = TQString(),
148 TDEInstance* _instance = TDEGlobal::instance() );
161 KoToolButton( const TQPixmap& pixmap, int id, TQWidget* parent,
162 const char* name = 0L, const TQString& txt = TQString() );
164 virtual ~KoToolButton();
166 virtual TQSize sizeHint() const;
167 virtual TQSize minimumSizeHint() const;
168 virtual TQSize minimumSize() const;
171 void colorSelected( const TQColor& color );
174 virtual void drawButton(TQPainter *p);
175 virtual bool eventFilter( TQObject* o, TQEvent* e );
179 void buttonShift( int& dx, int& dy );
180 bool hitArrow( const TQPoint& pos );
182 TQPopupMenu* m_popup;
TDEAction * clear(const TQObject *recvr, const char *slot, TDEActionCollection *parent, const char *name=0)
|