summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/.cvsignore3
-rw-r--r--libopie2/opieui/ofontselector.cpp429
-rw-r--r--libopie2/opieui/ofontselector.h104
-rw-r--r--libopie2/opieui/opieui.pro14
-rw-r--r--libopie2/opieui/otabbar.cpp83
-rw-r--r--libopie2/opieui/otabbar.h85
-rw-r--r--libopie2/opieui/otabinfo.h140
-rw-r--r--libopie2/opieui/otabwidget.cpp423
-rw-r--r--libopie2/opieui/otabwidget.h295
-rw-r--r--libopie2/opieui/otimepicker.cpp295
-rw-r--r--libopie2/opieui/otimepicker.h125
-rw-r--r--libopie2/opieui/otimepickerbase.ui292
12 files changed, 2285 insertions, 3 deletions
diff --git a/libopie2/opieui/.cvsignore b/libopie2/opieui/.cvsignore
index b1559c0..1244207 100644
--- a/libopie2/opieui/.cvsignore
+++ b/libopie2/opieui/.cvsignore
@@ -4,4 +4,5 @@ moc*
4*moc 4*moc
5*.o 5*.o
6~* 6~*
7 7*base.cpp
8*base.h
diff --git a/libopie2/opieui/ofontselector.cpp b/libopie2/opieui/ofontselector.cpp
new file mode 100644
index 0000000..49628c9
--- a/dev/null
+++ b/libopie2/opieui/ofontselector.cpp
@@ -0,0 +1,429 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) Robert Griebl <sandman@handhelds.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details.
21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29
30/* OPIE */
31#include <opie2/ofontselector.h>
32#include <qpe/fontdatabase.h>
33
34/* QT */
35#include <qlayout.h>
36#include <qlistbox.h>
37#include <qcombobox.h>
38#include <qlabel.h>
39#include <qfont.h>
40#include <qmultilineedit.h>
41
42using namespace Opie;
43
44namespace Opie
45{
46
47class OFontSelectorPrivate
48{
49public:
50 QListBox * m_font_family_list;
51 QComboBox * m_font_style_list;
52 QComboBox * m_font_size_list;
53 QMultiLineEdit *m_preview;
54
55 bool m_pointbug : 1;
56
57 FontDatabase m_fdb;
58};
59
60};
61
62namespace
63{
64
65class FontListItem : public QListBoxText
66{
67public:
68 FontListItem ( const QString &t, const QStringList &styles, const QValueList<int> &sizes ) : QListBoxText()
69 {
70 m_name = t;
71 m_styles = styles;
72 m_sizes = sizes;
73
74 QString str = t;
75 str [0] = str [0]. upper();
76 setText ( str );
77 }
78
79 QString family() const
80 {
81 return m_name;
82 }
83
84 const QStringList &styles() const
85 {
86 return m_styles;
87 }
88
89 const QValueList<int> &sizes() const
90 {
91 return m_sizes;
92 }
93
94private:
95 QStringList m_styles;
96 QValueList<int> m_sizes;
97 QString m_name;
98};
99
100
101static int findItemCB( QComboBox *box, const QString &str )
102{
103 for ( int i = 0; i < box->count(); i++ )
104 {
105 if ( box->text ( i ) == str )
106 return i;
107 }
108 return -1;
109}
110
111}
112/* static same as anon. namespace */
113static int qt_version()
114{
115 const char *qver = qVersion();
116
117 return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' );
118}
119
120/**
121 * Constructs the Selector object
122 * @param withpreview If a font preview should be given
123 * @param parent The parent of the Font Selector
124 * @param name The name of the object
125 * @param fl WidgetFlags
126 */
127OFontSelector::OFontSelector( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl )
128{
129 d = new OFontSelectorPrivate();
130
131 QGridLayout *gridLayout = new QGridLayout( this, 0, 0, 4, 4 );
132 gridLayout->setRowStretch( 4, 10 );
133
134 d->m_font_family_list = new QListBox( this, "FontListBox" );
135 gridLayout->addMultiCellWidget( d->m_font_family_list, 0, 4, 0, 0 );
136 connect( d->m_font_family_list, SIGNAL( highlighted( int ) ), this, SLOT( fontFamilyClicked( int ) ) );
137
138 QLabel *label = new QLabel( tr( "Style" ), this );
139 gridLayout->addWidget( label, 0, 1 );
140
141 d->m_font_style_list = new QComboBox( this, "StyleListBox" );
142 connect( d->m_font_style_list, SIGNAL( activated( int ) ), this, SLOT( fontStyleClicked( int ) ) );
143 gridLayout->addWidget( d->m_font_style_list, 1, 1 );
144
145 label = new QLabel( tr( "Size" ), this );
146 gridLayout->addWidget( label, 2, 1 );
147
148 d->m_font_size_list = new QComboBox( this, "SizeListBox" );
149 connect( d->m_font_size_list, SIGNAL( activated( int ) ),
150 this, SLOT( fontSizeClicked( int ) ) );
151 gridLayout->addWidget( d->m_font_size_list, 3, 1 );
152
153 d->m_pointbug = ( qt_version() <= 233 );
154
155 if ( withpreview )
156 {
157 d->m_preview = new QMultiLineEdit ( this, "Preview" );
158 d->m_preview->setAlignment ( AlignCenter );
159 d->m_preview->setWordWrap ( QMultiLineEdit::WidgetWidth );
160 d->m_preview->setMargin ( 3 );
161 d->m_preview->setText ( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" ));
162 gridLayout->addRowSpacing ( 5, 4 );
163 gridLayout->addMultiCellWidget ( d->m_preview, 6, 6, 0, 1 );
164 gridLayout->setRowStretch ( 6, 5 );
165 }
166 else
167 d->m_preview = 0;
168
169 loadFonts ( d->m_font_family_list );
170}
171
172OFontSelector::~OFontSelector()
173{
174 delete d;
175}
176
177/**
178 * This methods tries to set the font
179 * @param f The wishes font
180 * @return success or failure
181 */
182bool OFontSelector::setSelectedFont ( const QFont &f )
183{
184 return setSelectedFont ( f. family(), d->m_fdb. styleString ( f ), f. pointSize(), QFont::encodingName ( f. charSet()));
185}
186
187
188/**
189 * This is an overloaded method @see setSelectedFont
190 * @param familyStr The family of the font
191 * @param styleStr The style of the font
192 * @param sizeVal The size of font
193 * @param charset The charset to be used. Will be deprecated by QT3
194 */
195bool OFontSelector::setSelectedFont( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & charset )
196{
197 QString sizeStr = QString::number ( sizeVal );
198
199 QListBoxItem *family = d->m_font_family_list->findItem ( familyStr );
200 if ( !family )
201 family = d->m_font_family_list->findItem ( "Helvetica" );
202 if ( !family )
203 family = d->m_font_family_list->firstItem();
204 d->m_font_family_list->setCurrentItem ( family );
205 fontFamilyClicked ( d->m_font_family_list->index ( family ));
206
207 int style = findItemCB ( d->m_font_style_list, styleStr );
208 if ( style < 0 )
209 style = findItemCB ( d->m_font_style_list, "Regular" );
210 if ( style < 0 && d->m_font_style_list->count() > 0 )
211 style = 0;
212 d->m_font_style_list->setCurrentItem ( style );
213 fontStyleClicked ( style );
214
215 int size = findItemCB ( d->m_font_size_list, sizeStr );
216 if ( size < 0 )
217 size = findItemCB ( d->m_font_size_list, "10" );
218 if ( size < 0 && d->m_font_size_list->count() > 0 )
219 size = 0;
220 d->m_font_size_list->setCurrentItem ( size );
221 fontSizeClicked ( size );
222
223 return (( family ) && ( style >= 0 ) && ( size >= 0 ));
224}
225
226/**
227 * This method returns the name, style and size of the currently selected
228 * font or false if no font is selected
229 * @param family The font family will be written there
230 * @param style The style will be written there
231 * @param size The size will be written there
232 * @return success or failure
233 */
234bool OFontSelector::selectedFont ( QString &family, QString &style, int &size )
235{
236 QString dummy;
237 return selectedFont ( family, style, size, dummy );
238}
239
240
241/**
242 * This method does return the font family or QString::null if there is
243 * no font item selected
244 * @return the font family
245 */
246QString OFontSelector::fontFamily() const
247{
248 FontListItem *fli = (FontListItem *) d->m_font_family_list->item ( d->m_font_family_list->currentItem());
249
250 return fli ? fli->family() : QString::null;
251}
252
253/**
254 * This method will return the style of the font or QString::null
255 * @return the style of the font
256 */
257QString OFontSelector::fontStyle() const
258{
259 FontListItem *fli = (FontListItem *) d->m_font_family_list->item ( d->m_font_family_list->currentItem());
260 int fst = d->m_font_style_list->currentItem();
261
262 return ( fli && fst >= 0 ) ? fli->styles() [fst] : QString::null;
263}
264
265/**
266 * This method will return the font size or 10 if no font size is available
267 */
268int OFontSelector::fontSize() const
269{
270 FontListItem *fli = (FontListItem *) d->m_font_family_list->item ( d->m_font_family_list->currentItem());
271 int fsi = d->m_font_size_list->currentItem();
272
273 return ( fli && fsi >= 0 ) ? fli->sizes() [fsi] : 10;
274}
275
276/**
277 * returns the charset of the font or QString::null
278 */
279QString OFontSelector::fontCharSet() const
280{
281 FontListItem *fli = (FontListItem *) d->m_font_family_list->item ( d->m_font_family_list->currentItem());
282
283 return fli ? d->m_fdb. charSets ( fli->family()) [0] : QString::null;
284}
285
286/**
287 * Overloaded member function see above
288 * @see selectedFont
289 */
290bool OFontSelector::selectedFont ( QString &family, QString &style, int &size, QString &charset )
291{
292 int ffa = d->m_font_family_list->currentItem();
293 int fst = d->m_font_style_list->currentItem();
294 int fsi = d->m_font_size_list->currentItem();
295
296 FontListItem *fli = (FontListItem *) d->m_font_family_list->item ( ffa );
297
298 if ( fli )
299 {
300 family = fli->family();
301 style = fst >= 0 ? fli->styles() [fst] : QString::null;
302 size = fsi >= 0 ? fli->sizes() [fsi] : 10;
303 charset = d->m_fdb. charSets ( fli->family()) [0];
304
305 return true;
306 }
307 else
308 return false;
309}
310
311void OFontSelector::loadFonts ( QListBox *list )
312{
313 QStringList f = d->m_fdb. families();
314
315 for ( QStringList::ConstIterator it = f. begin(); it != f. end(); ++it )
316 {
317 QValueList <int> ps = d->m_fdb. pointSizes ( *it );
318
319 if ( d->m_pointbug )
320 {
321 for ( QValueList <int>::Iterator it = ps. begin(); it != ps. end(); it++ )
322 *it /= 10;
323 }
324
325 list->insertItem ( new FontListItem ( *it, d->m_fdb. styles ( *it ), ps ));
326 }
327}
328
329void OFontSelector::fontFamilyClicked ( int index )
330{
331 QString oldstyle = d->m_font_style_list->currentText();
332 QString oldsize = d->m_font_size_list->currentText();
333
334 FontListItem *fli = (FontListItem *) d->m_font_family_list->item ( index );
335
336 d->m_font_style_list->clear();
337 d->m_font_style_list->insertStringList ( fli->styles());
338 d->m_font_style_list->setEnabled ( !fli->styles(). isEmpty());
339
340 int i;
341
342 i = findItemCB ( d->m_font_style_list, oldstyle );
343 if ( i < 0 )
344 i = findItemCB ( d->m_font_style_list, "Regular" );
345 if (( i < 0 ) && ( d->m_font_style_list->count() > 0 ))
346 i = 0;
347
348 if ( i >= 0 )
349 {
350 d->m_font_style_list->setCurrentItem ( i );
351 fontStyleClicked ( i );
352 }
353
354 d->m_font_size_list->clear();
355 QValueList<int> sl = fli->sizes();
356
357 for ( QValueList<int>::Iterator it = sl. begin(); it != sl. end(); ++it )
358 d->m_font_size_list->insertItem ( QString::number ( *it ));
359
360 i = findItemCB ( d->m_font_size_list, oldsize );
361 if ( i < 0 )
362 i = findItemCB ( d->m_font_size_list, "10" );
363 if (( i < 0 ) && ( d->m_font_size_list->count() > 0 ))
364 i = 0;
365
366 if ( i >= 0 )
367 {
368 d->m_font_size_list->setCurrentItem ( i );
369 fontSizeClicked ( i );
370 }
371 changeFont();
372}
373
374void OFontSelector::fontStyleClicked ( int /*index*/ )
375{
376 changeFont();
377}
378
379void OFontSelector::fontSizeClicked ( int /*index*/ )
380{
381 changeFont();
382}
383
384void OFontSelector::changeFont()
385{
386 QFont f = selectedFont();
387
388 if ( d->m_preview )
389 d->m_preview->setFont ( f );
390
391 emit fontSelected ( f );
392}
393
394/**
395 * Return the selected font
396 */
397QFont OFontSelector::selectedFont()
398{
399 int ffa = d->m_font_family_list->currentItem();
400 int fst = d->m_font_style_list->currentItem();
401 int fsi = d->m_font_size_list->currentItem();
402
403 FontListItem *fli = (FontListItem *) d->m_font_family_list->item ( ffa );
404
405 if ( fli )
406 {
407 return d->m_fdb. font ( fli->family(), \
408 fst >= 0 ? fli->styles() [fst] : QString::null, \
409 fsi >= 0 ? fli->sizes() [fsi] : 10, \
410 d->m_fdb. charSets ( fli->family()) [0] );
411 }
412 else
413 return QFont();
414}
415
416void OFontSelector::resizeEvent ( QResizeEvent *re )
417{
418 if ( d->m_preview )
419 {
420 d->m_preview->setMinimumHeight ( 1 );
421 d->m_preview->setMaximumHeight ( 32767 );
422 }
423
424 QWidget::resizeEvent ( re );
425
426 if ( d->m_preview )
427 d->m_preview->setFixedHeight ( d->m_preview->height());
428
429}
diff --git a/libopie2/opieui/ofontselector.h b/libopie2/opieui/ofontselector.h
new file mode 100644
index 0000000..ad51819
--- a/dev/null
+++ b/libopie2/opieui/ofontselector.h
@@ -0,0 +1,104 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) Robert Griebl <sandman@handhelds.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details.
21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29
30#ifndef OFONTSELECTOR_H
31#define OFONTSELECTOR_H
32
33/* QT */
34#include <qwidget.h>
35
36class QListBox;
37
38namespace Opie
39{
40
41class OFontSelectorPrivate;
42
43/**
44 * This class lets you chose a Font out of a list of Fonts.
45 * It can show a preview too. This selector will use all available
46 * fonts
47 *
48 *
49 * @short A widget to select a font
50 * @see QWidget
51 * @see QFont
52 * @author Rober Griebl
53 */
54class OFontSelector : public QWidget
55{
56 Q_OBJECT
57
58public:
59 OFontSelector ( bool withpreview, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
60 virtual ~OFontSelector ( );
61
62 bool selectedFont ( QString &family, QString &style, int &size );
63 bool selectedFont ( QString &family, QString &style, int &size, QString &charset );
64
65 QFont selectedFont ( );
66
67 bool setSelectedFont ( const QFont & );
68 bool setSelectedFont ( const QString &family, const QString &style, int size, const QString &charset = 0 );
69
70 QString fontFamily ( ) const;
71 QString fontStyle ( ) const;
72 int fontSize ( ) const;
73 QString fontCharSet ( ) const;
74
75signals:
76 /**
77 * This signal gets emitted when a font got chosen
78 */
79 void fontSelected ( const QFont & );
80
81protected slots:
82 /** @internal */
83 virtual void fontFamilyClicked ( int );
84 /** @internal */
85 virtual void fontStyleClicked ( int );
86 /** @internal */
87 virtual void fontSizeClicked ( int );
88
89protected:
90 virtual void resizeEvent ( QResizeEvent *re );
91
92private:
93 void loadFonts ( QListBox * );
94
95 void changeFont ( );
96
97private:
98 OFontSelectorPrivate *d;
99};
100
101};
102
103#endif
104
diff --git a/libopie2/opieui/opieui.pro b/libopie2/opieui/opieui.pro
index 41db153..b9bf203 100644
--- a/libopie2/opieui/opieui.pro
+++ b/libopie2/opieui/opieui.pro
@@ -8,12 +8,17 @@ HEADERS = ocheckitem.h \
8 ofileselector_p.h \ 8 ofileselector_p.h \
9 ofiledialog.h \ 9 ofiledialog.h \
10 ofileview.h \ 10 ofileview.h \
11 ofontselector.h \
11 oimageeffect.h \ 12 oimageeffect.h \
12 olistview.h \ 13 olistview.h \
13 opixmapeffect.h \ 14 opixmapeffect.h \
14 opopupmenu.h \ 15 opopupmenu.h \
15 opixmapprovider.h \ 16 opixmapprovider.h \
16 oselector.h \ 17 oselector.h \
18 otabinfo.h \
19 otabbar.h \
20 otabwidget.h \
21 otimepicker.h \
17 oversatileview.h \ 22 oversatileview.h \
18 oversatileviewitem.h \ 23 oversatileviewitem.h \
19 omessagebox.h \ 24 omessagebox.h \
@@ -25,12 +30,16 @@ SOURCES = ocheckitem.cpp \
25 oclickablelabel.cpp \ 30 oclickablelabel.cpp \
26 ofileselector.cpp \ 31 ofileselector.cpp \
27 ofiledialog.cpp \ 32 ofiledialog.cpp \
33 ofontselector.cpp \
28 oimageeffect.cpp \ 34 oimageeffect.cpp \
29 olistview.cpp \ 35 olistview.cpp \
30 opixmapeffect.cpp \ 36 opixmapeffect.cpp \
31 opopupmenu.cpp \ 37 opopupmenu.cpp \
32 opixmapprovider.cpp \ 38 opixmapprovider.cpp \
33 oselector.cpp \ 39 oselector.cpp \
40 otabbar.cpp \
41 otabwidget.cpp \
42 otimepicker.cpp \
34 oversatileview.cpp \ 43 oversatileview.cpp \
35 oversatileviewitem.cpp \ 44 oversatileviewitem.cpp \
36 odialog.cpp \ 45 odialog.cpp \
@@ -38,9 +47,10 @@ SOURCES = ocheckitem.cpp \
38 otaskbarapplet.cpp \ 47 otaskbarapplet.cpp \
39 oseparator.cpp 48 oseparator.cpp
40 49
41INTERFACES = 50INTERFACES = otimepickerbase.ui
51
42TARGET = opieui2 52TARGET = opieui2
43VERSION = 1.8.3 53VERSION = 1.8.4
44 54
45INCLUDEPATH += $(OPIEDIR)/include 55INCLUDEPATH += $(OPIEDIR)/include
46DEPENDPATH += $(OPIEDIR)/include 56DEPENDPATH += $(OPIEDIR)/include
diff --git a/libopie2/opieui/otabbar.cpp b/libopie2/opieui/otabbar.cpp
new file mode 100644
index 0000000..cd3a34b
--- a/dev/null
+++ b/libopie2/opieui/otabbar.cpp
@@ -0,0 +1,83 @@
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#include <opie2/otabbar.h>
33
34using namespace Opie;
35
36OTabBar::OTabBar( QWidget *parent , const char *name )
37 :QTabBar( parent, name )
38{}
39
40void OTabBar::paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus ) const
41{
42
43 QRect r = br;
44 if ( t->iconset)
45 {
46 QIconSet::Mode mode = (t->enabled && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled;
47 if ( mode == QIconSet::Normal && has_focus )
48 {
49 mode = QIconSet::Active;
50 }
51 QPixmap pixmap = t->iconset->pixmap( QIconSet::Small, mode );
52 int pixw = pixmap.width();
53 int pixh = pixmap.height();
54 r.setLeft( r.left() + pixw + 2 );
55 p->drawPixmap( br.left()+2, br.center().y()-pixh/2, pixmap );
56 }
57
58 QRect tr = r;
59 if ( t->id == currentTab() )
60 {
61 tr.setBottom( tr.bottom() - style().defaultFrameWidth() );
62 }
63
64 if ( t->enabled && isEnabled() )
65 {
66 p->setPen( colorGroup().foreground() );
67 p->drawText( tr, AlignCenter | ShowPrefix, t->label );
68 }
69 else if ( style() == MotifStyle )
70 {
71 p->setPen( palette().disabled().foreground() );
72 p->drawText( tr, AlignCenter | ShowPrefix, t->label );
73 }
74 else
75 {
76 p->setPen( colorGroup().light() );
77 QRect wr = tr;
78 wr.moveBy( 1, 1 );
79 p->drawText( wr, AlignCenter | ShowPrefix, t->label );
80 p->setPen( palette().disabled().foreground() );
81 p->drawText( tr, AlignCenter | ShowPrefix, t->label );
82 }
83}
diff --git a/libopie2/opieui/otabbar.h b/libopie2/opieui/otabbar.h
new file mode 100644
index 0000000..2f35c85
--- a/dev/null
+++ b/libopie2/opieui/otabbar.h
@@ -0,0 +1,85 @@
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 OTABBAR_H
33#define OTABBAR_H
34
35/* QT */
36#include <qtabbar.h>
37
38namespace Opie
39{
40
41/**
42 * @class OTabBar
43 * @brief The OTabBar class is a derivative of QTabBar.
44 *
45 * OTabBar is a derivation of TrollTech's QTabBar which provides
46 * a row of tabs for selection. The only difference between this
47 * class and QTabBar is that there is no dotted line box around
48 * the label of the tab with the current focus.
49 */
50class OTabBar : public QTabBar
51{
52 Q_OBJECT
53
54public:
55 /**
56 * @fn OTabBar( QWidget *parent = 0, const char *name = 0 )
57 * @brief Object constructor.
58 *
59 * @param parent Pointer to parent of this control.
60 * @param name Name of control.
61 *
62 * Constructs a new OTabBar control with parent and name.
63 */
64 OTabBar( QWidget * = 0, const char * = 0 );
65
66protected:
67 /**
68 * @fn paintLabel( QPainter* p, const QRect& br , QTab* t, bool has_focus)const
69 * @brief Internal function to draw a tab's label.
70 *
71 * @param p Pointer to QPainter used for drawing.
72 * @param br QRect providing region to draw label in.
73 * @param t Tab to draw label for.
74 * @param has_focus Boolean value not used, retained for compatibility reasons.
75 */
76 void paintLabel( QPainter *, const QRect &, QTab *, bool ) const;
77
78private:
79 class Private;
80 Private *d;
81};
82
83};
84
85#endif
diff --git a/libopie2/opieui/otabinfo.h b/libopie2/opieui/otabinfo.h
new file mode 100644
index 0000000..4a6ce14
--- a/dev/null
+++ b/libopie2/opieui/otabinfo.h
@@ -0,0 +1,140 @@
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 OTABINFO_H
33#define OTABINFO_H
34
35/* QT */
36#include <qlist.h>
37#include <qstring.h>
38
39class QWidget;
40
41namespace Opie
42{
43
44/**
45 * @class OTabInfo
46 * @brief The OTabInfo class is used internally by OTabWidget to keep track
47 * of widgets added to the control.
48 *
49 * OTabInfo provides the following information about a widget added to an
50 * OTabWidget control:
51 *
52 * ID - integer tab bar ID
53 * Control - QWidget pointer to child widget
54 * Label - QString text label for OTabWidget selection control
55 * Icon - QString name of icon file
56 */
57class OTabInfo
58{
59public:
60 /**
61 * @fn OTabInfo()
62 * @brief Object constructor.
63 *
64 * @param parent Pointer to parent of this control.
65 * @param name Name of control.
66 * @param s Style of widget selection control.
67 * @param p Position of the widget selection control.
68 */
69 OTabInfo() : i( -1 ), c( 0 ), p( 0 ), l( QString::null ) {}
70
71 /**
72 * @fn OTabInfo( int id, QWidget *control, const QString &icon, const QString &label )
73 * @brief Object constructor.
74 *
75 * @param id TabBar identifier for widget.
76 * @param control QWidget pointer to widget.
77 * @param icon QString name of icon file.
78 * @param label QString text label for OTabWidget selection control.
79 */
80 OTabInfo( int id, QWidget *control, const QString &icon, const QString &label )
81 : i( id ), c( control ), p( icon ), l( label ) {}
82
83 /**
84 * @fn id()const
85 * @brief Returns TabBar ID.
86 */
87 int id() const { return i; }
88
89 /**
90 * @fn label()const
91 * @brief Returns text label for widget.
92 */
93 const QString &label() const { return l; }
94
95 /**
96 * @fn setLabel( const QString &label )
97 * @brief Set label for tab.
98 *
99 * @param label QString text label for OTabWidget selection control.
100 */
101 void setLabel( const QString &label ) { l = label; }
102
103 /**
104 * @fn control()const
105 * @brief Returns pointer to widget.
106 */
107 QWidget *control() const { return c; }
108
109 /**
110 * @fn icon()const
111 * @brief Returns name of icon file.
112 */
113 const QString &icon() const { return p; }
114
115 /**
116 * @fn setIcon( const QString &icon )
117 * @brief Set icon for tab.
118 *
119 * @param icon QString name of icon file.
120 */
121 void setIcon( const QString &icon ) { p = icon; }
122
123private:
124 int i;
125 QWidget *c;
126 QString p;
127 QString l;
128 class Private;
129 Private *d;
130};
131
132/**
133 * @class OTabInfoList
134 * @brief A list of OTabInfo objects used by OTabWidget.
135 */
136typedef QList<OTabInfo> OTabInfoList;
137
138};
139
140#endif
diff --git a/libopie2/opieui/otabwidget.cpp b/libopie2/opieui/otabwidget.cpp
new file mode 100644
index 0000000..ec6af9d
--- a/dev/null
+++ b/libopie2/opieui/otabwidget.cpp
@@ -0,0 +1,423 @@
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#include <opie2/otabwidget.h>
33
34/* OPIE */
35#include <qpe/applnk.h>
36#include <qpe/config.h>
37#include <qpe/resource.h>
38#include <opie2/otabbar.h>
39
40/* QT */
41#include <qcombobox.h>
42#include <qwidgetstack.h>
43
44using namespace Opie;
45
46OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPosition p )
47 : QWidget( parent, name )
48{
49 if ( s == Global )
50 {
51 Config config( "qpe" );
52 config.setGroup( "Appearance" );
53 s = ( TabStyle ) config.readNumEntry( "TabStyle", (int) IconTab );
54 if ( s <= Global || s > IconList)
55 {
56 s = IconTab;
57 }
58 QString pos = config.readEntry( "TabPosition", "Top");
59 if ( pos == "Bottom" )
60 {
61 p = Bottom;
62 }
63 else
64 {
65 p = Top;
66 }
67 }
68
69 widgetStack = new QWidgetStack( this, "widgetstack" );
70 widgetStack->setFrameStyle( QFrame::NoFrame );
71 widgetStack->setLineWidth( style().defaultFrameWidth() );
72
73 tabBarStack = new QWidgetStack( this, "tabbarstack" );
74
75 tabBar = new OTabBar( tabBarStack, "tabbar" );
76 tabBarStack->addWidget( tabBar, 0 );
77 connect( tabBar, SIGNAL( selected( int ) ), this, SLOT( slotTabBarSelected( int ) ) );
78
79 tabList = new QComboBox( false, tabBarStack, "tablist" );
80 tabBarStack->addWidget( tabList, 1 );
81 connect( tabList, SIGNAL( activated( int ) ), this, SLOT( slotTabListSelected( int ) ) );
82
83 tabBarPosition = p;
84 setTabStyle( s );
85 setTabPosition( p );
86
87 currTab= 0x0;
88}
89
90OTabWidget::~OTabWidget()
91{}
92
93void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &label )
94{
95 QPixmap iconset = loadSmooth( icon );
96
97 QTab *tab = new QTab();
98 if ( tabBarStyle == IconTab )
99 {
100 tab->label = QString::null;
101 }
102 else
103 {
104 tab->label = label;
105 }
106 if ( tabBarStyle == IconTab || tabBarStyle == IconList )
107 {
108 tab->iconset = new QIconSet( iconset );
109 }
110 int tabid = tabBar->addTab( tab );
111
112 if ( tabBarStyle == IconTab || tabBarStyle == IconList )
113 {
114 tabList->insertItem( iconset, label, -1 );
115 }
116 else
117 {
118 tabList->insertItem( label );
119 }
120
121 widgetStack->addWidget( child, tabid );
122 widgetStack->raiseWidget( child );
123 widgetStack->setFrameStyle( QFrame::StyledPanel | QFrame::Raised );
124
125 OTabInfo *tabinfo = new OTabInfo( tabid, child, icon, label );
126 tabs.append( tabinfo );
127 selectTab( tabinfo );
128}
129
130void OTabWidget::removePage( QWidget *childwidget )
131{
132 if ( childwidget )
133 {
134 OTabInfo *tab = tabs.first();
135 while ( tab && tab->control() != childwidget )
136 {
137 tab = tabs.next();
138 }
139 if ( tab && tab->control() == childwidget )
140 {
141 tabBar->setTabEnabled( tab->id(), FALSE );
142 tabBar->removeTab( tabBar->tab( tab->id() ) );
143 int i = 0;
144 while ( i < tabList->count() && tabList->text( i ) != tab->label() )
145 {
146 i++;
147 }
148 if ( tabList->text( i ) == tab->label() )
149 {
150 tabList->removeItem( i );
151 }
152 widgetStack->removeWidget( childwidget );
153 tabs.remove( tab );
154 delete tab;
155 currTab = tabs.current();
156 if ( !currTab )
157 {
158 widgetStack->setFrameStyle( QFrame::NoFrame );
159 }
160
161 setUpLayout();
162 }
163 }
164}
165
166void OTabWidget::changeTab( QWidget *widget, const QString &iconset, const QString &label)
167{
168 OTabInfo *currtab = tabs.first();
169 while ( currtab && currtab->control() != widget )
170 {
171 currtab = tabs.next();
172 }
173 if ( currtab && currtab->control() == widget )
174 {
175 QTab *tab = tabBar->tab( currtab->id() );
176 QPixmap icon( loadSmooth( iconset ) );
177 tab->setText( label );
178 if ( tabBarStyle == IconTab )
179 tab->setIconSet( icon );
180 int i = 0;
181 while ( i < tabList->count() && tabList->text( i ) != currtab->label() )
182 {
183 i++;
184 }
185 if ( i < tabList->count() && tabList->text( i ) == currtab->label() )
186 {
187 if ( tabBarStyle == IconTab || tabBarStyle == IconList )
188 {
189 tabList->changeItem( icon, label, i );
190 }
191 else
192 {
193 tabList->changeItem( label, i );
194 }
195 }
196 currtab->setLabel( label );
197 currtab->setIcon( iconset );
198 }
199 setUpLayout();
200}
201
202void OTabWidget::setCurrentTab( QWidget *childwidget )
203{
204 OTabInfo *currtab = tabs.first();
205 while ( currtab && currtab->control() != childwidget )
206 {
207 currtab = tabs.next();
208 }
209 if ( currtab && currtab->control() == childwidget )
210 {
211 selectTab( currtab );
212 }
213}
214
215void OTabWidget::setCurrentTab( const QString &tabname )
216{
217 OTabInfo *newtab = tabs.first();
218 while ( newtab && newtab->label() != tabname )
219 {
220 newtab = tabs.next();
221 }
222 if ( newtab && newtab->label() == tabname )
223 {
224 selectTab( newtab );
225 }
226}
227
228void OTabWidget::setCurrentTab(int tabindex)
229{
230 OTabInfo *newtab = tabs.first();
231 while ( newtab && newtab->id() != tabindex )
232 {
233 newtab = tabs.next();
234 }
235 if ( newtab && newtab->id() == tabindex )
236 {
237 selectTab( newtab );
238 }
239}
240
241
242OTabWidget::TabStyle OTabWidget::tabStyle() const
243{
244 return tabBarStyle;
245}
246
247void OTabWidget::setTabStyle( TabStyle s )
248{
249 tabBarStyle = s;
250 if ( tabBarStyle == TextTab || tabBarStyle == IconTab )
251 {
252 QTab *currtab;
253 for ( OTabInfo *tabinfo = tabs.first(); tabinfo; tabinfo = tabs.next() )
254 {
255 currtab = tabBar->tab( tabinfo->id() );
256 if ( tabBarStyle == IconTab )
257 {
258 currtab->iconset = new QIconSet( loadSmooth( tabinfo->icon() ) );
259 if ( tabinfo == currTab )
260 currtab->setText( tabinfo->label() );
261 else
262 currtab->setText( QString::null );
263 }
264 else
265 {
266 currtab->iconset = 0x0;
267 currtab->setText( tabinfo->label() );
268 }
269 }
270 tabBarStack->raiseWidget( tabBar );
271 }
272 else if ( tabBarStyle == TextList || tabBarStyle == IconList )
273 {
274 tabList->clear();
275 for ( OTabInfo *tabinfo = tabs.first(); tabinfo; tabinfo = tabs.next() )
276 {
277 if ( tabBarStyle == IconList )
278 {
279 tabList->insertItem( loadSmooth( tabinfo->icon() ), tabinfo->label() );
280 }
281 else
282 {
283 tabList->insertItem( tabinfo->label() );
284 }
285 }
286 tabBarStack->raiseWidget( tabList );
287 }
288 setUpLayout();
289}
290
291OTabWidget::TabPosition OTabWidget::tabPosition() const
292{
293 return tabBarPosition;
294}
295
296void OTabWidget::setTabPosition( TabPosition p )
297{
298 tabBarPosition = p;
299 if ( tabBarPosition == Top )
300 {
301 tabBar->setShape( QTabBar::RoundedAbove );
302 }
303 else
304 {
305 tabBar->setShape( QTabBar::RoundedBelow );
306 }
307 setUpLayout();
308}
309
310void OTabWidget::slotTabBarSelected( int id )
311{
312 OTabInfo *newtab = tabs.first();
313 while ( newtab && newtab->id() != id )
314 {
315 newtab = tabs.next();
316 }
317 if ( newtab && newtab->id() == id )
318 {
319 selectTab( newtab );
320 }
321}
322
323void OTabWidget::slotTabListSelected( int index )
324{
325 OTabInfo *newtab = tabs.at( index );
326 if ( newtab )
327 {
328 selectTab( newtab );
329 }
330}
331
332QPixmap OTabWidget::loadSmooth( const QString &name )
333{
334 QPixmap p;
335 p.convertFromImage( Resource::loadImage( name ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
336 return p;
337}
338
339void OTabWidget::selectTab( OTabInfo *tab )
340{
341 if ( tabBarStyle == IconTab )
342 {
343 if ( currTab )
344 {
345 tabBar->tab( currTab->id() )->setText( QString::null );
346 setUpLayout();
347 }
348 tabBar->tab( tab->id() )->setText( tab->label() );
349 tabBar->setCurrentTab( tab->id() );
350 setUpLayout();
351 tabBar->update();
352 }
353 else
354 {
355 tabBar->setCurrentTab( tab->id() );
356 }
357
358 widgetStack->raiseWidget( tab->control() );
359
360 emit currentChanged( tab->control() );
361
362 currTab = tab;
363}
364
365void OTabWidget::setUpLayout()
366{
367 tabBar->layoutTabs();
368 QSize t( tabBarStack->sizeHint() );
369 if ( tabBarStyle == IconTab )
370 {
371 if ( t.width() > width() )
372 t.setWidth( width() );
373 }
374 else
375 {
376 t.setWidth( width() );
377 }
378 int lw = widgetStack->lineWidth();
379 if ( tabBarPosition == Bottom )
380 {
381 tabBarStack->setGeometry( QMAX(0, lw-2), height() - t.height() - lw, t.width(), t.height() );
382 widgetStack->setGeometry( 0, 0, width(), height()-t.height()+QMAX(0, lw-2) );
383 }
384 else
385 {
386 tabBarStack->setGeometry( QMAX(0, lw-2), 0, t.width(), t.height() );
387 widgetStack->setGeometry( 0, t.height()-lw, width(), height()-t.height()+QMAX( 0, lw-2 ) );
388 }
389
390 if ( autoMask() )
391 updateMask();
392}
393
394QSize OTabWidget::sizeHint() const
395{
396 QSize s( widgetStack->sizeHint() );
397 QSize t( tabBarStack->sizeHint() );
398 return QSize( QMAX( s.width(), t.width() ), s.height() + t.height() );
399}
400
401void OTabWidget::resizeEvent( QResizeEvent * )
402{
403 setUpLayout();
404}
405
406int OTabWidget::currentTab()
407{
408 if ( currTab )
409 {
410 return currTab->id();
411 }
412 return -1;
413}
414
415QWidget* OTabWidget::currentWidget()const
416{
417 if ( currTab )
418 {
419 return currTab->control();
420 }
421
422 return 0;
423}
diff --git a/libopie2/opieui/otabwidget.h b/libopie2/opieui/otabwidget.h
new file mode 100644
index 0000000..51d1c6d
--- a/dev/null
+++ b/libopie2/opieui/otabwidget.h
@@ -0,0 +1,295 @@
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/* OPIE */
36#include <opie2/otabinfo.h>
37
38/* QT */
39#include <qwidget.h>
40#include <qlist.h>
41
42using namespace Opie;
43
44class QComboBox;
45class QPixmap;
46class QTabBar;
47class QWidgetStack;
48
49namespace Opie
50{
51
52class OTabBar;
53
54/**
55 * @class OTabWidget
56 * @brief The OTabWidget class provides a stack of widgets.
57 *
58 * OTabWidget is a derivation of TrollTech's QTabWidget which provides
59 * a stack of widgets. Widgets can be selected using either a tab bar or
60 * drop down list box.
61 *
62 * The normal way to use OTabWidget is to do the following in the
63 * constructor:
64 * - Create a OTabWidget.
65 * - Create a QWidget for each of the pages in the control, insert
66 * children into it, set up geometry management for it, and use addTab()
67 * to add the widget.
68 */
69class OTabWidget : public QWidget
70{
71 Q_OBJECT
72public:
73
74/**
75 * @enum TabStyle
76 * @brief Defines how the widget selection control is displayed.
77 *
78 * Valid values:
79 * - Global: use globally selected options (qpe.conf - TabStyle & TabPosition)
80 * - TextTab: Tabbed widget selection with text labels
81 * - IconTab: Tabbed widget selection with icon labels, text label for active widget
82 * (similar to Opie launcher)
83 * - TextList: Drop down list widget selection with text labels
84 * - IconList: Drop down list widget selection with icon & text labels
85 */
86 enum TabStyle { Global, TextTab, IconTab, TextList, IconList };
87
88/**
89 * @enum TabPosition
90 * @brief Defines where the widget selection control is drawn.
91 *
92 * Valid values:
93 * - Top: Widget selection control is drawn above widgets
94 * - Bottom: Widget selection control is drawn below widgets
95 */
96 enum TabPosition { Top, Bottom };
97
98/**
99 * @fn OTabWidget( QWidget *parent = 0, const char *name = 0, TabStyle s = Global, TabPosition p = Top )
100 * @brief Object constructor.
101 *
102 * @param parent Pointer to parent of this control.
103 * @param name Name of control.
104 * @param s Style of widget selection control.
105 * @param p Position of the widget selection control.
106 *
107 * Constructs a new OTabWidget control with parent and name. The style and position parameters
108 * determine how the widget selection control will be displayed.
109 */
110 // FIXME WFlags? -zecke
111 OTabWidget( QWidget * = 0, const char * = 0, TabStyle = Global, TabPosition = Top );
112
113/**
114 * @fn ~OTabWidget()
115 * @brief Object destructor.
116 */
117 ~OTabWidget();
118
119/**
120 * @fn addTab( QWidget *child, const QString &icon, const QString &label )
121 * @brief Add new widget to control.
122 *
123 * @param child Widget control.
124 * @param icon Path to icon.
125 * @param label Text label.
126 */
127 void addTab( QWidget *, const QString &, const QString & );
128
129/**
130 * @fn removePage( QWidget *widget )
131 * @brief Remove widget from control. Does not delete widget.
132 *
133 * @param widget Widget control to be removed.
134 */
135 /* ### Page vs. Tab.. yes the widget is a Page but then is addTab wrong -zecke */
136 void removePage( QWidget * );
137
138/**
139 * @fn changeTab( QWidget *widget, const QString &icon, const QString &label )
140 * @brief Change text and/or icon for existing tab
141 *
142 * @param child Widget control.
143 * @param icon Path to icon.
144 * @param label Text label.
145 */
146 void changeTab( QWidget *, const QString &, const QString & );
147
148/**
149 * @fn tabStyle()const
150 * @brief Returns current widget selection control style.
151 */
152 TabStyle tabStyle() const;
153
154/**
155 * @fn setTabStyle( TabStyle s )
156 * @brief Set the current widget selection control style.
157 *
158 * @param s New style to be used.
159 */
160 void setTabStyle( TabStyle );
161
162/**
163 * @fn tabPosition()const
164 * @brief Returns current widget selection control position.
165 */
166 TabPosition tabPosition() const;
167
168/**
169 * @fn setTabPosition( TabPosition p )
170 * @brief Set the current widget selection control position.
171 *
172 * @param p New position of widget selection control.
173 */
174 void setTabPosition( TabPosition );
175
176/**
177 * @fn setCurrentTab( QWidget *childwidget )
178 * @brief Selects and brings to top the desired widget by using widget pointer.
179 *
180 * @param childwidget Widget to select.
181 */
182 void setCurrentTab( QWidget * );
183
184/**
185 * @fn setCurrentTab( const QString &tabname )
186 * @brief Selects and brings to top the desired widget, by using label.
187 *
188 * @param tabname Text label for widget to select.
189 */
190 void setCurrentTab( const QString & );
191
192/**
193 * @fn setCurrentTab( int )
194 * @brief Selects and brings to top the desired widget, by using id.
195 *
196 * @param tab id for widget to select.
197 */
198 void setCurrentTab(int);
199
200/**
201 * @fn sizeHint()const
202 * @brief Reimplemented for internal purposes.
203 */
204 QSize sizeHint() const;
205
206/**
207 * @fn currentTab( )
208 * @brief returns current tab id.
209 */
210 // ### make const
211 int currentTab()/* const */;
212/**
213 * @brief returns the current page of the active tab
214 *
215 * @since 1.2
216 */
217 QWidget* currentWidget()const;
218
219protected:
220
221/**
222 * @fn resizeEvent( QResizeEvent * )
223 * @brief Reimplemented for internal purposes.
224 */
225 void resizeEvent( QResizeEvent * );
226
227private:
228 OTabInfoList tabs;
229 OTabInfo *currTab;
230
231 TabStyle tabBarStyle;
232 TabPosition tabBarPosition;
233
234 QWidgetStack *tabBarStack;
235 OTabBar *tabBar;
236 QComboBox *tabList;
237
238 QWidgetStack *widgetStack;
239 class Private;
240 Private* d;
241
242/**
243 * @fn loadSmooth( const QString &name )
244 * @brief Loads icon for widget.
245 *
246 * @param name Name of icon image file.
247 */
248 QPixmap loadSmooth( const QString & );
249
250/**
251 * @fn selectTab( OTabInfo *tab )
252 * @brief Internal function to select desired widget.
253 *
254 * @param tab Pointer to data for widget.
255 */
256 void selectTab( OTabInfo * );
257
258/**
259 * @fn setUpLayout()
260 * @brief Internal function to adjust layout.
261 */
262 void setUpLayout();
263
264
265signals:
266/**
267 * @fn currentChanegd( QWidget *widget )
268 * @brief This signal is emitted whenever the widget has changed.
269 *
270 * @param widget Pointer to new current widget.
271 */
272 void currentChanged( QWidget * );
273
274private slots:
275
276/**
277 * @fn slotTabBarSelected( int id )
278 * @brief Slot which is called when a tab is selected.
279 *
280 * @param id ID of widget selected.
281 */
282 void slotTabBarSelected( int );
283
284/**
285 * @fn slotTabListSelected( int index )
286 * @brief Slot which is called when a drop down selection is made.
287 *
288 * @param id Index of widget selected.
289 */
290 void slotTabListSelected( int );
291};
292
293};
294
295#endif
diff --git a/libopie2/opieui/otimepicker.cpp b/libopie2/opieui/otimepicker.cpp
new file mode 100644
index 0000000..9f9f2c2
--- a/dev/null
+++ b/libopie2/opieui/otimepicker.cpp
@@ -0,0 +1,295 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers <eilers.stefan@epost.de>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details.
21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29
30/* QT */
31#include <qbuttongroup.h>
32#include <qlayout.h>
33#include <qlineedit.h>
34#include <qstring.h>
35#include <qtoolbutton.h>
36
37/* OPIE */
38#include <opie2/otimepicker.h>
39
40using namespace Opie;
41
42/**
43 * Constructs the widget
44 * @param parent The parent of the OTimePicker
45 * @param name The name of the object
46 * @param fl Window Flags
47 */
48OTimePicker::OTimePicker(QWidget* parent, const char* name, Qt::WFlags fl)
49 :QWidget(parent,name,fl)
50{
51 QVBoxLayout *vbox=new QVBoxLayout(this);
52
53 OClickableLabel *r;
54 QString s;
55
56 // Hour Row
57 QWidget *row=new QWidget(this);
58 QHBoxLayout *l=new QHBoxLayout(row);
59 vbox->addWidget(row);
60
61 for (int i=0; i<24; i++)
62 {
63 r=new OClickableLabel(row);
64 hourLst.append(r);
65 s.sprintf("%.2d",i);
66 r->setText(s);
67 r->setToggleButton(true);
68 r->setAlignment(AlignHCenter | AlignVCenter);
69 l->addWidget(r);
70 connect(r, SIGNAL(toggled(bool)),
71 this, SLOT(slotHour(bool)));
72
73 if (i==11)
74 { // Second row
75 row=new QWidget(this);
76 l=new QHBoxLayout(row);
77 vbox->addWidget(row);
78 }
79 }
80
81 // Minute Row
82 row=new QWidget(this);
83 l=new QHBoxLayout(row);
84 vbox->addWidget(row);
85
86 for (int i=0; i<60; i+=5)
87 {
88 r=new OClickableLabel(row);
89 minuteLst.append(r);
90 s.sprintf("%.2d",i);
91 r->setText(s);
92 r->setToggleButton(true);
93 r->setAlignment(AlignHCenter | AlignVCenter);
94 l->addWidget(r);
95 connect(r, SIGNAL(toggled(bool)),
96 this, SLOT(slotMinute(bool)));
97 }
98}
99
100/**
101 * This method return the current time
102 * @return the time
103 */
104QTime OTimePicker::time()const
105{
106 return tm;
107}
108
109void OTimePicker::slotHour(bool b)
110{
111
112 OClickableLabel *r = (OClickableLabel *) sender();
113
114 if (b)
115 {
116 QValueListIterator<OClickableLabel *> it;
117 for (it=hourLst.begin(); it!=hourLst.end(); it++)
118 {
119 if (*it != r) (*it)->setOn(false);
120 else tm.setHMS((*it)->text().toInt(), tm.minute(), 0);
121 }
122 emit timeChanged(tm);
123 }
124 else
125 {
126 r->setOn(true);
127 }
128
129}
130
131void OTimePicker::slotMinute(bool b)
132{
133
134 OClickableLabel *r = (OClickableLabel *) sender();
135
136 if (b)
137 {
138 QValueListIterator<OClickableLabel *> it;
139 for (it=minuteLst.begin(); it!=minuteLst.end(); it++)
140 {
141 if (*it != r) (*it)->setOn(false);
142 else tm.setHMS(tm.hour(),(*it)->text().toInt(), 0);
143 }
144 emit timeChanged(tm);
145 }
146 else
147 {
148 r->setOn(true);
149 }
150
151}
152
153/**
154 * Method to set the time. No signal gets emitted during this method call
155 * Minutes must be within 5 minutes step starting at 0 ( 0,5,10,15,20... )
156 * @param t The time to be set
157 */
158void OTimePicker::setTime( const QTime& t)
159{
160 setTime( t.hour(), t.minute() );
161}
162
163/**
164 * Method to set the time. No signal gets emitted during this method call
165 * @param h The hour
166 * @param m The minute. Minutes need to set by 5 minute steps
167 */
168void OTimePicker::setTime( int h, int m )
169{
170 setHour(h);
171 setMinute(m);
172}
173
174/*
175 * FIXME round minutes to the 5 minute arrangement -zecke
176 */
177/**
178 * Method to set the minutes
179 * @param m minutes
180 */
181void OTimePicker::setMinute(int m)
182{
183
184 QString minute;
185 minute.sprintf("%.2d",m);
186
187 QValueListIterator<OClickableLabel *> it;
188 for (it=minuteLst.begin(); it!=minuteLst.end(); it++)
189 {
190 if ((*it)->text() == minute) (*it)->setOn(true);
191 else (*it)->setOn(false);
192 }
193
194 tm.setHMS(tm.hour(),m,0);
195}
196
197/**
198 * Method to set the hour
199 */
200void OTimePicker::setHour(int h)
201{
202
203 QString hour;
204 hour.sprintf("%.2d",h);
205
206 QValueListIterator<OClickableLabel *> it;
207 for (it=hourLst.begin(); it!=hourLst.end(); it++)
208 {
209 if ((*it)->text() == hour) (*it)->setOn(true);
210 else (*it)->setOn(false);
211 }
212 tm.setHMS(h,tm.minute(),0);
213}
214
215
216/**
217 * This is a modal Dialog.
218 *
219 * @param parent The parent widget
220 * @param name The name of the object
221 * @param fl Possible window flags
222 */
223OTimePickerDialog::OTimePickerDialog ( QWidget* parent, const char* name, WFlags fl )
224 : OTimePickerDialogBase (parent , name, true , fl)
225{
226
227 connect ( m_timePicker, SIGNAL( timeChanged( const QTime& ) ),
228 this, SLOT( setTime ( const QTime& ) ) );
229 connect ( minuteField, SIGNAL( textChanged ( const QString& ) ),
230 this, SLOT ( setMinute ( const QString& ) ) );
231 connect ( hourField, SIGNAL( textChanged ( const QString& ) ),
232 this, SLOT ( setHour ( const QString& ) ) );
233
234}
235
236/**
237 * @return the time
238 */
239QTime OTimePickerDialog::time()const
240{
241 return m_time;
242}
243
244/**
245 * Set the time to time
246 * @param time The time to be set
247 */
248void OTimePickerDialog::setTime( const QTime& time )
249{
250 m_time = time;
251
252 m_timePicker->setHour ( time.hour() );
253 m_timePicker->setMinute( time.minute() );
254
255 // Set Textfields
256 if ( time.hour() < 10 )
257 hourField->setText( "0" + QString::number( time.hour() ) );
258 else
259 hourField->setText( QString::number( time.hour() ) );
260
261 if ( time.minute() < 10 )
262 minuteField->setText( "0" + QString::number( time.minute() ) );
263 else
264 minuteField->setText( QString::number( time.minute() ) );
265
266}
267
268/**
269 * This method takes the current minute and tries to set hour
270 * to hour. This succeeds if the resulting date is valid
271 * @param hour The hour as a string
272 */
273void OTimePickerDialog::setHour ( const QString& hour )
274{
275 if ( QTime::isValid ( hour.toInt(), m_time.minute() , 00 ) )
276 {
277 m_time.setHMS ( hour.toInt(), m_time.minute() , 00 );
278 setTime ( m_time );
279 }
280
281}
282
283/**
284 * Method to set a new minute. It tries to convert the string to int and
285 * if the resulting date is valid a new date is set.
286 * @see setHour
287 */
288void OTimePickerDialog::setMinute ( const QString& minute )
289{
290 if ( QTime::isValid ( m_time.hour(), minute.toInt(), 00 ) )
291 {
292 m_time.setHMS ( m_time.hour(), minute.toInt(), 00 );
293 setTime ( m_time );
294 }
295}
diff --git a/libopie2/opieui/otimepicker.h b/libopie2/opieui/otimepicker.h
new file mode 100644
index 0000000..2da7773
--- a/dev/null
+++ b/libopie2/opieui/otimepicker.h
@@ -0,0 +1,125 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers <eilers.stefan@epost.de>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details.
21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29
30#ifndef OTIMEPICKER_H
31#define OTIMEPICKER_H
32
33/* OPIE */
34#include <opie2/oclickablelabel.h>
35#include "otimepickerbase.h"
36
37/* QT */
38#include <qwidget.h>
39#include <qvaluelist.h>
40#include <qdatetime.h>
41#include <qdialog.h>
42
43using namespace Opie;
44
45// namespace Opie
46// {
47
48/**
49 * A class to pick time. It uses clickable labels
50 * internally to allow a quick selection of a time.
51 * A time can be selected by two clicks of a user
52 *
53 * @short A widget to quickly pick a QTime
54 * @version 1.0
55 * @see QWidget
56 * @see QTime
57 * @author Hakan Ardo, Stefan Eilers
58 */
59class OTimePicker: public QWidget
60{
61 Q_OBJECT
62
63public:
64 OTimePicker(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
65
66public slots:
67 void setHour(int h);
68 void setMinute(int m);
69 void setTime( const QTime& );
70 void setTime( int h, int m );
71
72public:
73 QTime time()const;
74
75private:
76 QValueList<OClickableLabel *> hourLst;
77 QValueList<OClickableLabel *> minuteLst;
78 QTime tm;
79 struct Private;
80 Private *d;
81
82private slots:
83 void slotHour(bool b);
84 void slotMinute(bool b);
85
86signals:
87 /**
88 * gets emitted when the time got changed by the user
89 */
90 void timeChanged(const QTime &);
91};
92
93/**
94 *
95 * @short A small dialog to pick a time
96 * @version 1.0
97 * @author Stefan Eilers
98 *
99 **/
100
101class OTimePickerDialog: public OTimePickerDialogBase
102{
103 Q_OBJECT
104
105public:
106 OTimePickerDialog ( QWidget* parent = 0, const char* name = NULL, WFlags fl = 0 );
107 ~OTimePickerDialog() { };
108
109 QTime time()const;
110
111public slots:
112 void setTime( const QTime& time );
113 void setHour( const QString& hour );
114 void setMinute( const QString& minute );
115
116private:
117 QTime m_time;
118 class Private;
119 Private* d;
120};
121
122// };
123
124#endif
125
diff --git a/libopie2/opieui/otimepickerbase.ui b/libopie2/opieui/otimepickerbase.ui
new file mode 100644
index 0000000..3e7f2fb
--- a/dev/null
+++ b/libopie2/opieui/otimepickerbase.ui
@@ -0,0 +1,292 @@
1<!DOCTYPE UI><UI>
2<class>OTimePickerDialogBase</class>
3<widget>
4 <class>QDialog</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>OTimePickerDialogBase</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>210</width>
15 <height>137</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>sizePolicy</name>
20 <sizepolicy>
21 <hsizetype>3</hsizetype>
22 <vsizetype>1</vsizetype>
23 </sizepolicy>
24 </property>
25 <property stdset="1">
26 <name>caption</name>
27 <string>OTimePickerDialogBase</string>
28 </property>
29 <property>
30 <name>layoutMargin</name>
31 </property>
32 <property>
33 <name>layoutSpacing</name>
34 </property>
35 <vbox>
36 <property stdset="1">
37 <name>margin</name>
38 <number>5</number>
39 </property>
40 <property stdset="1">
41 <name>spacing</name>
42 <number>4</number>
43 </property>
44 <widget>
45 <class>QFrame</class>
46 <property stdset="1">
47 <name>name</name>
48 <cstring>Frame10</cstring>
49 </property>
50 <property stdset="1">
51 <name>sizePolicy</name>
52 <sizepolicy>
53 <hsizetype>1</hsizetype>
54 <vsizetype>7</vsizetype>
55 </sizepolicy>
56 </property>
57 <property stdset="1">
58 <name>frameShape</name>
59 <enum>NoFrame</enum>
60 </property>
61 <property stdset="1">
62 <name>frameShadow</name>
63 <enum>Raised</enum>
64 </property>
65 <property>
66 <name>layoutMargin</name>
67 </property>
68 <hbox>
69 <property stdset="1">
70 <name>margin</name>
71 <number>2</number>
72 </property>
73 <property stdset="1">
74 <name>spacing</name>
75 <number>6</number>
76 </property>
77 <spacer>
78 <property>
79 <name>name</name>
80 <cstring>Spacer4</cstring>
81 </property>
82 <property stdset="1">
83 <name>orientation</name>
84 <enum>Horizontal</enum>
85 </property>
86 <property stdset="1">
87 <name>sizeType</name>
88 <enum>MinimumExpanding</enum>
89 </property>
90 <property>
91 <name>sizeHint</name>
92 <size>
93 <width>20</width>
94 <height>20</height>
95 </size>
96 </property>
97 </spacer>
98 <widget>
99 <class>QFrame</class>
100 <property stdset="1">
101 <name>name</name>
102 <cstring>Frame4</cstring>
103 </property>
104 <property stdset="1">
105 <name>sizePolicy</name>
106 <sizepolicy>
107 <hsizetype>4</hsizetype>
108 <vsizetype>4</vsizetype>
109 </sizepolicy>
110 </property>
111 <property stdset="1">
112 <name>frameShape</name>
113 <enum>Box</enum>
114 </property>
115 <property stdset="1">
116 <name>frameShadow</name>
117 <enum>Sunken</enum>
118 </property>
119 <property>
120 <name>layoutMargin</name>
121 </property>
122 <property>
123 <name>layoutSpacing</name>
124 </property>
125 <hbox>
126 <property stdset="1">
127 <name>margin</name>
128 <number>4</number>
129 </property>
130 <property stdset="1">
131 <name>spacing</name>
132 <number>6</number>
133 </property>
134 <widget>
135 <class>QLabel</class>
136 <property stdset="1">
137 <name>name</name>
138 <cstring>TextLabel1</cstring>
139 </property>
140 <property stdset="1">
141 <name>text</name>
142 <string>Time:</string>
143 </property>
144 </widget>
145 <widget>
146 <class>QLineEdit</class>
147 <property stdset="1">
148 <name>name</name>
149 <cstring>hourField</cstring>
150 </property>
151 <property stdset="1">
152 <name>sizePolicy</name>
153 <sizepolicy>
154 <hsizetype>4</hsizetype>
155 <vsizetype>0</vsizetype>
156 </sizepolicy>
157 </property>
158 <property stdset="1">
159 <name>alignment</name>
160 <set>AlignHCenter</set>
161 </property>
162 <property>
163 <name>hAlign</name>
164 </property>
165 </widget>
166 <widget>
167 <class>QLabel</class>
168 <property stdset="1">
169 <name>name</name>
170 <cstring>TextLabel1_2</cstring>
171 </property>
172 <property stdset="1">
173 <name>font</name>
174 <font>
175 <bold>1</bold>
176 </font>
177 </property>
178 <property stdset="1">
179 <name>text</name>
180 <string>:</string>
181 </property>
182 </widget>
183 <widget>
184 <class>QLineEdit</class>
185 <property stdset="1">
186 <name>name</name>
187 <cstring>minuteField</cstring>
188 </property>
189 <property stdset="1">
190 <name>alignment</name>
191 <set>AlignHCenter</set>
192 </property>
193 <property>
194 <name>hAlign</name>
195 </property>
196 </widget>
197 </hbox>
198 </widget>
199 <spacer>
200 <property>
201 <name>name</name>
202 <cstring>Spacer5</cstring>
203 </property>
204 <property stdset="1">
205 <name>orientation</name>
206 <enum>Horizontal</enum>
207 </property>
208 <property stdset="1">
209 <name>sizeType</name>
210 <enum>MinimumExpanding</enum>
211 </property>
212 <property>
213 <name>sizeHint</name>
214 <size>
215 <width>20</width>
216 <height>20</height>
217 </size>
218 </property>
219 </spacer>
220 </hbox>
221 </widget>
222 <widget>
223 <class>QGroupBox</class>
224 <property stdset="1">
225 <name>name</name>
226 <cstring>GroupBox1</cstring>
227 </property>
228 <property stdset="1">
229 <name>sizePolicy</name>
230 <sizepolicy>
231 <hsizetype>3</hsizetype>
232 <vsizetype>3</vsizetype>
233 </sizepolicy>
234 </property>
235 <property stdset="1">
236 <name>margin</name>
237 <number>0</number>
238 </property>
239 <property stdset="1">
240 <name>title</name>
241 <string>Pick Time:</string>
242 </property>
243 <grid>
244 <property stdset="1">
245 <name>margin</name>
246 <number>11</number>
247 </property>
248 <property stdset="1">
249 <name>spacing</name>
250 <number>6</number>
251 </property>
252 <widget row="0" column="0" >
253 <class>OTimePicker</class>
254 <property stdset="1">
255 <name>name</name>
256 <cstring>m_timePicker</cstring>
257 </property>
258 <property stdset="1">
259 <name>sizePolicy</name>
260 <sizepolicy>
261 <hsizetype>3</hsizetype>
262 <vsizetype>3</vsizetype>
263 </sizepolicy>
264 </property>
265 </widget>
266 </grid>
267 </widget>
268 </vbox>
269</widget>
270<customwidgets>
271 <customwidget>
272 <class>OTimePicker</class>
273 <header location="local">otimepicker.h</header>
274 <sizehint>
275 <width>-1</width>
276 <height>-1</height>
277 </sizehint>
278 <container>0</container>
279 <sizepolicy>
280 <hordata>7</hordata>
281 <verdata>1</verdata>
282 </sizepolicy>
283 <pixmap>image0</pixmap>
284 </customwidget>
285</customwidgets>
286<images>
287 <image>
288 <name>image0</name>
289 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753</data>
290 </image>
291</images>
292</UI>