summaryrefslogtreecommitdiff
path: root/noncore/settings/appearance2/stylelistitem.h
Unidiff
Diffstat (limited to 'noncore/settings/appearance2/stylelistitem.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/appearance2/stylelistitem.h85
1 files changed, 85 insertions, 0 deletions
diff --git a/noncore/settings/appearance2/stylelistitem.h b/noncore/settings/appearance2/stylelistitem.h
new file mode 100644
index 0000000..3cc63dc
--- a/dev/null
+++ b/noncore/settings/appearance2/stylelistitem.h
@@ -0,0 +1,85 @@
1#ifndef STYLELISTITEM_H
2#define STYLELISTITEM_H
3
4#include <qlistbox.h>
5#include <qpe/styleinterface.h>
6
7#include <stdio.h>
8
9class StyleListItem : public QListBoxText {
10public:
11 StyleListItem ( const QString &t, QStyle *sty ) : QListBoxText ( t )
12 {
13 m_lib = 0;
14 m_style_if = 0;
15 m_settings_if = 0;
16 m_style = sty;
17 }
18
19 StyleListItem ( QLibrary *lib, StyleInterface *iface ) : QListBoxText ( iface-> name ( ))
20 {
21 m_lib = lib;
22 m_style_if = iface;
23 m_settings_if = 0;
24 m_style = iface-> create ( );
25
26 iface-> queryInterface ( IID_StyleSettings, (QUnknownInterface **) &m_settings_if );
27 }
28
29 virtual ~StyleListItem ( )
30 {
31 delete m_style;
32
33 if ( m_settings_if )
34 m_settings_if-> release ( );
35 if ( m_style_if )
36 m_style_if-> release ( );
37 delete m_lib;
38 }
39
40 bool hasSettings ( ) const
41 {
42 return ( m_settings_if );
43 }
44
45 QWidget *settings ( QWidget *parent )
46 {
47 return m_settings_if ? m_settings_if-> create ( parent ) : 0;
48 }
49
50 bool setSettings ( bool accepted )
51 {
52 if ( !m_settings_if )
53 return false;
54
55 if ( accepted )
56 return m_settings_if-> accept ( );
57 else {
58 m_settings_if-> reject ( );
59 return false;
60 }
61 }
62
63 QString key ( )
64 {
65 if ( m_style_if )
66 return QString ( m_style_if-> key ( ));
67 else
68 return text ( );
69 }
70
71 QStyle *style ( )
72 {
73 return m_style;
74 }
75
76private:
77 QLibrary *m_lib;
78 QStyle *m_style;
79 StyleInterface *m_style_if;
80 StyleSettingsInterface *m_settings_if;
81
82};
83
84
85#endif