-rw-r--r-- | libopie2/opieui/big-screen/obigscreen_p.h | 9 | ||||
-rw-r--r-- | libopie2/opieui/big-screen/osplitter.cpp | 13 | ||||
-rw-r--r-- | libopie2/opieui/big-screen/osplitter.h | 15 | ||||
-rw-r--r-- | libopie2/opieui/big-screen/owidgetstack.cpp | 9 | ||||
-rw-r--r-- | libopie2/opieui/big-screen/owidgetstack.h | 7 |
5 files changed, 31 insertions, 22 deletions
diff --git a/libopie2/opieui/big-screen/obigscreen_p.h b/libopie2/opieui/big-screen/obigscreen_p.h index db8fc83..a85a56c 100644 --- a/libopie2/opieui/big-screen/obigscreen_p.h +++ b/libopie2/opieui/big-screen/obigscreen_p.h | |||
@@ -1,28 +1,31 @@ | |||
1 | #ifndef OPIE_BIG_SCREEN_PRIVATE | 1 | #ifndef OPIE_BIG_SCREEN_PRIVATE |
2 | #define OPIE_BIG_SCREEN_PRIVATE | 2 | #define OPIE_BIG_SCREEN_PRIVATE |
3 | 3 | ||
4 | /* QT */ | 4 | /* QT */ |
5 | #include <qstring.h> | 5 | #include <qstring.h> |
6 | 6 | ||
7 | class QWidget; | 7 | class QWidget; |
8 | 8 | ||
9 | namespace Opie | 9 | namespace Opie { |
10 | { | 10 | namespace Ui { |
11 | namespace Private{ | ||
11 | 12 | ||
12 | struct OSplitterContainer | 13 | struct OSplitterContainer |
13 | { | 14 | { |
14 | bool operator==( const OSplitterContainer& o) const | 15 | bool operator==( const OSplitterContainer& o) const |
15 | { | 16 | { |
16 | if (widget != o.widget ) return false; | 17 | if (widget != o.widget ) return false; |
17 | if (icon != o.icon ) return false; | 18 | if (icon != o.icon ) return false; |
18 | if (name != o.name ) return false; | 19 | if (name != o.name ) return false; |
19 | return true; | 20 | return true; |
20 | } | 21 | } |
21 | QWidget* widget; | 22 | QWidget* widget; |
22 | QString icon; | 23 | QString icon; |
23 | QString name; | 24 | QString name; |
24 | }; | 25 | }; |
25 | 26 | ||
26 | }; | 27 | } |
28 | } | ||
29 | } | ||
27 | 30 | ||
28 | #endif | 31 | #endif |
diff --git a/libopie2/opieui/big-screen/osplitter.cpp b/libopie2/opieui/big-screen/osplitter.cpp index 89f3793..bcfd3a6 100644 --- a/libopie2/opieui/big-screen/osplitter.cpp +++ b/libopie2/opieui/big-screen/osplitter.cpp | |||
@@ -14,49 +14,50 @@ | |||
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 "osplitter.h" | 29 | #include "osplitter.h" |
30 | 30 | ||
31 | /* OPIE */ | 31 | /* OPIE */ |
32 | #include <opie2/otabwidget.h> | 32 | #include <opie2/otabwidget.h> |
33 | 33 | ||
34 | /* QT */ | 34 | /* QT */ |
35 | #include <qvaluelist.h> | 35 | #include <qvaluelist.h> |
36 | #include <qvbox.h> | 36 | #include <qvbox.h> |
37 | 37 | ||
38 | using namespace Opie; | 38 | using namespace Opie::Ui; |
39 | using namespace Opie::Ui::Private; | ||
39 | 40 | ||
40 | /** | 41 | /** |
41 | * | 42 | * |
42 | * This is the constructor of OSplitter | 43 | * This is the constructor of OSplitter |
43 | * You might want to call setSizeChange to tell | 44 | * You might want to call setSizeChange to tell |
44 | * OSplitter to change its layout when a specefic | 45 | * OSplitter to change its layout when a specefic |
45 | * mark was crossed. OSplitter sets a default value. | 46 | * mark was crossed. OSplitter sets a default value. |
46 | * | 47 | * |
47 | * You cann add widget with addWidget to the OSplitter. | 48 | * You cann add widget with addWidget to the OSplitter. |
48 | * OSplitter supports also grouping of Splitters where they | 49 | * OSplitter supports also grouping of Splitters where they |
49 | * can share one OTabBar in small screen mode. This can be used | 50 | * can share one OTabBar in small screen mode. This can be used |
50 | * for email clients like vies but see the example. | 51 | * for email clients like vies but see the example. |
51 | * | 52 | * |
52 | * @param orient The orientation wether to layout horizontal or vertical | 53 | * @param orient The orientation wether to layout horizontal or vertical |
53 | * @param parent The parent of this widget | 54 | * @param parent The parent of this widget |
54 | * @param name The name passed on to QObject | 55 | * @param name The name passed on to QObject |
55 | * @param fl Additional widgets flags passed to QWidget | 56 | * @param fl Additional widgets flags passed to QWidget |
56 | * | 57 | * |
57 | * @short single c'tor of the OSplitter | 58 | * @short single c'tor of the OSplitter |
58 | */ | 59 | */ |
59 | OSplitter::OSplitter( Orientation orient, QWidget* parent, const char* name, WFlags fl ) | 60 | OSplitter::OSplitter( Orientation orient, QWidget* parent, const char* name, WFlags fl ) |
60 | : QFrame( parent, name, fl ) | 61 | : QFrame( parent, name, fl ) |
61 | { | 62 | { |
62 | m_orient = orient; | 63 | m_orient = orient; |
@@ -147,94 +148,94 @@ QString OSplitter::label()const | |||
147 | void OSplitter::setSizeChange( int width_height ) | 148 | void OSplitter::setSizeChange( int width_height ) |
148 | { | 149 | { |
149 | m_size_policy = width_height; | 150 | m_size_policy = width_height; |
150 | QSize sz(width(), height() ); | 151 | QSize sz(width(), height() ); |
151 | QResizeEvent ev(sz, sz ); | 152 | QResizeEvent ev(sz, sz ); |
152 | resizeEvent(&ev); | 153 | resizeEvent(&ev); |
153 | } | 154 | } |
154 | 155 | ||
155 | /** | 156 | /** |
156 | * This functions allows to add another OSplitter and to share | 157 | * This functions allows to add another OSplitter and to share |
157 | * the OTabBar in small screen mode. The ownerships gets transfered. | 158 | * the OTabBar in small screen mode. The ownerships gets transfered. |
158 | * OSplitters are always added after normal widget items | 159 | * OSplitters are always added after normal widget items |
159 | */ | 160 | */ |
160 | void OSplitter::addWidget( OSplitter* split ) | 161 | void OSplitter::addWidget( OSplitter* split ) |
161 | { | 162 | { |
162 | m_splitter.append( split ); | 163 | m_splitter.append( split ); |
163 | 164 | ||
164 | /* | 165 | /* |
165 | * set tab widget | 166 | * set tab widget |
166 | */ | 167 | */ |
167 | if (m_tabWidget ) | 168 | if (m_tabWidget ) |
168 | setTabWidget( m_parentTab ); | 169 | setTabWidget( m_parentTab ); |
169 | else | 170 | else |
170 | { | 171 | { |
171 | Opie::OSplitterContainer con; | 172 | OSplitterContainer con; |
172 | con.widget =split; | 173 | con.widget =split; |
173 | addToBox( con ); | 174 | addToBox( con ); |
174 | } | 175 | } |
175 | } | 176 | } |
176 | 177 | ||
177 | /* | 178 | /* |
178 | * If in a tab it should be removed | 179 | * If in a tab it should be removed |
179 | * and if in a hbox the reparent kills it too | 180 | * and if in a hbox the reparent kills it too |
180 | */ | 181 | */ |
181 | /** | 182 | /** |
182 | * This removes the splitter again. You currently need to call this | 183 | * This removes the splitter again. You currently need to call this |
183 | * before you delete or otherwise you can get mem corruption | 184 | * before you delete or otherwise you can get mem corruption |
184 | * or other weird behaviour. | 185 | * or other weird behaviour. |
185 | * Owner ship gets transfered back to you it's current parent | 186 | * Owner ship gets transfered back to you it's current parent |
186 | * is 0 | 187 | * is 0 |
187 | */ | 188 | */ |
188 | void OSplitter::removeWidget( OSplitter* split) | 189 | void OSplitter::removeWidget( OSplitter* split) |
189 | { | 190 | { |
190 | split->setTabWidget( 0 ); | 191 | split->setTabWidget( 0 ); |
191 | split->reparent( 0, 0, QPoint(0, 0) ); | 192 | split->reparent( 0, 0, QPoint(0, 0) ); |
192 | } | 193 | } |
193 | 194 | ||
194 | /** | 195 | /** |
195 | * Adds a widget to the Splitter. The widgets gets inserted | 196 | * Adds a widget to the Splitter. The widgets gets inserted |
196 | * at the end of either the Box or TabWidget. | 197 | * at the end of either the Box or TabWidget. |
197 | * Ownership gets transfered and the widgets gets reparented. | 198 | * Ownership gets transfered and the widgets gets reparented. |
198 | * Note: icon and label is only available on small screensizes | 199 | * Note: icon and label is only available on small screensizes |
199 | * if size is smaller than the mark | 200 | * if size is smaller than the mark |
200 | * Warning: No null checking of the widget is done. Only on debug | 201 | * Warning: No null checking of the widget is done. Only on debug |
201 | * a message will be outputtet | 202 | * a message will be outputtet |
202 | * | 203 | * |
203 | * @param wid The widget which will be added | 204 | * @param wid The widget which will be added |
204 | * @param icon The icon of the possible Tab | 205 | * @param icon The icon of the possible Tab |
205 | * @param label The label of the possible Tab | 206 | * @param label The label of the possible Tab |
206 | */ | 207 | */ |
207 | void OSplitter::addWidget( QWidget* wid, const QString& icon, const QString& label ) | 208 | void OSplitter::addWidget( QWidget* wid, const QString& icon, const QString& label ) |
208 | { | 209 | { |
209 | #ifdef DEBUG | 210 | #ifdef DEBUG |
210 | if (!wid ) | 211 | if (!wid ) |
211 | { | 212 | { |
212 | qWarning("Widget is not valid!"); | 213 | qWarning("Widget is not valid!"); |
213 | return; | 214 | return; |
214 | } | 215 | } |
215 | #endif | 216 | #endif |
216 | Opie::OSplitterContainer cont; | 217 | OSplitterContainer cont; |
217 | cont.widget = wid; | 218 | cont.widget = wid; |
218 | cont.icon =icon; | 219 | cont.icon =icon; |
219 | cont.name = label; | 220 | cont.name = label; |
220 | 221 | ||
221 | m_container.append( cont ); | 222 | m_container.append( cont ); |
222 | 223 | ||
223 | /* | 224 | /* |
224 | * | 225 | * |
225 | */ | 226 | */ |
226 | if (!m_splitter.isEmpty() && (m_tabWidget || m_parentTab ) ) | 227 | if (!m_splitter.isEmpty() && (m_tabWidget || m_parentTab ) ) |
227 | setTabWidget( m_parentTab ); | 228 | setTabWidget( m_parentTab ); |
228 | else | 229 | else |
229 | { | 230 | { |
230 | if (m_hbox ) | 231 | if (m_hbox ) |
231 | addToBox( cont ); | 232 | addToBox( cont ); |
232 | else | 233 | else |
233 | addToTab( cont ); | 234 | addToTab( cont ); |
234 | } | 235 | } |
235 | } | 236 | } |
236 | 237 | ||
237 | 238 | ||
238 | /** | 239 | /** |
239 | * Removes the widget from the tab widgets if necessary. | 240 | * Removes the widget from the tab widgets if necessary. |
240 | * OSplitter drops ownership of this widget and the widget | 241 | * OSplitter drops ownership of this widget and the widget |
@@ -375,63 +376,63 @@ void OSplitter::resizeEvent( QResizeEvent* res ) | |||
375 | mode = false; | 376 | mode = false; |
376 | } | 377 | } |
377 | else if ( (res->size().width() <= m_size_policy && | 378 | else if ( (res->size().width() <= m_size_policy && |
378 | m_orient == Horizontal ) || | 379 | m_orient == Horizontal ) || |
379 | (res->size().height() <= m_size_policy && | 380 | (res->size().height() <= m_size_policy && |
380 | m_orient == Vertical ) ) | 381 | m_orient == Vertical ) ) |
381 | { | 382 | { |
382 | changeTab(); | 383 | changeTab(); |
383 | } | 384 | } |
384 | else if ( res->size().height() > m_size_policy && | 385 | else if ( res->size().height() > m_size_policy && |
385 | m_orient == Vertical ) | 386 | m_orient == Vertical ) |
386 | { | 387 | { |
387 | qWarning("Changng to vbox %s", name() ); | 388 | qWarning("Changng to vbox %s", name() ); |
388 | changeVBox(); | 389 | changeVBox(); |
389 | mode = false; | 390 | mode = false; |
390 | } | 391 | } |
391 | 392 | ||
392 | emit sizeChanged(mode, m_orient ); | 393 | emit sizeChanged(mode, m_orient ); |
393 | } | 394 | } |
394 | 395 | ||
395 | /* | 396 | /* |
396 | * Adds a container to a tab either the parent tab | 397 | * Adds a container to a tab either the parent tab |
397 | * or our own | 398 | * or our own |
398 | */ | 399 | */ |
399 | void OSplitter::addToTab( const Opie::OSplitterContainer& con ) | 400 | void OSplitter::addToTab( const Opie::Ui::Private::OSplitterContainer& con ) |
400 | { | 401 | { |
401 | QWidget *wid = con.widget; | 402 | QWidget *wid = con.widget; |
402 | // not needed widgetstack will reparent as well wid.reparent(m_tabWidget, wid->getWFlags(), QPoint(0, 0) ); | 403 | // not needed widgetstack will reparent as well wid.reparent(m_tabWidget, wid->getWFlags(), QPoint(0, 0) ); |
403 | if (m_parentTab ) | 404 | if (m_parentTab ) |
404 | m_parentTab->addTab( wid, con.icon, con.name ); | 405 | m_parentTab->addTab( wid, con.icon, con.name ); |
405 | else | 406 | else |
406 | m_tabWidget->addTab( wid, con.icon, con.name ); | 407 | m_tabWidget->addTab( wid, con.icon, con.name ); |
407 | } | 408 | } |
408 | 409 | ||
409 | 410 | ||
410 | /* | 411 | /* |
411 | * adds a container to the box | 412 | * adds a container to the box |
412 | */ | 413 | */ |
413 | void OSplitter::addToBox( const Opie::OSplitterContainer& con ) | 414 | void OSplitter::addToBox( const Opie::Ui::Private::OSplitterContainer& con ) |
414 | { | 415 | { |
415 | QWidget* wid = con.widget; | 416 | QWidget* wid = con.widget; |
416 | wid->reparent(m_hbox, 0, QPoint(0, 0) ); | 417 | wid->reparent(m_hbox, 0, QPoint(0, 0) ); |
417 | } | 418 | } |
418 | 419 | ||
419 | 420 | ||
420 | /* | 421 | /* |
421 | * Removes a widget from the tab | 422 | * Removes a widget from the tab |
422 | */ | 423 | */ |
423 | void OSplitter::removeFromTab( QWidget* wid ) | 424 | void OSplitter::removeFromTab( QWidget* wid ) |
424 | { | 425 | { |
425 | if (m_parentTab ) | 426 | if (m_parentTab ) |
426 | m_parentTab->removePage( wid ); | 427 | m_parentTab->removePage( wid ); |
427 | else | 428 | else |
428 | m_tabWidget->removePage( wid ); | 429 | m_tabWidget->removePage( wid ); |
429 | } | 430 | } |
430 | 431 | ||
431 | /* | 432 | /* |
432 | * switches over to a OTabWidget layout | 433 | * switches over to a OTabWidget layout |
433 | * it is recursive | 434 | * it is recursive |
434 | */ | 435 | */ |
435 | void OSplitter::changeTab() | 436 | void OSplitter::changeTab() |
436 | { | 437 | { |
437 | /* if we're the owner of the tab widget */ | 438 | /* if we're the owner of the tab widget */ |
@@ -524,49 +525,49 @@ void OSplitter::changeVBox() | |||
524 | } | 525 | } |
525 | 526 | ||
526 | /* | 527 | /* |
527 | * common box code | 528 | * common box code |
528 | * first remove and add children | 529 | * first remove and add children |
529 | * the other splitters | 530 | * the other splitters |
530 | * it is recursive as well due the call to setTabWidget | 531 | * it is recursive as well due the call to setTabWidget |
531 | */ | 532 | */ |
532 | void OSplitter::commonChangeBox() | 533 | void OSplitter::commonChangeBox() |
533 | { | 534 | { |
534 | qWarning(" Name of Splitters is %s", name() ); | 535 | qWarning(" Name of Splitters is %s", name() ); |
535 | 536 | ||
536 | for (ContainerList::Iterator it = m_container.begin(); it != m_container.end(); ++it ) | 537 | for (ContainerList::Iterator it = m_container.begin(); it != m_container.end(); ++it ) |
537 | { | 538 | { |
538 | /* only if parent tab.. m_tabWidgets gets deleted and would do that as well */ | 539 | /* only if parent tab.. m_tabWidgets gets deleted and would do that as well */ |
539 | if (m_parentTab ) | 540 | if (m_parentTab ) |
540 | removeFromTab( (*it).widget ); | 541 | removeFromTab( (*it).widget ); |
541 | qWarning("Adding to box %s", (*it).name.latin1() ); | 542 | qWarning("Adding to box %s", (*it).name.latin1() ); |
542 | addToBox( (*it) ); | 543 | addToBox( (*it) ); |
543 | } | 544 | } |
544 | for ( OSplitter* split = m_splitter.first(); split; split = m_splitter.next() ) | 545 | for ( OSplitter* split = m_splitter.first(); split; split = m_splitter.next() ) |
545 | { | 546 | { |
546 | /* tell them the world had changed */ | 547 | /* tell them the world had changed */ |
547 | split->setTabWidget( 0 ); | 548 | split->setTabWidget( 0 ); |
548 | Opie::OSplitterContainer con; | 549 | OSplitterContainer con; |
549 | con.widget = split; | 550 | con.widget = split; |
550 | // con.widget = split->m_tabWidget ? static_cast<QWidget*>(split->m_tabWidget) | 551 | // con.widget = split->m_tabWidget ? static_cast<QWidget*>(split->m_tabWidget) |
551 | // : static_cast<QWidget*>(split->m_hbox); | 552 | // : static_cast<QWidget*>(split->m_hbox); |
552 | addToBox( con ); | 553 | addToBox( con ); |
553 | } | 554 | } |
554 | 555 | ||
555 | 556 | ||
556 | 557 | ||
557 | if (m_parentTab ) | 558 | if (m_parentTab ) |
558 | m_parentTab->addTab(m_hbox, iconName(), label() ); | 559 | m_parentTab->addTab(m_hbox, iconName(), label() ); |
559 | else | 560 | else |
560 | { | 561 | { |
561 | qWarning(" setting Box geometry for %s", name() ); | 562 | qWarning(" setting Box geometry for %s", name() ); |
562 | m_hbox->setGeometry( frameRect() ); | 563 | m_hbox->setGeometry( frameRect() ); |
563 | m_hbox->show(); | 564 | m_hbox->show(); |
564 | delete m_tabWidget; | 565 | delete m_tabWidget; |
565 | m_tabWidget = 0; | 566 | m_tabWidget = 0; |
566 | show(); // also show this widget | 567 | show(); // also show this widget |
567 | } | 568 | } |
568 | } | 569 | } |
569 | 570 | ||
570 | /* | 571 | /* |
571 | * sets the tabwidget, removes tabs, and relayouts the widget | 572 | * sets the tabwidget, removes tabs, and relayouts the widget |
572 | */ | 573 | */ |
diff --git a/libopie2/opieui/big-screen/osplitter.h b/libopie2/opieui/big-screen/osplitter.h index 2daae7f..7b5ea53 100644 --- a/libopie2/opieui/big-screen/osplitter.h +++ b/libopie2/opieui/big-screen/osplitter.h | |||
@@ -2,99 +2,99 @@ | |||
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 OSPLITTER_H | 29 | #ifndef OSPLITTER_H |
30 | #define OSPLITTER_H | 30 | #define OSPLITTER_H |
31 | 31 | ||
32 | #include "obigscreen_p.h" | 32 | #include "obigscreen_p.h" |
33 | 33 | ||
34 | /* QT */ | 34 | /* QT */ |
35 | #include <qframe.h> | 35 | #include <qframe.h> |
36 | #include <qlist.h> | 36 | #include <qlist.h> |
37 | #include <qstring.h> | 37 | #include <qstring.h> |
38 | #include <qvaluelist.h> | 38 | #include <qvaluelist.h> |
39 | 39 | ||
40 | class QHBox; | 40 | class QHBox; |
41 | 41 | ||
42 | //template class QValueList<Opie::OSplitterContainer>; | 42 | //template class QValueList<Opie::OSplitterContainer>; |
43 | 43 | ||
44 | /* | 44 | /* |
45 | * TODO | 45 | * TODO |
46 | * -check API docu | 46 | * -check API docu |
47 | * -one more example | 47 | * -one more example |
48 | * -allow inserting at a position | 48 | * -allow inserting at a position |
49 | */ | 49 | */ |
50 | 50 | ||
51 | namespace Opie | 51 | namespace Opie{ |
52 | { | 52 | namespace Ui { |
53 | class OTabWidget; | 53 | class OTabWidget; |
54 | 54 | ||
55 | /** | 55 | /** |
56 | * | 56 | * |
57 | * If you've widgets that could be placed side by side but you think | 57 | * If you've widgets that could be placed side by side but you think |
58 | * on small resolutions is not enough place but it would really make sense | 58 | * on small resolutions is not enough place but it would really make sense |
59 | * on bigger resolutions this class will help you. | 59 | * on bigger resolutions this class will help you. |
60 | * You can add as many widgets you want to it. Set a poliy on which width/height it | 60 | * You can add as many widgets you want to it. Set a poliy on which width/height it |
61 | * should switch the layout. | 61 | * should switch the layout. |
62 | * You can either say to place widgets vertical or horizontal. | 62 | * You can either say to place widgets vertical or horizontal. |
63 | * This class uses QHBox, QVBox and QTAbWidget internally. | 63 | * This class uses QHBox, QVBox and QTAbWidget internally. |
64 | * OSplitter takes ownership of the widgets | 64 | * OSplitter takes ownership of the widgets |
65 | * | 65 | * |
66 | * @since 1.2 | 66 | * @since 1.2 |
67 | * | 67 | * |
68 | * @short a small dynamically changing its layout to store two or more widgets side by side | 68 | * @short a small dynamically changing its layout to store two or more widgets side by side |
69 | * @version 0.1 | 69 | * @version 0.1 |
70 | * @author zecke | 70 | * @author zecke |
71 | */ | 71 | */ |
72 | class OSplitter : public QFrame | 72 | class OSplitter : public QFrame |
73 | { | 73 | { |
74 | Q_OBJECT | 74 | Q_OBJECT |
75 | public: | 75 | public: |
76 | typedef QValueList<Opie::OSplitterContainer> ContainerList; | 76 | typedef QValueList<Opie::Ui::Private::OSplitterContainer> ContainerList; |
77 | OSplitter( Qt::Orientation = Horizontal, QWidget *parent = 0, | 77 | OSplitter( Qt::Orientation = Horizontal, QWidget *parent = 0, |
78 | const char* name = 0, WFlags fl = 0 ); | 78 | const char* name = 0, WFlags fl = 0 ); |
79 | ~OSplitter(); | 79 | ~OSplitter(); |
80 | 80 | ||
81 | void setLabel( const QString& name ); | 81 | void setLabel( const QString& name ); |
82 | void setIconName( const QString& name ); | 82 | void setIconName( const QString& name ); |
83 | QString label()const; | 83 | QString label()const; |
84 | QString iconName()const; | 84 | QString iconName()const; |
85 | 85 | ||
86 | void setSizeChange( int width_height ); | 86 | void setSizeChange( int width_height ); |
87 | 87 | ||
88 | void addWidget( OSplitter* splitter ); | 88 | void addWidget( OSplitter* splitter ); |
89 | void addWidget( QWidget* wid, const QString& icon, const QString& label ); | 89 | void addWidget( QWidget* wid, const QString& icon, const QString& label ); |
90 | void removeWidget( QWidget* ); | 90 | void removeWidget( QWidget* ); |
91 | void removeWidget( OSplitter* ); | 91 | void removeWidget( OSplitter* ); |
92 | 92 | ||
93 | void setCurrentWidget( QWidget* ); | 93 | void setCurrentWidget( QWidget* ); |
94 | void setCurrentWidget( const QString& label ); | 94 | void setCurrentWidget( const QString& label ); |
95 | void setCurrentWidget( int ); | 95 | void setCurrentWidget( int ); |
96 | QWidget* currentWidget()const; | 96 | QWidget* currentWidget()const; |
97 | 97 | ||
98 | 98 | ||
99 | signals: | 99 | signals: |
100 | /** | 100 | /** |
@@ -103,48 +103,49 @@ signals: | |||
103 | */ | 103 | */ |
104 | void currentChanged( QWidget* ); | 104 | void currentChanged( QWidget* ); |
105 | 105 | ||
106 | /** | 106 | /** |
107 | * emitted whenever a border is crossed | 107 | * emitted whenever a border is crossed |
108 | * true if in small screen mode | 108 | * true if in small screen mode |
109 | * false if in bigscreen | 109 | * false if in bigscreen |
110 | * this signal is emitted after the layout switch | 110 | * this signal is emitted after the layout switch |
111 | * @param b The layout mode | 111 | * @param b The layout mode |
112 | * @param ori The orientation | 112 | * @param ori The orientation |
113 | */ | 113 | */ |
114 | void sizeChanged( bool b, Orientation ori); | 114 | void sizeChanged( bool b, Orientation ori); |
115 | public: | 115 | public: |
116 | // QSize sizeHint()const; | 116 | // QSize sizeHint()const; |
117 | // QSize minimumSizeHint()const; | 117 | // QSize minimumSizeHint()const; |
118 | 118 | ||
119 | protected: | 119 | protected: |
120 | void resizeEvent( QResizeEvent* ); | 120 | void resizeEvent( QResizeEvent* ); |
121 | 121 | ||
122 | private: | 122 | private: |
123 | /* true if OTabMode */ | 123 | /* true if OTabMode */ |
124 | bool layoutMode()const; | 124 | bool layoutMode()const; |
125 | // void reparentAll(); | 125 | // void reparentAll(); |
126 | void setTabWidget( OTabWidget*); | 126 | void setTabWidget( OTabWidget*); |
127 | void addToTab( const Opie::OSplitterContainer& ); | 127 | void addToTab( const Opie::Ui::Private::OSplitterContainer& ); |
128 | void addToBox( const Opie::OSplitterContainer& ); | 128 | void addToBox( const Opie::Ui::Private::OSplitterContainer& ); |
129 | void removeFromTab( QWidget* ); | 129 | void removeFromTab( QWidget* ); |
130 | void changeTab(); | 130 | void changeTab(); |
131 | void changeHBox(); | 131 | void changeHBox(); |
132 | void changeVBox(); | 132 | void changeVBox(); |
133 | void commonChangeBox(); | 133 | void commonChangeBox(); |
134 | QHBox *m_hbox; | 134 | QHBox *m_hbox; |
135 | OTabWidget *m_tabWidget; | 135 | OTabWidget *m_tabWidget; |
136 | OTabWidget *m_parentTab; | 136 | OTabWidget *m_parentTab; |
137 | Orientation m_orient; | 137 | Orientation m_orient; |
138 | int m_size_policy; | 138 | int m_size_policy; |
139 | 139 | ||
140 | ContainerList m_container; | 140 | ContainerList m_container; |
141 | QList<OSplitter> m_splitter; | 141 | QList<OSplitter> m_splitter; |
142 | 142 | ||
143 | QString m_icon, m_name; | 143 | QString m_icon, m_name; |
144 | 144 | ||
145 | struct Private; | 145 | struct Private; |
146 | Private *d; | 146 | Private *d; |
147 | }; | 147 | }; |
148 | }; | 148 | } |
149 | } | ||
149 | 150 | ||
150 | #endif | 151 | #endif |
diff --git a/libopie2/opieui/big-screen/owidgetstack.cpp b/libopie2/opieui/big-screen/owidgetstack.cpp index 57e97e3..a0a6355 100644 --- a/libopie2/opieui/big-screen/owidgetstack.cpp +++ b/libopie2/opieui/big-screen/owidgetstack.cpp | |||
@@ -11,53 +11,53 @@ | |||
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 "owidgetstack.h" | 29 | #include "owidgetstack.h" |
30 | 30 | ||
31 | /* QT */ | 31 | /* QT */ |
32 | #include <qapplication.h> | 32 | #include <qapplication.h> |
33 | #include <qwidgetstack.h> | 33 | #include <qwidgetstack.h> |
34 | 34 | ||
35 | namespace { | 35 | namespace Opie { |
36 | namespace Ui { | ||
36 | const int mode_size = 330; | 37 | const int mode_size = 330; |
37 | } | ||
38 | 38 | ||
39 | using namespace Opie; | 39 | |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * This is the standard widget. For simple usage see the example. Normally this widget | 42 | * This is the standard widget. For simple usage see the example. Normally this widget |
43 | * is the central widget of a QMainWindow. | 43 | * is the central widget of a QMainWindow. |
44 | * Use removeWidget before you delete a widget yourself. OWidgetStack does not | 44 | * Use removeWidget before you delete a widget yourself. OWidgetStack does not |
45 | * yet recognize removal of children. | 45 | * yet recognize removal of children. |
46 | * | 46 | * |
47 | * @param parent The parent widget. It maybe 0 but then you need to take care of deletion. | 47 | * @param parent The parent widget. It maybe 0 but then you need to take care of deletion. |
48 | * Or you use QPEApplication::showMainWidget(). | 48 | * Or you use QPEApplication::showMainWidget(). |
49 | * @param name Name will be passed on to QObject | 49 | * @param name Name will be passed on to QObject |
50 | * @param fl Additional window flags passed to QFrame. see @Qt::WFlags | 50 | * @param fl Additional window flags passed to QFrame. see @Qt::WFlags |
51 | */ | 51 | */ |
52 | OWidgetStack::OWidgetStack( QWidget* parent, const char* name, WFlags fl) | 52 | OWidgetStack::OWidgetStack( QWidget* parent, const char* name, WFlags fl) |
53 | : QFrame( parent, name, fl ) | 53 | : QFrame( parent, name, fl ) |
54 | { | 54 | { |
55 | m_last = m_mWidget = 0; | 55 | m_last = m_mWidget = 0; |
56 | m_forced = false; | 56 | m_forced = false; |
57 | 57 | ||
58 | QApplication::desktop()->installEventFilter( this ); | 58 | QApplication::desktop()->installEventFilter( this ); |
59 | setFontPropagation ( AllChildren ); | 59 | setFontPropagation ( AllChildren ); |
60 | setPalettePropagation( AllChildren ); | 60 | setPalettePropagation( AllChildren ); |
61 | 61 | ||
62 | /* sets m_mode and initializes more */ | 62 | /* sets m_mode and initializes more */ |
63 | /* if you change this call change switchTop as well */ | 63 | /* if you change this call change switchTop as well */ |
@@ -412,24 +412,27 @@ void OWidgetStack::switchTop() { | |||
412 | /* this works because it is guaranteed that switchStack was called at least once*/ | 412 | /* this works because it is guaranteed that switchStack was called at least once*/ |
413 | if (!m_stack && m_mWidget) { | 413 | if (!m_stack && m_mWidget) { |
414 | m_mWidget->setGeometry( frameRect() ); | 414 | m_mWidget->setGeometry( frameRect() ); |
415 | return; | 415 | return; |
416 | }else if (!m_stack) | 416 | }else if (!m_stack) |
417 | return; | 417 | return; |
418 | 418 | ||
419 | if (!m_list.isEmpty() ) { | 419 | if (!m_list.isEmpty() ) { |
420 | QMap<int, QWidget*>::Iterator it = m_list.begin(); | 420 | QMap<int, QWidget*>::Iterator it = m_list.begin(); |
421 | for ( ; it != m_list.end(); ++it ) { | 421 | for ( ; it != m_list.end(); ++it ) { |
422 | /* better than reparenting twice */ | 422 | /* better than reparenting twice */ |
423 | if ( it.data() == m_mWidget ) { | 423 | if ( it.data() == m_mWidget ) { |
424 | m_mWidget->reparent(this, 0, frameRect().topLeft() ); | 424 | m_mWidget->reparent(this, 0, frameRect().topLeft() ); |
425 | m_mWidget->setGeometry( frameRect() ); | 425 | m_mWidget->setGeometry( frameRect() ); |
426 | m_mWidget->show(); | 426 | m_mWidget->show(); |
427 | }else | 427 | }else |
428 | /* ### FIXME we need to place the widget better */ | 428 | /* ### FIXME we need to place the widget better */ |
429 | it.data()->reparent(0, WType_TopLevel, QPoint(10, 10) ); | 429 | it.data()->reparent(0, WType_TopLevel, QPoint(10, 10) ); |
430 | } | 430 | } |
431 | } | 431 | } |
432 | 432 | ||
433 | delete m_stack; | 433 | delete m_stack; |
434 | m_stack = 0; | 434 | m_stack = 0; |
435 | } | 435 | } |
436 | |||
437 | } | ||
438 | } \ No newline at end of file | ||
diff --git a/libopie2/opieui/big-screen/owidgetstack.h b/libopie2/opieui/big-screen/owidgetstack.h index 53818c8..d2f9a9f 100644 --- a/libopie2/opieui/big-screen/owidgetstack.h +++ b/libopie2/opieui/big-screen/owidgetstack.h | |||
@@ -14,50 +14,50 @@ | |||
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 OWIDGETSTACK_H | 29 | #ifndef OWIDGETSTACK_H |
30 | #define OWIDGETSTACK_H | 30 | #define OWIDGETSTACK_H |
31 | 31 | ||
32 | /* QT*/ | 32 | /* QT*/ |
33 | #include <qframe.h> | 33 | #include <qframe.h> |
34 | #include <qmap.h> | 34 | #include <qmap.h> |
35 | 35 | ||
36 | class QWidgetStack; | 36 | class QWidgetStack; |
37 | 37 | ||
38 | namespace Opie | 38 | namespace Opie { |
39 | { | 39 | namespace Ui { |
40 | /** | 40 | /** |
41 | * | 41 | * |
42 | * OWidgetStack is the answer to the problem of using Opie at different screen | 42 | * OWidgetStack is the answer to the problem of using Opie at different screen |
43 | * sizes and to have a different behaviour. Most applications use a QWidgetStack | 43 | * sizes and to have a different behaviour. Most applications use a QWidgetStack |
44 | * to supply a view on click. And by clicking the (X) you go back but this | 44 | * to supply a view on click. And by clicking the (X) you go back but this |
45 | * behaviour feels strange on bigger screens. It's ok on smaller one because | 45 | * behaviour feels strange on bigger screens. It's ok on smaller one because |
46 | * one can't determine the difference. | 46 | * one can't determine the difference. |
47 | * This stack reads the default out of the size of the desktop widget but | 47 | * This stack reads the default out of the size of the desktop widget but |
48 | * can be forced to have either the one or the other behaviour. | 48 | * can be forced to have either the one or the other behaviour. |
49 | * The first widget added is considered the 'main' widget and its | 49 | * The first widget added is considered the 'main' widget and its |
50 | * sizeHint will be taking if in BigScreen mode. | 50 | * sizeHint will be taking if in BigScreen mode. |
51 | * In small screen mode this widget behaves exactly like a QWidgetStack and in BigScreen | 51 | * In small screen mode this widget behaves exactly like a QWidgetStack and in BigScreen |
52 | * mode it'll use the MainWindow as child of this widget and arranges the others as | 52 | * mode it'll use the MainWindow as child of this widget and arranges the others as |
53 | * hidden top level widgets. | 53 | * hidden top level widgets. |
54 | * | 54 | * |
55 | * @version 0.1 | 55 | * @version 0.1 |
56 | * @author hOlgAr F. | 56 | * @author hOlgAr F. |
57 | * @short Either a true stack or a list of top Level widgets | 57 | * @short Either a true stack or a list of top Level widgets |
58 | */ | 58 | */ |
59 | class OWidgetStack : public QFrame { | 59 | class OWidgetStack : public QFrame { |
60 | Q_OBJECT | 60 | Q_OBJECT |
61 | public: | 61 | public: |
62 | enum Mode { SmallScreen, BigScreen, NoForce }; | 62 | enum Mode { SmallScreen, BigScreen, NoForce }; |
63 | OWidgetStack( QWidget* parent, const char* name = 0, WFlags fl = 0 ); | 63 | OWidgetStack( QWidget* parent, const char* name = 0, WFlags fl = 0 ); |
@@ -106,27 +106,28 @@ public slots: | |||
106 | void raiseWidget( QWidget* ); | 106 | void raiseWidget( QWidget* ); |
107 | void hideWidget( int ); | 107 | void hideWidget( int ); |
108 | void hideWidget( QWidget* ); | 108 | void hideWidget( QWidget* ); |
109 | void setMainWindow( QWidget* ); | 109 | void setMainWindow( QWidget* ); |
110 | void setMainWindow( int ); | 110 | void setMainWindow( int ); |
111 | 111 | ||
112 | protected: | 112 | protected: |
113 | void resizeEvent( QResizeEvent* ); | 113 | void resizeEvent( QResizeEvent* ); |
114 | 114 | ||
115 | private: | 115 | private: |
116 | void switchStack(); | 116 | void switchStack(); |
117 | void switchTop(); | 117 | void switchTop(); |
118 | QMap<int, QWidget*> m_list; | 118 | QMap<int, QWidget*> m_list; |
119 | QWidgetStack *m_stack; | 119 | QWidgetStack *m_stack; |
120 | QWidget *m_mWidget; | 120 | QWidget *m_mWidget; |
121 | QWidget *m_last; | 121 | QWidget *m_last; |
122 | 122 | ||
123 | enum Mode m_mode; | 123 | enum Mode m_mode; |
124 | bool m_forced : 1; | 124 | bool m_forced : 1; |
125 | 125 | ||
126 | struct Private; | 126 | struct Private; |
127 | Private *d; | 127 | Private *d; |
128 | }; | 128 | }; |
129 | 129 | ||
130 | }; | 130 | } |
131 | } | ||
131 | 132 | ||
132 | #endif | 133 | #endif |