summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/big-screen/example/osplitter_example.cpp28
-rw-r--r--libopie/big-screen/example/osplitter_example.h20
-rw-r--r--libopie/big-screen/example/osplitter_example.obin0 -> 17276 bytes
-rw-r--r--libopie/big-screen/example/osplitter_example.pro13
-rw-r--r--libopie/big-screen/obigscreen_p.h20
-rw-r--r--libopie/big-screen/osplitter.cpp165
-rw-r--r--libopie/big-screen/osplitter.h22
7 files changed, 228 insertions, 40 deletions
diff --git a/libopie/big-screen/example/osplitter_example.cpp b/libopie/big-screen/example/osplitter_example.cpp
new file mode 100644
index 0000000..e337379
--- a/dev/null
+++ b/libopie/big-screen/example/osplitter_example.cpp
@@ -0,0 +1,28 @@
1#include <qdir.h>
2#include <qlayout.h>
3
4#include "../osplitter.h"
5
6#include <qpe/qpeapplication.h>
7#include <opie/oapplicationfactory.h>
8
9#include "osplitter_example.h"
10
11OPIE_EXPORT_APP( OApplicationFactory<OSplitterExample> )
12
13OSplitterExample::OSplitterExample( QWidget *w,const char* n,WFlags f )
14 : QWidget( w, n, f ){
15 QVBoxLayout * lay = new QVBoxLayout(this);
16 OSplitter * splitter = new OSplitter( Horizontal, this );
17 lay->addWidget( splitter );
18
19 OFileSelector *selector = new OFileSelector( splitter, OFileSelector::FileSelector,
20 OFileSelector::Normal, QDir::homeDirPath(),
21 QString::null );
22 splitter->addWidget( selector, "zoom", tr("Selector 1") );
23
24 selector = new OFileSelector( splitter, OFileSelector::FileSelector, OFileSelector::Normal,
25 QDir::homeDirPath(), QString::null );
26 splitter->addWidget( selector, "zoom", tr("Selector 2") );
27
28}
diff --git a/libopie/big-screen/example/osplitter_example.h b/libopie/big-screen/example/osplitter_example.h
new file mode 100644
index 0000000..ae8f120
--- a/dev/null
+++ b/libopie/big-screen/example/osplitter_example.h
@@ -0,0 +1,20 @@
1/*
2 * May be used, copied and modified wihtout any limitation
3 */
4
5#ifndef OSPlitter_EXAMPLE_H
6#define OSPlitter_EXAMPLE_H
7
8#include <qvbox.h>
9#include <opie/ofileselector.h>
10
11class OSplitterExample : public QWidget {
12 Q_OBJECT
13public:
14 static QString appName() { return QString::fromLatin1("osplitter_example"); }
15 OSplitterExample( QWidget *parent, const char* name, WFlags fl );
16
17};
18
19
20#endif
diff --git a/libopie/big-screen/example/osplitter_example.o b/libopie/big-screen/example/osplitter_example.o
new file mode 100644
index 0000000..e52d5d9
--- a/dev/null
+++ b/libopie/big-screen/example/osplitter_example.o
Binary files differ
diff --git a/libopie/big-screen/example/osplitter_example.pro b/libopie/big-screen/example/osplitter_example.pro
new file mode 100644
index 0000000..b12bf17
--- a/dev/null
+++ b/libopie/big-screen/example/osplitter_example.pro
@@ -0,0 +1,13 @@
1CONFIG = qt warn_on
2TEMPLATE = app
3TARGET = osplitter_example
4
5HEADERS = osplitter_example.h ../osplitter.h
6SOURCES = osplitter_example.cpp ../osplitter.cpp
7
8INCLUDEPATH += $(OPIEDIR)/include ../
9DEPENDSPATH += $(OPIEDIR)/include
10
11LIBS += -lqpe -lopie
12
13include ( $(OPIEDIR)/include.pro ) \ No newline at end of file
diff --git a/libopie/big-screen/obigscreen_p.h b/libopie/big-screen/obigscreen_p.h
new file mode 100644
index 0000000..ed256d9
--- a/dev/null
+++ b/libopie/big-screen/obigscreen_p.h
@@ -0,0 +1,20 @@
1#ifndef OPIE_BIG_SCREEN_PRIVATE
2#define OPIE_BIG_SCREEN_PRIVATE
3
4namespace Opie {
5
6struct OSplitterContainer {
7 bool operator==( const OSplitterContainer& o)const {
8 if (widget != o.widget ) return false;
9 if (icon != o.icon ) return false;
10 if (name != o.name ) return false;
11 return true;
12 }
13 QWidget* widget;
14 QString icon;
15 QString name;
16};
17
18}
19
20#endif
diff --git a/libopie/big-screen/osplitter.cpp b/libopie/big-screen/osplitter.cpp
index dcb5cc5..ce53ee1 100644
--- a/libopie/big-screen/osplitter.cpp
+++ b/libopie/big-screen/osplitter.cpp
@@ -1,213 +1,318 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 hOlgAr <zecke@handhelds.org> 3             .=l. Copyright (c) 2002 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
37struct OSplitterContainer {
38 QWidget* widget;
39 const QString& icon
40 const QString& name;
41};
42
43
44/** 37/**
45 * 38 *
46 * This is the constructor of OSplitter 39 * This is the constructor of OSplitter
47 * You might want to call setSizeChange to tell 40 * You might want to call setSizeChange to tell
48 * OSplitter to change its layout when a specefic 41 * OSplitter to change its layout when a specefic
49 * mark was crossed. OSplitter sets a default value. 42 * mark was crossed. OSplitter sets a default value.
50 * 43 *
51 * You cann add widget with addWidget to the OSplitter. 44 * You cann add widget with addWidget to the OSplitter.
52 * 45 *
53 * @param orient The orientation wether to layout horizontal or vertical 46 * @param orient The orientation wether to layout horizontal or vertical
54 * @param parent The parent of this widget 47 * @param parent The parent of this widget
55 * @param name The name passed on to QObject 48 * @param name The name passed on to QObject
56 * @param fl Additional widgets flags passed to QWidget 49 * @param fl Additional widgets flags passed to QWidget
57 * 50 *
58 * @short single c'tor of the OSplitter 51 * @short single c'tor of the OSplitter
59 */ 52 */
60OSplitter::OSplitter( Orientation orient, QWidget* parent, const char* name, WFlags fl ) 53OSplitter::OSplitter( Orientation orient, QWidget* parent, const char* name, WFlags fl )
61 : QWidget( parent, name, fl ) 54 : QFrame( parent, name, fl )
62{ 55{
63 m_orient = orient; 56 m_orient = orient;
64 m_hbox = 0; 57 m_hbox = 0;
65 m_tabWidget = 0;
66 m_size_policy = 330; 58 m_size_policy = 330;
59 setFontPropagation( AllChildren );
60 setPalettePropagation( AllChildren );
61
62 m_tabWidget = new OTabWidget(this);
67} 63}
68 64
69 65
70/** 66/**
71 * Destructor destructs this object and cleans up. All child 67 * Destructor destructs this object and cleans up. All child
72 * widgets will be deleted 68 * widgets will be deleted
73 * @see addWidget 69 * @see addWidget
74 */ 70 */
75OSplitter::~OSplitter() { 71OSplitter::~OSplitter() {
76 delete m_hbox; 72 delete m_hbox;
77 delete m_tabWidget; 73 delete m_tabWidget;
78} 74}
79 75
80 76
81/** 77/**
82 * This function sets the size change policy of the splitter. 78 * This function sets the size change policy of the splitter.
83 * If this size marked is crossed the splitter will relayout. 79 * If this size marked is crossed the splitter will relayout.
84 * Note that depending on the set Orientation it'll either look 80 * Note that depending on the set Orientation it'll either look
85 * at the width or height. 81 * at the width or height.
86 * 82 *
87 * @param width_height The mark that will be watched. Interpreted depending on the Orientation of the Splitter. 83 * @param width_height The mark that will be watched. Interpreted depending on the Orientation of the Splitter.
88 * @return void 84 * @return void
89 */ 85 */
90void OSplitter::setSizeChange( int width_height ) { 86void OSplitter::setSizeChange( int width_height ) {
91 m_size_policy = width_height; 87 m_size_policy = width_height;
92 relayout(); 88 QSize sz(width(), height() );
89 QResizeEvent ev(sz, sz );
90 resizeEvent(&ev);
93} 91}
94 92
95/** 93/**
96 * Adds a widget to the Splitter. The widgets gets inserted 94 * Adds a widget to the Splitter. The widgets gets inserted
97 * at the end of either the Box or TabWidget. 95 * at the end of either the Box or TabWidget.
98 * Ownership gets transfered and the widgets gets reparented. 96 * Ownership gets transfered and the widgets gets reparented.
99 * Note: icon and label is only available on small screensizes 97 * Note: icon and label is only available on small screensizes
100 * if size is smaller than the mark 98 * if size is smaller than the mark
101 * Warning: No null checking of the widget is done. Only on debug 99 * Warning: No null checking of the widget is done. Only on debug
102 * a message will be outputtet 100 * a message will be outputtet
103 * 101 *
104 * @param wid The widget which will be added 102 * @param wid The widget which will be added
105 * @param icon The icon of the possible Tab 103 * @param icon The icon of the possible Tab
106 * @param label The label of the possible Tab 104 * @param label The label of the possible Tab
107 */ 105 */
108void OSplitter::addWidget( QWidget* wid, const QString& icon, const QString& label ) { 106void OSplitter::addWidget( QWidget* wid, const QString& icon, const QString& label ) {
109#ifdef DEBUG 107#ifdef DEBUG
110 if (!wid ) { 108 if (!wid ) {
111 qWarning("Widget is not valid!"); 109 qWarning("Widget is not valid!");
112 return; 110 return;
113 } 111 }
114#endif 112#endif
115 OSplitterContainer cont; 113 Opie::OSplitterContainer cont;
116 cont.widget = wid; 114 cont.widget = wid;
117 cont.icon =icon; 115 cont.icon =icon;
118 cont.label = label; 116 cont.name = label;
119 117
120 m_container.append( cont ); 118 m_container.append( cont );
121 119
122 if (m_hbox ) 120 if (m_hbox )
123 addToBox( cont ); 121 addToBox( cont );
124 else 122 else
125 addToTab( cont ); 123 addToTab( cont );
126} 124}
127 125
128 126
129/** 127/**
130 * Removes the widget from the tab widgets. OSplitter drops ownership 128 * Removes the widget from the tab widgets if necessary.
131 * of this widget and the widget will be reparented to 0. 129 * OSplitter drops ownership of this widget and the widget
130 * will be reparented i tto 0.
132 * The widget will not be deleted. 131 * The widget will not be deleted.
133 * 132 *
134 * @param w The widget to be removed 133 * @param w The widget to be removed
135 */ 134 */
136void OSplitter::removeWidget( QWidget* w) { 135void OSplitter::removeWidget( QWidget* w) {
137 /* if not widget nor parent or parent not any of my master childs return */ 136 ContainerList::Iterator it;
138 if (!w && w->parent() && ( w->parent() != m_hbox || w->parent() != m_tabWidget ) ) 137 for ( it = m_container.begin(); it != m_container.end(); ++it )
138 if ( (*it).widget == w )
139 break;
140
141 if (it == m_container.end() )
139 return; 142 return;
140 143
144
141 /* only tab needs to be removed.. box recognizes it */ 145 /* only tab needs to be removed.. box recognizes it */
142 if ( !m_hbox ) 146 if ( !m_hbox )
143 removeFromTab( w ); 147 removeFromTab( w );
144 148
145 149
146 /* Find the widget, reparent it and remove it from our list */ 150 /* Find reparent it and remove it from our list */
147 ContainerList::Iterator it;
148 for ( it = m_container.begin(); it != m_container.end(); ++it )
149 if ( (*it).widget == w ) {
150 w.reparent( 0, w.getWFlags );
151 it = m_container.remove( it );
152 break;
153 }
154 151
152 w->reparent( 0, 0, QPoint(0, 0));
153 it = m_container.remove( it );
155 154
156} 155}
157 156
158 157
159/** 158/**
160 * This method will give focus to the widget. If in a tabwidget 159 * This method will give focus to the widget. If in a tabwidget
161 * the tabbar will be changed 160 * the tabbar will be changed
162 * 161 *
163 * @param w The widget which will be set the current one 162 * @param w The widget which will be set the current one
164 */ 163 */
165void OSplitter::setCurrentWidget( QWidget* w) { 164void OSplitter::setCurrentWidget( QWidget* w) {
166 if (m_tabWidget ) 165 if (m_tabWidget )
167 m_tabWidget->setCurrentWidget( w ); 166 m_tabWidget->setCurrentTab( w );
168 else 167// else
169 m_hbox->setFocus( w ); 168 // m_hbox->setFocus( w );
170 169
171} 170}
172 171
173/** 172/**
174 * This is an overloaded member function and only differs in the argument it takes. 173 * This is an overloaded member function and only differs in the
174 * argument it takes.
175 * Searches list of widgets for label. It'll pick the first label it finds 175 * Searches list of widgets for label. It'll pick the first label it finds
176 * 176 *
177 * @param label Label to look for. First match will be taken 177 * @param label Label to look for. First match will be taken
178 */ 178 */
179void OSplitter::setCurrentWidget( const QString& label ) { 179void OSplitter::setCurrentWidget( const QString& label ) {
180 ContainerList::Iterator it; 180 ContainerList::Iterator it;
181 for (it = m_container.begin(); it != m_container.end(); ++it ) { 181 for (it = m_container.begin(); it != m_container.end(); ++it ) {
182 if ( (*it).name == label ) { 182 if ( (*it).name == label ) {
183 setCurrentWidget( (*it).widget ); 183 setCurrentWidget( (*it).widget );
184 break; 184 break;
185 } 185 }
186 } 186 }
187} 187}
188 188
189/** 189/**
190 * return the currently activated widget if in tab widget moud 190 * return the currently activated widget if in tab widget mode
191 * or null because all widgets are visible 191 * or null because all widgets are visible
192 */ 192 */
193QWidget* OSplitter::currentWidget() { 193QWidget* OSplitter::currentWidget() {
194 if ( m_hbox ) 194 if ( m_hbox )
195 return 0l; 195 return 0l;
196 else 196 else
197 return m_tabWidget->currentWidget(); 197 return m_tabWidget->currentWidget();
198} 198}
199 199
200 200#if 0
201/** 201/**
202 * @reimplented for internal reasons 202 * @reimplented for internal reasons
203 * returns the sizeHint of one of its sub widgets 203 * returns the sizeHint of one of its sub widgets
204 */ 204 */
205QSize OSplitter::sizeHint()const { 205QSize OSplitter::sizeHint()const {
206 if (m_hbox )
207 return m_hbox->sizeHint();
208 else
209 return m_tabWidget->sizeHint();
206} 210}
211#endif
207 212
208/** 213/**
209 * @reimplemented for internal reasons 214 * @reimplemented for internal reasons
210 */ 215 */
211void OSplitter::resizeEvent( QResizeEvent* res ) { 216void OSplitter::resizeEvent( QResizeEvent* res ) {
217 QFrame::resizeEvent( res );
218 /*
219 *
220 */
221// qWarning("Old size was width = %d height = %d", res->oldSize().width(), res->oldSize().height() );
222// qWarning("New size is width = %d height = %d", res->size().width(), res->size().height() );
223 if ( res->size().width() > m_size_policy &&
224 m_orient == Horizontal ) {
225 changeHBox();
226 }else if ( (res->size().width() <= m_size_policy &&
227 m_orient == Horizontal ) ||
228 (res->size().height() <= m_size_policy &&
229 m_orient == Vertical ) ) {
230 changeTab();
231 }else if ( res->size().height() > m_size_policy &&
232 m_size_policy == Vertical ) {
233 changeVBox();
234 }
235}
236
237
238void OSplitter::addToTab( const Opie::OSplitterContainer& con ) {
239 QWidget *wid = con.widget;
240// not needed widgetstack will reparent as well wid.reparent(m_tabWidget, wid->getWFlags(), QPoint(0, 0) );
241 m_tabWidget->addTab( wid, con.icon, con.name );
242}
243
244void OSplitter::addToBox( const Opie::OSplitterContainer& con ) {
245 QWidget* wid = con.widget;
246 wid->reparent(m_hbox, 0, QPoint(0, 0) );
247}
212 248
249void OSplitter::removeFromTab( QWidget* wid ) {
250 m_tabWidget->removePage( wid );
251}
252
253void OSplitter::changeTab() {
254 if (m_tabWidget ) {
255 m_tabWidget->setGeometry( frameRect() );
256 return;
257 }
258
259 qWarning(" New Tab Widget ");
260 /*
261 * and add all widgets this will reparent them
262 * delete m_hbox set it to 0
263 *
264 */
265 m_tabWidget = new OTabWidget( this );
266
267 for ( ContainerList::Iterator it = m_container.begin(); it != m_container.end(); ++it ) {
268 qWarning("Widget is %s", (*it).name.latin1() );
269 addToTab( (*it) );
270 }
271
272 delete m_hbox;
273 m_hbox = 0;
274 m_tabWidget->setGeometry( frameRect() );
275 m_tabWidget->show();
276
277}
278
279void OSplitter::changeHBox() {
280 if (m_hbox ) {
281 m_hbox->setGeometry( frameRect() );
282 return;
283 }
284
285 qWarning("new HBox");
286 m_hbox = new QHBox( this );
287 commonChangeBox();
288 delete m_tabWidget;
289 m_tabWidget = 0;
290 m_hbox->setGeometry( frameRect() );
291 m_hbox->show();
292}
293
294void OSplitter::changeVBox() {
295 if (m_hbox ) {
296 m_hbox->setGeometry( frameRect() );
297 return;
298 }
299
300 qWarning("New VBOX");
301 m_hbox = new QVBox( this );
302
303 commonChangeBox();
304 delete m_tabWidget;
305 m_tabWidget = 0;
306 m_hbox->setGeometry( frameRect() );
307 m_hbox->show();
308}
309
310
311void OSplitter::commonChangeBox() {
312 for (ContainerList::Iterator it = m_container.begin(); it != m_container.end(); ++it ) {
313 qWarning("Adding to box %s", (*it).name.latin1() );
314 addToBox( (*it) );
315 }
316 delete m_tabWidget;
317 m_tabWidget = 0;
213} 318}
diff --git a/libopie/big-screen/osplitter.h b/libopie/big-screen/osplitter.h
index 05849af..bc4f80b 100644
--- a/libopie/big-screen/osplitter.h
+++ b/libopie/big-screen/osplitter.h
@@ -1,102 +1,104 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 hOlgAr <zecke@handhelds.org> 3             .=l. Copyright (c) 2002 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 <qwidget.h> 34#include <qframe.h>
35#include <qvaluelist.h> 35#include <qvaluelist.h>
36 36
37#include "obigscreen_p.h"
37 38
38/* forward declarations */ 39/* forward declarations */
39class OTabWidget; 40class OTabWidget;
40class QHBox; 41class QHBox;
41struct OSplitterContainer; 42//template class QValueList<Opie::OSplitterContainer>;
42template class QValueList<OSplitterContainer>;
43 43
44 44
45/** 45/**
46 * 46 *
47 * If you've widgets that could be placed side by side but you think 47 * If you've widgets that could be placed side by side but you think
48 * on small resolutions is not enough place but it would really make sense 48 * on small resolutions is not enough place but it would really make sense
49 * on bigger resolutions this class will help you. 49 * on bigger resolutions this class will help you.
50 * You can add as many widgets you want to it. Set a poliy on which width/height it 50 * You can add as many widgets you want to it. Set a poliy on which width/height it
51 * should switch the layout. 51 * should switch the layout.
52 * You can either say to place widgets vertical or horizontal. 52 * You can either say to place widgets vertical or horizontal.
53 * This class uses QHBox, QVBox and QTAbWidget internally. 53 * This class uses QHBox, QVBox and QTAbWidget internally.
54 * OSplitter takes ownership of the widgets 54 * OSplitter takes ownership of the widgets
55 * 55 *
56 * @since 1.2 56 * @since 1.2
57 * 57 *
58 * @short a small dynamically changing its layout to store two or more widgets side by side 58 * @short a small dynamically changing its layout to store two or more widgets side by side
59 * @version 0.1 59 * @version 0.1
60 * @author zecke 60 * @author zecke
61 */ 61 */
62class OSplitter : public QWidget{ 62class OSplitter : public QFrame{
63 Q_OBJECT 63 Q_OBJECT
64public: 64public:
65 typedef QValueList<OSplitterContainer> ContainerList; 65 typedef QValueList<Opie::OSplitterContainer> ContainerList;
66 OSplitter( Qt::Orientation = Horizontal, QWidget *parent = 0, 66 OSplitter( Qt::Orientation = Horizontal, QWidget *parent = 0,
67 const char* name = 0, WFlags fl = 0 ); 67 const char* name = 0, WFlags fl = 0 );
68 ~OSplitter(); 68 ~OSplitter();
69 69
70 void setSizeChange( int width_height ); 70 void setSizeChange( int width_height );
71 71
72 void addWidget( QWidget* wid, const QString& icon, const QString& label ); 72 void addWidget( QWidget* wid, const QString& icon, const QString& label );
73 void removeWidget( QWidget* ); 73 void removeWidget( QWidget* );
74 74
75 void setCurrentWidget( QWidget* ); 75 void setCurrentWidget( QWidget* );
76 void setCurrentWidget( const QString& label ); 76 void setCurrentWidget( const QString& label );
77 QWidget* currentWidget(); 77 QWidget* currentWidget();
78 78
79 QSize sizeHint()const; 79// QSize sizeHint()const;
80 80
81protected: 81protected:
82 void resizeEvent( QResizeEvent* ); 82 void resizeEvent( QResizeEvent* );
83 83
84private: 84private:
85 void relayout(); 85 void addToTab( const Opie::OSplitterContainer& );
86 void addToTab( const OSplitterContainer& ); 86 void addToBox( const Opie::OSplitterContainer& );
87 void addToBox( const OSplitterContainer& );
88 void removeFromTab( QWidget* ); 87 void removeFromTab( QWidget* );
89 void removeFromBox( QWidget* ); 88 void changeTab();
89 void changeHBox();
90 void changeVBox();
91 void commonChangeBox();
90 QHBox *m_hbox; 92 QHBox *m_hbox;
91 OTabWidget *m_tabWidget; 93 OTabWidget *m_tabWidget;
92 Orientation m_orient; 94 Orientation m_orient;
93 int m_size_policy; 95 int m_size_policy;
94 96
95 ContainerList m_container; 97 ContainerList m_container;
96 98
97 struct Private; 99 struct Private;
98 Private *d; 100 Private *d;
99}; 101};
100 102
101 103
102#endif 104#endif