summaryrefslogtreecommitdiff
path: root/libopie/ofontmenu.cc
authorzecke <zecke>2002-04-13 23:18:09 (UTC)
committer zecke <zecke>2002-04-13 23:18:09 (UTC)
commit707f0d3dd81b8ecec2df4e942c0efd2ee51b7fc5 (patch) (side-by-side diff)
treed17645bbf5e0318e6e10c3377605c107a110ebd1 /libopie/ofontmenu.cc
parent0f7ff8056deb70f1c32bdcf46bb2b623063bdc1c (diff)
downloadopie-707f0d3dd81b8ecec2df4e942c0efd2ee51b7fc5.zip
opie-707f0d3dd81b8ecec2df4e942c0efd2ee51b7fc5.tar.gz
opie-707f0d3dd81b8ecec2df4e942c0efd2ee51b7fc5.tar.bz2
PopupMenu for fontsize handling like on the Zaurus
Diffstat (limited to 'libopie/ofontmenu.cc') (more/less context) (show whitespace changes)
-rw-r--r--libopie/ofontmenu.cc78
1 files changed, 78 insertions, 0 deletions
diff --git a/libopie/ofontmenu.cc b/libopie/ofontmenu.cc
new file mode 100644
index 0000000..2acae1c
--- a/dev/null
+++ b/libopie/ofontmenu.cc
@@ -0,0 +1,78 @@
+
+#include "ofontmenu.h"
+
+
+
+OFontMenu::OFontMenu(QWidget *parent, const char *name, const QList<QWidget> &list )
+ : QPopupMenu( parent, name )
+{
+ m_list = list;
+ insertItem(tr("Large"), this, SLOT(slotLarge() ),
+ 0, 10);
+ insertItem(tr("Medium"), this, SLOT(slotMedium() ),
+ 0, 11 );
+ insertItem(tr("Small"), this, SLOT(slotSmall() ),
+ 0, 12 );
+ setCheckable( true );
+}
+void OFontMenu::setWidgets(const QList<QWidget> &list )
+{
+ m_list = list;
+}
+void OFontMenu::addWidget( QWidget *wid )
+{
+ m_list.append(wid );
+}
+void OFontMenu::removeWidget( QWidget *wid )
+{
+ m_list.remove( wid );
+}
+const QList<QWidget> &OFontMenu::widgets()const
+{
+ return m_list;
+}
+void OFontMenu::forceSize(QWidget *wid, int size )
+{
+ WidSize *widz = new WidSize;
+ widz->wid = wid;
+ widz->size = size;
+ m_wids.append( widz );
+}
+void OFontMenu::slotSmall()
+{
+ setItemChecked(10, false );
+ setItemChecked(11, false );
+ setItemChecked(12, true );
+ setFontSize( 8 );
+}
+void OFontMenu::slotMedium()
+{
+ setItemChecked(10, false );
+ setItemChecked(11, true );
+ setItemChecked(12, false );
+ setFontSize(10 );
+}
+void OFontMenu::slotLarge()
+{
+ setItemChecked(10, true );
+ setItemChecked(11, false );
+ setItemChecked(12, false );
+ setFontSize(14 );
+}
+void OFontMenu::setFontSize(int size )
+{
+ QWidget *wid;
+ for(wid = m_list.first(); wid !=0; wid = m_list.next() ){
+ QFont font = wid->font();
+ font.setPointSize( size );
+ wid->setFont( font );
+ }
+ if(!m_wids.isEmpty() ){
+ WidSize *wids;
+ for( wids = m_wids.first(); wids != 0; wids = m_wids.next() ){
+ QFont font = wids->wid->font();
+ font.setPointSize( wids->size );
+ wids->wid->setFont( font );
+ }
+ }
+}