summaryrefslogtreecommitdiff
path: root/libopie2
authorzecke <zecke>2004-03-24 00:06:20 (UTC)
committer zecke <zecke>2004-03-24 00:06:20 (UTC)
commitdbde00826e485c509471961a15f95395a81b3b72 (patch) (unidiff)
tree92ac26cc77cb6f9df4c49606b2b791adedb1ba48 /libopie2
parentc8acbf192ca4aa64ed66306ca872cb3860590b3c (diff)
downloadopie-dbde00826e485c509471961a15f95395a81b3b72.zip
opie-dbde00826e485c509471961a15f95395a81b3b72.tar.gz
opie-dbde00826e485c509471961a15f95395a81b3b72.tar.bz2
Ideas from Mickey. Install eventFilter for a widget as well and then
send a signal
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/okeyconfigwidget.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/libopie2/opieui/okeyconfigwidget.h b/libopie2/opieui/okeyconfigwidget.h
index d76ea46..bcbb579 100644
--- a/libopie2/opieui/okeyconfigwidget.h
+++ b/libopie2/opieui/okeyconfigwidget.h
@@ -1,96 +1,105 @@
1#ifndef ODP_KEY_CONFIG_WIDGET_H 1#ifndef ODP_KEY_CONFIG_WIDGET_H
2#define ODP_KEY_CONFIG_WIDGET_H 2#define ODP_KEY_CONFIG_WIDGET_H
3 3
4#include <opie2/oconfig.h> 4#include <opie2/oconfig.h>
5 5
6#include <qstring.h> 6#include <qstring.h>
7#include <qpixmap.h> 7#include <qpixmap.h>
8#include <qbytearray.h> 8#include <qbytearray.h>
9#include <qhbox.h> 9#include <qhbox.h>
10#include <qvaluelist.h> 10#include <qvaluelist.h>
11 11
12class QKeyEvent; 12class QKeyEvent;
13 13
14namespace Opie { 14namespace Opie {
15namespace Ui { 15namespace Ui {
16 16
17class OKeyConfigItem { 17class OKeyConfigItem {
18 friend class OKeyConfigManager; 18 friend class OKeyConfigManager;
19public: 19public:
20 typedef QValueList<OKeyConfigItem> OKeyConfigItemList; 20 typedef QValueList<OKeyConfigItem> OKeyConfigItemList;
21 OKeyConfigItem( const QString& text = QString::null , const QCString& config_key = QCString(), 21 OKeyConfigItem( const QString& text = QString::null , const QCString& config_key = QCString(),
22 const QPixmap& symbol = QPixmap(), 22 const QPixmap& symbol = QPixmap(),
23 int key = 0, int mod = 0, 23 int key = 0, int mod = 0,
24 int default_key = 0, int default_modified = 0 ); 24 int default_key = 0, int default_modified = 0 );
25 ~OKeyConfigItem(); 25 ~OKeyConfigItem();
26 26
27 QString text()const; 27 QString text()const;
28 QPixmap pixmap()const; 28 QPixmap pixmap()const;
29 int key()const; 29 int key()const;
30 int modifier()const; 30 int modifier()const;
31 int defaultKey()const; 31 int defaultKey()const;
32 int defaultModifier()const; 32 int defaultModifier()const;
33 33
34 void setText( const QString& text ); 34 void setText( const QString& text );
35 void setPixmap( const QPixmap& ); 35 void setPixmap( const QPixmap& );
36 void setKey( int ); 36 void setKey( int );
37 void setModied( int ); 37 void setModied( int );
38 void setDefaultKey( int ); 38 void setDefaultKey( int );
39 void setDefaultModifier( int ); 39 void setDefaultModifier( int );
40 40
41 bool isConfigured()const; 41 bool isConfigured()const;
42 bool isEmpty()const; 42 bool isEmpty()const;
43private: 43private:
44 QString m_text; 44 QString m_text;
45 QCString m_config; 45 QCString m_config;
46 QPixmap m_pix; 46 QPixmap m_pix;
47 int m_key; 47 int m_key;
48 int m_mod; 48 int m_mod;
49 int m_defKey; 49 int m_defKey;
50 int m_defMod; 50 int m_defMod;
51 class Private; 51 class Private;
52 Private *d; 52 Private *d;
53}; 53};
54 54
55 55
56class OKeyConfig : public QObject { 56class OKeyConfig : public QObject {
57 Q_OBJECT 57 Q_OBJECT
58public: 58public:
59 OKeyConfig(Opie::Core::OConfig *conf = 0, bool grabkeyboard); 59 OKeyConfig(Opie::Core::OConfig *conf = 0, bool grabkeyboard);
60 ~OKeyConfig(); 60 ~OKeyConfig();
61 61
62 void load(); 62 void load();
63 void save(); 63 void save();
64 64
65 OKeyConfigItem handleKeyEvent( QKeyEvent* ); 65 OKeyConfigItem handleKeyEvent( QKeyEvent* );
66 QString handleKeyEventString( QKeyEvent* ); 66 QString handleKeyEventString( QKeyEvent* );
67 67
68 void addKeyConfig( const OKeyConfigItem& ); 68 void addKeyConfig( const OKeyConfigItem& );
69 void removeKeyConfig( const OKeyConfigItem& ); 69 void removeKeyConfig( const OKeyConfigItem& );
70
71 void handleWidget( QWidget* );
70signals: 72signals:
71 void keyConfigChanged( OKeyConfig* ); 73 void keyConfigChanged( OKeyConfig* );
74 void actionActivated( QWidget*, QKeyEvent*, const OKeyConfigItem& );
72 75
73private: 76private:
74 OKeyConfigItemList m_keys; 77 OKeyConfigItemList m_keys;
78 QValueList<QWidget*> m_widgets;
79 class Private;
80 Private *d;
75}; 81};
76 82
77 83
78class OKeyConfigWidget : public QHBox { 84class OKeyConfigWidget : public QHBox {
79 Q_OBJECT 85 Q_OBJECT
80public: 86public:
81 enum ChangeMode { Imediate, Queu }; 87 enum ChangeMode { Imediate, Queu };
82 OKeyConfigWidget( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 88 OKeyConfigWidget( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
83 OKeyConfigWidget( OKeyConfig *, QWidget* parent = 0, const char* = 0, WFlags = 0 ); 89 OKeyConfigWidget( OKeyConfig *, QWidget* parent = 0, const char* = 0, WFlags = 0 );
84 ~OKeyConfigWidget(); 90 ~OKeyConfigWidget();
85 91
86 void setChangeMode( enum ChangeMode ); 92 void setChangeMode( enum ChangeMode );
87 ChangeMode changeMode()const; 93 ChangeMode changeMode()const;
88 94
89 void reload(); 95 void reload();
96private:
97 class Private;
98 Private *d;
90}; 99};
91 100
92} 101}
93} 102}
94 103
95 104
96#endif 105#endif