summaryrefslogtreecommitdiff
path: root/libopie2/opieui/big-screen/owidgetstack.h
authormickeyl <mickeyl>2004-01-15 15:32:10 (UTC)
committer mickeyl <mickeyl>2004-01-15 15:32:10 (UTC)
commit84bb8c9046007fe2adfaa016aded88b961c65e62 (patch) (unidiff)
tree8d7a57903b8c66ed28943a7d112cef93dd94111c /libopie2/opieui/big-screen/owidgetstack.h
parentac1e2b945965ee8caabd658e90f9e234fc622619 (diff)
downloadopie-84bb8c9046007fe2adfaa016aded88b961c65e62.zip
opie-84bb8c9046007fe2adfaa016aded88b961c65e62.tar.gz
opie-84bb8c9046007fe2adfaa016aded88b961c65e62.tar.bz2
libopie1 (bigscreen) --> libopie2/opieui
Diffstat (limited to 'libopie2/opieui/big-screen/owidgetstack.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/big-screen/owidgetstack.h132
1 files changed, 132 insertions, 0 deletions
diff --git a/libopie2/opieui/big-screen/owidgetstack.h b/libopie2/opieui/big-screen/owidgetstack.h
new file mode 100644
index 0000000..53818c8
--- a/dev/null
+++ b/libopie2/opieui/big-screen/owidgetstack.h
@@ -0,0 +1,132 @@
1/*
2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2003 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 OWIDGETSTACK_H
30#define OWIDGETSTACK_H
31
32/* QT*/
33#include <qframe.h>
34#include <qmap.h>
35
36class QWidgetStack;
37
38namespace Opie
39{
40/**
41 *
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
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
46 * one can't determine the difference.
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.
49 * The first widget added is considered the 'main' widget and its
50 * sizeHint will be taking if in BigScreen mode.
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
53 * hidden top level widgets.
54 *
55 * @version 0.1
56 * @author hOlgAr F.
57 * @short Either a true stack or a list of top Level widgets
58 */
59class OWidgetStack : public QFrame {
60 Q_OBJECT
61public:
62 enum Mode { SmallScreen, BigScreen, NoForce };
63 OWidgetStack( QWidget* parent, const char* name = 0, WFlags fl = 0 );
64 ~OWidgetStack();
65
66 enum Mode mode()const;
67 void forceMode( enum Mode );
68
69 void addWidget( QWidget* , int );
70 void removeWidget( QWidget* );
71
72// QSizeHint sizeHint()const;
73// QSizeHint minimumSizeHint()const;
74
75 QWidget *widget( int )const;
76 int id( QWidget* )const;
77
78
79
80 QWidget* visibleWidget() const;
81
82 bool eventFilter( QObject*, QEvent* );
83signals:
84 /**
85 * OWidgetStack monitors the Desktop Widget for
86 * size changes if it recignizes a change size it'll
87 * send a signal and adjust its mode. After the signal
88 * was emitted. During the signal a call to mode() the
89 * old mode will be returned. Note that if a size change happens
90 * but no modeChange no signal will be emitted
91 *
92 *
93 * @param mode The new mode of the desktop
94 */
95 void modeChanged( enum Mode mode);
96
97 /**
98 * These two signals are emitted whenever we're about to
99 * show one of the widgets
100 */
101 void aboutToShow( QWidget* );
102 void aboutToShow( int );
103
104public slots:
105 void raiseWidget( int );
106 void raiseWidget( QWidget* );
107 void hideWidget( int );
108 void hideWidget( QWidget* );
109 void setMainWindow( QWidget* );
110 void setMainWindow( int );
111
112protected:
113 void resizeEvent( QResizeEvent* );
114
115private:
116 void switchStack();
117 void switchTop();
118 QMap<int, QWidget*> m_list;
119 QWidgetStack *m_stack;
120 QWidget *m_mWidget;
121 QWidget *m_last;
122
123 enum Mode m_mode;
124 bool m_forced : 1;
125
126 struct Private;
127 Private *d;
128};
129
130};
131
132#endif