summaryrefslogtreecommitdiff
path: root/libopie/ofontmenu.cc
authorzecke <zecke>2002-04-15 20:53:57 (UTC)
committer zecke <zecke>2002-04-15 20:53:57 (UTC)
commite010d922ac415558e5efd35e69e39e45908b5501 (patch) (unidiff)
tree7b6dac3a82613fdefb15c818541891f577ecf48d /libopie/ofontmenu.cc
parent15244683bb97d303d0d3b6104b46a9b429aaed85 (diff)
downloadopie-e010d922ac415558e5efd35e69e39e45908b5501.zip
opie-e010d922ac415558e5efd35e69e39e45908b5501.tar.gz
opie-e010d922ac415558e5efd35e69e39e45908b5501.tar.bz2
updates?
too much to remember
Diffstat (limited to 'libopie/ofontmenu.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ofontmenu.cc34
1 files changed, 34 insertions, 0 deletions
diff --git a/libopie/ofontmenu.cc b/libopie/ofontmenu.cc
index 2acae1c..52ff3ee 100644
--- a/libopie/ofontmenu.cc
+++ b/libopie/ofontmenu.cc
@@ -1,22 +1,54 @@
1 1
2
3#include <qpe/config.h>
2#include "ofontmenu.h" 4#include "ofontmenu.h"
3 5
4 6
5 7
6OFontMenu::OFontMenu(QWidget *parent, const char *name, const QList<QWidget> &list ) 8OFontMenu::OFontMenu(QWidget *parent, const char *name, const QList<QWidget> &list )
7 : QPopupMenu( parent, name ) 9 : QPopupMenu( parent, name )
8{ 10{
9 m_list = list; 11 m_list = list;
12 m_wids.setAutoDelete( TRUE );
13
10 insertItem(tr("Large"), this, SLOT(slotLarge() ), 14 insertItem(tr("Large"), this, SLOT(slotLarge() ),
11 0, 10); 15 0, 10);
12 insertItem(tr("Medium"), this, SLOT(slotMedium() ), 16 insertItem(tr("Medium"), this, SLOT(slotMedium() ),
13 0, 11 ); 17 0, 11 );
14 insertItem(tr("Small"), this, SLOT(slotSmall() ), 18 insertItem(tr("Small"), this, SLOT(slotSmall() ),
15 0, 12 ); 19 0, 12 );
16 setCheckable( true ); 20 setCheckable( true );
21 m_size=10;
22}
23void OFontMenu::save(Config *cfg )
24{
25 cfg->setGroup("OFontMenu" );
26 cfg->writeEntry("size", m_size );
27}
28void OFontMenu::restore(Config *cfg )
29{
30 cfg->setGroup("OFontMeny" );
31 m_size = cfg->readNumEntry("size" );
32 setItemChecked(10, false );
33 setItemChecked(11, false );
34 setItemChecked(12, false );
35 switch( m_size ){
36 case 8:
37 setItemChecked(12, true );
38 break;
39 case 14:
40 setItemChecked(10, true );
41 break;
42 case 10:// fall through
43 default:
44 setItemChecked(11, true );
45 m_size = 10;
46 break;
47 }
48 setFontSize( m_size );
17} 49}
18void OFontMenu::setWidgets(const QList<QWidget> &list ) 50void OFontMenu::setWidgets(const QList<QWidget> &list )
19{ 51{
20 m_list = list; 52 m_list = list;
21} 53}
22void OFontMenu::addWidget( QWidget *wid ) 54void OFontMenu::addWidget( QWidget *wid )
@@ -58,12 +90,13 @@ void OFontMenu::slotLarge()
58 setItemChecked(11, false ); 90 setItemChecked(11, false );
59 setItemChecked(12, false ); 91 setItemChecked(12, false );
60 setFontSize(14 ); 92 setFontSize(14 );
61} 93}
62void OFontMenu::setFontSize(int size ) 94void OFontMenu::setFontSize(int size )
63{ 95{
96 m_size = size;
64 QWidget *wid; 97 QWidget *wid;
65 for(wid = m_list.first(); wid !=0; wid = m_list.next() ){ 98 for(wid = m_list.first(); wid !=0; wid = m_list.next() ){
66 QFont font = wid->font(); 99 QFont font = wid->font();
67 font.setPointSize( size ); 100 font.setPointSize( size );
68 wid->setFont( font ); 101 wid->setFont( font );
69 } 102 }
@@ -72,7 +105,8 @@ void OFontMenu::setFontSize(int size )
72 for( wids = m_wids.first(); wids != 0; wids = m_wids.next() ){ 105 for( wids = m_wids.first(); wids != 0; wids = m_wids.next() ){
73 QFont font = wids->wid->font(); 106 QFont font = wids->wid->font();
74 font.setPointSize( wids->size ); 107 font.setPointSize( wids->size );
75 wids->wid->setFont( font ); 108 wids->wid->setFont( font );
76 } 109 }
77 } 110 }
111 emit fontChanged(size );
78} 112}