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,32 +1,64 @@
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 )
23{ 55{
24 m_list.append(wid ); 56 m_list.append(wid );
25} 57}
26void OFontMenu::removeWidget( QWidget *wid ) 58void OFontMenu::removeWidget( QWidget *wid )
27{ 59{
28 m_list.remove( wid ); 60 m_list.remove( wid );
29} 61}
30const QList<QWidget> &OFontMenu::widgets()const 62const QList<QWidget> &OFontMenu::widgets()const
31{ 63{
32 return m_list; 64 return m_list;
@@ -48,31 +80,33 @@ void OFontMenu::slotSmall()
48void OFontMenu::slotMedium() 80void OFontMenu::slotMedium()
49{ 81{
50 setItemChecked(10, false ); 82 setItemChecked(10, false );
51 setItemChecked(11, true ); 83 setItemChecked(11, true );
52 setItemChecked(12, false ); 84 setItemChecked(12, false );
53 setFontSize(10 ); 85 setFontSize(10 );
54} 86}
55void OFontMenu::slotLarge() 87void OFontMenu::slotLarge()
56{ 88{
57 setItemChecked(10, true ); 89 setItemChecked(10, true );
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 }
70 if(!m_wids.isEmpty() ){ 103 if(!m_wids.isEmpty() ){
71 WidSize *wids; 104 WidSize *wids;
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}