Diffstat (limited to 'libopie2/opieui/big-screen/owidgetstack.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opieui/big-screen/owidgetstack.h | 7 |
1 files changed, 4 insertions, 3 deletions
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 | |||
@@ -1,132 +1,133 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2003 hOlgAr <zecke@handhelds.org> | 3 | .=l. Copyright (c) 2003 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 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 | ||
36 | class QWidgetStack; | 36 | class QWidgetStack; |
37 | 37 | ||
38 | namespace Opie | 38 | namespace Opie { |
39 | { | 39 | namespace 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 |
52 | * mode it'll use the MainWindow as child of this widget and arranges the others as | 52 | * mode it'll use the MainWindow as child of this widget and arranges the others as |
53 | * hidden top level widgets. | 53 | * hidden top level widgets. |
54 | * | 54 | * |
55 | * @version 0.1 | 55 | * @version 0.1 |
56 | * @author hOlgAr F. | 56 | * @author hOlgAr F. |
57 | * @short Either a true stack or a list of top Level widgets | 57 | * @short Either a true stack or a list of top Level widgets |
58 | */ | 58 | */ |
59 | class OWidgetStack : public QFrame { | 59 | class OWidgetStack : public QFrame { |
60 | Q_OBJECT | 60 | Q_OBJECT |
61 | public: | 61 | public: |
62 | enum Mode { SmallScreen, BigScreen, NoForce }; | 62 | enum Mode { SmallScreen, BigScreen, NoForce }; |
63 | OWidgetStack( QWidget* parent, const char* name = 0, WFlags fl = 0 ); | 63 | OWidgetStack( QWidget* parent, const char* name = 0, WFlags fl = 0 ); |
64 | ~OWidgetStack(); | 64 | ~OWidgetStack(); |
65 | 65 | ||
66 | enum Mode mode()const; | 66 | enum Mode mode()const; |
67 | void forceMode( enum Mode ); | 67 | void forceMode( enum Mode ); |
68 | 68 | ||
69 | void addWidget( QWidget* , int ); | 69 | void addWidget( QWidget* , int ); |
70 | void removeWidget( QWidget* ); | 70 | void removeWidget( QWidget* ); |
71 | 71 | ||
72 | // QSizeHint sizeHint()const; | 72 | // QSizeHint sizeHint()const; |
73 | // QSizeHint minimumSizeHint()const; | 73 | // QSizeHint minimumSizeHint()const; |
74 | 74 | ||
75 | QWidget *widget( int )const; | 75 | QWidget *widget( int )const; |
76 | int id( QWidget* )const; | 76 | int id( QWidget* )const; |
77 | 77 | ||
78 | 78 | ||
79 | 79 | ||
80 | QWidget* visibleWidget() const; | 80 | QWidget* visibleWidget() const; |
81 | 81 | ||
82 | bool eventFilter( QObject*, QEvent* ); | 82 | bool eventFilter( QObject*, QEvent* ); |
83 | signals: | 83 | signals: |
84 | /** | 84 | /** |
85 | * OWidgetStack monitors the Desktop Widget for | 85 | * OWidgetStack monitors the Desktop Widget for |
86 | * size changes if it recignizes a change size it'll | 86 | * size changes if it recignizes a change size it'll |
87 | * send a signal and adjust its mode. After the signal | 87 | * send a signal and adjust its mode. After the signal |
88 | * was emitted. During the signal a call to mode() the | 88 | * was emitted. During the signal a call to mode() the |
89 | * old mode will be returned. Note that if a size change happens | 89 | * old mode will be returned. Note that if a size change happens |
90 | * but no modeChange no signal will be emitted | 90 | * but no modeChange no signal will be emitted |
91 | * | 91 | * |
92 | * | 92 | * |
93 | * @param mode The new mode of the desktop | 93 | * @param mode The new mode of the desktop |
94 | */ | 94 | */ |
95 | void modeChanged( enum Mode mode); | 95 | void modeChanged( enum Mode mode); |
96 | 96 | ||
97 | /** | 97 | /** |
98 | * These two signals are emitted whenever we're about to | 98 | * These two signals are emitted whenever we're about to |
99 | * show one of the widgets | 99 | * show one of the widgets |
100 | */ | 100 | */ |
101 | void aboutToShow( QWidget* ); | 101 | void aboutToShow( QWidget* ); |
102 | void aboutToShow( int ); | 102 | void aboutToShow( int ); |
103 | 103 | ||
104 | public slots: | 104 | public slots: |
105 | void raiseWidget( int ); | 105 | void raiseWidget( int ); |
106 | void raiseWidget( QWidget* ); | 106 | void raiseWidget( QWidget* ); |
107 | void hideWidget( int ); | 107 | void hideWidget( int ); |
108 | void hideWidget( QWidget* ); | 108 | void hideWidget( QWidget* ); |
109 | void setMainWindow( QWidget* ); | 109 | void setMainWindow( QWidget* ); |
110 | void setMainWindow( int ); | 110 | void setMainWindow( int ); |
111 | 111 | ||
112 | protected: | 112 | protected: |
113 | void resizeEvent( QResizeEvent* ); | 113 | void resizeEvent( QResizeEvent* ); |
114 | 114 | ||
115 | private: | 115 | private: |
116 | void switchStack(); | 116 | void switchStack(); |
117 | void switchTop(); | 117 | void switchTop(); |
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 |