-rw-r--r-- | libopie2/opieui/otabwidget.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie2/opieui/otabwidget.h b/libopie2/opieui/otabwidget.h index 6a64b7d..b3423e8 100644 --- a/libopie2/opieui/otabwidget.h +++ b/libopie2/opieui/otabwidget.h | |||
@@ -1,292 +1,292 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) 2002 Dan Williams <williamsdr@acm.org> | 3 | Copyright (C) 2002 Dan Williams <williamsdr@acm.org> |
4 | =. | 4 | =. |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | 28 | ||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef OTABWIDGET_H | 31 | #ifndef OTABWIDGET_H |
32 | #define OTABWIDGET_H | 32 | #define OTABWIDGET_H |
33 | 33 | ||
34 | /* OPIE */ | 34 | /* OPIE */ |
35 | #include <opie2/otabinfo.h> | 35 | #include <opie2/otabinfo.h> |
36 | 36 | ||
37 | /* QT */ | 37 | /* QT */ |
38 | #include <qwidget.h> | 38 | #include <qwidget.h> |
39 | #include <qlist.h> | 39 | #include <qlist.h> |
40 | 40 | ||
41 | 41 | ||
42 | class QComboBox; | 42 | class QComboBox; |
43 | class QPixmap; | 43 | class QPixmap; |
44 | class QTabBar; | 44 | class QTabBar; |
45 | class QWidgetStack; | 45 | class QWidgetStack; |
46 | 46 | ||
47 | namespace Opie { | 47 | namespace Opie { |
48 | namespace Ui { | 48 | namespace Ui { |
49 | 49 | ||
50 | class OTabBar; | 50 | class OTabBar; |
51 | 51 | ||
52 | /** | 52 | /** |
53 | * @class OTabWidget | 53 | * @class OTabWidget |
54 | * @brief The OTabWidget class provides a stack of widgets. | 54 | * @brief The OTabWidget class provides a stack of widgets. |
55 | * | 55 | * |
56 | * OTabWidget is a derivation of TrollTech's QTabWidget which provides | 56 | * OTabWidget is a derivation of TrollTech's QTabWidget which provides |
57 | * a stack of widgets. Widgets can be selected using either a tab bar or | 57 | * a stack of widgets. Widgets can be selected using either a tab bar or |
58 | * drop down list box. | 58 | * drop down list box. |
59 | * | 59 | * |
60 | * The normal way to use OTabWidget is to do the following in the | 60 | * The normal way to use OTabWidget is to do the following in the |
61 | * constructor: | 61 | * constructor: |
62 | * - Create a OTabWidget. | 62 | * - Create a OTabWidget. |
63 | * - Create a QWidget for each of the pages in the control, insert | 63 | * - Create a QWidget for each of the pages in the control, insert |
64 | * children into it, set up geometry management for it, and use addTab() | 64 | * children into it, set up geometry management for it, and use addTab() |
65 | * to add the widget. | 65 | * to add the widget. |
66 | */ | 66 | */ |
67 | class OTabWidget : public QWidget | 67 | class OTabWidget : public QWidget |
68 | { | 68 | { |
69 | Q_OBJECT | 69 | Q_OBJECT |
70 | 70 | ||
71 | public: | 71 | public: |
72 | /** | 72 | /** |
73 | * @enum TabStyle | 73 | * @enum TabStyle |
74 | * @brief Defines how the widget selection control is displayed. | 74 | * @brief Defines how the widget selection control is displayed. |
75 | * | 75 | * |
76 | * Valid values: | 76 | * Valid values: |
77 | * - Global: use globally selected options (qpe.conf - TabStyle & TabPosition) | 77 | * - Global: use globally selected options (qpe.conf - TabStyle & TabPosition) |
78 | * - TextTab: Tabbed widget selection with text labels | 78 | * - TextTab: Tabbed widget selection with text labels |
79 | * - IconTab: Tabbed widget selection with icon labels, text label for active widget | 79 | * - IconTab: Tabbed widget selection with icon labels, text label for active widget |
80 | * (similar to Opie launcher) | 80 | * (similar to Opie launcher) |
81 | * - TextList: Drop down list widget selection with text labels | 81 | * - TextList: Drop down list widget selection with text labels |
82 | * - IconList: Drop down list widget selection with icon & text labels | 82 | * - IconList: Drop down list widget selection with icon & text labels |
83 | */ | 83 | */ |
84 | enum TabStyle { Global, TextTab, IconTab, TextList, IconList }; | 84 | enum TabStyle { Global, TextTab, IconTab, TextList, IconList }; |
85 | 85 | ||
86 | /** | 86 | /** |
87 | * @enum TabPosition | 87 | * @enum TabPosition |
88 | * @brief Defines where the widget selection control is drawn. | 88 | * @brief Defines where the widget selection control is drawn. |
89 | * | 89 | * |
90 | * Valid values: | 90 | * Valid values: |
91 | * - Top: Widget selection control is drawn above widgets | 91 | * - Top: Widget selection control is drawn above widgets |
92 | * - Bottom: Widget selection control is drawn below widgets | 92 | * - Bottom: Widget selection control is drawn below widgets |
93 | */ | 93 | */ |
94 | enum TabPosition { Top, Bottom }; | 94 | enum TabPosition { Top, Bottom }; |
95 | 95 | ||
96 | /** | 96 | /** |
97 | * @fn OTabWidget( QWidget *parent = 0, const char *name = 0, TabStyle s = Global, TabPosition p = Top ) | 97 | * @fn OTabWidget( QWidget *parent = 0, const char *name = 0, TabStyle s = Global, TabPosition p = Top ) |
98 | * @brief Object constructor. | 98 | * @brief Object constructor. |
99 | * | 99 | * |
100 | * @param parent Pointer to parent of this control. | 100 | * @param parent Pointer to parent of this control. |
101 | * @param name Name of control. | 101 | * @param name Name of control. |
102 | * @param s Style of widget selection control. | 102 | * @param s Style of widget selection control. |
103 | * @param p Position of the widget selection control. | 103 | * @param p Position of the widget selection control. |
104 | * | 104 | * |
105 | * Constructs a new OTabWidget control with parent and name. The style and position parameters | 105 | * Constructs a new OTabWidget control with parent and name. The style and position parameters |
106 | * determine how the widget selection control will be displayed. | 106 | * determine how the widget selection control will be displayed. |
107 | */ | 107 | */ |
108 | OTabWidget( QWidget * = 0, const char * = 0, TabStyle = Global, TabPosition = Top ); | 108 | OTabWidget( QWidget * = 0, const char * = 0, TabStyle = Global, TabPosition = Top ); |
109 | 109 | ||
110 | /** | 110 | /** |
111 | * @fn ~OTabWidget() | 111 | * @fn ~OTabWidget() |
112 | * @brief Object destructor. | 112 | * @brief Object destructor. |
113 | */ | 113 | */ |
114 | ~OTabWidget(); | 114 | ~OTabWidget(); |
115 | 115 | ||
116 | /** | 116 | /** |
117 | * @fn addTab( QWidget *child, const QString &icon, const QString &label ) | 117 | * @fn addTab( QWidget *child, const QString &icon, const QString &label ) |
118 | * @brief Add new widget to control. | 118 | * @brief Add new widget to control. |
119 | * | 119 | * |
120 | * @param child Widget control. | 120 | * @param child Widget control. |
121 | * @param icon Path to icon. | 121 | * @param icon Path to icon. |
122 | * @param label Text label. | 122 | * @param label Text label. |
123 | */ | 123 | */ |
124 | void addTab( QWidget *, const QString &, const QString & ); | 124 | void addTab( QWidget *, const QString &, const QString & ); |
125 | 125 | ||
126 | /** | 126 | /** |
127 | * @fn removePage( QWidget *widget ) | 127 | * @fn removePage( QWidget *widget ) |
128 | * @brief Remove widget from control. Does not delete widget. | 128 | * @brief Remove widget from control. Does not delete widget. |
129 | * | 129 | * |
130 | * @param widget Widget control to be removed. | 130 | * @param widget Widget control to be removed. |
131 | */ | 131 | */ |
132 | void removePage( QWidget * ); | 132 | void removePage( QWidget * ); |
133 | 133 | ||
134 | /** | 134 | /** |
135 | * @fn changeTab( QWidget *widget, const QString &icon, const QString &label ) | 135 | * @fn changeTab( QWidget *widget, const QString &icon, const QString &label ) |
136 | * @brief Change text and/or icon for existing tab | 136 | * @brief Change text and/or icon for existing tab |
137 | * | 137 | * |
138 | * @param child Widget control. | 138 | * @param child Widget control. |
139 | * @param icon Path to icon. | 139 | * @param icon Path to icon. |
140 | * @param label Text label. | 140 | * @param label Text label. |
141 | */ | 141 | */ |
142 | void changeTab( QWidget *, const QString &, const QString & ); | 142 | void changeTab( QWidget *, const QString &, const QString & ); |
143 | 143 | ||
144 | /** | 144 | /** |
145 | * @fn tabStyle()const | 145 | * @fn tabStyle()const |
146 | * @brief Returns current widget selection control style. | 146 | * @brief Returns current widget selection control style. |
147 | */ | 147 | */ |
148 | TabStyle tabStyle() const; | 148 | TabStyle tabStyle() const; |
149 | 149 | ||
150 | /** | 150 | /** |
151 | * @fn setTabStyle( TabStyle s ) | 151 | * @fn setTabStyle( TabStyle s ) |
152 | * @brief Set the current widget selection control style. | 152 | * @brief Set the current widget selection control style. |
153 | * | 153 | * |
154 | * @param s New style to be used. | 154 | * @param s New style to be used. |
155 | */ | 155 | */ |
156 | void setTabStyle( TabStyle ); | 156 | void setTabStyle( TabStyle ); |
157 | 157 | ||
158 | /** | 158 | /** |
159 | * @fn tabPosition()const | 159 | * @fn tabPosition()const |
160 | * @brief Returns current widget selection control position. | 160 | * @brief Returns current widget selection control position. |
161 | */ | 161 | */ |
162 | TabPosition tabPosition() const; | 162 | TabPosition tabPosition() const; |
163 | 163 | ||
164 | /** | 164 | /** |
165 | * @fn setTabPosition( TabPosition p ) | 165 | * @fn setTabPosition( TabPosition p ) |
166 | * @brief Set the current widget selection control position. | 166 | * @brief Set the current widget selection control position. |
167 | * | 167 | * |
168 | * @param p New position of widget selection control. | 168 | * @param p New position of widget selection control. |
169 | */ | 169 | */ |
170 | void setTabPosition( TabPosition ); | 170 | void setTabPosition( TabPosition ); |
171 | 171 | ||
172 | /** | 172 | /** |
173 | * @fn setCurrentTab( QWidget *childwidget ) | 173 | * @fn setCurrentTab( QWidget *childwidget ) |
174 | * @brief Selects and brings to top the desired widget by using widget pointer. | 174 | * @brief Selects and brings to top the desired widget by using widget pointer. |
175 | * | 175 | * |
176 | * @param childwidget Widget to select. | 176 | * @param childwidget Widget to select. |
177 | */ | 177 | */ |
178 | void setCurrentTab( QWidget * ); | 178 | void setCurrentTab( QWidget * ); |
179 | 179 | ||
180 | /** | 180 | /** |
181 | * @fn setCurrentTab( const QString &tabname ) | 181 | * @fn setCurrentTab( const QString &tabname ) |
182 | * @brief Selects and brings to top the desired widget, by using label. | 182 | * @brief Selects and brings to top the desired widget, by using label. |
183 | * | 183 | * |
184 | * @param tabname Text label for widget to select. | 184 | * @param tabname Text label for widget to select. |
185 | */ | 185 | */ |
186 | void setCurrentTab( const QString & ); | 186 | void setCurrentTab( const QString & ); |
187 | 187 | ||
188 | /** | 188 | /** |
189 | * @fn setCurrentTab( int ) | 189 | * @fn setCurrentTab( int ) |
190 | * @brief Selects and brings to top the desired widget, by using id. | 190 | * @brief Selects and brings to top the desired widget, by using id. |
191 | * | 191 | * |
192 | * @param tab id for widget to select. | 192 | * @param tab id for widget to select. |
193 | */ | 193 | */ |
194 | void setCurrentTab(int); | 194 | void setCurrentTab(int); |
195 | 195 | ||
196 | /** | 196 | /** |
197 | * @fn sizeHint()const | 197 | * @fn sizeHint()const |
198 | * @brief Reimplemented for internal purposes. | 198 | * @brief Reimplemented for internal purposes. |
199 | */ | 199 | */ |
200 | QSize sizeHint() const; | 200 | QSize sizeHint() const; |
201 | 201 | ||
202 | /** | 202 | /** |
203 | * @fn currentTab( ) | 203 | * @fn currentTab( ) |
204 | * @brief returns current tab id. | 204 | * @brief returns current tab id. |
205 | */ | 205 | */ |
206 | // ### make const | 206 | // ### make const |
207 | int currentTab()/* const */; | 207 | int currentTab()/* const */; |
208 | /** | 208 | /** |
209 | * @brief returns the current page of the active tab | 209 | * @brief returns the current page of the active tab |
210 | * | 210 | * |
211 | * @since 1.2 | 211 | * @since 1.2 |
212 | */ | 212 | */ |
213 | QWidget* currentWidget()const; | 213 | QWidget* currentWidget()const; |
214 | 214 | ||
215 | protected: | 215 | protected: |
216 | 216 | ||
217 | /** | 217 | /** |
218 | * @fn resizeEvent( QResizeEvent * ) | 218 | * @fn resizeEvent( QResizeEvent * ) |
219 | * @brief Reimplemented for internal purposes. | 219 | * @brief Reimplemented for internal purposes. |
220 | */ | 220 | */ |
221 | void resizeEvent( QResizeEvent * ); | 221 | void resizeEvent( QResizeEvent * ); |
222 | 222 | ||
223 | private: | 223 | private: |
224 | OTabInfoList tabs; | 224 | OTabInfoList tabs; |
225 | OTabInfo *currTab; | 225 | OTabInfo *currTab; |
226 | 226 | ||
227 | TabStyle tabBarStyle; | 227 | TabStyle tabBarStyle; |
228 | TabPosition tabBarPosition; | 228 | TabPosition tabBarPosition; |
229 | 229 | ||
230 | QWidgetStack *tabBarStack; | 230 | QWidgetStack *tabBarStack; |
231 | OTabBar *tabBar; | 231 | OTabBar *tabBar; |
232 | QComboBox *tabList; | 232 | QComboBox *tabList; |
233 | 233 | ||
234 | QWidgetStack *widgetStack; | 234 | QWidgetStack *widgetStack; |
235 | class Private; | 235 | class Private; |
236 | Private* d; | 236 | Private* d; |
237 | 237 | ||
238 | /** | 238 | /** |
239 | * @fn loadSmooth( const QString &name ) | 239 | * @fn loadSmooth( const QString &name ) |
240 | * @brief Loads icon for widget. | 240 | * @brief Loads icon for widget. |
241 | * | 241 | * |
242 | * @param name Name of icon image file. | 242 | * @param name Name of icon image file. |
243 | */ | 243 | */ |
244 | QPixmap loadSmooth( const QString & ); | 244 | QPixmap loadSmooth( const QString & ); |
245 | 245 | ||
246 | /** | 246 | /** |
247 | * @fn selectTab( OTabInfo *tab ) | 247 | * @fn selectTab( OTabInfo *tab ) |
248 | * @brief Internal function to select desired widget. | 248 | * @brief Internal function to select desired widget. |
249 | * | 249 | * |
250 | * @param tab Pointer to data for widget. | 250 | * @param tab Pointer to data for widget. |
251 | */ | 251 | */ |
252 | void selectTab( OTabInfo * ); | 252 | void selectTab( OTabInfo * ); |
253 | 253 | ||
254 | /** | 254 | /** |
255 | * @fn setUpLayout() | 255 | * @fn setUpLayout() |
256 | * @brief Internal function to adjust layout. | 256 | * @brief Internal function to adjust layout. |
257 | */ | 257 | */ |
258 | void setUpLayout(); | 258 | void setUpLayout(); |
259 | 259 | ||
260 | 260 | ||
261 | signals: | 261 | signals: |
262 | /** | 262 | /** |
263 | * @fn currentChanegd( QWidget *widget ) | 263 | * @fn currentChanged( QWidget *widget ) |
264 | * @brief This signal is emitted whenever the widget has changed. | 264 | * @brief This signal is emitted whenever the widget has changed. |
265 | * | 265 | * |
266 | * @param widget Pointer to new current widget. | 266 | * @param widget Pointer to new current widget. |
267 | */ | 267 | */ |
268 | void currentChanged( QWidget * ); | 268 | void currentChanged( QWidget * ); |
269 | 269 | ||
270 | private slots: | 270 | private slots: |
271 | 271 | ||
272 | /** | 272 | /** |
273 | * @fn slotTabBarSelected( int id ) | 273 | * @fn slotTabBarSelected( int id ) |
274 | * @brief Slot which is called when a tab is selected. | 274 | * @brief Slot which is called when a tab is selected. |
275 | * | 275 | * |
276 | * @param id ID of widget selected. | 276 | * @param id ID of widget selected. |
277 | */ | 277 | */ |
278 | void slotTabBarSelected( int ); | 278 | void slotTabBarSelected( int ); |
279 | 279 | ||
280 | /** | 280 | /** |
281 | * @fn slotTabListSelected( int index ) | 281 | * @fn slotTabListSelected( int index ) |
282 | * @brief Slot which is called when a drop down selection is made. | 282 | * @brief Slot which is called when a drop down selection is made. |
283 | * | 283 | * |
284 | * @param id Index of widget selected. | 284 | * @param id Index of widget selected. |
285 | */ | 285 | */ |
286 | void slotTabListSelected( int ); | 286 | void slotTabListSelected( int ); |
287 | }; | 287 | }; |
288 | 288 | ||
289 | } | 289 | } |
290 | } | 290 | } |
291 | 291 | ||
292 | #endif | 292 | #endif |