author | sandman <sandman> | 2002-09-20 01:42:10 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-09-20 01:42:10 (UTC) |
commit | b1f3d33cb0b3f203f153074a8812d5988c3031b2 (patch) (unidiff) | |
tree | 1734ac2808dab8f0982b23a2a9101486fcdcfee5 /noncore/settings/appearance2/stylelistitem.h | |
parent | 9204c61f669fb265f6c5f14bfd6ca363a2929e40 (diff) | |
download | opie-b1f3d33cb0b3f203f153074a8812d5988c3031b2.zip opie-b1f3d33cb0b3f203f153074a8812d5988c3031b2.tar.gz opie-b1f3d33cb0b3f203f153074a8812d5988c3031b2.tar.bz2 |
New experimental appearance settings
Diffstat (limited to 'noncore/settings/appearance2/stylelistitem.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/appearance2/stylelistitem.h | 85 |
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 | |||
9 | class StyleListItem : public QListBoxText { | ||
10 | public: | ||
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 | |||
76 | private: | ||
77 | QLibrary *m_lib; | ||
78 | QStyle *m_style; | ||
79 | StyleInterface *m_style_if; | ||
80 | StyleSettingsInterface *m_settings_if; | ||
81 | |||
82 | }; | ||
83 | |||
84 | |||
85 | #endif | ||