Diffstat (limited to 'libopie/big-screen/osplitter.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie/big-screen/osplitter.h | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/libopie/big-screen/osplitter.h b/libopie/big-screen/osplitter.h new file mode 100644 index 0000000..05849af --- a/dev/null +++ b/libopie/big-screen/osplitter.h | |||
@@ -0,0 +1,102 @@ | |||
1 | /* | ||
2 | =. This file is part of the OPIE Project | ||
3 | .=l. Copyright (c) 2002 hOlgAr <zecke@handhelds.org> | ||
4 | .>+-= | ||
5 | _;:, .> :=|. This library is free software; you can | ||
6 | .> <`_, > . <= redistribute it and/or modify it under | ||
7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
8 | .="- .-=="i, .._ License as published by the Free Software | ||
9 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
10 | ._= =} : or (at your option) any later version. | ||
11 | .%`+i> _;_. | ||
12 | .i_,=:_. -<s. This library is distributed in the hope that | ||
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
14 | : .. .:, . . . without even the implied warranty of | ||
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
17 | ..}^=.= = ; Library General Public License for more | ||
18 | ++= -. .` .: details. | ||
19 | : = ...= . :.=- | ||
20 | -. .:....=;==+<; You should have received a copy of the GNU | ||
21 | -_. . . )=. = Library General Public License along with | ||
22 | -- :-=` this library; see the file COPYING.LIB. | ||
23 | If not, write to the Free Software Foundation, | ||
24 | Inc., 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
28 | |||
29 | #ifndef OPIE_SPLITTER_H | ||
30 | #define OPIE_SPLITTER_H | ||
31 | |||
32 | #include <qstring.h> | ||
33 | |||
34 | #include <qwidget.h> | ||
35 | #include <qvaluelist.h> | ||
36 | |||
37 | |||
38 | /* forward declarations */ | ||
39 | class OTabWidget; | ||
40 | class QHBox; | ||
41 | struct OSplitterContainer; | ||
42 | template class QValueList<OSplitterContainer>; | ||
43 | |||
44 | |||
45 | /** | ||
46 | * | ||
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 | ||
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 | ||
51 | * should switch the layout. | ||
52 | * You can either say to place widgets vertical or horizontal. | ||
53 | * This class uses QHBox, QVBox and QTAbWidget internally. | ||
54 | * OSplitter takes ownership of the widgets | ||
55 | * | ||
56 | * @since 1.2 | ||
57 | * | ||
58 | * @short a small dynamically changing its layout to store two or more widgets side by side | ||
59 | * @version 0.1 | ||
60 | * @author zecke | ||
61 | */ | ||
62 | class OSplitter : public QWidget{ | ||
63 | Q_OBJECT | ||
64 | public: | ||
65 | typedef QValueList<OSplitterContainer> ContainerList; | ||
66 | OSplitter( Qt::Orientation = Horizontal, QWidget *parent = 0, | ||
67 | const char* name = 0, WFlags fl = 0 ); | ||
68 | ~OSplitter(); | ||
69 | |||
70 | void setSizeChange( int width_height ); | ||
71 | |||
72 | void addWidget( QWidget* wid, const QString& icon, const QString& label ); | ||
73 | void removeWidget( QWidget* ); | ||
74 | |||
75 | void setCurrentWidget( QWidget* ); | ||
76 | void setCurrentWidget( const QString& label ); | ||
77 | QWidget* currentWidget(); | ||
78 | |||
79 | QSize sizeHint()const; | ||
80 | |||
81 | protected: | ||
82 | void resizeEvent( QResizeEvent* ); | ||
83 | |||
84 | private: | ||
85 | void relayout(); | ||
86 | void addToTab( const OSplitterContainer& ); | ||
87 | void addToBox( const OSplitterContainer& ); | ||
88 | void removeFromTab( QWidget* ); | ||
89 | void removeFromBox( QWidget* ); | ||
90 | QHBox *m_hbox; | ||
91 | OTabWidget *m_tabWidget; | ||
92 | Orientation m_orient; | ||
93 | int m_size_policy; | ||
94 | |||
95 | ContainerList m_container; | ||
96 | |||
97 | struct Private; | ||
98 | Private *d; | ||
99 | }; | ||
100 | |||
101 | |||
102 | #endif | ||