summaryrefslogtreecommitdiff
path: root/libopie/ofontmenu.cc
authormickeyl <mickeyl>2004-11-16 19:14:18 (UTC)
committer mickeyl <mickeyl>2004-11-16 19:14:18 (UTC)
commitea3945a9bd8f9830f70b1efa133f9df13b19362f (patch) (unidiff)
treef2ea22cc50e9aa8aa73ee7dea148f41c563c9666 /libopie/ofontmenu.cc
parent1c6f490e8541626f68422e0a3a7c7281d7f5b7d3 (diff)
downloadopie-ea3945a9bd8f9830f70b1efa133f9df13b19362f.zip
opie-ea3945a9bd8f9830f70b1efa133f9df13b19362f.tar.gz
opie-ea3945a9bd8f9830f70b1efa133f9df13b19362f.tar.bz2
libopie1 goes into unsupported
Diffstat (limited to 'libopie/ofontmenu.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ofontmenu.cc156
1 files changed, 0 insertions, 156 deletions
diff --git a/libopie/ofontmenu.cc b/libopie/ofontmenu.cc
deleted file mode 100644
index d16c5e5..0000000
--- a/libopie/ofontmenu.cc
+++ b/dev/null
@@ -1,156 +0,0 @@
1
2
3#include <qpe/config.h>
4#include "ofontmenu.h"
5
6
7/**
8 * Constructs the FontMenu.
9 *
10 * @param parent The parent widget
11 * @param name A name for this widget
12 * @param list The list of widgets to be controlled
13 */
14OFontMenu::OFontMenu(QWidget *parent, const char *name, const QList<QWidget> &list )
15 : QPopupMenu( parent, name )
16{
17 m_list = list;
18 m_wids.setAutoDelete( TRUE );
19
20 insertItem(tr("Large"), this, SLOT(slotLarge() ),
21 0, 10);
22 insertItem(tr("Medium"), this, SLOT(slotMedium() ),
23 0, 11 );
24 insertItem(tr("Small"), this, SLOT(slotSmall() ),
25 0, 12 );
26 setCheckable( true );
27 m_size=10;
28}
29
30/**
31 * This method saves the font size
32 * into a Config object
33 * OFontMenu will be used as group and size as key
34 * @param cfg The Config object to be used
35 */
36void OFontMenu::save(Config *cfg )
37{
38 cfg->setGroup("OFontMenu" );
39 cfg->writeEntry("size", m_size );
40}
41
42/**
43 * This method restores the font size from a Config object
44 * it'll apply the sizes to the widgets and will also set the
45 * menu appropriate
46 */
47void OFontMenu::restore(Config *cfg )
48{
49 cfg->setGroup("OFontMeny" );
50 m_size = cfg->readNumEntry("size" );
51 setItemChecked(10, false );
52 setItemChecked(11, false );
53 setItemChecked(12, false );
54 switch( m_size ){
55 case 8:
56 setItemChecked(12, true );
57 break;
58 case 14:
59 setItemChecked(10, true );
60 break;
61 case 10:// fall through
62 default:
63 setItemChecked(11, true );
64 m_size = 10;
65 break;
66 }
67 setFontSize( m_size );
68}
69
70/**
71 * set the list of widgets
72 * @param list the widget list
73 */
74void OFontMenu::setWidgets(const QList<QWidget> &list )
75{
76 m_list = list;
77}
78
79/**
80 * add a widget to the list
81 * @param wid The widget to be added
82 */
83void OFontMenu::addWidget( QWidget *wid )
84{
85 m_list.append(wid );
86}
87
88/**
89 * removes the widget from the list of controlled objects
90 * @param wid the to be removed widget
91 */
92void OFontMenu::removeWidget( QWidget *wid )
93{
94 m_list.remove( wid );
95}
96
97/**
98 * The list of controlled widgets
99 */
100const QList<QWidget> &OFontMenu::widgets()const
101{
102 return m_list;
103}
104
105/**
106 * Forces a size on a widget
107 * @param wid The widget
108 * @param size The font size forced onto the widget
109 */
110void OFontMenu::forceSize(QWidget *wid, int size )
111{
112 WidSize *widz = new WidSize;
113 widz->wid = wid;
114 widz->size = size;
115 m_wids.append( widz );
116}
117void OFontMenu::slotSmall()
118{
119 setItemChecked(10, false );
120 setItemChecked(11, false );
121 setItemChecked(12, true );
122 setFontSize( 8 );
123}
124void OFontMenu::slotMedium()
125{
126 setItemChecked(10, false );
127 setItemChecked(11, true );
128 setItemChecked(12, false );
129 setFontSize(10 );
130}
131void OFontMenu::slotLarge()
132{
133 setItemChecked(10, true );
134 setItemChecked(11, false );
135 setItemChecked(12, false );
136 setFontSize(14 );
137}
138void OFontMenu::setFontSize(int size )
139{
140 m_size = size;
141 QWidget *wid;
142 for(wid = m_list.first(); wid !=0; wid = m_list.next() ){
143 QFont font = wid->font();
144 font.setPointSize( size );
145 wid->setFont( font );
146 }
147 if(!m_wids.isEmpty() ){
148 WidSize *wids;
149 for( wids = m_wids.first(); wids != 0; wids = m_wids.next() ){
150 QFont font = wids->wid->font();
151 font.setPointSize( wids->size );
152 wids->wid->setFont( font );
153 }
154 }
155 emit fontChanged(size );
156}