summaryrefslogtreecommitdiff
path: root/libopie/big-screen/owidgetstack.h
Unidiff
Diffstat (limited to 'libopie/big-screen/owidgetstack.h') (more/less context) (show whitespace changes)
-rw-r--r--libopie/big-screen/owidgetstack.h127
1 files changed, 127 insertions, 0 deletions
diff --git a/libopie/big-screen/owidgetstack.h b/libopie/big-screen/owidgetstack.h
new file mode 100644
index 0000000..5179213
--- a/dev/null
+++ b/libopie/big-screen/owidgetstack.h
@@ -0,0 +1,127 @@
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 OPIE_BIG_WIDGET_STACK_H
30#define OPIE_BIG_WIDGET_STACK_H
31
32#include <qframe.h>
33#include <qmap.h>
34
35class QWidgetStack;
36/**
37 *
38 * OWidgetStack is the answer to the problem of using Opie at different screen
39 * sizes and to have a different behaviour. Most applications use a QWidgetStack
40 * to supply a view on click. And by clicking the (X) you go back but this
41 * behaviour feels strange on bigger screens. It's ok on smaller one because
42 * one can't determine the difference.
43 * This stack reads the default out of the size of the desktop widget but
44 * can be forced to have either the one or the other behaviour.
45 * The first widget added is considered the 'main' widget and its
46 * sizeHint will be taking if in BigScreen mode.
47 * In small screen mode this widget behaves exactly like a QWidgetStack and in BigScreen
48 * mode it'll use the MainWindow as child of this widget and arranges the others as
49 * hidden top level widgets.
50 *
51 * @version 0.1
52 * @author hOlgAr F.
53 * @short Either a true stack or a list of top Level widgets
54 */
55class OWidgetStack : public QFrame {
56 Q_OBJECT
57public:
58 enum Mode { SmallScreen, BigScreen, NoForce };
59 OWidgetStack( QWidget* parent, const char* name = 0, WFlags fl = 0 );
60 ~OWidgetStack();
61
62 enum Mode mode()const;
63 void forceMode( enum Mode );
64
65 void addWidget( QWidget* , int );
66 void removeWidget( QWidget* );
67
68// QSizeHint sizeHint()const;
69// QSizeHint minimumSizeHint()const;
70
71 QWidget *widget( int )const;
72 int id( QWidget* )const;
73
74
75
76 QWidget* visibleWidget() const;
77
78 bool eventFilter( QObject*, QEvent* );
79signals:
80 /**
81 * OWidgetStack monitors the Desktop Widget for
82 * size changes if it recignizes a change size it'll
83 * send a signal and adjust its mode. After the signal
84 * was emitted. During the signal a call to mode() the
85 * old mode will be returned. Note that if a size change happens
86 * but no modeChange no signal will be emitted
87 *
88 *
89 * @param mode The new mode of the desktop
90 */
91 void modeChanged( enum Mode mode);
92
93 /**
94 * These two signals are emitted whenever we're about to
95 * show one of the widgets
96 */
97 void aboutToShow( QWidget* );
98 void aboutToShow( int );
99
100public slots:
101 void raiseWidget( int );
102 void raiseWidget( QWidget* );
103 void hideWidget( int );
104 void hideWidget( QWidget* );
105 void setMainWindow( QWidget* );
106 void setMainWindow( int );
107
108protected:
109 void resizeEvent( QResizeEvent* );
110
111private:
112 void switchStack();
113 void switchTop();
114 QMap<int, QWidget*> m_list;
115 QWidgetStack *m_stack;
116 QWidget *m_mWidget;
117 QWidget *m_last;
118
119 enum Mode m_mode;
120 bool m_forced : 1;
121
122 struct Private;
123 Private *d;
124};
125
126
127#endif