-rw-r--r-- | libopie/ocolorbutton.cpp | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/libopie/ocolorbutton.cpp b/libopie/ocolorbutton.cpp index ddb6c4f..113a77a 100644 --- a/libopie/ocolorbutton.cpp +++ b/libopie/ocolorbutton.cpp | |||
@@ -33,20 +33,28 @@ | |||
33 | #include <qimage.h> | 33 | #include <qimage.h> |
34 | 34 | ||
35 | #include <qpe/resource.h> | 35 | #include <qpe/resource.h> |
36 | 36 | ||
37 | class OColorButtonPrivate { | 37 | struct OColorButtonPrivate { |
38 | public: | ||
39 | QPopupMenu *m_menu; | 38 | QPopupMenu *m_menu; |
40 | QColor m_color; | 39 | QColor m_color; |
41 | }; | 40 | }; |
42 | 41 | ||
42 | |||
43 | /** | ||
44 | * This concstructs a Color Button with @param color as the start color | ||
45 | * It'll use a OColorPopupMenu internally | ||
46 | * | ||
47 | * @param parent The parent of the Color Button | ||
48 | * @param color The color from where to start on | ||
49 | * @param name @see QObject | ||
50 | */ | ||
43 | OColorButton::OColorButton ( QWidget *parent, const QColor &color, const char *name ) | 51 | OColorButton::OColorButton ( QWidget *parent, const QColor &color, const char *name ) |
44 | : QPushButton ( parent, name ) | 52 | : QPushButton ( parent, name ) |
45 | { | 53 | { |
46 | d = new OColorButtonPrivate; | 54 | d = new OColorButtonPrivate; |
47 | 55 | ||
48 | d-> m_menu = new ColorPopupMenu ( color, 0, 0 ); | 56 | d-> m_menu = new OColorPopupMenu ( color, 0, 0 ); |
49 | setPopup ( d-> m_menu ); | 57 | setPopup ( d-> m_menu ); |
50 | //setPopupDelay ( 0 ); | 58 | //setPopupDelay ( 0 ); |
51 | connect ( d-> m_menu, SIGNAL( colorSelected ( const QColor & )), this, SLOT( updateColor ( const QColor & ))); | 59 | connect ( d-> m_menu, SIGNAL( colorSelected ( const QColor & )), this, SLOT( updateColor ( const QColor & ))); |
52 | 60 | ||
@@ -56,23 +64,36 @@ OColorButton::OColorButton ( QWidget *parent, const QColor &color, const char *n | |||
56 | setMinimumSize ( s ); | 64 | setMinimumSize ( s ); |
57 | setMaximumSize ( s. width ( ) * 2, s. height ( )); | 65 | setMaximumSize ( s. width ( ) * 2, s. height ( )); |
58 | } | 66 | } |
59 | 67 | ||
68 | /** | ||
69 | * This destructs the object | ||
70 | */ | ||
60 | OColorButton::~OColorButton ( ) | 71 | OColorButton::~OColorButton ( ) |
61 | { | 72 | { |
62 | delete d; | 73 | delete d; |
63 | } | 74 | } |
64 | 75 | ||
76 | /** | ||
77 | * @return Returns the current color of the button | ||
78 | */ | ||
65 | QColor OColorButton::color ( ) const | 79 | QColor OColorButton::color ( ) const |
66 | { | 80 | { |
67 | return d-> m_color; | 81 | return d-> m_color; |
68 | } | 82 | } |
69 | 83 | ||
84 | /** | ||
85 | * This method sets the color of the button | ||
86 | * @param c The color to be set. | ||
87 | */ | ||
70 | void OColorButton::setColor ( const QColor &c ) | 88 | void OColorButton::setColor ( const QColor &c ) |
71 | { | 89 | { |
72 | updateColor ( c ); | 90 | updateColor ( c ); |
73 | } | 91 | } |
74 | 92 | ||
93 | /** | ||
94 | * @internal | ||
95 | */ | ||
75 | void OColorButton::updateColor ( const QColor &c ) | 96 | void OColorButton::updateColor ( const QColor &c ) |
76 | { | 97 | { |
77 | d-> m_color = c; | 98 | d-> m_color = c; |
78 | 99 | ||