summaryrefslogtreecommitdiff
path: root/libopie2/opieui/big-screen
Unidiff
Diffstat (limited to 'libopie2/opieui/big-screen') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/big-screen/obigscreen_p.h9
-rw-r--r--libopie2/opieui/big-screen/osplitter.cpp13
-rw-r--r--libopie2/opieui/big-screen/osplitter.h15
-rw-r--r--libopie2/opieui/big-screen/owidgetstack.cpp9
-rw-r--r--libopie2/opieui/big-screen/owidgetstack.h7
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
7class QWidget; 7class QWidget;
8 8
9namespace Opie 9namespace Opie {
10{ 10namespace Ui {
11namespace Private{
11 12
12struct OSplitterContainer 13struct 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
@@ -26,25 +26,26 @@
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
38using namespace Opie; 38using namespace Opie::Ui;
39using 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.
@@ -159,25 +160,25 @@ void OSplitter::setSizeChange( int width_height )
159 */ 160 */
160void OSplitter::addWidget( OSplitter* split ) 161void 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
@@ -204,25 +205,25 @@ void OSplitter::removeWidget( OSplitter* split)
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 */
207void OSplitter::addWidget( QWidget* wid, const QString& icon, const QString& label ) 208void 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
@@ -387,39 +388,39 @@ void OSplitter::resizeEvent( QResizeEvent* res )
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 */
399void OSplitter::addToTab( const Opie::OSplitterContainer& con ) 400void 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 */
413void OSplitter::addToBox( const Opie::OSplitterContainer& con ) 414void 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 */
423void OSplitter::removeFromTab( QWidget* wid ) 424void OSplitter::removeFromTab( QWidget* wid )
424{ 425{
425 if (m_parentTab ) 426 if (m_parentTab )
@@ -536,25 +537,25 @@ void OSplitter::commonChangeBox()
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 {
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
@@ -14,75 +14,75 @@
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
40class QHBox; 40class 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
51namespace Opie 51namespace Opie{
52{ 52namespace Ui {
53class OTabWidget; 53class 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 */
72class OSplitter : public QFrame 72class OSplitter : public QFrame
73{ 73{
74 Q_OBJECT 74 Q_OBJECT
75public: 75public:
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 );
@@ -115,36 +115,37 @@ signals:
115public: 115public:
116 // QSize sizeHint()const; 116 // QSize sizeHint()const;
117 // QSize minimumSizeHint()const; 117 // QSize minimumSizeHint()const;
118 118
119protected: 119protected:
120 void resizeEvent( QResizeEvent* ); 120 void resizeEvent( QResizeEvent* );
121 121
122private: 122private:
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
@@ -23,29 +23,29 @@
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
35namespace { 35namespace Opie {
36namespace Ui {
36 const int mode_size = 330; 37 const int mode_size = 330;
37}
38 38
39using 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 */
@@ -424,12 +424,15 @@ void OWidgetStack::switchTop() {
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
@@ -26,26 +26,26 @@
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
36class QWidgetStack; 36class QWidgetStack;
37 37
38namespace Opie 38namespace Opie {
39{ 39namespace 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
@@ -118,15 +118,16 @@ private:
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