-rw-r--r-- | libopie/otabwidget.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libopie/otabwidget.h b/libopie/otabwidget.h index bcd9a85..a67fe06 100644 --- a/libopie/otabwidget.h +++ b/libopie/otabwidget.h | |||
@@ -34,243 +34,243 @@ | |||
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 OTabBar; | 40 | class OTabBar; |
41 | class QComboBox; | 41 | class QComboBox; |
42 | class QPixmap; | 42 | class QPixmap; |
43 | class QTabBar; | 43 | class QTabBar; |
44 | class QWidgetStack; | 44 | class QWidgetStack; |
45 | 45 | ||
46 | /** | 46 | /** |
47 | * @class OTabWidget | 47 | * @class OTabWidget |
48 | * @brief The OTabWidget class provides a stack of widgets. | 48 | * @brief The OTabWidget class provides a stack of widgets. |
49 | * | 49 | * |
50 | * OTabWidget is a derivation of TrollTech's QTabWidget which provides | 50 | * OTabWidget is a derivation of TrollTech's QTabWidget which provides |
51 | * a stack of widgets. Widgets can be selected using either a tab bar or | 51 | * a stack of widgets. Widgets can be selected using either a tab bar or |
52 | * drop down list box. | 52 | * drop down list box. |
53 | * | 53 | * |
54 | * The normal way to use OTabWidget is to do the following in the | 54 | * The normal way to use OTabWidget is to do the following in the |
55 | * constructor: | 55 | * constructor: |
56 | * - Create a OTabWidget. | 56 | * - Create a OTabWidget. |
57 | * - Create a QWidget for each of the pages in the control, insert | 57 | * - Create a QWidget for each of the pages in the control, insert |
58 | * children into it, set up geometry management for it, and use addTab() | 58 | * children into it, set up geometry management for it, and use addTab() |
59 | * to add the widget. | 59 | * to add the widget. |
60 | */ | 60 | */ |
61 | class OTabWidget : public QWidget | 61 | class OTabWidget : public QWidget |
62 | { | 62 | { |
63 | Q_OBJECT | 63 | Q_OBJECT |
64 | public: | 64 | public: |
65 | 65 | ||
66 | /** | 66 | /** |
67 | * @enum TabStyle | 67 | * @enum TabStyle |
68 | * @brief Defines how the widget selection control is displayed. | 68 | * @brief Defines how the widget selection control is displayed. |
69 | * | 69 | * |
70 | * Valid values: | 70 | * Valid values: |
71 | * - Global: use globally selected options (qpe.conf - TabStyle & TabPosition) | 71 | * - Global: use globally selected options (qpe.conf - TabStyle & TabPosition) |
72 | * - TextTab: Tabbed widget selection with text labels | 72 | * - TextTab: Tabbed widget selection with text labels |
73 | * - IconTab: Tabbed widget selection with icon labels, text label for active widget | 73 | * - IconTab: Tabbed widget selection with icon labels, text label for active widget |
74 | * (similar to Opie launcher) | 74 | * (similar to Opie launcher) |
75 | * - TextList: Drop down list widget selection with text labels | 75 | * - TextList: Drop down list widget selection with text labels |
76 | * - IconList: Drop down list widget selection with icon & text labels | 76 | * - IconList: Drop down list widget selection with icon & text labels |
77 | */ | 77 | */ |
78 | enum TabStyle { Global, TextTab, IconTab, TextList, IconList }; | 78 | enum TabStyle { Global, TextTab, IconTab, TextList, IconList }; |
79 | 79 | ||
80 | /** | 80 | /** |
81 | * @enum TabPosition | 81 | * @enum TabPosition |
82 | * @brief Defines where the widget selection control is drawn. | 82 | * @brief Defines where the widget selection control is drawn. |
83 | * | 83 | * |
84 | * Valid values: | 84 | * Valid values: |
85 | * - Top: Widget selection control is drawn above widgets | 85 | * - Top: Widget selection control is drawn above widgets |
86 | * - Bottom: Widget selection control is drawn below widgets | 86 | * - Bottom: Widget selection control is drawn below widgets |
87 | */ | 87 | */ |
88 | enum TabPosition { Top, Bottom }; | 88 | enum TabPosition { Top, Bottom }; |
89 | 89 | ||
90 | /** | 90 | /** |
91 | * @fn OTabWidget( QWidget *parent = 0, const char *name = 0, TabStyle s = Global, TabPosition p = Top ) | 91 | * @fn OTabWidget( QWidget *parent = 0, const char *name = 0, TabStyle s = Global, TabPosition p = Top ) |
92 | * @brief Object constructor. | 92 | * @brief Object constructor. |
93 | * | 93 | * |
94 | * @param parent Pointer to parent of this control. | 94 | * @param parent Pointer to parent of this control. |
95 | * @param name Name of control. | 95 | * @param name Name of control. |
96 | * @param s Style of widget selection control. | 96 | * @param s Style of widget selection control. |
97 | * @param p Position of the widget selection control. | 97 | * @param p Position of the widget selection control. |
98 | * | 98 | * |
99 | * Constructs a new OTabWidget control with parent and name. The style and position parameters | 99 | * Constructs a new OTabWidget control with parent and name. The style and position parameters |
100 | * determine how the widget selection control will be displayed. | 100 | * determine how the widget selection control will be displayed. |
101 | */ | 101 | */ |
102 | // FIXME WFlags? -zecke | 102 | // FIXME WFlags? -zecke |
103 | OTabWidget( QWidget * = 0, const char * = 0, TabStyle = Global, TabPosition = Top ); | 103 | OTabWidget( QWidget * = 0, const char * = 0, TabStyle = Global, TabPosition = Top ); |
104 | 104 | ||
105 | /** | 105 | /** |
106 | * @fn ~OTabWidget() | 106 | * @fn ~OTabWidget() |
107 | * @brief Object destructor. | 107 | * @brief Object destructor. |
108 | */ | 108 | */ |
109 | ~OTabWidget(); | 109 | ~OTabWidget(); |
110 | 110 | ||
111 | /** | 111 | /** |
112 | * @fn addTab( QWidget *child, const QString &icon, const QString &label ) | 112 | * @fn addTab( QWidget *child, const QString &icon, const QString &label ) |
113 | * @brief Add new widget to control. | 113 | * @brief Add new widget to control. |
114 | * | 114 | * |
115 | * @param child Widget control. | 115 | * @param child Widget control. |
116 | * @param icon Path to icon. | 116 | * @param icon Path to icon. |
117 | * @param label Text label. | 117 | * @param label Text label. |
118 | */ | 118 | */ |
119 | void addTab( QWidget *, const QString &, const QString & ); | 119 | void addTab( QWidget *, const QString &, const QString & ); |
120 | 120 | ||
121 | /** | 121 | /** |
122 | * @fn removePage( QWidget *widget ) | 122 | * @fn removePage( QWidget *widget ) |
123 | * @brief Remove widget from control. Does not delete widget. | 123 | * @brief Remove widget from control. Does not delete widget. |
124 | * | 124 | * |
125 | * @param widget Widget control to be removed. | 125 | * @param widget Widget control to be removed. |
126 | */ | 126 | */ |
127 | void removePage( QWidget * ); | 127 | void removePage( QWidget * ); |
128 | 128 | ||
129 | /** | 129 | /** |
130 | * @fn changeTab( QWidget *widget, const QIconSet &icon, const QString &label ) | 130 | * @fn changeTab( QWidget *widget, const QString &icon, const QString &label ) |
131 | * @brief Change text and/or icon for existing tab | 131 | * @brief Change text and/or icon for existing tab |
132 | * | 132 | * |
133 | * @param child Widget control. | 133 | * @param child Widget control. |
134 | * @param icon Path to icon. | 134 | * @param icon Path to icon. |
135 | * @param label Text label. | 135 | * @param label Text label. |
136 | */ | 136 | */ |
137 | void changeTab( QWidget *, const QString &, const QString & ); | 137 | void changeTab( QWidget *, const QString &, const QString & ); |
138 | 138 | ||
139 | /** | 139 | /** |
140 | * @fn tabStyle() | 140 | * @fn tabStyle()const |
141 | * @brief Returns current widget selection control style. | 141 | * @brief Returns current widget selection control style. |
142 | */ | 142 | */ |
143 | TabStyle tabStyle() const; | 143 | TabStyle tabStyle() const; |
144 | 144 | ||
145 | /** | 145 | /** |
146 | * @fn setTabStyle( TabStyle s ) | 146 | * @fn setTabStyle( TabStyle s ) |
147 | * @brief Set the current widget selection control style. | 147 | * @brief Set the current widget selection control style. |
148 | * | 148 | * |
149 | * @param s New style to be used. | 149 | * @param s New style to be used. |
150 | */ | 150 | */ |
151 | void setTabStyle( TabStyle ); | 151 | void setTabStyle( TabStyle ); |
152 | 152 | ||
153 | /** | 153 | /** |
154 | * @fn tabPosition() | 154 | * @fn tabPosition()const |
155 | * @brief Returns current widget selection control position. | 155 | * @brief Returns current widget selection control position. |
156 | */ | 156 | */ |
157 | TabPosition tabPosition() const; | 157 | TabPosition tabPosition() const; |
158 | 158 | ||
159 | /** | 159 | /** |
160 | * @fn setTabPosition( TabPosition p ) | 160 | * @fn setTabPosition( TabPosition p ) |
161 | * @brief Set the current widget selection control position. | 161 | * @brief Set the current widget selection control position. |
162 | * | 162 | * |
163 | * @param p New position of widget selection control. | 163 | * @param p New position of widget selection control. |
164 | */ | 164 | */ |
165 | void setTabPosition( TabPosition ); | 165 | void setTabPosition( TabPosition ); |
166 | 166 | ||
167 | /** | 167 | /** |
168 | * @fn setCurrentTab( QWidget *childwidget ) | 168 | * @fn setCurrentTab( QWidget *childwidget ) |
169 | * @brief Selects and brings to top the desired widget by using widget pointer. | 169 | * @brief Selects and brings to top the desired widget by using widget pointer. |
170 | * | 170 | * |
171 | * @param childwidget Widget to select. | 171 | * @param childwidget Widget to select. |
172 | */ | 172 | */ |
173 | void setCurrentTab( QWidget * ); | 173 | void setCurrentTab( QWidget * ); |
174 | 174 | ||
175 | /** | 175 | /** |
176 | * @fn setCurrentTab( const QString &tabname ) | 176 | * @fn setCurrentTab( const QString &tabname ) |
177 | * @brief Selects and brings to top the desired widget, by using label. | 177 | * @brief Selects and brings to top the desired widget, by using label. |
178 | * | 178 | * |
179 | * @param tabname Text label for widget to select. | 179 | * @param tabname Text label for widget to select. |
180 | */ | 180 | */ |
181 | void setCurrentTab( const QString & ); | 181 | void setCurrentTab( const QString & ); |
182 | 182 | ||
183 | /** | 183 | /** |
184 | * @fn setCurrentTab( int ) | 184 | * @fn setCurrentTab( int ) |
185 | * @brief Selects and brings to top the desired widget, by using id. | 185 | * @brief Selects and brings to top the desired widget, by using id. |
186 | * | 186 | * |
187 | * @param tab id for widget to select. | 187 | * @param tab id for widget to select. |
188 | */ | 188 | */ |
189 | void setCurrentTab(int); | 189 | void setCurrentTab(int); |
190 | 190 | ||
191 | /** | 191 | /** |
192 | * @fn sizeHint() | 192 | * @fn sizeHint()const |
193 | * @brief Reimplemented for internal purposes. | 193 | * @brief Reimplemented for internal purposes. |
194 | */ | 194 | */ |
195 | QSize sizeHint() const; | 195 | QSize sizeHint() const; |
196 | 196 | ||
197 | /** | 197 | /** |
198 | * @fn currentTab( ) | 198 | * @fn currentTab( ) |
199 | * @brief returns current tab id. | 199 | * @brief returns current tab id. |
200 | */ | 200 | */ |
201 | int currentTab(); | 201 | int currentTab(); |
202 | 202 | ||
203 | 203 | ||
204 | protected: | 204 | protected: |
205 | 205 | ||
206 | /** | 206 | /** |
207 | * @fn resizeEvent( QResizeEvent * ) | 207 | * @fn resizeEvent( QResizeEvent * ) |
208 | * @brief Reimplemented for internal purposes. | 208 | * @brief Reimplemented for internal purposes. |
209 | */ | 209 | */ |
210 | void resizeEvent( QResizeEvent * ); | 210 | void resizeEvent( QResizeEvent * ); |
211 | 211 | ||
212 | private: | 212 | private: |
213 | OTabInfoList tabs; | 213 | OTabInfoList tabs; |
214 | OTabInfo *currTab; | 214 | OTabInfo *currTab; |
215 | 215 | ||
216 | TabStyle tabBarStyle; | 216 | TabStyle tabBarStyle; |
217 | TabPosition tabBarPosition; | 217 | TabPosition tabBarPosition; |
218 | 218 | ||
219 | QWidgetStack *tabBarStack; | 219 | QWidgetStack *tabBarStack; |
220 | OTabBar *tabBar; | 220 | OTabBar *tabBar; |
221 | QComboBox *tabList; | 221 | QComboBox *tabList; |
222 | 222 | ||
223 | QWidgetStack *widgetStack; | 223 | QWidgetStack *widgetStack; |
224 | 224 | ||
225 | /** | 225 | /** |
226 | * @fn loadSmooth( const QString &name ) | 226 | * @fn loadSmooth( const QString &name ) |
227 | * @brief Loads icon for widget. | 227 | * @brief Loads icon for widget. |
228 | * | 228 | * |
229 | * @param name Name of icon image file. | 229 | * @param name Name of icon image file. |
230 | */ | 230 | */ |
231 | QPixmap loadSmooth( const QString & ); | 231 | QPixmap loadSmooth( const QString & ); |
232 | 232 | ||
233 | /** | 233 | /** |
234 | * @fn selectTab( OTabInfo *tab ) | 234 | * @fn selectTab( OTabInfo *tab ) |
235 | * @brief Internal function to select desired widget. | 235 | * @brief Internal function to select desired widget. |
236 | * | 236 | * |
237 | * @param tab Pointer to data for widget. | 237 | * @param tab Pointer to data for widget. |
238 | */ | 238 | */ |
239 | void selectTab( OTabInfo * ); | 239 | void selectTab( OTabInfo * ); |
240 | 240 | ||
241 | /** | 241 | /** |
242 | * @fn setUpLayout() | 242 | * @fn setUpLayout() |
243 | * @brief Internal function to adjust layout. | 243 | * @brief Internal function to adjust layout. |
244 | */ | 244 | */ |
245 | void setUpLayout(); | 245 | void setUpLayout(); |
246 | 246 | ||
247 | 247 | ||
248 | signals: | 248 | signals: |
249 | /** | 249 | /** |
250 | * @fn currentChanegd( QWidget *widget ) | 250 | * @fn currentChanegd( QWidget *widget ) |
251 | * @brief This signal is emitted whenever the widget has changed. | 251 | * @brief This signal is emitted whenever the widget has changed. |
252 | * | 252 | * |
253 | * @param widget Pointer to new current widget. | 253 | * @param widget Pointer to new current widget. |
254 | */ | 254 | */ |
255 | void currentChanged( QWidget * ); | 255 | void currentChanged( QWidget * ); |
256 | 256 | ||
257 | private slots: | 257 | private slots: |
258 | 258 | ||
259 | /** | 259 | /** |
260 | * @fn slotTabBarSelected( int id ) | 260 | * @fn slotTabBarSelected( int id ) |
261 | * @brief Slot which is called when a tab is selected. | 261 | * @brief Slot which is called when a tab is selected. |
262 | * | 262 | * |
263 | * @param id ID of widget selected. | 263 | * @param id ID of widget selected. |
264 | */ | 264 | */ |
265 | void slotTabBarSelected( int ); | 265 | void slotTabBarSelected( int ); |
266 | 266 | ||
267 | /** | 267 | /** |
268 | * @fn slotTabListSelected( int index ) | 268 | * @fn slotTabListSelected( int index ) |
269 | * @brief Slot which is called when a drop down selection is made. | 269 | * @brief Slot which is called when a drop down selection is made. |
270 | * | 270 | * |
271 | * @param id Index of widget selected. | 271 | * @param id Index of widget selected. |
272 | */ | 272 | */ |
273 | void slotTabListSelected( int ); | 273 | void slotTabListSelected( int ); |
274 | }; | 274 | }; |
275 | 275 | ||
276 | #endif | 276 | #endif |