author | harlekin <harlekin> | 2002-09-03 11:10:28 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-09-03 11:10:28 (UTC) |
commit | c52ae29638c92381e4c84aee4d798a1c11361b53 (patch) (unidiff) | |
tree | 606c5bcb6d5594454104f8083cdfca6845362745 /libopie | |
parent | 0eb35a5148ae1e513785de32842bce61037b9657 (diff) | |
download | opie-c52ae29638c92381e4c84aee4d798a1c11361b53.zip opie-c52ae29638c92381e4c84aee4d798a1c11361b53.tar.gz opie-c52ae29638c92381e4c84aee4d798a1c11361b53.tar.bz2 |
otabwidget changes by drw , like getting rid of the dotted line etc
-rw-r--r-- | libopie/libopie.pro | 6 | ||||
-rw-r--r-- | libopie/otabwidget.cpp | 4 | ||||
-rw-r--r-- | libopie/otabwidget.h | 3 | ||||
-rw-r--r-- | libopie/otimepickerbase.h | 2 |
4 files changed, 8 insertions, 7 deletions
diff --git a/libopie/libopie.pro b/libopie/libopie.pro index d5b4836..891c03e 100644 --- a/libopie/libopie.pro +++ b/libopie/libopie.pro | |||
@@ -1,25 +1,25 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qte warn_on release | 2 | CONFIG += qte warn_on release |
3 | HEADERS = ofontmenu.h ofileselector.h ofiledialog.h ofileview.h tododb.h todoevent.h todoresource.h todovcalresource.h xmltree.h colordialog.h colorpopupmenu.h oclickablelabel.h oprocctrl.h oprocess.h odevice.h otimepicker.h otabwidget.h otabinfo.h | 3 | HEADERS = ofontmenu.h ofileselector.h ofiledialog.h ofileview.h tododb.h todoevent.h todoresource.h todovcalresource.h xmltree.h colordialog.h colorpopupmenu.h oclickablelabel.h oprocctrl.h oprocess.h odevice.h otimepicker.h otabwidget.h otabbar.h otabinfo.h |
4 | SOURCES = ofontmenu.cc ofileselector.cc ofiledialog.cc xmltree.cc tododb.cpp todoevent.cpp todovcalresource.cpp colordialog.cpp colorpopupmenu.cpp oclickablelabel.cpp oprocctrl.cpp oprocess.cpp odevice.cpp otimepicker.cpp otabwidget.cpp | 4 | SOURCES = ofontmenu.cc ofileselector.cc ofiledialog.cc xmltree.cc tododb.cpp todoevent.cpp todovcalresource.cpp colordialog.cpp colorpopupmenu.cpp oclickablelabel.cpp oprocctrl.cpp oprocess.cpp odevice.cpp otimepicker.cpp otabwidget.cpp otabbar.cpp |
5 | TARGET = opie | 5 | TARGET = opie |
6 | INCLUDEPATH += $(OPIEDIR)/include | 6 | INCLUDEPATH += $(OPIEDIR)/include |
7 | DESTDIR = $(QTDIR)/lib$(PROJMAK) | 7 | DESTDIR = $(QTDIR)/lib$(PROJMAK) |
8 | #VERSION = 1.0.0 | 8 | #VERSION = 1.0.0 |
9 | 9 | ||
10 | INTERFACES = otimepickerbase.ui | 10 | INTERFACES = otimepickerbase.ui |
11 | 11 | ||
12 | TRANSLATIONS = ../i18n/de/libopie.ts \ | 12 | TRANSLATIONS = ../i18n/de/libopie.ts \ |
13 | ../i18n/en/libopie.ts \ | 13 | ../i18n/en/libopie.ts \ |
14 | ../i18n/es/libopie.ts \ | 14 | ../i18n/es/libopie.ts \ |
15 | ../i18n/fr/libopie.ts \ | 15 | ../i18n/fr/libopie.ts \ |
16 | ../i18n/hu/libopie.ts \ | 16 | ../i18n/hu/libopie.ts \ |
17 | ../i18n/ja/libopie.ts \ | 17 | ../i18n/ja/libopie.ts \ |
18 | ../i18n/ko/libopie.ts \ | 18 | ../i18n/ko/libopie.ts \ |
19 | ../i18n/no/libopie.ts \ | 19 | ../i18n/no/libopie.ts \ |
20 | ../i18n/pl/libopie.ts \ | 20 | ../i18n/pl/libopie.ts \ |
21 | ../i18n/pt/libopie.ts \ | 21 | ../i18n/pt/libopie.ts \ |
22 | ../i18n/pt_BR/libopie.ts \ | 22 | ../i18n/pt_BR/libopie.ts \ |
23 | ../i18n/sl/libopie.ts \ | 23 | ../i18n/sl/libopie.ts \ |
24 | ../i18n/zh_CN/libopie.ts \ | 24 | ../i18n/zh_CN/libopie.ts \ |
25 | ../i18n/zh_TW/libopie.ts | 25 | ../i18n/zh_TW/libopie.ts |
diff --git a/libopie/otabwidget.cpp b/libopie/otabwidget.cpp index b60d472..d5b963b 100644 --- a/libopie/otabwidget.cpp +++ b/libopie/otabwidget.cpp | |||
@@ -1,267 +1,267 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Dan Williams <williamsdr@acm.org> | 4 | Copyright (c) 2002 Dan Williams <williamsdr@acm.org> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include "otabwidget.h" | 32 | #include "otabwidget.h" |
33 | 33 | ||
34 | #include <qpe/config.h> | 34 | #include <qpe/config.h> |
35 | #include <qpe/resource.h> | 35 | #include <qpe/resource.h> |
36 | #include <opie/otabbar.h> | ||
36 | 37 | ||
37 | #include <qcombobox.h> | 38 | #include <qcombobox.h> |
38 | #include <qtabbar.h> | ||
39 | #include <qwidgetstack.h> | 39 | #include <qwidgetstack.h> |
40 | 40 | ||
41 | OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPosition p ) | 41 | OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPosition p ) |
42 | : QWidget( parent, name ) | 42 | : QWidget( parent, name ) |
43 | { | 43 | { |
44 | if ( s == Global ) | 44 | if ( s == Global ) |
45 | { | 45 | { |
46 | Config config( "qpe" ); | 46 | Config config( "qpe" ); |
47 | config.setGroup( "Appearance" ); | 47 | config.setGroup( "Appearance" ); |
48 | tabBarStyle = ( TabStyle ) config.readNumEntry( "TabStyle", (int) IconTab ); | 48 | tabBarStyle = ( TabStyle ) config.readNumEntry( "TabStyle", (int) IconTab ); |
49 | if ( tabBarStyle <= Global || tabBarStyle > IconList) | 49 | if ( tabBarStyle <= Global || tabBarStyle > IconList) |
50 | { | 50 | { |
51 | tabBarStyle = IconTab; | 51 | tabBarStyle = IconTab; |
52 | } | 52 | } |
53 | QString pos = config.readEntry( "TabPosition", "Top"); | 53 | QString pos = config.readEntry( "TabPosition", "Top"); |
54 | if ( pos == "Bottom" ) | 54 | if ( pos == "Bottom" ) |
55 | { | 55 | { |
56 | tabBarPosition = Bottom; | 56 | tabBarPosition = Bottom; |
57 | } | 57 | } |
58 | else | 58 | else |
59 | { | 59 | { |
60 | tabBarPosition = Top; | 60 | tabBarPosition = Top; |
61 | } | 61 | } |
62 | } | 62 | } |
63 | else | 63 | else |
64 | { | 64 | { |
65 | tabBarStyle = s; | 65 | tabBarStyle = s; |
66 | tabBarPosition = p; | 66 | tabBarPosition = p; |
67 | } | 67 | } |
68 | 68 | ||
69 | widgetStack = new QWidgetStack( this, "widgetstack" ); | 69 | widgetStack = new QWidgetStack( this, "widgetstack" ); |
70 | widgetStack->setFrameStyle( QFrame::StyledPanel | QFrame::Raised ); | 70 | widgetStack->setFrameStyle( QFrame::StyledPanel | QFrame::Raised ); |
71 | widgetStack->setLineWidth( style().defaultFrameWidth() ); | 71 | widgetStack->setLineWidth( style().defaultFrameWidth() ); |
72 | 72 | ||
73 | tabBarStack = new QWidgetStack( this, "tabbarstack" ); | 73 | tabBarStack = new QWidgetStack( this, "tabbarstack" ); |
74 | 74 | ||
75 | tabBar = new QTabBar( tabBarStack, "tabbar" ); | 75 | tabBar = new OTabBar( tabBarStack, "tabbar" ); |
76 | tabBarStack->addWidget( tabBar, 0 ); | 76 | tabBarStack->addWidget( tabBar, 0 ); |
77 | connect( tabBar, SIGNAL( selected( int ) ), this, SLOT( slotTabBarSelected( int ) ) ); | 77 | connect( tabBar, SIGNAL( selected( int ) ), this, SLOT( slotTabBarSelected( int ) ) ); |
78 | 78 | ||
79 | tabList = new QComboBox( false, tabBarStack, "tablist" ); | 79 | tabList = new QComboBox( false, tabBarStack, "tablist" ); |
80 | tabBarStack->addWidget( tabList, 1 ); | 80 | tabBarStack->addWidget( tabList, 1 ); |
81 | connect( tabList, SIGNAL( activated( int ) ), this, SLOT( slotTabListSelected( int ) ) ); | 81 | connect( tabList, SIGNAL( activated( int ) ), this, SLOT( slotTabListSelected( int ) ) ); |
82 | 82 | ||
83 | if ( tabBarStyle == TextTab || tabBarStyle == IconTab ) | 83 | if ( tabBarStyle == TextTab || tabBarStyle == IconTab ) |
84 | { | 84 | { |
85 | tabBarStack->raiseWidget( tabBar ); | 85 | tabBarStack->raiseWidget( tabBar ); |
86 | } | 86 | } |
87 | else if ( tabBarStyle == TextList || tabBarStyle == IconList ) | 87 | else if ( tabBarStyle == TextList || tabBarStyle == IconList ) |
88 | { | 88 | { |
89 | tabBarStack->raiseWidget( tabList ); | 89 | tabBarStack->raiseWidget( tabList ); |
90 | } | 90 | } |
91 | 91 | ||
92 | if ( tabBarPosition == Bottom ) | 92 | if ( tabBarPosition == Bottom ) |
93 | { | 93 | { |
94 | tabBar->setShape( QTabBar::RoundedBelow ); | 94 | tabBar->setShape( QTabBar::RoundedBelow ); |
95 | } | 95 | } |
96 | 96 | ||
97 | currentTab= 0x0; | 97 | currentTab= 0x0; |
98 | } | 98 | } |
99 | 99 | ||
100 | OTabWidget::~OTabWidget() | 100 | OTabWidget::~OTabWidget() |
101 | { | 101 | { |
102 | } | 102 | } |
103 | 103 | ||
104 | void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &label ) | 104 | void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &label ) |
105 | { | 105 | { |
106 | QPixmap iconset = loadSmooth( icon ); | 106 | QPixmap iconset = loadSmooth( icon ); |
107 | 107 | ||
108 | QTab * tab = new QTab(); | 108 | QTab * tab = new QTab(); |
109 | if ( tabBarStyle == IconTab ) | 109 | if ( tabBarStyle == IconTab ) |
110 | { | 110 | { |
111 | tab->label = QString::null; | 111 | tab->label = QString::null; |
112 | } | 112 | } |
113 | else | 113 | else |
114 | { | 114 | { |
115 | tab->label = label; | 115 | tab->label = label; |
116 | } | 116 | } |
117 | if ( tabBarStyle == IconTab || tabBarStyle == IconList) | 117 | if ( tabBarStyle == IconTab || tabBarStyle == IconList) |
118 | { | 118 | { |
119 | tab->iconset = new QIconSet( iconset ); | 119 | tab->iconset = new QIconSet( iconset ); |
120 | } | 120 | } |
121 | int tabid = tabBar->addTab( tab ); | 121 | int tabid = tabBar->addTab( tab ); |
122 | 122 | ||
123 | if ( tabBarStyle == IconTab || tabBarStyle == IconList ) | 123 | if ( tabBarStyle == IconTab || tabBarStyle == IconList ) |
124 | { | 124 | { |
125 | tabList->insertItem( iconset, label, -1 ); | 125 | tabList->insertItem( iconset, label, -1 ); |
126 | } | 126 | } |
127 | else | 127 | else |
128 | { | 128 | { |
129 | tabList->insertItem( label ); | 129 | tabList->insertItem( label ); |
130 | } | 130 | } |
131 | 131 | ||
132 | widgetStack->addWidget( child, tabid ); | 132 | widgetStack->addWidget( child, tabid ); |
133 | widgetStack->raiseWidget( child ); | 133 | widgetStack->raiseWidget( child ); |
134 | 134 | ||
135 | OTabInfo *tabinfo = new OTabInfo( tabid, child, icon, label ); | 135 | OTabInfo *tabinfo = new OTabInfo( tabid, child, icon, label ); |
136 | tabs.append( tabinfo ); | 136 | tabs.append( tabinfo ); |
137 | selectTab( tabinfo ); | 137 | selectTab( tabinfo ); |
138 | } | 138 | } |
139 | 139 | ||
140 | void OTabWidget::setCurrentTab( QWidget *childwidget ) | 140 | void OTabWidget::setCurrentTab( QWidget *childwidget ) |
141 | { | 141 | { |
142 | OTabInfo *newtab = tabs.first(); | 142 | OTabInfo *newtab = tabs.first(); |
143 | while ( newtab && newtab->control() != childwidget ) | 143 | while ( newtab && newtab->control() != childwidget ) |
144 | { | 144 | { |
145 | newtab = tabs.next(); | 145 | newtab = tabs.next(); |
146 | } | 146 | } |
147 | if ( newtab && newtab->control() == childwidget ) | 147 | if ( newtab && newtab->control() == childwidget ) |
148 | { | 148 | { |
149 | selectTab( newtab ); | 149 | selectTab( newtab ); |
150 | } | 150 | } |
151 | } | 151 | } |
152 | 152 | ||
153 | void OTabWidget::setCurrentTab( const QString &tabname ) | 153 | void OTabWidget::setCurrentTab( const QString &tabname ) |
154 | { | 154 | { |
155 | OTabInfo *newtab = tabs.first(); | 155 | OTabInfo *newtab = tabs.first(); |
156 | while ( newtab && newtab->label() != tabname ) | 156 | while ( newtab && newtab->label() != tabname ) |
157 | { | 157 | { |
158 | newtab = tabs.next(); | 158 | newtab = tabs.next(); |
159 | } | 159 | } |
160 | if ( newtab && newtab->label() == tabname ) | 160 | if ( newtab && newtab->label() == tabname ) |
161 | { | 161 | { |
162 | selectTab( newtab ); | 162 | selectTab( newtab ); |
163 | } | 163 | } |
164 | } | 164 | } |
165 | 165 | ||
166 | OTabWidget::TabStyle OTabWidget::tabStyle() const | 166 | OTabWidget::TabStyle OTabWidget::tabStyle() const |
167 | { | 167 | { |
168 | return tabBarStyle; | 168 | return tabBarStyle; |
169 | } | 169 | } |
170 | 170 | ||
171 | void OTabWidget::setTabStyle( TabStyle s ) | 171 | void OTabWidget::setTabStyle( TabStyle s ) |
172 | { | 172 | { |
173 | tabBarStyle = s; | 173 | tabBarStyle = s; |
174 | } | 174 | } |
175 | 175 | ||
176 | OTabWidget::TabPosition OTabWidget::tabPosition() const | 176 | OTabWidget::TabPosition OTabWidget::tabPosition() const |
177 | { | 177 | { |
178 | return tabBarPosition; | 178 | return tabBarPosition; |
179 | } | 179 | } |
180 | 180 | ||
181 | void OTabWidget::setTabPosition( TabPosition p ) | 181 | void OTabWidget::setTabPosition( TabPosition p ) |
182 | { | 182 | { |
183 | tabBarPosition = p; | 183 | tabBarPosition = p; |
184 | } | 184 | } |
185 | 185 | ||
186 | void OTabWidget::slotTabBarSelected( int id ) | 186 | void OTabWidget::slotTabBarSelected( int id ) |
187 | { | 187 | { |
188 | OTabInfo *newtab = tabs.first(); | 188 | OTabInfo *newtab = tabs.first(); |
189 | while ( newtab && newtab->id() != id ) | 189 | while ( newtab && newtab->id() != id ) |
190 | { | 190 | { |
191 | newtab = tabs.next(); | 191 | newtab = tabs.next(); |
192 | } | 192 | } |
193 | if ( newtab && newtab->id() == id ) | 193 | if ( newtab && newtab->id() == id ) |
194 | { | 194 | { |
195 | selectTab( newtab ); | 195 | selectTab( newtab ); |
196 | } | 196 | } |
197 | } | 197 | } |
198 | 198 | ||
199 | void OTabWidget::slotTabListSelected( int index ) | 199 | void OTabWidget::slotTabListSelected( int index ) |
200 | { | 200 | { |
201 | OTabInfo *newtab = tabs.at( index ); | 201 | OTabInfo *newtab = tabs.at( index ); |
202 | if ( newtab ) | 202 | if ( newtab ) |
203 | { | 203 | { |
204 | selectTab( newtab ); | 204 | selectTab( newtab ); |
205 | } | 205 | } |
206 | } | 206 | } |
207 | 207 | ||
208 | QPixmap OTabWidget::loadSmooth( const QString &name ) | 208 | QPixmap OTabWidget::loadSmooth( const QString &name ) |
209 | { | 209 | { |
210 | QImage image = Resource::loadImage( name ); | 210 | QImage image = Resource::loadImage( name ); |
211 | QPixmap pixmap; | 211 | QPixmap pixmap; |
212 | pixmap.convertFromImage( image.smoothScale( 16, 16 ) ); | 212 | pixmap.convertFromImage( image.smoothScale( 16, 16 ) ); |
213 | return pixmap; | 213 | return pixmap; |
214 | } | 214 | } |
215 | 215 | ||
216 | void OTabWidget::selectTab( OTabInfo *tab ) | 216 | void OTabWidget::selectTab( OTabInfo *tab ) |
217 | { | 217 | { |
218 | if ( tabBarStyle == IconTab ) | 218 | if ( tabBarStyle == IconTab ) |
219 | { | 219 | { |
220 | if ( currentTab ) | 220 | if ( currentTab ) |
221 | { | 221 | { |
222 | tabBar->tab( currentTab->id() )->setText( QString::null ); | 222 | tabBar->tab( currentTab->id() )->setText( QString::null ); |
223 | setUpLayout(); | 223 | setUpLayout(); |
224 | } | 224 | } |
225 | tabBar->tab( tab->id() )->setText( tab->label() ); | 225 | tabBar->tab( tab->id() )->setText( tab->label() ); |
226 | currentTab = tab; | 226 | currentTab = tab; |
227 | } | 227 | } |
228 | tabBar->setCurrentTab( tab->id() ); | 228 | tabBar->setCurrentTab( tab->id() ); |
229 | setUpLayout(); | 229 | setUpLayout(); |
230 | tabBar->update(); | 230 | tabBar->update(); |
231 | 231 | ||
232 | widgetStack->raiseWidget( tab->control() ); | 232 | widgetStack->raiseWidget( tab->control() ); |
233 | } | 233 | } |
234 | 234 | ||
235 | void OTabWidget::setUpLayout() | 235 | void OTabWidget::setUpLayout() |
236 | { | 236 | { |
237 | tabBar->layoutTabs(); | 237 | tabBar->layoutTabs(); |
238 | QSize t( tabBarStack->sizeHint() ); | 238 | QSize t( tabBarStack->sizeHint() ); |
239 | if ( t.width() > width() ) | 239 | if ( t.width() > width() ) |
240 | t.setWidth( width() ); | 240 | t.setWidth( width() ); |
241 | int lw = widgetStack->lineWidth(); | 241 | int lw = widgetStack->lineWidth(); |
242 | if ( tabBarPosition == Bottom ) | 242 | if ( tabBarPosition == Bottom ) |
243 | { | 243 | { |
244 | tabBarStack->setGeometry( QMAX(0, lw-2), height() - t.height() - lw, t.width(), t.height() ); | 244 | tabBarStack->setGeometry( QMAX(0, lw-2), height() - t.height() - lw, t.width(), t.height() ); |
245 | widgetStack->setGeometry( 0, 0, width(), height()-t.height()+QMAX(0, lw-2) ); | 245 | widgetStack->setGeometry( 0, 0, width(), height()-t.height()+QMAX(0, lw-2) ); |
246 | } | 246 | } |
247 | else | 247 | else |
248 | { | 248 | { |
249 | tabBarStack->setGeometry( QMAX(0, lw-2), 0, t.width(), t.height() ); | 249 | tabBarStack->setGeometry( QMAX(0, lw-2), 0, t.width(), t.height() ); |
250 | widgetStack->setGeometry( 0, t.height()-lw, width(), height()-t.height()+QMAX(0, lw-2)); | 250 | widgetStack->setGeometry( 0, t.height()-lw, width(), height()-t.height()+QMAX(0, lw-2)); |
251 | } | 251 | } |
252 | 252 | ||
253 | if ( autoMask() ) | 253 | if ( autoMask() ) |
254 | updateMask(); | 254 | updateMask(); |
255 | } | 255 | } |
256 | 256 | ||
257 | QSize OTabWidget::sizeHint() const | 257 | QSize OTabWidget::sizeHint() const |
258 | { | 258 | { |
259 | QSize s( widgetStack->sizeHint() ); | 259 | QSize s( widgetStack->sizeHint() ); |
260 | QSize t( tabBarStack->sizeHint() ); | 260 | QSize t( tabBarStack->sizeHint() ); |
261 | return QSize( QMAX( s.width(), t.width()), s.height() + t.height() ); | 261 | return QSize( QMAX( s.width(), t.width()), s.height() + t.height() ); |
262 | } | 262 | } |
263 | 263 | ||
264 | void OTabWidget::resizeEvent( QResizeEvent * ) | 264 | void OTabWidget::resizeEvent( QResizeEvent * ) |
265 | { | 265 | { |
266 | setUpLayout(); | 266 | setUpLayout(); |
267 | } | 267 | } |
diff --git a/libopie/otabwidget.h b/libopie/otabwidget.h index 6a0fbe8..bacda07 100644 --- a/libopie/otabwidget.h +++ b/libopie/otabwidget.h | |||
@@ -1,232 +1,233 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Dan Williams <williamsdr@acm.org> | 4 | Copyright (c) 2002 Dan Williams <williamsdr@acm.org> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #ifndef OTABWIDGET_H | 32 | #ifndef OTABWIDGET_H |
33 | #define OTABWIDGET_H | 33 | #define OTABWIDGET_H |
34 | 34 | ||
35 | #include "otabinfo.h" | 35 | #include "otabinfo.h" |
36 | 36 | ||
37 | #include <qwidget.h> | 37 | #include <qwidget.h> |
38 | #include <qlist.h> | 38 | #include <qlist.h> |
39 | 39 | ||
40 | class OTabBar; | ||
40 | class QComboBox; | 41 | class QComboBox; |
41 | class QPixmap; | 42 | class QPixmap; |
42 | class QTabBar; | 43 | class QTabBar; |
43 | class QWidgetStack; | 44 | class QWidgetStack; |
44 | 45 | ||
45 | /** | 46 | /** |
46 | * @class OTabWidget | 47 | * @class OTabWidget |
47 | * @brief The OTabWidget class provides a stack of widgets. | 48 | * @brief The OTabWidget class provides a stack of widgets. |
48 | * | 49 | * |
49 | * OTabWidget is a derivation of TrollTech's QTabWidget which provides | 50 | * OTabWidget is a derivation of TrollTech's QTabWidget which provides |
50 | * a stack of widgets. Widgets can be selected using either a tab bar or | 51 | * a stack of widgets. Widgets can be selected using either a tab bar or |
51 | * drop down list box. | 52 | * drop down list box. |
52 | * | 53 | * |
53 | * 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 |
54 | * constructor: | 55 | * constructor: |
55 | * - Create a OTabWidget. | 56 | * - Create a OTabWidget. |
56 | * - 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 |
57 | * 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() |
58 | * to add the widget. | 59 | * to add the widget. |
59 | */ | 60 | */ |
60 | class OTabWidget : public QWidget | 61 | class OTabWidget : public QWidget |
61 | { | 62 | { |
62 | Q_OBJECT | 63 | Q_OBJECT |
63 | public: | 64 | public: |
64 | 65 | ||
65 | /** | 66 | /** |
66 | * @enum TabStyle | 67 | * @enum TabStyle |
67 | * @brief Defines how the widget selection control is displayed. | 68 | * @brief Defines how the widget selection control is displayed. |
68 | * | 69 | * |
69 | * Valid values: | 70 | * Valid values: |
70 | * - Global: use globally selected options (qpe.conf - TabStyle & TabPosition) | 71 | * - Global: use globally selected options (qpe.conf - TabStyle & TabPosition) |
71 | * - TextTab: Tabbed widget selection with text labels | 72 | * - TextTab: Tabbed widget selection with text labels |
72 | * - 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 |
73 | * (similar to Opie launcher) | 74 | * (similar to Opie launcher) |
74 | * - TextList: Drop down list widget selection with text labels | 75 | * - TextList: Drop down list widget selection with text labels |
75 | * - IconList: Drop down list widget selection with icon & text labels | 76 | * - IconList: Drop down list widget selection with icon & text labels |
76 | */ | 77 | */ |
77 | enum TabStyle { Global, TextTab, IconTab, TextList, IconList }; | 78 | enum TabStyle { Global, TextTab, IconTab, TextList, IconList }; |
78 | 79 | ||
79 | /** | 80 | /** |
80 | * @enum TabPosition | 81 | * @enum TabPosition |
81 | * @brief Defines where the widget selection control is drawn. | 82 | * @brief Defines where the widget selection control is drawn. |
82 | * | 83 | * |
83 | * Valid values: | 84 | * Valid values: |
84 | * - Top: Widget selection control is drawn above widgets | 85 | * - Top: Widget selection control is drawn above widgets |
85 | * - Bottom: Widget selection control is drawn below widgets | 86 | * - Bottom: Widget selection control is drawn below widgets |
86 | */ | 87 | */ |
87 | enum TabPosition { Top, Bottom }; | 88 | enum TabPosition { Top, Bottom }; |
88 | 89 | ||
89 | /** | 90 | /** |
90 | * @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 ) |
91 | * @brief Object constructor. | 92 | * @brief Object constructor. |
92 | * | 93 | * |
93 | * @param parent Pointer to parent of this control. | 94 | * @param parent Pointer to parent of this control. |
94 | * @param name Name of control. | 95 | * @param name Name of control. |
95 | * @param s Style of widget selection control. | 96 | * @param s Style of widget selection control. |
96 | * @param p Position of the widget selection control. | 97 | * @param p Position of the widget selection control. |
97 | * | 98 | * |
98 | * 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 |
99 | * determine how the widget selection control will be displayed. | 100 | * determine how the widget selection control will be displayed. |
100 | */ | 101 | */ |
101 | OTabWidget( QWidget * = 0, const char * = 0, TabStyle = Global, TabPosition = Top ); | 102 | OTabWidget( QWidget * = 0, const char * = 0, TabStyle = Global, TabPosition = Top ); |
102 | 103 | ||
103 | /** | 104 | /** |
104 | * @fn ~OTabWidget() | 105 | * @fn ~OTabWidget() |
105 | * @brief Object destructor. | 106 | * @brief Object destructor. |
106 | */ | 107 | */ |
107 | ~OTabWidget(); | 108 | ~OTabWidget(); |
108 | 109 | ||
109 | /** | 110 | /** |
110 | * @fn addTab( QWidget *child, const QString &icon, const QString &label ) | 111 | * @fn addTab( QWidget *child, const QString &icon, const QString &label ) |
111 | * @brief Add new widget to control. | 112 | * @brief Add new widget to control. |
112 | * | 113 | * |
113 | * @param child Widget control. | 114 | * @param child Widget control. |
114 | * @param icon Path to icon. | 115 | * @param icon Path to icon. |
115 | * @param label Text label. | 116 | * @param label Text label. |
116 | */ | 117 | */ |
117 | void addTab( QWidget *, const QString &, const QString & ); | 118 | void addTab( QWidget *, const QString &, const QString & ); |
118 | 119 | ||
119 | /** | 120 | /** |
120 | * @fn tabStyle() | 121 | * @fn tabStyle() |
121 | * @brief Returns current widget selection control style. | 122 | * @brief Returns current widget selection control style. |
122 | */ | 123 | */ |
123 | TabStyle tabStyle() const; | 124 | TabStyle tabStyle() const; |
124 | 125 | ||
125 | /** | 126 | /** |
126 | * @fn setTabStyle( TabStyle s ) | 127 | * @fn setTabStyle( TabStyle s ) |
127 | * @brief Set the current widget selection control style. | 128 | * @brief Set the current widget selection control style. |
128 | * | 129 | * |
129 | * @param s New style to be used. | 130 | * @param s New style to be used. |
130 | */ | 131 | */ |
131 | void setTabStyle( TabStyle ); | 132 | void setTabStyle( TabStyle ); |
132 | 133 | ||
133 | /** | 134 | /** |
134 | * @fn tabPosition() | 135 | * @fn tabPosition() |
135 | * @brief Returns current widget selection control position. | 136 | * @brief Returns current widget selection control position. |
136 | */ | 137 | */ |
137 | TabPosition tabPosition() const; | 138 | TabPosition tabPosition() const; |
138 | 139 | ||
139 | /** | 140 | /** |
140 | * @fn setTabPosition( TabPosition p ) | 141 | * @fn setTabPosition( TabPosition p ) |
141 | * @brief Set the current widget selection control position. | 142 | * @brief Set the current widget selection control position. |
142 | * | 143 | * |
143 | * @param p New position of widget selection control. | 144 | * @param p New position of widget selection control. |
144 | */ | 145 | */ |
145 | void setTabPosition( TabPosition ); | 146 | void setTabPosition( TabPosition ); |
146 | 147 | ||
147 | /** | 148 | /** |
148 | * @fn setCurrentTab( QWidget *childwidget ) | 149 | * @fn setCurrentTab( QWidget *childwidget ) |
149 | * @brief Selects and brings to top the desired widget by using widget pointer. | 150 | * @brief Selects and brings to top the desired widget by using widget pointer. |
150 | * | 151 | * |
151 | * @param childwidget Widget to select. | 152 | * @param childwidget Widget to select. |
152 | */ | 153 | */ |
153 | void setCurrentTab( QWidget * ); | 154 | void setCurrentTab( QWidget * ); |
154 | 155 | ||
155 | /** | 156 | /** |
156 | * @fn setCurrentTab( const QString &tabname ) | 157 | * @fn setCurrentTab( const QString &tabname ) |
157 | * @brief Selects and brings to top the desired widget, by using label. | 158 | * @brief Selects and brings to top the desired widget, by using label. |
158 | * | 159 | * |
159 | * @param tabname Text label for widget to select. | 160 | * @param tabname Text label for widget to select. |
160 | */ | 161 | */ |
161 | void setCurrentTab( const QString & ); | 162 | void setCurrentTab( const QString & ); |
162 | 163 | ||
163 | /** | 164 | /** |
164 | * @fn sizeHint() | 165 | * @fn sizeHint() |
165 | * @brief Reimplemented for internal purposes. | 166 | * @brief Reimplemented for internal purposes. |
166 | */ | 167 | */ |
167 | QSize sizeHint() const; | 168 | QSize sizeHint() const; |
168 | 169 | ||
169 | 170 | ||
170 | protected: | 171 | protected: |
171 | 172 | ||
172 | /** | 173 | /** |
173 | * @fn resizeEvent( QResizeEvent * ) | 174 | * @fn resizeEvent( QResizeEvent * ) |
174 | * @brief Reimplemented for internal purposes. | 175 | * @brief Reimplemented for internal purposes. |
175 | */ | 176 | */ |
176 | void resizeEvent( QResizeEvent * ); | 177 | void resizeEvent( QResizeEvent * ); |
177 | 178 | ||
178 | private: | 179 | private: |
179 | OTabInfoList tabs; | 180 | OTabInfoList tabs; |
180 | OTabInfo *currentTab; | 181 | OTabInfo *currentTab; |
181 | 182 | ||
182 | TabStyle tabBarStyle; | 183 | TabStyle tabBarStyle; |
183 | TabPosition tabBarPosition; | 184 | TabPosition tabBarPosition; |
184 | 185 | ||
185 | QWidgetStack *tabBarStack; | 186 | QWidgetStack *tabBarStack; |
186 | QTabBar *tabBar; | 187 | OTabBar *tabBar; |
187 | QComboBox *tabList; | 188 | QComboBox *tabList; |
188 | 189 | ||
189 | QWidgetStack *widgetStack; | 190 | QWidgetStack *widgetStack; |
190 | 191 | ||
191 | /** | 192 | /** |
192 | * @fn loadSmooth( const QString &name ) | 193 | * @fn loadSmooth( const QString &name ) |
193 | * @brief Loads icon for widget. | 194 | * @brief Loads icon for widget. |
194 | * | 195 | * |
195 | * @param name Name of icon image file. | 196 | * @param name Name of icon image file. |
196 | */ | 197 | */ |
197 | QPixmap loadSmooth( const QString & ); | 198 | QPixmap loadSmooth( const QString & ); |
198 | 199 | ||
199 | /** | 200 | /** |
200 | * @fn selectTab( OTabInfo *tab ) | 201 | * @fn selectTab( OTabInfo *tab ) |
201 | * @brief Internal function to select desired widget. | 202 | * @brief Internal function to select desired widget. |
202 | * | 203 | * |
203 | * @param tab Pointer to data for widget. | 204 | * @param tab Pointer to data for widget. |
204 | */ | 205 | */ |
205 | void selectTab( OTabInfo * ); | 206 | void selectTab( OTabInfo * ); |
206 | 207 | ||
207 | /** | 208 | /** |
208 | * @fn setUpLayout() | 209 | * @fn setUpLayout() |
209 | * @brief Internal function to adjust layout. | 210 | * @brief Internal function to adjust layout. |
210 | */ | 211 | */ |
211 | void setUpLayout(); | 212 | void setUpLayout(); |
212 | 213 | ||
213 | private slots: | 214 | private slots: |
214 | 215 | ||
215 | /** | 216 | /** |
216 | * @fn slotTabBarSelected( int id ) | 217 | * @fn slotTabBarSelected( int id ) |
217 | * @brief Slot which is called when a tab is selected. | 218 | * @brief Slot which is called when a tab is selected. |
218 | * | 219 | * |
219 | * @param id ID of widget selected. | 220 | * @param id ID of widget selected. |
220 | */ | 221 | */ |
221 | void slotTabBarSelected( int ); | 222 | void slotTabBarSelected( int ); |
222 | 223 | ||
223 | /** | 224 | /** |
224 | * @fn slotTabListSelected( int index ) | 225 | * @fn slotTabListSelected( int index ) |
225 | * @brief Slot which is called when a drop down selection is made. | 226 | * @brief Slot which is called when a drop down selection is made. |
226 | * | 227 | * |
227 | * @param id Index of widget selected. | 228 | * @param id Index of widget selected. |
228 | */ | 229 | */ |
229 | void slotTabListSelected( int ); | 230 | void slotTabListSelected( int ); |
230 | }; | 231 | }; |
231 | 232 | ||
232 | #endif | 233 | #endif |
diff --git a/libopie/otimepickerbase.h b/libopie/otimepickerbase.h index bac2b06..09598f9 100644 --- a/libopie/otimepickerbase.h +++ b/libopie/otimepickerbase.h | |||
@@ -1,47 +1,47 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** Form interface generated from reading ui file 'otimepickerbase.ui' | 2 | ** Form interface generated from reading ui file 'otimepickerbase.ui' |
3 | ** | 3 | ** |
4 | ** Created: Tue Aug 20 10:04:21 2002 | 4 | ** Created: Tue Sep 3 13:12:19 2002 |
5 | ** by: The User Interface Compiler (uic) | 5 | ** by: The User Interface Compiler (uic) |
6 | ** | 6 | ** |
7 | ** WARNING! All changes made in this file will be lost! | 7 | ** WARNING! All changes made in this file will be lost! |
8 | ****************************************************************************/ | 8 | ****************************************************************************/ |
9 | #ifndef OTIMEPICKERDIALOGBASE_H | 9 | #ifndef OTIMEPICKERDIALOGBASE_H |
10 | #define OTIMEPICKERDIALOGBASE_H | 10 | #define OTIMEPICKERDIALOGBASE_H |
11 | 11 | ||
12 | #include <qvariant.h> | 12 | #include <qvariant.h> |
13 | #include <qdialog.h> | 13 | #include <qdialog.h> |
14 | class QVBoxLayout; | 14 | class QVBoxLayout; |
15 | class QHBoxLayout; | 15 | class QHBoxLayout; |
16 | class QGridLayout; | 16 | class QGridLayout; |
17 | class OTimePicker; | 17 | class OTimePicker; |
18 | class QFrame; | 18 | class QFrame; |
19 | class QGroupBox; | 19 | class QGroupBox; |
20 | class QLabel; | 20 | class QLabel; |
21 | class QLineEdit; | 21 | class QLineEdit; |
22 | 22 | ||
23 | class OTimePickerDialogBase : public QDialog | 23 | class OTimePickerDialogBase : public QDialog |
24 | { | 24 | { |
25 | Q_OBJECT | 25 | Q_OBJECT |
26 | 26 | ||
27 | public: | 27 | public: |
28 | OTimePickerDialogBase( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); | 28 | OTimePickerDialogBase( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); |
29 | ~OTimePickerDialogBase(); | 29 | ~OTimePickerDialogBase(); |
30 | 30 | ||
31 | QFrame* Frame10; | 31 | QFrame* Frame10; |
32 | QFrame* Frame4; | 32 | QFrame* Frame4; |
33 | QLabel* TextLabel1; | 33 | QLabel* TextLabel1; |
34 | QLineEdit* hourField; | 34 | QLineEdit* hourField; |
35 | QLabel* TextLabel1_2; | 35 | QLabel* TextLabel1_2; |
36 | QLineEdit* minuteField; | 36 | QLineEdit* minuteField; |
37 | QGroupBox* GroupBox1; | 37 | QGroupBox* GroupBox1; |
38 | OTimePicker* m_timePicker; | 38 | OTimePicker* m_timePicker; |
39 | 39 | ||
40 | protected: | 40 | protected: |
41 | QVBoxLayout* OTimePickerDialogBaseLayout; | 41 | QVBoxLayout* OTimePickerDialogBaseLayout; |
42 | QHBoxLayout* Frame10Layout; | 42 | QHBoxLayout* Frame10Layout; |
43 | QHBoxLayout* Frame4Layout; | 43 | QHBoxLayout* Frame4Layout; |
44 | bool event( QEvent* ); | 44 | bool event( QEvent* ); |
45 | }; | 45 | }; |
46 | 46 | ||
47 | #endif // OTIMEPICKERDIALOGBASE_H | 47 | #endif // OTIMEPICKERDIALOGBASE_H |