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