author | zecke <zecke> | 2003-09-07 12:47:42 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-09-07 12:47:42 (UTC) |
commit | dbea3ba9d8315f94d102af7e4a7244b1fb507f85 (patch) (unidiff) | |
tree | 2c1fe2aa303b6a900f2fffe7a18f91a949fc2d99 | |
parent | e06de75edc6c01d97248050030f197bd8f21fb10 (diff) | |
download | opie-dbea3ba9d8315f94d102af7e4a7244b1fb507f85.zip opie-dbea3ba9d8315f94d102af7e4a7244b1fb507f85.tar.gz opie-dbea3ba9d8315f94d102af7e4a7244b1fb507f85.tar.bz2 |
Add thoughts and interface about dynamic ToolBar/MenuBar generation
and a modal helper template class
-rw-r--r-- | libopie/big-screen/obarcollection.h | 107 | ||||
-rw-r--r-- | libopie/big-screen/omodalhelper.h | 72 |
2 files changed, 179 insertions, 0 deletions
diff --git a/libopie/big-screen/obarcollection.h b/libopie/big-screen/obarcollection.h new file mode 100644 index 0000000..5822360 --- a/dev/null +++ b/libopie/big-screen/obarcollection.h | |||
@@ -0,0 +1,107 @@ | |||
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 HAZE_OBAR_EXTENSION | ||
30 | #define HAZE_OBAR_EXTENSION | ||
31 | |||
32 | #include <qstring.h> | ||
33 | #include <qwidget.h> | ||
34 | |||
35 | class QAction; | ||
36 | class QPopupMenu; | ||
37 | |||
38 | /* | ||
39 | * ### TODO | ||
40 | * -Consider Life Updates | ||
41 | * -Make ValueBased like Opie-featurelist | ||
42 | */ | ||
43 | |||
44 | /** | ||
45 | * The different screen sizes have different look and feel. On bigger | ||
46 | * screens only a QToolBar feels strange. One is at least known to have | ||
47 | * a Help-Menu, a File Menu with Quit/Exit but instead of providing two | ||
48 | * different ways / two action sets we will group actions to gether and give | ||
49 | * them attributes when and where we might want them to be visible. | ||
50 | * We can also group actions. For example you could Group All Actions | ||
51 | * into the File Group. This means with many actions you would only have more toolbar | ||
52 | * actions but many sub menus in File. On bigger screen this would automatically | ||
53 | * expand to a full blown MenuBar and ToolButtons. | ||
54 | * | ||
55 | * @short Grouping of actions for dynamic Bar Generation | ||
56 | * @version 0.01 | ||
57 | * @author hOlgAr | ||
58 | */ | ||
59 | class OBarGroup { | ||
60 | public: | ||
61 | enum Preference { Allways, Never, IfPlace }; | ||
62 | OBarGroup( const QString& name, enum Preference groupPreference ); | ||
63 | ~OBarGroup(); | ||
64 | |||
65 | void add( QAction* action, enum Preference menuPreference, | ||
66 | enum Preference toolpreference ); | ||
67 | void add( const QString&, QPopupMenu* ); | ||
68 | |||
69 | void add( OBarGroup* ); | ||
70 | |||
71 | void remove( QAction* action ); | ||
72 | void remove( QMap* ); | ||
73 | |||
74 | protected: | ||
75 | OBarGroup* parent()const; | ||
76 | |||
77 | private: | ||
78 | }; | ||
79 | |||
80 | |||
81 | /** | ||
82 | * Add your groups in order to the bar manager | ||
83 | * and either call createGUI() on it, or tell it | ||
84 | * it the mainwindow and it is listening to the show event | ||
85 | * and then creates the toolbar | ||
86 | */ | ||
87 | class OBarManager : public QObject{ | ||
88 | public: | ||
89 | OBarManager( QWindow* parent ); | ||
90 | ~OBarManager(); | ||
91 | |||
92 | void add( OBarGroup*, int pos = -1 ); | ||
93 | void remove( OBarGroup* ); | ||
94 | |||
95 | bool eventFilter( QObject* , QEvent* ); | ||
96 | |||
97 | public slots: | ||
98 | void createGUI(); | ||
99 | }; | ||
100 | |||
101 | /* | ||
102 | * ### TODO GUI merging | ||
103 | */ | ||
104 | |||
105 | #endif | ||
106 | |||
107 | |||
diff --git a/libopie/big-screen/omodalhelper.h b/libopie/big-screen/omodalhelper.h new file mode 100644 index 0000000..643458f --- a/dev/null +++ b/libopie/big-screen/omodalhelper.h | |||
@@ -0,0 +1,72 @@ | |||
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 HAZE_OMODAL_HELPER_H | ||
30 | #define HAZE_OMODAL_HELPER_H | ||
31 | |||
32 | #include <qwidget.h> | ||
33 | |||
34 | class OModalHelperSignal : public QObject { | ||
35 | Q_OBJECT | ||
36 | public: | ||
37 | OModalHelperSignal(); | ||
38 | |||
39 | signals: | ||
40 | done( int status, int transaction ); | ||
41 | accpeted( int transaction ); | ||
42 | rejected( int transaction ); | ||
43 | }; | ||
44 | |||
45 | /** | ||
46 | * Modality sucks! ;) But it is easy to work with | ||
47 | * do exec() on a dialog and you know everything is funky. | ||
48 | * You only need to have one Dialog loaded and so on. | ||
49 | * This class helps you to work like with modality and help | ||
50 | * you to keep things in sync | ||
51 | * It's a template class but it sends signals once one Item is ready | ||
52 | * the signals contains the status and id of the item and then you | ||
53 | * can fetch it. | ||
54 | * Also if you edit an record external you can tell this class and it'll | ||
55 | * call the merge() function of your widget to maybe merge in these changes. | ||
56 | * It also supports multiple modes. Either it can create new dialogs | ||
57 | * for each item or it can queue them depending on your usage. But it is | ||
58 | * so smart that if only one item is shown that the queue bar is not shown | ||
59 | * See the example for simple usage. | ||
60 | * | ||
61 | * @short helps to live without modaility | ||
62 | * @author hOlgAr | ||
63 | * @version 0.01 | ||
64 | */ | ||
65 | template<class Dialog, class Record> | ||
66 | class OModalHelper{ | ||
67 | public: | ||
68 | OModalHelper(QObject* parnet ); | ||
69 | |||
70 | }; | ||
71 | |||
72 | #endif | ||