-rw-r--r-- | libopie/ofontmenu.cc | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/libopie/ofontmenu.cc b/libopie/ofontmenu.cc index 52ff3ee..d16c5e5 100644 --- a/libopie/ofontmenu.cc +++ b/libopie/ofontmenu.cc | |||
@@ -3,9 +3,15 @@ | |||
3 | #include <qpe/config.h> | 3 | #include <qpe/config.h> |
4 | #include "ofontmenu.h" | 4 | #include "ofontmenu.h" |
5 | 5 | ||
6 | 6 | ||
7 | 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 | */ | ||
8 | OFontMenu::OFontMenu(QWidget *parent, const char *name, const QList<QWidget> &list ) | 14 | OFontMenu::OFontMenu(QWidget *parent, const char *name, const QList<QWidget> &list ) |
9 | : QPopupMenu( parent, name ) | 15 | : QPopupMenu( parent, name ) |
10 | { | 16 | { |
11 | m_list = list; | 17 | m_list = list; |
@@ -19,13 +25,26 @@ OFontMenu::OFontMenu(QWidget *parent, const char *name, const QList<QWidget> &li | |||
19 | 0, 12 ); | 25 | 0, 12 ); |
20 | setCheckable( true ); | 26 | setCheckable( true ); |
21 | m_size=10; | 27 | m_size=10; |
22 | } | 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 | */ | ||
23 | void OFontMenu::save(Config *cfg ) | 36 | void OFontMenu::save(Config *cfg ) |
24 | { | 37 | { |
25 | cfg->setGroup("OFontMenu" ); | 38 | cfg->setGroup("OFontMenu" ); |
26 | cfg->writeEntry("size", m_size ); | 39 | cfg->writeEntry("size", m_size ); |
27 | } | 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 | */ | ||
28 | void OFontMenu::restore(Config *cfg ) | 47 | void OFontMenu::restore(Config *cfg ) |
29 | { | 48 | { |
30 | cfg->setGroup("OFontMeny" ); | 49 | cfg->setGroup("OFontMeny" ); |
31 | m_size = cfg->readNumEntry("size" ); | 50 | m_size = cfg->readNumEntry("size" ); |
@@ -46,24 +65,49 @@ void OFontMenu::restore(Config *cfg ) | |||
46 | break; | 65 | break; |
47 | } | 66 | } |
48 | setFontSize( m_size ); | 67 | setFontSize( m_size ); |
49 | } | 68 | } |
69 | |||
70 | /** | ||
71 | * set the list of widgets | ||
72 | * @param list the widget list | ||
73 | */ | ||
50 | void OFontMenu::setWidgets(const QList<QWidget> &list ) | 74 | void OFontMenu::setWidgets(const QList<QWidget> &list ) |
51 | { | 75 | { |
52 | m_list = list; | 76 | m_list = list; |
53 | } | 77 | } |
78 | |||
79 | /** | ||
80 | * add a widget to the list | ||
81 | * @param wid The widget to be added | ||
82 | */ | ||
54 | void OFontMenu::addWidget( QWidget *wid ) | 83 | void OFontMenu::addWidget( QWidget *wid ) |
55 | { | 84 | { |
56 | m_list.append(wid ); | 85 | m_list.append(wid ); |
57 | } | 86 | } |
87 | |||
88 | /** | ||
89 | * removes the widget from the list of controlled objects | ||
90 | * @param wid the to be removed widget | ||
91 | */ | ||
58 | void OFontMenu::removeWidget( QWidget *wid ) | 92 | void OFontMenu::removeWidget( QWidget *wid ) |
59 | { | 93 | { |
60 | m_list.remove( wid ); | 94 | m_list.remove( wid ); |
61 | } | 95 | } |
96 | |||
97 | /** | ||
98 | * The list of controlled widgets | ||
99 | */ | ||
62 | const QList<QWidget> &OFontMenu::widgets()const | 100 | const QList<QWidget> &OFontMenu::widgets()const |
63 | { | 101 | { |
64 | return m_list; | 102 | return m_list; |
65 | } | 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 | */ | ||
66 | void OFontMenu::forceSize(QWidget *wid, int size ) | 110 | void OFontMenu::forceSize(QWidget *wid, int size ) |
67 | { | 111 | { |
68 | WidSize *widz = new WidSize; | 112 | WidSize *widz = new WidSize; |
69 | widz->wid = wid; | 113 | widz->wid = wid; |