summaryrefslogtreecommitdiff
path: root/noncore/unsupported/libopie/ofontmenu.h
Unidiff
Diffstat (limited to 'noncore/unsupported/libopie/ofontmenu.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/libopie/ofontmenu.h113
1 files changed, 113 insertions, 0 deletions
diff --git a/noncore/unsupported/libopie/ofontmenu.h b/noncore/unsupported/libopie/ofontmenu.h
new file mode 100644
index 0000000..6e143ca
--- a/dev/null
+++ b/noncore/unsupported/libopie/ofontmenu.h
@@ -0,0 +1,113 @@
1
2/*
3
4               =. This file is part of the OPIE Project
5             .=l. Copyright (c) 2002 zecke <zecke@handhelds.org>
6           .>+-=
7 _;:,     .>    :=|. This library is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This library is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details.
21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28
29*/
30
31
32
33
34#ifndef ofontmenu_h
35#define ofontmenu_h
36
37#include <qpopupmenu.h>
38#include <qlist.h>
39
40/*
41 * @internal
42 */
43namespace {
44 struct WidSize {
45 QWidget *wid;
46 int size;
47 };
48
49};
50
51// forward declarations
52class Config;
53
54/**
55 * This class is a specialised QPopupMenu. It'll display three different
56 * font sizes. Small, Normal and large by adding widgets to the Menu
57 * you can control the font size of these widgets
58 * by using the save and restore method you can also apply font sizes
59 * over two different runtimes
60 *
61 * <pre>
62 * QTable* tbl = new QTable();
63 * QList<QWidget> wid;
64 * wid.append( tbl );
65 * OFontMenu* menu = new OFontMenu(this, "Popup Menu", wid );
66 * Config cfg("mycfg");
67 * menu->restore( cfg );
68 * </pre>
69 *
70 * @author Holger Freyther ( zecke@handhelds.org )
71 * @version 0.1
72 * @short PopupMenu which can control the size of Widgets
73 * @see QPopupMenu
74 */
75class OFontMenu : public QPopupMenu {
76 Q_OBJECT
77 public:
78 OFontMenu(QWidget *parent, const char* name, const QList<QWidget> &list );
79 void save(Config *cfg );
80 void restore(Config *cfg );
81 void setWidgets(const QList<QWidget> &list );
82 void addWidget(QWidget *wid );
83 void forceSize(QWidget *wid, int size );
84 void removeWidget(QWidget *wid );
85 const QList<QWidget> &widgets()const;
86
87 signals:
88 /**
89 * this signal gets emitted when the font size gets changed
90 * @param size The new size of font
91 */
92 void fontChanged(int size );
93
94 private:
95 QList<QWidget> m_list;
96 QList<WidSize> m_wids;
97 int m_size;
98 class OFontMenuPrivate;
99 OFontMenuPrivate *d;
100
101 private slots:
102 virtual void slotSmall();
103 virtual void slotMedium();
104 virtual void slotLarge();
105 void setFontSize(int size );
106};
107
108#endif
109
110
111
112
113