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