-rw-r--r-- | libopie/otabbar.cpp | 81 | ||||
-rw-r--r-- | libopie/otabbar.h | 75 | ||||
-rw-r--r-- | libopie/otimepickerbase.h | 47 |
3 files changed, 156 insertions, 47 deletions
diff --git a/libopie/otabbar.cpp b/libopie/otabbar.cpp new file mode 100644 index 0000000..b5b93ba --- a/dev/null +++ b/libopie/otabbar.cpp | |||
@@ -0,0 +1,81 @@ | |||
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 "otabbar.h" | ||
33 | |||
34 | OTabBar::OTabBar( QWidget *parent = 0, const char *name = 0 ) | ||
35 | : QTabBar( parent, name ) | ||
36 | { | ||
37 | } | ||
38 | |||
39 | void OTabBar::paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus ) const | ||
40 | { | ||
41 | |||
42 | QRect r = br; | ||
43 | if ( t->iconset) | ||
44 | { | ||
45 | QIconSet::Mode mode = (t->enabled && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled; | ||
46 | if ( mode == QIconSet::Normal && has_focus ) { | ||
47 | mode = QIconSet::Active; | ||
48 | } | ||
49 | QPixmap pixmap = t->iconset->pixmap( QIconSet::Small, mode ); | ||
50 | int pixw = pixmap.width(); | ||
51 | int pixh = pixmap.height(); | ||
52 | r.setLeft( r.left() + pixw + 2 ); | ||
53 | p->drawPixmap( br.left()+2, br.center().y()-pixh/2, pixmap ); | ||
54 | } | ||
55 | |||
56 | QRect tr = r; | ||
57 | if ( t->id == currentTab() ) | ||
58 | { | ||
59 | tr.setBottom( tr.bottom() - style().defaultFrameWidth() ); | ||
60 | } | ||
61 | |||
62 | if ( t->enabled && isEnabled() ) | ||
63 | { | ||
64 | p->setPen( colorGroup().foreground() ); | ||
65 | p->drawText( tr, AlignCenter | ShowPrefix, t->label ); | ||
66 | } | ||
67 | else if ( style() == MotifStyle ) | ||
68 | { | ||
69 | p->setPen( palette().disabled().foreground() ); | ||
70 | p->drawText( tr, AlignCenter | ShowPrefix, t->label ); | ||
71 | } | ||
72 | else | ||
73 | { | ||
74 | p->setPen( colorGroup().light() ); | ||
75 | QRect wr = tr; | ||
76 | wr.moveBy( 1, 1 ); | ||
77 | p->drawText( wr, AlignCenter | ShowPrefix, t->label ); | ||
78 | p->setPen( palette().disabled().foreground() ); | ||
79 | p->drawText( tr, AlignCenter | ShowPrefix, t->label ); | ||
80 | } | ||
81 | } | ||
diff --git a/libopie/otabbar.h b/libopie/otabbar.h new file mode 100644 index 0000000..16797a3 --- a/dev/null +++ b/libopie/otabbar.h | |||
@@ -0,0 +1,75 @@ | |||
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 | #include <qtabbar.h> | ||
36 | |||
37 | /** | ||
38 | * @class OTabBar | ||
39 | * @brief The OTabBar class is a derivative of QTabBar. | ||
40 | * | ||
41 | * OTabBar is a derivation of TrollTech's QTabBar which provides | ||
42 | * a row of tabs for selection. The only difference between this | ||
43 | * class and QTabBar is that there is no dotted line box around | ||
44 | * the label of the tab with the current focus. | ||
45 | */ | ||
46 | class OTabBar : public QTabBar | ||
47 | { | ||
48 | Q_OBJECT | ||
49 | |||
50 | public: | ||
51 | /** | ||
52 | * @fn OTabBar( QWidget *parent = 0, const char *name = 0 ) | ||
53 | * @brief Object constructor. | ||
54 | * | ||
55 | * @param parent Pointer to parent of this control. | ||
56 | * @param name Name of control. | ||
57 | * | ||
58 | * Constructs a new OTabBar control with parent and name. | ||
59 | */ | ||
60 | OTabBar( QWidget * = 0, const char * = 0 ); | ||
61 | |||
62 | protected: | ||
63 | /** | ||
64 | * @fn paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus ) | ||
65 | * @brief Internal function to draw a tab's label. | ||
66 | * | ||
67 | * @param p Pointer to QPainter used for drawing. | ||
68 | * @param br QRect providing region to draw label in. | ||
69 | * @param t Tab to draw label for. | ||
70 | * @param has_focus Boolean value not used, retained for compatibility reasons. | ||
71 | */ | ||
72 | void paintLabel( QPainter *, const QRect &, QTab *, bool ) const; | ||
73 | }; | ||
74 | |||
75 | #endif | ||
diff --git a/libopie/otimepickerbase.h b/libopie/otimepickerbase.h deleted file mode 100644 index 09598f9..0000000 --- a/libopie/otimepickerbase.h +++ b/dev/null | |||
@@ -1,47 +0,0 @@ | |||
1 | /**************************************************************************** | ||
2 | ** Form interface generated from reading ui file 'otimepickerbase.ui' | ||
3 | ** | ||
4 | ** Created: Tue Sep 3 13:12:19 2002 | ||
5 | ** by: The User Interface Compiler (uic) | ||
6 | ** | ||
7 | ** WARNING! All changes made in this file will be lost! | ||
8 | ****************************************************************************/ | ||
9 | #ifndef OTIMEPICKERDIALOGBASE_H | ||
10 | #define OTIMEPICKERDIALOGBASE_H | ||
11 | |||
12 | #include <qvariant.h> | ||
13 | #include <qdialog.h> | ||
14 | class QVBoxLayout; | ||
15 | class QHBoxLayout; | ||
16 | class QGridLayout; | ||
17 | class OTimePicker; | ||
18 | class QFrame; | ||
19 | class QGroupBox; | ||
20 | class QLabel; | ||
21 | class QLineEdit; | ||
22 | |||
23 | class OTimePickerDialogBase : public QDialog | ||
24 | { | ||
25 | Q_OBJECT | ||
26 | |||
27 | public: | ||
28 | OTimePickerDialogBase( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); | ||
29 | ~OTimePickerDialogBase(); | ||
30 | |||
31 | QFrame* Frame10; | ||
32 | QFrame* Frame4; | ||
33 | QLabel* TextLabel1; | ||
34 | QLineEdit* hourField; | ||
35 | QLabel* TextLabel1_2; | ||
36 | QLineEdit* minuteField; | ||
37 | QGroupBox* GroupBox1; | ||
38 | OTimePicker* m_timePicker; | ||
39 | |||
40 | protected: | ||
41 | QVBoxLayout* OTimePickerDialogBaseLayout; | ||
42 | QHBoxLayout* Frame10Layout; | ||
43 | QHBoxLayout* Frame4Layout; | ||
44 | bool event( QEvent* ); | ||
45 | }; | ||
46 | |||
47 | #endif // OTIMEPICKERDIALOGBASE_H | ||