author | zecke <zecke> | 2003-09-04 17:04:06 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-09-04 17:04:06 (UTC) |
commit | 302e9b70ecb247977decf97269807abe5eccbdd7 (patch) (unidiff) | |
tree | 59bb2fe59f0ced82acd0d3529af16c0e0d516772 | |
parent | d11827ca5879b21488c189fb09f32ecf635644ae (diff) | |
download | opie-302e9b70ecb247977decf97269807abe5eccbdd7.zip opie-302e9b70ecb247977decf97269807abe5eccbdd7.tar.gz opie-302e9b70ecb247977decf97269807abe5eccbdd7.tar.bz2 |
Rely on QFRame for the sizeHint
-rw-r--r-- | libopie/big-screen/osplitter.cpp | 7 | ||||
-rw-r--r-- | libopie/big-screen/osplitter.h | 5 |
2 files changed, 7 insertions, 5 deletions
diff --git a/libopie/big-screen/osplitter.cpp b/libopie/big-screen/osplitter.cpp index b09bc94..0c9ed6c 100644 --- a/libopie/big-screen/osplitter.cpp +++ b/libopie/big-screen/osplitter.cpp | |||
@@ -1,582 +1,583 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2003 hOlgAr <zecke@handhelds.org> | 3 | .=l. Copyright (c) 2003 hOlgAr <zecke@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This library is free software; you can | 5 | _;:, .> :=|. This library is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This library is distributed in the hope that | 12 | .i_,=:_. -<s. This library is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <qvaluelist.h> | 29 | #include <qvaluelist.h> |
30 | #include <qvbox.h> | 30 | #include <qvbox.h> |
31 | 31 | ||
32 | #include <opie/otabwidget.h> | 32 | #include <opie/otabwidget.h> |
33 | 33 | ||
34 | #include "osplitter.h" | 34 | #include "osplitter.h" |
35 | 35 | ||
36 | 36 | ||
37 | /** | 37 | /** |
38 | * | 38 | * |
39 | * This is the constructor of OSplitter | 39 | * This is the constructor of OSplitter |
40 | * You might want to call setSizeChange to tell | 40 | * You might want to call setSizeChange to tell |
41 | * OSplitter to change its layout when a specefic | 41 | * OSplitter to change its layout when a specefic |
42 | * mark was crossed. OSplitter sets a default value. | 42 | * mark was crossed. OSplitter sets a default value. |
43 | * | 43 | * |
44 | * You cann add widget with addWidget to the OSplitter. | 44 | * You cann add widget with addWidget to the OSplitter. |
45 | * OSplitter supports also grouping of Splitters where they | 45 | * OSplitter supports also grouping of Splitters where they |
46 | * can share one OTabBar in small screen mode. This can be used | 46 | * can share one OTabBar in small screen mode. This can be used |
47 | * for email clients like vies but see the example. | 47 | * for email clients like vies but see the example. |
48 | * | 48 | * |
49 | * @param orient The orientation wether to layout horizontal or vertical | 49 | * @param orient The orientation wether to layout horizontal or vertical |
50 | * @param parent The parent of this widget | 50 | * @param parent The parent of this widget |
51 | * @param name The name passed on to QObject | 51 | * @param name The name passed on to QObject |
52 | * @param fl Additional widgets flags passed to QWidget | 52 | * @param fl Additional widgets flags passed to QWidget |
53 | * | 53 | * |
54 | * @short single c'tor of the OSplitter | 54 | * @short single c'tor of the OSplitter |
55 | */ | 55 | */ |
56 | OSplitter::OSplitter( Orientation orient, QWidget* parent, const char* name, WFlags fl ) | 56 | OSplitter::OSplitter( Orientation orient, QWidget* parent, const char* name, WFlags fl ) |
57 | : QFrame( parent, name, fl ) | 57 | : QFrame( parent, name, fl ) |
58 | { | 58 | { |
59 | m_orient = orient; | 59 | m_orient = orient; |
60 | m_hbox = 0; | 60 | m_hbox = 0; |
61 | m_size_policy = 330; | 61 | m_size_policy = 330; |
62 | setFontPropagation( AllChildren ); | 62 | setFontPropagation( AllChildren ); |
63 | setPalettePropagation( AllChildren ); | 63 | setPalettePropagation( AllChildren ); |
64 | 64 | ||
65 | /* start by default with the tab widget */ | 65 | /* start by default with the tab widget */ |
66 | m_tabWidget = 0; | 66 | m_tabWidget = 0; |
67 | m_parentTab = 0; | 67 | m_parentTab = 0; |
68 | changeTab(); | 68 | changeTab(); |
69 | 69 | ||
70 | } | 70 | } |
71 | 71 | ||
72 | 72 | ||
73 | /** | 73 | /** |
74 | * Destructor destructs this object and cleans up. All child | 74 | * Destructor destructs this object and cleans up. All child |
75 | * widgets will be deleted | 75 | * widgets will be deleted |
76 | * @see addWidget | 76 | * @see addWidget |
77 | */ | 77 | */ |
78 | OSplitter::~OSplitter() { | 78 | OSplitter::~OSplitter() { |
79 | qWarning("Deleted Splitter"); | 79 | qWarning("Deleted Splitter"); |
80 | m_splitter.setAutoDelete( true ); | 80 | m_splitter.setAutoDelete( true ); |
81 | m_splitter.clear(); | 81 | m_splitter.clear(); |
82 | 82 | ||
83 | delete m_hbox; | 83 | delete m_hbox; |
84 | delete m_tabWidget; | 84 | delete m_tabWidget; |
85 | } | 85 | } |
86 | 86 | ||
87 | 87 | ||
88 | /** | 88 | /** |
89 | * Sets the label for the Splitter. This label will be used | 89 | * Sets the label for the Splitter. This label will be used |
90 | * if a parent splitter is arranged as TabWidget but | 90 | * if a parent splitter is arranged as TabWidget but |
91 | * this splitter is in fullscreen mode. Then a tab with OSplitter::label() | 91 | * this splitter is in fullscreen mode. Then a tab with OSplitter::label() |
92 | * and iconName() gets added. | 92 | * and iconName() gets added. |
93 | * | 93 | * |
94 | * @param name The name of the Label | 94 | * @param name The name of the Label |
95 | */ | 95 | */ |
96 | void OSplitter::setLabel( const QString& name ) { | 96 | void OSplitter::setLabel( const QString& name ) { |
97 | m_name = name; | 97 | m_name = name; |
98 | } | 98 | } |
99 | 99 | ||
100 | /** | 100 | /** |
101 | * @see setLabel but this is for the icon retrieved by Resource | 101 | * @see setLabel but this is for the icon retrieved by Resource |
102 | * | 102 | * |
103 | * @param name The name of the icon in example ( "zoom" ) | 103 | * @param name The name of the icon in example ( "zoom" ) |
104 | */ | 104 | */ |
105 | void OSplitter::setIconName( const QString& name ) { | 105 | void OSplitter::setIconName( const QString& name ) { |
106 | m_icon = name; | 106 | m_icon = name; |
107 | } | 107 | } |
108 | 108 | ||
109 | 109 | ||
110 | /** | 110 | /** |
111 | * returns the iconName | 111 | * returns the iconName |
112 | * @see setIconName | 112 | * @see setIconName |
113 | */ | 113 | */ |
114 | QString OSplitter::iconName()const { | 114 | QString OSplitter::iconName()const { |
115 | return m_icon; | 115 | return m_icon; |
116 | } | 116 | } |
117 | 117 | ||
118 | /** | 118 | /** |
119 | * returns the label set with setLabel | 119 | * returns the label set with setLabel |
120 | * @see setLabel | 120 | * @see setLabel |
121 | */ | 121 | */ |
122 | QString OSplitter::label()const { | 122 | QString OSplitter::label()const { |
123 | return m_name; | 123 | return m_name; |
124 | } | 124 | } |
125 | 125 | ||
126 | /** | 126 | /** |
127 | * This function sets the size change policy of the splitter. | 127 | * This function sets the size change policy of the splitter. |
128 | * If this size marked is crossed the splitter will relayout. | 128 | * If this size marked is crossed the splitter will relayout. |
129 | * Note: that depending on the set Orientation it'll either look | 129 | * Note: that depending on the set Orientation it'll either look |
130 | * at the width or height. | 130 | * at the width or height. |
131 | * Note: If you want to from side to side view to tabbed view you need | 131 | * Note: If you want to from side to side view to tabbed view you need |
132 | * to make sure that the size you supply is not smaller than the minimum | 132 | * to make sure that the size you supply is not smaller than the minimum |
133 | * size of your added widgets. Note that if you use widgets like QComboBoxes | 133 | * size of your added widgets. Note that if you use widgets like QComboBoxes |
134 | * you need to teach them to accept smaller sizes as well @see QWidget::setSizePolicy | 134 | * you need to teach them to accept smaller sizes as well @see QWidget::setSizePolicy |
135 | * | 135 | * |
136 | * @param width_height The mark that will be watched. Interpreted depending on the Orientation of the Splitter. | 136 | * @param width_height The mark that will be watched. Interpreted depending on the Orientation of the Splitter. |
137 | * @return void | 137 | * @return void |
138 | */ | 138 | */ |
139 | void OSplitter::setSizeChange( int width_height ) { | 139 | void OSplitter::setSizeChange( int width_height ) { |
140 | m_size_policy = width_height; | 140 | m_size_policy = width_height; |
141 | QSize sz(width(), height() ); | 141 | QSize sz(width(), height() ); |
142 | QResizeEvent ev(sz, sz ); | 142 | QResizeEvent ev(sz, sz ); |
143 | resizeEvent(&ev); | 143 | resizeEvent(&ev); |
144 | } | 144 | } |
145 | 145 | ||
146 | /** | 146 | /** |
147 | * This functions allows to add another OSplitter and to share | 147 | * This functions allows to add another OSplitter and to share |
148 | * the OTabBar in small screen mode. The ownerships gets transfered. | 148 | * the OTabBar in small screen mode. The ownerships gets transfered. |
149 | * OSplitters are always added after normal widget items | 149 | * OSplitters are always added after normal widget items |
150 | */ | 150 | */ |
151 | void OSplitter::addWidget( OSplitter* split ) { | 151 | void OSplitter::addWidget( OSplitter* split ) { |
152 | m_splitter.append( split ); | 152 | m_splitter.append( split ); |
153 | 153 | ||
154 | /* | 154 | /* |
155 | * set tab widget | 155 | * set tab widget |
156 | */ | 156 | */ |
157 | if (m_tabWidget ) | 157 | if (m_tabWidget ) |
158 | setTabWidget( m_parentTab ); | 158 | setTabWidget( m_parentTab ); |
159 | else{ | 159 | else{ |
160 | Opie::OSplitterContainer con; | 160 | Opie::OSplitterContainer con; |
161 | con.widget =split; | 161 | con.widget =split; |
162 | addToBox( con ); | 162 | addToBox( con ); |
163 | } | 163 | } |
164 | } | 164 | } |
165 | 165 | ||
166 | /* | 166 | /* |
167 | * If in a tab it should be removed | 167 | * If in a tab it should be removed |
168 | * and if in a hbox the reparent kills it too | 168 | * and if in a hbox the reparent kills it too |
169 | */ | 169 | */ |
170 | /** | 170 | /** |
171 | * This removes the splitter again. You currently need to call this | 171 | * This removes the splitter again. You currently need to call this |
172 | * before you delete or otherwise you can get mem corruption | 172 | * before you delete or otherwise you can get mem corruption |
173 | * or other weird behaviour. | 173 | * or other weird behaviour. |
174 | * Owner ship gets transfered back to you it's current parent | 174 | * Owner ship gets transfered back to you it's current parent |
175 | * is 0 | 175 | * is 0 |
176 | */ | 176 | */ |
177 | void OSplitter::removeWidget( OSplitter* split) { | 177 | void OSplitter::removeWidget( OSplitter* split) { |
178 | split->setTabWidget( 0 ); | 178 | split->setTabWidget( 0 ); |
179 | split->reparent( 0, 0, QPoint(0, 0) ); | 179 | split->reparent( 0, 0, QPoint(0, 0) ); |
180 | } | 180 | } |
181 | 181 | ||
182 | /** | 182 | /** |
183 | * Adds a widget to the Splitter. The widgets gets inserted | 183 | * Adds a widget to the Splitter. The widgets gets inserted |
184 | * at the end of either the Box or TabWidget. | 184 | * at the end of either the Box or TabWidget. |
185 | * Ownership gets transfered and the widgets gets reparented. | 185 | * Ownership gets transfered and the widgets gets reparented. |
186 | * Note: icon and label is only available on small screensizes | 186 | * Note: icon and label is only available on small screensizes |
187 | * if size is smaller than the mark | 187 | * if size is smaller than the mark |
188 | * Warning: No null checking of the widget is done. Only on debug | 188 | * Warning: No null checking of the widget is done. Only on debug |
189 | * a message will be outputtet | 189 | * a message will be outputtet |
190 | * | 190 | * |
191 | * @param wid The widget which will be added | 191 | * @param wid The widget which will be added |
192 | * @param icon The icon of the possible Tab | 192 | * @param icon The icon of the possible Tab |
193 | * @param label The label of the possible Tab | 193 | * @param label The label of the possible Tab |
194 | */ | 194 | */ |
195 | void OSplitter::addWidget( QWidget* wid, const QString& icon, const QString& label ) { | 195 | void OSplitter::addWidget( QWidget* wid, const QString& icon, const QString& label ) { |
196 | #ifdef DEBUG | 196 | #ifdef DEBUG |
197 | if (!wid ) { | 197 | if (!wid ) { |
198 | qWarning("Widget is not valid!"); | 198 | qWarning("Widget is not valid!"); |
199 | return; | 199 | return; |
200 | } | 200 | } |
201 | #endif | 201 | #endif |
202 | Opie::OSplitterContainer cont; | 202 | Opie::OSplitterContainer cont; |
203 | cont.widget = wid; | 203 | cont.widget = wid; |
204 | cont.icon =icon; | 204 | cont.icon =icon; |
205 | cont.name = label; | 205 | cont.name = label; |
206 | 206 | ||
207 | m_container.append( cont ); | 207 | m_container.append( cont ); |
208 | 208 | ||
209 | /* | 209 | /* |
210 | * | 210 | * |
211 | */ | 211 | */ |
212 | if (!m_splitter.isEmpty() && (m_tabWidget || m_parentTab ) ) | 212 | if (!m_splitter.isEmpty() && (m_tabWidget || m_parentTab ) ) |
213 | setTabWidget( m_parentTab ); | 213 | setTabWidget( m_parentTab ); |
214 | else { | 214 | else { |
215 | if (m_hbox ) | 215 | if (m_hbox ) |
216 | addToBox( cont ); | 216 | addToBox( cont ); |
217 | else | 217 | else |
218 | addToTab( cont ); | 218 | addToTab( cont ); |
219 | } | 219 | } |
220 | } | 220 | } |
221 | 221 | ||
222 | 222 | ||
223 | /** | 223 | /** |
224 | * Removes the widget from the tab widgets if necessary. | 224 | * Removes the widget from the tab widgets if necessary. |
225 | * OSplitter drops ownership of this widget and the widget | 225 | * OSplitter drops ownership of this widget and the widget |
226 | * will be reparented i tto 0. | 226 | * will be reparented i tto 0. |
227 | * The widget will not be deleted. | 227 | * The widget will not be deleted. |
228 | * | 228 | * |
229 | * @param w The widget to be removed | 229 | * @param w The widget to be removed |
230 | */ | 230 | */ |
231 | void OSplitter::removeWidget( QWidget* w) { | 231 | void OSplitter::removeWidget( QWidget* w) { |
232 | ContainerList::Iterator it; | 232 | ContainerList::Iterator it; |
233 | for ( it = m_container.begin(); it != m_container.end(); ++it ) | 233 | for ( it = m_container.begin(); it != m_container.end(); ++it ) |
234 | if ( (*it).widget == w ) | 234 | if ( (*it).widget == w ) |
235 | break; | 235 | break; |
236 | 236 | ||
237 | if (it == m_container.end() ) | 237 | if (it == m_container.end() ) |
238 | return; | 238 | return; |
239 | 239 | ||
240 | 240 | ||
241 | /* only tab needs to be removed.. box recognizes it */ | 241 | /* only tab needs to be removed.. box recognizes it */ |
242 | if ( !m_hbox ) | 242 | if ( !m_hbox ) |
243 | removeFromTab( w ); | 243 | removeFromTab( w ); |
244 | 244 | ||
245 | 245 | ||
246 | /* Find reparent it and remove it from our list */ | 246 | /* Find reparent it and remove it from our list */ |
247 | 247 | ||
248 | w->reparent( 0, 0, QPoint(0, 0)); | 248 | w->reparent( 0, 0, QPoint(0, 0)); |
249 | it = m_container.remove( it ); | 249 | it = m_container.remove( it ); |
250 | 250 | ||
251 | } | 251 | } |
252 | 252 | ||
253 | 253 | ||
254 | /** | 254 | /** |
255 | * This method will give focus to the widget. If in a tabwidget | 255 | * This method will give focus to the widget. If in a tabwidget |
256 | * the tabbar will be changed | 256 | * the tabbar will be changed |
257 | * | 257 | * |
258 | * @param w The widget which will be set the current one | 258 | * @param w The widget which will be set the current one |
259 | */ | 259 | */ |
260 | void OSplitter::setCurrentWidget( QWidget* w) { | 260 | void OSplitter::setCurrentWidget( QWidget* w) { |
261 | if (m_tabWidget ) | 261 | if (m_tabWidget ) |
262 | m_tabWidget->setCurrentTab( w ); | 262 | m_tabWidget->setCurrentTab( w ); |
263 | // else | 263 | // else |
264 | // m_hbox->setFocus( w ); | 264 | // m_hbox->setFocus( w ); |
265 | 265 | ||
266 | } | 266 | } |
267 | 267 | ||
268 | /** | 268 | /** |
269 | * This is an overloaded member function and only differs in the | 269 | * This is an overloaded member function and only differs in the |
270 | * argument it takes. | 270 | * argument it takes. |
271 | * Searches list of widgets for label. It'll pick the first label it finds | 271 | * Searches list of widgets for label. It'll pick the first label it finds |
272 | * | 272 | * |
273 | * @param label Label to look for. First match will be taken | 273 | * @param label Label to look for. First match will be taken |
274 | */ | 274 | */ |
275 | void OSplitter::setCurrentWidget( const QString& label ) { | 275 | void OSplitter::setCurrentWidget( const QString& label ) { |
276 | ContainerList::Iterator it; | 276 | ContainerList::Iterator it; |
277 | for (it = m_container.begin(); it != m_container.end(); ++it ) { | 277 | for (it = m_container.begin(); it != m_container.end(); ++it ) { |
278 | if ( (*it).name == label ) { | 278 | if ( (*it).name == label ) { |
279 | setCurrentWidget( (*it).widget ); | 279 | setCurrentWidget( (*it).widget ); |
280 | break; | 280 | break; |
281 | } | 281 | } |
282 | } | 282 | } |
283 | } | 283 | } |
284 | 284 | ||
285 | /** | 285 | /** |
286 | * This will only work when the TabWidget is active | 286 | * This will only work when the TabWidget is active |
287 | * If everything is visible this signal is kindly ignored | 287 | * If everything is visible this signal is kindly ignored |
288 | * @see OTabWidget::setCurrentTab(int) | 288 | * @see OTabWidget::setCurrentTab(int) |
289 | * | 289 | * |
290 | * @param tab The tab to make current | 290 | * @param tab The tab to make current |
291 | */ | 291 | */ |
292 | void OSplitter::setCurrentWidget( int tab ) { | 292 | void OSplitter::setCurrentWidget( int tab ) { |
293 | if (m_tabWidget ) | 293 | if (m_tabWidget ) |
294 | m_tabWidget->setCurrentTab( tab ); | 294 | m_tabWidget->setCurrentTab( tab ); |
295 | } | 295 | } |
296 | 296 | ||
297 | /** | 297 | /** |
298 | * return the currently activated widget if in tab widget mode | 298 | * return the currently activated widget if in tab widget mode |
299 | * or null because all widgets are visible | 299 | * or null because all widgets are visible |
300 | */ | 300 | */ |
301 | QWidget* OSplitter::currentWidget() const{ | 301 | QWidget* OSplitter::currentWidget() const{ |
302 | if (m_tabWidget) | 302 | if (m_tabWidget) |
303 | return m_tabWidget->currentWidget(); | 303 | return m_tabWidget->currentWidget(); |
304 | else if (m_parentTab ) | 304 | else if (m_parentTab ) |
305 | return m_parentTab->currentWidget(); | 305 | return m_parentTab->currentWidget(); |
306 | 306 | ||
307 | return 0l; | 307 | return 0l; |
308 | } | 308 | } |
309 | 309 | /* wrong */ | |
310 | 310 | #if 0 | |
311 | /** | 311 | /** |
312 | * @reimplented for internal reasons | 312 | * @reimplented for internal reasons |
313 | * returns the sizeHint of one of its sub widgets | 313 | * returns the sizeHint of one of its sub widgets |
314 | */ | 314 | */ |
315 | QSize OSplitter::sizeHint()const { | 315 | QSize OSplitter::sizeHint()const { |
316 | if (m_parentTab ) | 316 | if (m_parentTab ) |
317 | return QFrame::sizeHint(); | 317 | return QFrame::sizeHint(); |
318 | 318 | ||
319 | if (m_hbox ) | 319 | if (m_hbox ) |
320 | return m_hbox->sizeHint(); | 320 | return m_hbox->sizeHint(); |
321 | else | 321 | else |
322 | return m_tabWidget->sizeHint(); | 322 | return m_tabWidget->sizeHint(); |
323 | } | 323 | } |
324 | 324 | ||
325 | QSize OSplitter::minimumSizeHint()const { | 325 | QSize OSplitter::minimumSizeHint()const { |
326 | if (m_parentTab ) | 326 | if (m_parentTab ) |
327 | return QFrame::minimumSizeHint(); | 327 | return QFrame::minimumSizeHint(); |
328 | if (m_hbox) | 328 | if (m_hbox) |
329 | return m_hbox->sizeHint(); | 329 | return m_hbox->sizeHint(); |
330 | else | 330 | else |
331 | return m_tabWidget->sizeHint(); | 331 | return m_tabWidget->sizeHint(); |
332 | } | 332 | } |
333 | 333 | #endif | |
334 | 334 | ||
335 | /** | 335 | /** |
336 | * @reimplemented for internal reasons | 336 | * @reimplemented for internal reasons |
337 | */ | 337 | */ |
338 | void OSplitter::resizeEvent( QResizeEvent* res ) { | 338 | void OSplitter::resizeEvent( QResizeEvent* res ) { |
339 | QFrame::resizeEvent( res ); | 339 | QFrame::resizeEvent( res ); |
340 | /* | 340 | /* |
341 | * | 341 | * |
342 | */ | 342 | */ |
343 | // qWarning("Old size was width = %d height = %d", res->oldSize().width(), res->oldSize().height() ); | 343 | // qWarning("Old size was width = %d height = %d", res->oldSize().width(), res->oldSize().height() ); |
344 | bool mode = true; | 344 | bool mode = true; |
345 | qWarning("New size is width = %d height = %d %s", res->size().width(), res->size().height(), name() ); | 345 | qWarning("New size is width = %d height = %d %s", res->size().width(), res->size().height(), name() ); |
346 | if ( res->size().width() > m_size_policy && | 346 | if ( res->size().width() > m_size_policy && |
347 | m_orient == Horizontal ) { | 347 | m_orient == Horizontal ) { |
348 | changeHBox(); | 348 | changeHBox(); |
349 | mode = false; | 349 | mode = false; |
350 | }else if ( (res->size().width() <= m_size_policy && | 350 | }else if ( (res->size().width() <= m_size_policy && |
351 | m_orient == Horizontal ) || | 351 | m_orient == Horizontal ) || |
352 | (res->size().height() <= m_size_policy && | 352 | (res->size().height() <= m_size_policy && |
353 | m_orient == Vertical ) ) { | 353 | m_orient == Vertical ) ) { |
354 | changeTab(); | 354 | changeTab(); |
355 | }else if ( res->size().height() > m_size_policy && | 355 | }else if ( res->size().height() > m_size_policy && |
356 | m_orient == Vertical ) { | 356 | m_orient == Vertical ) { |
357 | qWarning("Changng to vbox %s", name() ); | 357 | qWarning("Changng to vbox %s", name() ); |
358 | changeVBox(); | 358 | changeVBox(); |
359 | mode = false; | 359 | mode = false; |
360 | } | 360 | } |
361 | 361 | ||
362 | emit sizeChanged(mode, m_orient ); | 362 | emit sizeChanged(mode, m_orient ); |
363 | } | 363 | } |
364 | 364 | ||
365 | /* | 365 | /* |
366 | * Adds a container to a tab either the parent tab | 366 | * Adds a container to a tab either the parent tab |
367 | * or our own | 367 | * or our own |
368 | */ | 368 | */ |
369 | void OSplitter::addToTab( const Opie::OSplitterContainer& con ) { | 369 | void OSplitter::addToTab( const Opie::OSplitterContainer& con ) { |
370 | QWidget *wid = con.widget; | 370 | QWidget *wid = con.widget; |
371 | // not needed widgetstack will reparent as well wid.reparent(m_tabWidget, wid->getWFlags(), QPoint(0, 0) ); | 371 | // not needed widgetstack will reparent as well wid.reparent(m_tabWidget, wid->getWFlags(), QPoint(0, 0) ); |
372 | if (m_parentTab ) | 372 | if (m_parentTab ) |
373 | m_parentTab->addTab( wid, con.icon, con.name ); | 373 | m_parentTab->addTab( wid, con.icon, con.name ); |
374 | else | 374 | else |
375 | m_tabWidget->addTab( wid, con.icon, con.name ); | 375 | m_tabWidget->addTab( wid, con.icon, con.name ); |
376 | } | 376 | } |
377 | 377 | ||
378 | 378 | ||
379 | /* | 379 | /* |
380 | * adds a container to the box | 380 | * adds a container to the box |
381 | */ | 381 | */ |
382 | void OSplitter::addToBox( const Opie::OSplitterContainer& con ) { | 382 | void OSplitter::addToBox( const Opie::OSplitterContainer& con ) { |
383 | QWidget* wid = con.widget; | 383 | QWidget* wid = con.widget; |
384 | wid->reparent(m_hbox, 0, QPoint(0, 0) ); | 384 | wid->reparent(m_hbox, 0, QPoint(0, 0) ); |
385 | } | 385 | } |
386 | 386 | ||
387 | 387 | ||
388 | /* | 388 | /* |
389 | * Removes a widget from the tab | 389 | * Removes a widget from the tab |
390 | */ | 390 | */ |
391 | void OSplitter::removeFromTab( QWidget* wid ) { | 391 | void OSplitter::removeFromTab( QWidget* wid ) { |
392 | if (m_parentTab ) | 392 | if (m_parentTab ) |
393 | m_parentTab->removePage( wid ); | 393 | m_parentTab->removePage( wid ); |
394 | else | 394 | else |
395 | m_tabWidget->removePage( wid ); | 395 | m_tabWidget->removePage( wid ); |
396 | } | 396 | } |
397 | 397 | ||
398 | /* | 398 | /* |
399 | * switches over to a OTabWidget layout | 399 | * switches over to a OTabWidget layout |
400 | * it is recursive | 400 | * it is recursive |
401 | */ | 401 | */ |
402 | void OSplitter::changeTab() { | 402 | void OSplitter::changeTab() { |
403 | /* if we're the owner of the tab widget */ | 403 | /* if we're the owner of the tab widget */ |
404 | if (m_tabWidget ) { | 404 | if (m_tabWidget ) { |
405 | raise(); | 405 | raise(); |
406 | show(); | 406 | show(); |
407 | m_tabWidget->setGeometry( frameRect() ); | 407 | m_tabWidget->setGeometry( frameRect() ); |
408 | return; | 408 | return; |
409 | } | 409 | } |
410 | 410 | ||
411 | qWarning(" New Tab Widget %s", name() ); | 411 | qWarning(" New Tab Widget %s", name() ); |
412 | /* | 412 | /* |
413 | * and add all widgets this will reparent them | 413 | * and add all widgets this will reparent them |
414 | * delete m_hbox set it to 0 | 414 | * delete m_hbox set it to 0 |
415 | * | 415 | * |
416 | */ | 416 | */ |
417 | OTabWidget *tab; | 417 | OTabWidget *tab; |
418 | if ( m_parentTab ) { | 418 | if ( m_parentTab ) { |
419 | hide(); | 419 | hide(); |
420 | tab = m_parentTab; | 420 | tab = m_parentTab; |
421 | /* expensive but needed cause we're called from setTabWidget and resizeEvent*/ | 421 | /* expensive but needed cause we're called from setTabWidget and resizeEvent*/ |
422 | if (!m_container.isEmpty() ) { | 422 | if (!m_container.isEmpty() ) { |
423 | ContainerList::Iterator it = m_container.begin(); | 423 | ContainerList::Iterator it = m_container.begin(); |
424 | for (; it != m_container.end(); ++it ) | 424 | for (; it != m_container.end(); ++it ) |
425 | m_parentTab->removePage( (*it).widget ); | 425 | m_parentTab->removePage( (*it).widget ); |
426 | } | 426 | } |
427 | }else | 427 | }else |
428 | tab = m_tabWidget = new OTabWidget( this ); | 428 | tab = m_tabWidget = new OTabWidget( this ); |
429 | 429 | ||
430 | connect(tab, SIGNAL(currentChanged(QWidget*) ), | 430 | connect(tab, SIGNAL(currentChanged(QWidget*) ), |
431 | this, SIGNAL(currentChanged(QWidget*) ) ); | 431 | this, SIGNAL(currentChanged(QWidget*) ) ); |
432 | 432 | ||
433 | for ( ContainerList::Iterator it = m_container.begin(); it != m_container.end(); ++it ) { | 433 | for ( ContainerList::Iterator it = m_container.begin(); it != m_container.end(); ++it ) { |
434 | qWarning("Widget is %s", (*it).name.latin1() ); | 434 | qWarning("Widget is %s", (*it).name.latin1() ); |
435 | addToTab( (*it) ); | 435 | addToTab( (*it) ); |
436 | } | 436 | } |
437 | 437 | ||
438 | for ( OSplitter* split = m_splitter.first(); split; split = m_splitter.next() ) { | 438 | for ( OSplitter* split = m_splitter.first(); split; split = m_splitter.next() ) { |
439 | split->reparent(this, 0, QPoint(0, 0) ); | 439 | split->reparent(this, 0, QPoint(0, 0) ); |
440 | split->setTabWidget( tab ); | 440 | split->setTabWidget( tab ); |
441 | } | 441 | } |
442 | 442 | ||
443 | 443 | ||
444 | delete m_hbox; | 444 | delete m_hbox; |
445 | m_hbox = 0; | 445 | m_hbox = 0; |
446 | if (!m_tabWidget ) | 446 | if (!m_tabWidget ) |
447 | return; | 447 | return; |
448 | 448 | ||
449 | m_tabWidget->setGeometry( frameRect() ); | 449 | m_tabWidget->setGeometry( frameRect() ); |
450 | m_tabWidget->show(); | 450 | m_tabWidget->show(); |
451 | 451 | ||
452 | } | 452 | } |
453 | 453 | ||
454 | /* | 454 | /* |
455 | * changes over to a box | 455 | * changes over to a box |
456 | * this is recursive as well | 456 | * this is recursive as well |
457 | */ | 457 | */ |
458 | void OSplitter::changeHBox() { | 458 | void OSplitter::changeHBox() { |
459 | if (m_hbox ) { | 459 | if (m_hbox ) { |
460 | m_hbox->setGeometry( frameRect() ); | 460 | m_hbox->setGeometry( frameRect() ); |
461 | return; | 461 | return; |
462 | } | 462 | } |
463 | 463 | ||
464 | qWarning("new HBox %s", name() ); | 464 | qWarning("new HBox %s", name() ); |
465 | m_hbox = new QHBox( this ); | 465 | m_hbox = new QHBox( this ); |
466 | commonChangeBox(); | 466 | commonChangeBox(); |
467 | } | 467 | } |
468 | 468 | ||
469 | void OSplitter::changeVBox() { | 469 | void OSplitter::changeVBox() { |
470 | if (m_hbox ) { | 470 | if (m_hbox ) { |
471 | m_hbox->setGeometry( frameRect() ); | 471 | m_hbox->setGeometry( frameRect() ); |
472 | return; | 472 | return; |
473 | } | 473 | } |
474 | 474 | ||
475 | qWarning("New VBOX %s", name() ); | 475 | qWarning("New VBOX %s", name() ); |
476 | m_hbox = new QVBox( this ); | 476 | m_hbox = new QVBox( this ); |
477 | 477 | ||
478 | commonChangeBox(); | 478 | commonChangeBox(); |
479 | 479 | ||
480 | } | 480 | } |
481 | 481 | ||
482 | /* | 482 | /* |
483 | * common box code | 483 | * common box code |
484 | * first remove and add children | 484 | * first remove and add children |
485 | * the other splitters | 485 | * the other splitters |
486 | * it is recursive as well due the call to setTabWidget | 486 | * it is recursive as well due the call to setTabWidget |
487 | */ | 487 | */ |
488 | void OSplitter::commonChangeBox() { | 488 | void OSplitter::commonChangeBox() { |
489 | qWarning(" Name of Splitters is %s", name() ); | 489 | qWarning(" Name of Splitters is %s", name() ); |
490 | 490 | ||
491 | for (ContainerList::Iterator it = m_container.begin(); it != m_container.end(); ++it ) { | 491 | for (ContainerList::Iterator it = m_container.begin(); it != m_container.end(); ++it ) { |
492 | /* only if parent tab.. m_tabWidgets gets deleted and would do that as well */ | 492 | /* only if parent tab.. m_tabWidgets gets deleted and would do that as well */ |
493 | if (m_parentTab ) | 493 | if (m_parentTab ) |
494 | removeFromTab( (*it).widget ); | 494 | removeFromTab( (*it).widget ); |
495 | qWarning("Adding to box %s", (*it).name.latin1() ); | 495 | qWarning("Adding to box %s", (*it).name.latin1() ); |
496 | addToBox( (*it) ); | 496 | addToBox( (*it) ); |
497 | } | 497 | } |
498 | for ( OSplitter* split = m_splitter.first(); split; split = m_splitter.next() ) { | 498 | for ( OSplitter* split = m_splitter.first(); split; split = m_splitter.next() ) { |
499 | /* tell them the world had changed */ | 499 | /* tell them the world had changed */ |
500 | split->setTabWidget( 0 ); | 500 | split->setTabWidget( 0 ); |
501 | Opie::OSplitterContainer con; | 501 | Opie::OSplitterContainer con; |
502 | con.widget = split; | 502 | con.widget = split; |
503 | // con.widget = split->m_tabWidget ? static_cast<QWidget*>(split->m_tabWidget) | 503 | // con.widget = split->m_tabWidget ? static_cast<QWidget*>(split->m_tabWidget) |
504 | // : static_cast<QWidget*>(split->m_hbox); | 504 | // : static_cast<QWidget*>(split->m_hbox); |
505 | addToBox( con ); | 505 | addToBox( con ); |
506 | } | 506 | } |
507 | 507 | ||
508 | 508 | ||
509 | 509 | ||
510 | if (m_parentTab ) | 510 | if (m_parentTab ) |
511 | m_parentTab->addTab(m_hbox, iconName(), label() ); | 511 | m_parentTab->addTab(m_hbox, iconName(), label() ); |
512 | else { | 512 | else { |
513 | qWarning(" setting Box geometry for %s", name() ); | 513 | qWarning(" setting Box geometry for %s", name() ); |
514 | m_hbox->setGeometry( frameRect() ); | 514 | m_hbox->setGeometry( frameRect() ); |
515 | m_hbox->show(); | 515 | m_hbox->show(); |
516 | delete m_tabWidget; | 516 | delete m_tabWidget; |
517 | m_tabWidget = 0; | 517 | m_tabWidget = 0; |
518 | show(); // also show this widget | ||
518 | } | 519 | } |
519 | } | 520 | } |
520 | 521 | ||
521 | /* | 522 | /* |
522 | * sets the tabwidget, removes tabs, and relayouts the widget | 523 | * sets the tabwidget, removes tabs, and relayouts the widget |
523 | */ | 524 | */ |
524 | void OSplitter::setTabWidget( OTabWidget* wid) { | 525 | void OSplitter::setTabWidget( OTabWidget* wid) { |
525 | /* clean up cause m_parentTab will not be available for us */ | 526 | /* clean up cause m_parentTab will not be available for us */ |
526 | if ( m_parentTab ) { | 527 | if ( m_parentTab ) { |
527 | if (m_hbox ) | 528 | if (m_hbox ) |
528 | m_parentTab->removePage( m_hbox ); | 529 | m_parentTab->removePage( m_hbox ); |
529 | else if (!m_container.isEmpty() ){ | 530 | else if (!m_container.isEmpty() ){ |
530 | ContainerList::Iterator it = m_container.begin(); | 531 | ContainerList::Iterator it = m_container.begin(); |
531 | for ( ; it != m_container.end(); ++it ) | 532 | for ( ; it != m_container.end(); ++it ) |
532 | m_parentTab->removePage( (*it).widget ); | 533 | m_parentTab->removePage( (*it).widget ); |
533 | } | 534 | } |
534 | } | 535 | } |
535 | /* the parent Splitter changed so either make us indepent or dep */ | 536 | /* the parent Splitter changed so either make us indepent or dep */ |
536 | 537 | ||
537 | m_parentTab = wid; | 538 | m_parentTab = wid; |
538 | 539 | ||
539 | QWidget *tab = m_tabWidget; | 540 | QWidget *tab = m_tabWidget; |
540 | QWidget *box = m_hbox; | 541 | QWidget *box = m_hbox; |
541 | m_hbox = 0; m_tabWidget = 0; | 542 | m_hbox = 0; m_tabWidget = 0; |
542 | 543 | ||
543 | if ( layoutMode() ) | 544 | if ( layoutMode() ) |
544 | changeTab(); | 545 | changeTab(); |
545 | else if (m_orient == Horizontal ) | 546 | else if (m_orient == Horizontal ) |
546 | changeHBox(); | 547 | changeHBox(); |
547 | else | 548 | else |
548 | changeVBox(); | 549 | changeVBox(); |
549 | 550 | ||
550 | /* our own crap is added and children from change* */ | 551 | /* our own crap is added and children from change* */ |
551 | delete tab; | 552 | delete tab; |
552 | delete box; | 553 | delete box; |
553 | } | 554 | } |
554 | 555 | ||
555 | 556 | ||
556 | #if 0 | 557 | #if 0 |
557 | void OSplitter::reparentAll() { | 558 | void OSplitter::reparentAll() { |
558 | if (m_container.isEmpty() ) | 559 | if (m_container.isEmpty() ) |
559 | return; | 560 | return; |
560 | 561 | ||
561 | ContainerList::Iterator it = m_container.begin(); | 562 | ContainerList::Iterator it = m_container.begin(); |
562 | for ( ; it != m_container.end(); ++it ) | 563 | for ( ; it != m_container.end(); ++it ) |
563 | (*it).wid->reparent(0, 0, QPoint(0, 0) ); | 564 | (*it).wid->reparent(0, 0, QPoint(0, 0) ); |
564 | 565 | ||
565 | 566 | ||
566 | } | 567 | } |
567 | #endif | 568 | #endif |
568 | 569 | ||
569 | /** | 570 | /** |
570 | * @internal | 571 | * @internal |
571 | */ | 572 | */ |
572 | bool OSplitter::layoutMode()const { | 573 | bool OSplitter::layoutMode()const { |
573 | if ( size().width() > m_size_policy && | 574 | if ( size().width() > m_size_policy && |
574 | m_orient == Horizontal ) { | 575 | m_orient == Horizontal ) { |
575 | return false; | 576 | return false; |
576 | }else if ( size().height() > m_size_policy && | 577 | }else if ( size().height() > m_size_policy && |
577 | m_orient == Vertical ) { | 578 | m_orient == Vertical ) { |
578 | return false; | 579 | return false; |
579 | } | 580 | } |
580 | 581 | ||
581 | return true; | 582 | return true; |
582 | } | 583 | } |
diff --git a/libopie/big-screen/osplitter.h b/libopie/big-screen/osplitter.h index 33a085f..61a247b 100644 --- a/libopie/big-screen/osplitter.h +++ b/libopie/big-screen/osplitter.h | |||
@@ -1,145 +1,146 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2003 hOlgAr <zecke@handhelds.org> | 3 | .=l. Copyright (c) 2003 hOlgAr <zecke@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This library is free software; you can | 5 | _;:, .> :=|. This library is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This library is distributed in the hope that | 12 | .i_,=:_. -<s. This library is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #ifndef OPIE_SPLITTER_H | 29 | #ifndef OPIE_SPLITTER_H |
30 | #define OPIE_SPLITTER_H | 30 | #define OPIE_SPLITTER_H |
31 | 31 | ||
32 | #include <qstring.h> | 32 | #include <qstring.h> |
33 | 33 | ||
34 | #include <qframe.h> | 34 | #include <qframe.h> |
35 | #include <qvaluelist.h> | 35 | #include <qvaluelist.h> |
36 | #include <qlist.h> | 36 | #include <qlist.h> |
37 | 37 | ||
38 | #include "obigscreen_p.h" | 38 | #include "obigscreen_p.h" |
39 | 39 | ||
40 | /* forward declarations */ | 40 | /* forward declarations */ |
41 | class OTabWidget; | 41 | class OTabWidget; |
42 | class QHBox; | 42 | class QHBox; |
43 | //template class QValueList<Opie::OSplitterContainer>; | 43 | //template class QValueList<Opie::OSplitterContainer>; |
44 | 44 | ||
45 | /* | 45 | /* |
46 | * TODO | 46 | * TODO |
47 | * -check API docu | 47 | * -check API docu |
48 | * -one more example | 48 | * -one more example |
49 | * -allow inserting at a position | 49 | * -allow inserting at a position |
50 | */ | 50 | */ |
51 | 51 | ||
52 | /** | 52 | /** |
53 | * | 53 | * |
54 | * If you've widgets that could be placed side by side but you think | 54 | * If you've widgets that could be placed side by side but you think |
55 | * on small resolutions is not enough place but it would really make sense | 55 | * on small resolutions is not enough place but it would really make sense |
56 | * on bigger resolutions this class will help you. | 56 | * on bigger resolutions this class will help you. |
57 | * You can add as many widgets you want to it. Set a poliy on which width/height it | 57 | * You can add as many widgets you want to it. Set a poliy on which width/height it |
58 | * should switch the layout. | 58 | * should switch the layout. |
59 | * You can either say to place widgets vertical or horizontal. | 59 | * You can either say to place widgets vertical or horizontal. |
60 | * This class uses QHBox, QVBox and QTAbWidget internally. | 60 | * This class uses QHBox, QVBox and QTAbWidget internally. |
61 | * OSplitter takes ownership of the widgets | 61 | * OSplitter takes ownership of the widgets |
62 | * | 62 | * |
63 | * @since 1.2 | 63 | * @since 1.2 |
64 | * | 64 | * |
65 | * @short a small dynamically changing its layout to store two or more widgets side by side | 65 | * @short a small dynamically changing its layout to store two or more widgets side by side |
66 | * @version 0.1 | 66 | * @version 0.1 |
67 | * @author zecke | 67 | * @author zecke |
68 | */ | 68 | */ |
69 | class OSplitter : public QFrame{ | 69 | class OSplitter : public QFrame{ |
70 | Q_OBJECT | 70 | Q_OBJECT |
71 | public: | 71 | public: |
72 | typedef QValueList<Opie::OSplitterContainer> ContainerList; | 72 | typedef QValueList<Opie::OSplitterContainer> ContainerList; |
73 | OSplitter( Qt::Orientation = Horizontal, QWidget *parent = 0, | 73 | OSplitter( Qt::Orientation = Horizontal, QWidget *parent = 0, |
74 | const char* name = 0, WFlags fl = 0 ); | 74 | const char* name = 0, WFlags fl = 0 ); |
75 | ~OSplitter(); | 75 | ~OSplitter(); |
76 | 76 | ||
77 | void setLabel( const QString& name ); | 77 | void setLabel( const QString& name ); |
78 | void setIconName( const QString& name ); | 78 | void setIconName( const QString& name ); |
79 | QString label()const; | 79 | QString label()const; |
80 | QString iconName()const; | 80 | QString iconName()const; |
81 | 81 | ||
82 | void setSizeChange( int width_height ); | 82 | void setSizeChange( int width_height ); |
83 | 83 | ||
84 | void addWidget( OSplitter* splitter ); | 84 | void addWidget( OSplitter* splitter ); |
85 | void addWidget( QWidget* wid, const QString& icon, const QString& label ); | 85 | void addWidget( QWidget* wid, const QString& icon, const QString& label ); |
86 | void removeWidget( QWidget* ); | 86 | void removeWidget( QWidget* ); |
87 | void removeWidget( OSplitter* ); | 87 | void removeWidget( OSplitter* ); |
88 | 88 | ||
89 | void setCurrentWidget( QWidget* ); | 89 | void setCurrentWidget( QWidget* ); |
90 | void setCurrentWidget( const QString& label ); | 90 | void setCurrentWidget( const QString& label ); |
91 | void setCurrentWidget( int ); | 91 | void setCurrentWidget( int ); |
92 | QWidget* currentWidget()const; | 92 | QWidget* currentWidget()const; |
93 | 93 | ||
94 | |||
94 | signals: | 95 | signals: |
95 | /** | 96 | /** |
96 | * Emitted if in tab and comes directly from the tab widget | 97 | * Emitted if in tab and comes directly from the tab widget |
97 | * | 98 | * |
98 | */ | 99 | */ |
99 | void currentChanged( QWidget* ); | 100 | void currentChanged( QWidget* ); |
100 | 101 | ||
101 | /** | 102 | /** |
102 | * emitted whenever a border is crossed | 103 | * emitted whenever a border is crossed |
103 | * true if in small screen mode | 104 | * true if in small screen mode |
104 | * false if in bigscreen | 105 | * false if in bigscreen |
105 | * this signal is emitted after the layout switch | 106 | * this signal is emitted after the layout switch |
106 | * @param b The layout mode | 107 | * @param b The layout mode |
107 | * @param ori The orientation | 108 | * @param ori The orientation |
108 | */ | 109 | */ |
109 | void sizeChanged( bool b, Orientation ori); | 110 | void sizeChanged( bool b, Orientation ori); |
110 | public: | 111 | public: |
111 | QSize sizeHint()const; | 112 | // QSize sizeHint()const; |
112 | QSize minimumSizeHint()const; | 113 | // QSize minimumSizeHint()const; |
113 | 114 | ||
114 | protected: | 115 | protected: |
115 | void resizeEvent( QResizeEvent* ); | 116 | void resizeEvent( QResizeEvent* ); |
116 | 117 | ||
117 | private: | 118 | private: |
118 | /* true if OTabMode */ | 119 | /* true if OTabMode */ |
119 | bool layoutMode()const; | 120 | bool layoutMode()const; |
120 | // void reparentAll(); | 121 | // void reparentAll(); |
121 | void setTabWidget( OTabWidget*); | 122 | void setTabWidget( OTabWidget*); |
122 | void addToTab( const Opie::OSplitterContainer& ); | 123 | void addToTab( const Opie::OSplitterContainer& ); |
123 | void addToBox( const Opie::OSplitterContainer& ); | 124 | void addToBox( const Opie::OSplitterContainer& ); |
124 | void removeFromTab( QWidget* ); | 125 | void removeFromTab( QWidget* ); |
125 | void changeTab(); | 126 | void changeTab(); |
126 | void changeHBox(); | 127 | void changeHBox(); |
127 | void changeVBox(); | 128 | void changeVBox(); |
128 | void commonChangeBox(); | 129 | void commonChangeBox(); |
129 | QHBox *m_hbox; | 130 | QHBox *m_hbox; |
130 | OTabWidget *m_tabWidget; | 131 | OTabWidget *m_tabWidget; |
131 | OTabWidget *m_parentTab; | 132 | OTabWidget *m_parentTab; |
132 | Orientation m_orient; | 133 | Orientation m_orient; |
133 | int m_size_policy; | 134 | int m_size_policy; |
134 | 135 | ||
135 | ContainerList m_container; | 136 | ContainerList m_container; |
136 | QList<OSplitter> m_splitter; | 137 | QList<OSplitter> m_splitter; |
137 | 138 | ||
138 | QString m_icon, m_name; | 139 | QString m_icon, m_name; |
139 | 140 | ||
140 | struct Private; | 141 | struct Private; |
141 | Private *d; | 142 | Private *d; |
142 | }; | 143 | }; |
143 | 144 | ||
144 | 145 | ||
145 | #endif | 146 | #endif |