summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/colordialog.h12
-rw-r--r--libopie/colorpopupmenu.cpp51
-rw-r--r--libopie/colorpopupmenu.h213
3 files changed, 236 insertions, 40 deletions
diff --git a/libopie/colordialog.h b/libopie/colordialog.h
index 474bc61..926f8f2 100644
--- a/libopie/colordialog.h
+++ b/libopie/colordialog.h
@@ -44,6 +44,18 @@
44 44
45class OColorDialogPrivate; 45class OColorDialogPrivate;
46 46
47/**
48 * @class OColorDialog
49 * @brief The OColorDialog class is a copy of QColorDialog for use in Opie.
50 *
51 * OColorDialog is a copy of TrollTech's QColorDialog for use in Opie. The default
52 * build of QT/Embedded used by Opie does not include QColorDialog, so it is provided
53 * here. It is renamed to prevent conflicts in the event the QColorDialog is included
54 * at a later date in QP/E.
55 *
56 * See http://doc.trolltech.com/2.3/qcolordialog.html for complete documentation of
57 * QColorDialog.
58 */
47class Q_EXPORT OColorDialog : public QDialog 59class Q_EXPORT OColorDialog : public QDialog
48{ 60{
49 Q_OBJECT 61 Q_OBJECT
diff --git a/libopie/colorpopupmenu.cpp b/libopie/colorpopupmenu.cpp
index 17e2c0a..510a2ad 100644
--- a/libopie/colorpopupmenu.cpp
+++ b/libopie/colorpopupmenu.cpp
@@ -1,23 +1,34 @@
1/********************************************************************** 1/*
2** ColorPopupMenu 2                This file is part of the Opie Project
3** 3
4** Popup menu for selecting colors 4              Copyright (c) 2002 S. Prud'homme <prudhomme@laposte.net>
5** 5              Dan Williams <williamsdr@acm.org>
6** Based on colorpanel by S. Prud'homme <prudhomme@laposte.net> 6 =.
7** 7 .=l.
8** Copyright (C) 2002, Dan Williams 8           .>+-=
9** williamsdr@acm.org 9 _;:,     .>    :=|. This program is free software; you can
10** http://draknor.net 10.> <`_,   >  .   <= redistribute it and/or modify it under
11** 11:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
12** This file may be distributed and/or modified under the terms of the 12.="- .-=="i,     .._ License as published by the Free Software
13** GNU General Public License version 2 as published by the Free Software 13 - .   .-<_>     .<> Foundation; either version 2 of the License,
14** Foundation and appearing in the file LICENSE.GPL included in the 14     ._= =}       : or (at your option) any later version.
15** packaging of this file. 15    .%`+i>       _;_.
16** 16    .i_,=:_.      -<s. This program is distributed in the hope that
17** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 17     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
18** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 18    : ..    .:,     . . . without even the implied warranty of
19** 19    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
20**********************************************************************/ 20  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
21..}^=.=       =       ; Library General Public License for more
22++=   -.     .`     .: details.
23 :     =  ...= . :.=-
24 -.   .:....=;==+<; You should have received a copy of the GNU
25  -_. . .   )=.  = Library General Public License along with
26    --        :-=` this library; see the file COPYING.LIB.
27 If not, write to the Free Software Foundation,
28 Inc., 59 Temple Place - Suite 330,
29 Boston, MA 02111-1307, USA.
30
31*/
21 32
22#include "colorpopupmenu.h" 33#include "colorpopupmenu.h"
23#include "colordialog.h" 34#include "colordialog.h"
diff --git a/libopie/colorpopupmenu.h b/libopie/colorpopupmenu.h
index 1a6ab08..b0453b2 100644
--- a/libopie/colorpopupmenu.h
+++ b/libopie/colorpopupmenu.h
@@ -1,23 +1,34 @@
1/********************************************************************** 1/*
2** ColorPopupMenu 2                This file is part of the Opie Project
3** 3
4** Popup menu for selecting colors 4              Copyright (c) 2002 S. Prud'homme <prudhomme@laposte.net>
5** 5              Dan Williams <williamsdr@acm.org>
6** Based on colorpanel by S. Prud'homme <prudhomme@laposte.net> 6 =.
7** 7 .=l.
8** Copyright (C) 2002, Dan Williams 8           .>+-=
9** williamsdr@acm.org 9 _;:,     .>    :=|. This program is free software; you can
10** http://draknor.net 10.> <`_,   >  .   <= redistribute it and/or modify it under
11** 11:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
12** This file may be distributed and/or modified under the terms of the 12.="- .-=="i,     .._ License as published by the Free Software
13** GNU General Public License version 2 as published by the Free Software 13 - .   .-<_>     .<> Foundation; either version 2 of the License,
14** Foundation and appearing in the file LICENSE.GPL included in the 14     ._= =}       : or (at your option) any later version.
15** packaging of this file. 15    .%`+i>       _;_.
16** 16    .i_,=:_.      -<s. This program is distributed in the hope that
17** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 17     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
18** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 18    : ..    .:,     . . . without even the implied warranty of
19** 19    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
20**********************************************************************/ 20  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
21..}^=.=       =       ; Library General Public License for more
22++=   -.     .`     .: details.
23 :     =  ...= . :.=-
24 -.   .:....=;==+<; You should have received a copy of the GNU
25  -_. . .   )=.  = Library General Public License along with
26    --        :-=` this library; see the file COPYING.LIB.
27 If not, write to the Free Software Foundation,
28 Inc., 59 Temple Place - Suite 330,
29 Boston, MA 02111-1307, USA.
30
31*/
21 32
22#ifndef COLORPOPUPMENU_H 33#ifndef COLORPOPUPMENU_H
23#define COLORPOPUPMENU_H 34#define COLORPOPUPMENU_H
@@ -28,22 +39,107 @@
28class QWidget; 39class QWidget;
29class QGridLayout; 40class QGridLayout;
30 41
42/**
43 * @class ColorPanelButton
44 * @brief The ColorPanelButton class provides a button for color selection.
45 *
46 * @see ColorPopupMenu
47 *
48 * The ColorPanelButton class provides a button for color selection. The button
49 * is drawn with the desired color and no border. This class is used internally
50 * by the ColorPopupMenu class to displaying colors in its menu.
51 */
31class ColorPanelButton : public QFrame 52class ColorPanelButton : public QFrame
32{ 53{
33 Q_OBJECT 54 Q_OBJECT
34 55
35public: 56public:
57
58/**
59 * @fn ColorPanelButton( const QColor& color, QWidget* parent = 0, const char* name = 0 )
60 * @brief Object constructor.
61 *
62 * @param color Desired color.
63 * @param parent Pointer to parent of this control.
64 * @param name Name of control.
65 *
66 * Constructs a new ColorPanelButton control with parent, name and desired color.
67 */
36 ColorPanelButton(const QColor& color, QWidget* parent = 0, const char* name = 0); 68 ColorPanelButton(const QColor& color, QWidget* parent = 0, const char* name = 0);
69
70/**
71 * @fn ~ColorPanelButton()
72 * @brief Object destructor.
73 */
37 ~ColorPanelButton(); 74 ~ColorPanelButton();
38 75
76/**
77 * @fn setActive( bool active )
78 * @brief Sets button selection state.
79 *
80 * @param active Boolean indicator of new button state.
81 *
82 * Changes button selection state. If button is selected, a highlighted border
83 * is drawn.
84 */
39 void setActive(bool active); 85 void setActive(bool active);
40 86
87/**
88 * @fn enterEvent( QEvent* e )
89 * @brief Reimplemented for internal reasons.
90 *
91 * @param e Event currently being processed.
92 *
93 * Reimplemented to ensure correct display of button based on whether it is
94 * active or not.
95 */
41 void enterEvent(QEvent* e); 96 void enterEvent(QEvent* e);
97
98/**
99 * @fn leaveEvent( QEvent* e )
100 * @brief Reimplemented for internal reasons.
101 *
102 * @param e Event currently being processed.
103 *
104 * Reimplemented to ensure correct display of button based on whether it is
105 * active or not.
106 */
42 void leaveEvent(QEvent* e); 107 void leaveEvent(QEvent* e);
108
109/**
110 * @fn paintEvent( QEvent* e )
111 * @brief Reimplemented for internal reasons.
112 *
113 * @param e Event currently being processed.
114 *
115 * Reimplemented to ensure correct display of button.
116 */
43 void paintEvent(QPaintEvent* e); 117 void paintEvent(QPaintEvent* e);
118
119/**
120 * @fn mouseReleaseEvent( QMouseEvent* e )
121 * @brief Slot executed when button is pressed.
122 *
123 * @param e Mouse event currently being processed.
124 *
125 * @see selected()
126 *
127 * This slot executes when the button has been pressed. It emits the selected
128 * signal as notification that it has been pressed.
129 */
44 void mouseReleaseEvent(QMouseEvent* e); 130 void mouseReleaseEvent(QMouseEvent* e);
45 131
46signals: 132signals:
133
134/**
135 * @fn selected( const QColor& color )
136 * @brief Signal to indicate button has been pressed.
137 *
138 * @param color Button color.
139 *
140 * This signal is emitted when the button is pressed. It provides the color
141 * associated to this button.
142 */
47 void selected(const QColor&); 143 void selected(const QColor&);
48 144
49private: 145private:
@@ -53,12 +149,41 @@ private:
53 ColorPanelButtonPrivate *d; 149 ColorPanelButtonPrivate *d;
54}; 150};
55 151
152/**
153 * @class ColorPopupMenu
154 * @brief The ColorPopupMenu class provides a small color selection
155 * popup menu.
156 *
157 * ColorPopupMenu is a derivation of TrollTech's QPopupMenu and provides
158 * a small color selection popup menu which can be attached to another control
159 * such as a toolbar button of menu item.
160 *
161 * The popup menu displays 30 default colors available in a grid, and also
162 * includes an option at the bottom to display a color selection dialog box for
163 * finer color control.
164 */
56class ColorPopupMenu : public QPopupMenu 165class ColorPopupMenu : public QPopupMenu
57{ 166{
58 Q_OBJECT 167 Q_OBJECT
59 168
60public: 169public:
170
171/**
172 * @fn ColorPopupMenu( const QColor& color, QWidget* parent = 0, const char* name = 0 )
173 * @brief Object constructor.
174 *
175 * @param color Initial color selected in menu.
176 * @param parent Pointer to parent of this control.
177 * @param name Name of control.
178 *
179 * Constructs a new ColorPopupMenu control with parent, name and initial color selected.
180 */
61 ColorPopupMenu( const QColor& color, QWidget* parent = 0, const char* name = 0 ); 181 ColorPopupMenu( const QColor& color, QWidget* parent = 0, const char* name = 0 );
182
183/**
184 * @fn ~ColorPopupMenu()
185 * @brief Object destructor.
186 */
62 ~ColorPopupMenu(); 187 ~ColorPopupMenu();
63 188
64private: 189private:
@@ -68,13 +193,61 @@ private:
68 QWidget* colorPanel; 193 QWidget* colorPanel;
69 QGridLayout* colorLayout; 194 QGridLayout* colorLayout;
70 195
196/**
197 * @fn addColor( const QColor& color, int row, int col )
198 * @brief Adds color selection option to popup menu.
199 *
200 * @param color Color to be displayed in menu.
201 * @param row Row where color is to appear in menu.
202 * @param col Column where color is to appear in menu.
203 *
204 * Adds a color selection option to popup menu. Used internally when
205 * initially constructing the menu control.
206 */
71 void addColor( const QColor& color, int row, int col ); 207 void addColor( const QColor& color, int row, int col );
72 208
73signals: 209signals:
210
211/**
212 * @fn colorSelected( const QColor& color )
213 * @brief Signal to indicate color chosen from the menu.
214 *
215 * @param color Color selected from the menu.
216 *
217 * This signal is emitted when a color has been selected either directly from
218 * the menu, or chosen from the color selection dialog.
219 */
74 void colorSelected( const QColor& color ); 220 void colorSelected( const QColor& color );
75 221
76protected slots: 222protected slots:
223
224/**
225 * @fn buttonSelected( const QColor& color )
226 * @brief Slot to process selected color.
227 *
228 * @param color Color selected from the menu.
229 *
230 * @see colorSelected()
231 *
232 * This slot executes when a color has been selected from the menu. It performs
233 * two functions:
234 * - Emit the colorSelected signal with the color selected.
235 * - Hide the menu.
236 */
77 void buttonSelected( const QColor& color ); 237 void buttonSelected( const QColor& color );
238
239/**
240 * @fn moreColorClicked()
241 * @brief Slot to process display color selection dialog.
242 *
243 * @see colorSelected()
244 *
245 * This slot executes when the 'More...' option is selected at the bottom of the menu.
246 * It performs the following functions:
247 * - Constructs and executes a OColorDialog to allow finer color selection.
248 * - Emit the colorSelected signal with the color selected.
249 * - Hide the menu.
250 */
78 void moreColorClicked(); 251 void moreColorClicked();
79}; 252};
80 253