author | alwin <alwin> | 2004-08-01 16:20:38 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-08-01 16:20:38 (UTC) |
commit | e9f9eb19567a2afa354c36490ee8f4b191cf9395 (patch) (unidiff) | |
tree | 264557433a4acf15e9bde6ab800d4a8df362d70e | |
parent | 67e2e98457418bc491efd2d4567f851e77a0441a (diff) | |
download | opie-e9f9eb19567a2afa354c36490ee8f4b191cf9395.zip opie-e9f9eb19567a2afa354c36490ee8f4b191cf9395.tar.gz opie-e9f9eb19567a2afa354c36490ee8f4b191cf9395.tar.bz2 |
made interface binary clean eg. inst() returns a hidden class
documentation
-rw-r--r-- | libopie2/opiecore/okeyfilter.cpp | 53 | ||||
-rw-r--r-- | libopie2/opiecore/okeyfilter.h | 54 |
2 files changed, 80 insertions, 27 deletions
diff --git a/libopie2/opiecore/okeyfilter.cpp b/libopie2/opiecore/okeyfilter.cpp index d806dbd..b064272 100644 --- a/libopie2/opiecore/okeyfilter.cpp +++ b/libopie2/opiecore/okeyfilter.cpp | |||
@@ -33,17 +33,28 @@ _;:, .> :=|. This program is free software; you can | |||
33 | namespace Opie { | 33 | namespace Opie { |
34 | namespace Core { | 34 | namespace Core { |
35 | 35 | ||
36 | QValueList<QWSServer::KeyboardFilter*> OKeyFilter::filterList; | 36 | class OKeyFilterPrivate:public OKeyFilter, QWSServer::KeyboardFilter |
37 | QValueList<QWSServer::KeyboardFilter*> OKeyFilter::preFilterList; | 37 | { |
38 | static QValueList<QWSServer::KeyboardFilter*> filterList; | ||
39 | static QValueList<QWSServer::KeyboardFilter*> preFilterList; | ||
40 | protected: | ||
41 | OKeyFilterPrivate(const OKeyFilterPrivate&):OKeyFilter(),QWSServer::KeyboardFilter(){}; | ||
42 | virtual void addPreHandler(QWSServer::KeyboardFilter*); | ||
43 | virtual void remPreHandler(QWSServer::KeyboardFilter*); | ||
44 | |||
45 | public: | ||
46 | OKeyFilterPrivate(); | ||
47 | virtual ~OKeyFilterPrivate(); | ||
48 | virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); | ||
49 | virtual void addHandler(QWSServer::KeyboardFilter*); | ||
50 | virtual void remHandler(QWSServer::KeyboardFilter*); | ||
51 | }; | ||
52 | |||
53 | QValueList<QWSServer::KeyboardFilter*> OKeyFilterPrivate::filterList; | ||
54 | QValueList<QWSServer::KeyboardFilter*> OKeyFilterPrivate::preFilterList; | ||
38 | 55 | ||
39 | OKeyFilter::OKeyFilter() | 56 | OKeyFilter::OKeyFilter() |
40 | :QWSServer::KeyboardFilter() | ||
41 | { | 57 | { |
42 | filterList.clear(); | ||
43 | preFilterList.clear(); | ||
44 | if ( isQWS( ) ) { | ||
45 | QWSServer::setKeyboardFilter ( this ); | ||
46 | } | ||
47 | } | 58 | } |
48 | 59 | ||
49 | OKeyFilter::~OKeyFilter() | 60 | OKeyFilter::~OKeyFilter() |
@@ -54,12 +65,12 @@ OKeyFilter* OKeyFilter::inst() | |||
54 | { | 65 | { |
55 | static OKeyFilter*ofilter = 0; | 66 | static OKeyFilter*ofilter = 0; |
56 | if (!ofilter) { | 67 | if (!ofilter) { |
57 | ofilter = new OKeyFilter; | 68 | ofilter = new OKeyFilterPrivate; |
58 | } | 69 | } |
59 | return ofilter; | 70 | return ofilter; |
60 | } | 71 | } |
61 | 72 | ||
62 | bool OKeyFilter::filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ) | 73 | bool OKeyFilterPrivate::filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ) |
63 | { | 74 | { |
64 | QValueList<QWSServer::KeyboardFilter*>::Iterator iter; | 75 | QValueList<QWSServer::KeyboardFilter*>::Iterator iter; |
65 | for (iter=preFilterList.begin();iter!=preFilterList.end();++iter) { | 76 | for (iter=preFilterList.begin();iter!=preFilterList.end();++iter) { |
@@ -75,7 +86,7 @@ bool OKeyFilter::filter( int unicode, int keycode, int modifiers, bool isPress, | |||
75 | return false; | 86 | return false; |
76 | } | 87 | } |
77 | 88 | ||
78 | void OKeyFilter::addHandler(QWSServer::KeyboardFilter*aF) | 89 | void OKeyFilterPrivate::addHandler(QWSServer::KeyboardFilter*aF) |
79 | { | 90 | { |
80 | if (filterList.find(aF)!=filterList.end()) { | 91 | if (filterList.find(aF)!=filterList.end()) { |
81 | return; | 92 | return; |
@@ -84,7 +95,7 @@ void OKeyFilter::addHandler(QWSServer::KeyboardFilter*aF) | |||
84 | filterList.append(aF); | 95 | filterList.append(aF); |
85 | } | 96 | } |
86 | 97 | ||
87 | void OKeyFilter::remHandler(QWSServer::KeyboardFilter*aF) | 98 | void OKeyFilterPrivate::remHandler(QWSServer::KeyboardFilter*aF) |
88 | { | 99 | { |
89 | QValueList<QWSServer::KeyboardFilter*>::Iterator iter; | 100 | QValueList<QWSServer::KeyboardFilter*>::Iterator iter; |
90 | if ( (iter=filterList.find(aF))==filterList.end() ) { | 101 | if ( (iter=filterList.find(aF))==filterList.end() ) { |
@@ -94,7 +105,7 @@ void OKeyFilter::remHandler(QWSServer::KeyboardFilter*aF) | |||
94 | filterList.remove(iter); | 105 | filterList.remove(iter); |
95 | } | 106 | } |
96 | 107 | ||
97 | void OKeyFilter::addPreHandler(QWSServer::KeyboardFilter*aF) | 108 | void OKeyFilterPrivate::addPreHandler(QWSServer::KeyboardFilter*aF) |
98 | { | 109 | { |
99 | if (preFilterList.find(aF)!=preFilterList.end()) { | 110 | if (preFilterList.find(aF)!=preFilterList.end()) { |
100 | return; | 111 | return; |
@@ -103,7 +114,7 @@ void OKeyFilter::addPreHandler(QWSServer::KeyboardFilter*aF) | |||
103 | preFilterList.append(aF); | 114 | preFilterList.append(aF); |
104 | } | 115 | } |
105 | 116 | ||
106 | void OKeyFilter::remPreHandler(QWSServer::KeyboardFilter*aF) | 117 | void OKeyFilterPrivate::remPreHandler(QWSServer::KeyboardFilter*aF) |
107 | { | 118 | { |
108 | QValueList<QWSServer::KeyboardFilter*>::Iterator iter; | 119 | QValueList<QWSServer::KeyboardFilter*>::Iterator iter; |
109 | if ( (iter=preFilterList.find(aF))==preFilterList.end() ) { | 120 | if ( (iter=preFilterList.find(aF))==preFilterList.end() ) { |
@@ -113,6 +124,20 @@ void OKeyFilter::remPreHandler(QWSServer::KeyboardFilter*aF) | |||
113 | preFilterList.remove(iter); | 124 | preFilterList.remove(iter); |
114 | } | 125 | } |
115 | 126 | ||
127 | OKeyFilterPrivate::OKeyFilterPrivate() | ||
128 | :OKeyFilter(),QWSServer::KeyboardFilter() | ||
129 | { | ||
130 | filterList.clear(); | ||
131 | preFilterList.clear(); | ||
132 | if ( isQWS( ) ) { | ||
133 | QWSServer::setKeyboardFilter ( this ); | ||
134 | } | ||
135 | } | ||
136 | |||
137 | OKeyFilterPrivate::~OKeyFilterPrivate() | ||
138 | { | ||
139 | } | ||
140 | |||
116 | /* namespace Core */ | 141 | /* namespace Core */ |
117 | } | 142 | } |
118 | /* namespace Opie */ | 143 | /* namespace Opie */ |
diff --git a/libopie2/opiecore/okeyfilter.h b/libopie2/opiecore/okeyfilter.h index 3f9f744..a65bc48 100644 --- a/libopie2/opiecore/okeyfilter.h +++ b/libopie2/opiecore/okeyfilter.h | |||
@@ -47,29 +47,57 @@ namespace Internal { | |||
47 | * @author Rajko Albrecht | 47 | * @author Rajko Albrecht |
48 | * @version 1.0 | 48 | * @version 1.0 |
49 | */ | 49 | */ |
50 | class OKeyFilter:public QWSServer::KeyboardFilter | 50 | class OKeyFilter |
51 | { | 51 | { |
52 | friend class Opie::Core::ODevice; | 52 | friend class Opie::Core::ODevice; |
53 | friend class Opie::Core::Internal::iPAQ; | 53 | friend class Opie::Core::Internal::iPAQ; |
54 | friend class Opie::Core::Internal::SIMpad; | 54 | friend class Opie::Core::Internal::SIMpad; |
55 | 55 | ||
56 | static QValueList<QWSServer::KeyboardFilter*> filterList; | ||
57 | static QValueList<QWSServer::KeyboardFilter*> preFilterList; | ||
58 | |||
59 | OKeyFilter(); | ||
60 | OKeyFilter(const OKeyFilter&):QWSServer::KeyboardFilter(){}; | ||
61 | |||
62 | protected: | 56 | protected: |
63 | void addPreHandler(QWSServer::KeyboardFilter*); | 57 | /** |
64 | void remPreHandler(QWSServer::KeyboardFilter*); | 58 | * Protected constructor - generate class via inst() |
59 | * @see inst() | ||
60 | */ | ||
61 | OKeyFilter(); | ||
62 | /** | ||
63 | * Protected constructor - generate class via inst() | ||
64 | * @see inst() | ||
65 | */ | ||
66 | OKeyFilter(const OKeyFilter&){}; | ||
67 | /** | ||
68 | * Append filter to the primary list. | ||
69 | * This is only allowed for friend classes from odevice | ||
70 | * @param aFilter a filter to append | ||
71 | * @see addHandler | ||
72 | */ | ||
73 | virtual void addPreHandler(QWSServer::KeyboardFilter*aFilter)=0; | ||
74 | /** | ||
75 | * Remove the specified filter from list and give back ownership. | ||
76 | * This is only allowed for friend classes from odevice | ||
77 | * @param aFilter a filter to remove | ||
78 | * @see remHandler | ||
79 | */ | ||
80 | virtual void remPreHandler(QWSServer::KeyboardFilter*aFilter)=0; | ||
65 | 81 | ||
66 | public: | 82 | public: |
67 | virtual ~OKeyFilter(); | 83 | virtual ~OKeyFilter(); |
68 | virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); | 84 | /** |
69 | 85 | * Append filter to the secondary list. | |
70 | void addHandler(QWSServer::KeyboardFilter*); | 86 | * @param aFilter a filter to append |
71 | void remHandler(QWSServer::KeyboardFilter*); | 87 | * @see addPreHandler |
88 | */ | ||
89 | virtual void addHandler(QWSServer::KeyboardFilter*)=0; | ||
90 | /** | ||
91 | * Remove the specified filter from list and give back ownership. | ||
92 | * @param aFilter a filter to remove | ||
93 | * @see remPreHandler | ||
94 | */ | ||
95 | virtual void remHandler(QWSServer::KeyboardFilter*)=0; | ||
72 | 96 | ||
97 | /** | ||
98 | * Returns a handler to an instance of OKeyFilter | ||
99 | * @return a pointer to a working OKeyFilter | ||
100 | */ | ||
73 | static OKeyFilter*inst(); | 101 | static OKeyFilter*inst(); |
74 | }; | 102 | }; |
75 | 103 | ||