|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Class for various input events, including custom events. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef ALFEVENTINPUT_H |
|
20 #define ALFEVENTINPUT_H |
|
21 |
|
22 #include <alf/alfwidgetevents.h> |
|
23 #include <osn/osndefines.h> |
|
24 #include <memory> |
|
25 #include <osn/ustring.h> |
|
26 class TAlfEvent; |
|
27 |
|
28 using namespace std; |
|
29 using namespace osncore; |
|
30 |
|
31 namespace Alf |
|
32 { |
|
33 |
|
34 class CAlfWidgetControl; |
|
35 class AlfReferenceToVisual; |
|
36 class AlfAttribute; |
|
37 |
|
38 // bit definitions in the received key events |
|
39 enum |
|
40 { |
|
41 eventBitLeftAlt =0x00000004, |
|
42 eventBitRightAlt =0x00000008, |
|
43 eventBitAlt =0x00000010, |
|
44 eventBitLeftCtrl =0x00000020, |
|
45 eventBitRightCtrl =0x00000040, |
|
46 eventBitCtrl =0x00000080, |
|
47 eventBitLeftShift =0x00000100, |
|
48 eventBitRightShift =0x00000200, |
|
49 eventBitShift =0x00000400, |
|
50 eventBitLeftFunc =0x00000800, |
|
51 eventBitRightFunc =0x00001000, |
|
52 eventBitFunc =0x00002000, |
|
53 eventBitCapsLock =0x00004000, |
|
54 eventBitNumLock =0x00008000, |
|
55 eventBitScrollLock =0x00010000 |
|
56 }; |
|
57 |
|
58 /** |
|
59 * Event input, which may be either a custom event or a key event. |
|
60 * Internal. |
|
61 */ |
|
62 OSN_NONSHARABLE_CLASS( AlfEventInput ) |
|
63 { |
|
64 public: |
|
65 public: |
|
66 /** |
|
67 * accepts the event. |
|
68 */ |
|
69 bool accept( const TAlfEvent& aEvent ) const; |
|
70 |
|
71 public: // data |
|
72 AlfEventInput(int, int, int, int); |
|
73 // Event type flags, combination of EventTypeFlags values |
|
74 int mEventTypeFlags; |
|
75 // Key or custom event id |
|
76 int mEventID; |
|
77 // Custom event data, if used |
|
78 int mEventData; |
|
79 // Key event modifiers |
|
80 int mKeyEventModifiers; |
|
81 }; |
|
82 |
|
83 /** |
|
84 * Pointer event input. |
|
85 * Internal. |
|
86 */ |
|
87 OSN_NONSHARABLE_CLASS( AlfPointerEventInput ) //: public CBase |
|
88 { |
|
89 public: |
|
90 /** |
|
91 * constructor. |
|
92 */ |
|
93 AlfPointerEventInput(const char* aElementName, const char* aVisualName, |
|
94 WidgetPointerEvent aEvent ); |
|
95 |
|
96 /** |
|
97 * Destructor. |
|
98 */ |
|
99 virtual ~AlfPointerEventInput(); |
|
100 |
|
101 public: |
|
102 /** |
|
103 * accept the event. |
|
104 */ |
|
105 bool accept( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ) const; |
|
106 |
|
107 private: |
|
108 AlfPointerEventInput(); |
|
109 |
|
110 private: // data |
|
111 |
|
112 auto_ptr<AlfReferenceToVisual> mVisualRef; |
|
113 WidgetPointerEvent mEvent; |
|
114 }; |
|
115 OSN_NONSHARABLE_CLASS( AlfWidgetAttributeInput ) |
|
116 { |
|
117 public: |
|
118 /** |
|
119 * Constructor. |
|
120 */ |
|
121 AlfWidgetAttributeInput( AlfAttribute& aAttribute, |
|
122 const char* aElementId ); |
|
123 |
|
124 ~AlfWidgetAttributeInput(); |
|
125 |
|
126 public: |
|
127 /** |
|
128 * Executes the event output. |
|
129 */ |
|
130 void execute( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ); |
|
131 |
|
132 bool accept(const TAlfEvent& aEvent) const; |
|
133 |
|
134 private: |
|
135 /** |
|
136 * constructor |
|
137 */ |
|
138 AlfWidgetAttributeInput(); |
|
139 |
|
140 private: // data |
|
141 AlfAttribute* mAttr; |
|
142 // Reference to element |
|
143 UString mElementId; |
|
144 }; |
|
145 OSN_NONSHARABLE_CLASS( AlfEventPasserInput ) |
|
146 { |
|
147 public: |
|
148 /** |
|
149 * Constructor. |
|
150 */ |
|
151 AlfEventPasserInput( int aEventId, int aEventData ); |
|
152 |
|
153 ~AlfEventPasserInput(); |
|
154 |
|
155 public: |
|
156 |
|
157 bool accept(const TAlfEvent& aEvent) const; |
|
158 |
|
159 private: |
|
160 /** |
|
161 * constructor |
|
162 */ |
|
163 AlfEventPasserInput(); |
|
164 |
|
165 private: // data |
|
166 int mEventId; |
|
167 int mEventData; |
|
168 }; |
|
169 } // namespace Alf |
|
170 |
|
171 #endif // ALFEVENTINPUT_H |