|
1 /* |
|
2 * Copyright (c) 2006-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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __HUIEVENT_H__ |
|
21 #define __HUIEVENT_H__ |
|
22 |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <coedef.h> |
|
26 #include <w32std.h> |
|
27 |
|
28 |
|
29 /* Forward declarations. */ |
|
30 class CHuiDisplay; |
|
31 class CHuiVisual; |
|
32 |
|
33 |
|
34 /** |
|
35 * An input event. This class would typically be passed to a control. |
|
36 * One example of an event would be a keypress, |
|
37 * or a custom message arriving from another control. |
|
38 * You cannot derive from this class. |
|
39 */ |
|
40 NONSHARABLE_CLASS(THuiEvent) |
|
41 { |
|
42 public: |
|
43 |
|
44 /** @beginAPI */ |
|
45 |
|
46 /** Event types. This is the most general type for the message.*/ |
|
47 enum TType |
|
48 { |
|
49 ETypeCustom, //!< a message passed from one control to another |
|
50 ETypeKey, //!< a message regarding a keypress |
|
51 ETypePointer, //!< a message regarding a touch screen interface |
|
52 ETypeIdleBegin, //!< hui has entered the idle state |
|
53 ETypeIdleEnd //!< hui has left the idle state |
|
54 }; |
|
55 |
|
56 |
|
57 /* Constructors. */ |
|
58 |
|
59 /** |
|
60 * Constructor. |
|
61 */ |
|
62 THuiEvent(CHuiDisplay* aDisplay, TType aType); |
|
63 |
|
64 /** |
|
65 * Constructor for custom events (not bound to any display). |
|
66 */ |
|
67 IMPORT_C THuiEvent(TInt aCustomParam); |
|
68 |
|
69 /** |
|
70 * Constructor for pointer events. |
|
71 */ |
|
72 IMPORT_C THuiEvent(CHuiDisplay* aDisplay, const TPointerEvent& aPointerEvent); |
|
73 |
|
74 /* Methods. */ |
|
75 |
|
76 /** |
|
77 * Returns the type of the event. |
|
78 * @see TType |
|
79 */ |
|
80 IMPORT_C TType Type() const; |
|
81 |
|
82 /** |
|
83 * Determines whether the event is a custom event. |
|
84 */ |
|
85 IMPORT_C TBool IsCustomEvent() const; |
|
86 |
|
87 /** |
|
88 * Determines whether the event is a key event, for example, a key was pressed. |
|
89 */ |
|
90 IMPORT_C TBool IsKeyEvent() const; |
|
91 |
|
92 /** |
|
93 * Determines whether the event is a pointer event. |
|
94 * A pointer event is caused by a pointing device, such as a click, move or drag. |
|
95 * @return true if the event is a pointer event. |
|
96 */ |
|
97 IMPORT_C TBool IsPointerEvent() const; |
|
98 |
|
99 /** |
|
100 * Returns a reference to the display which the event originated from. |
|
101 */ |
|
102 IMPORT_C CHuiDisplay& Display() const; |
|
103 |
|
104 /** |
|
105 * Pointer is down. |
|
106 * @return ETrue if this is a pointer event and the pointer has been pressed down. |
|
107 */ |
|
108 IMPORT_C TBool PointerDown() const; |
|
109 |
|
110 /** |
|
111 * Pointer is up. |
|
112 * @return ETrue if this is a pointer event and the pointer has been lifted up. |
|
113 */ |
|
114 IMPORT_C TBool PointerUp() const; |
|
115 |
|
116 /** |
|
117 * Pointer event is a long press. |
|
118 * @return ETrue if this is a pointer event and the pointer has been pressed for long tap duration. |
|
119 */ |
|
120 IMPORT_C TBool PointerLongTap() const; |
|
121 |
|
122 IMPORT_C void SetVisual(CHuiVisual* aVisual); |
|
123 |
|
124 IMPORT_C CHuiVisual* Visual() const; |
|
125 |
|
126 /** @endAPI */ |
|
127 |
|
128 /** |
|
129 * Constructor for key events. |
|
130 */ |
|
131 THuiEvent(CHuiDisplay* aDisplay, const TKeyEvent& aKeyEvent, TEventCode aType); |
|
132 |
|
133 |
|
134 private: |
|
135 |
|
136 /* Private methods */ |
|
137 |
|
138 |
|
139 public: |
|
140 |
|
141 /* Public member variables. */ |
|
142 |
|
143 /** The display from where the event originated. */ |
|
144 CHuiDisplay* iDisplay; |
|
145 |
|
146 /** Type of this event, if it is a Symbian S60 event code. |
|
147 * |
|
148 * For example: EEventKeyUp, EEventKeyDown |
|
149 * |
|
150 * @see Symbian event codes. |
|
151 */ |
|
152 TEventCode iCode; |
|
153 |
|
154 /** The S60 struct that contains scancode, key event information, etc. |
|
155 * @see Symbian event codes. |
|
156 */ |
|
157 TKeyEvent iKeyEvent; |
|
158 |
|
159 |
|
160 /** The S60 struct that contains pointer device event info, which would be |
|
161 * triggered by touch screen interaction. |
|
162 * @see Symbian event codes. |
|
163 */ |
|
164 TAdvancedPointerEvent iPointerEvent; |
|
165 |
|
166 /** Parameter for custom events. Alignment not BC between TB9.1 and 9.2 */ |
|
167 TInt iParam; |
|
168 |
|
169 |
|
170 private: |
|
171 |
|
172 /** Type of the event. */ |
|
173 TType iType; |
|
174 |
|
175 /** Visual which the event is associated with. */ |
|
176 CHuiVisual* iVisual; |
|
177 |
|
178 // occupied by Advanced pointer event, to keep at least the size as same |
|
179 //TInt iSpare1; |
|
180 //TInt iSpare2; |
|
181 }; |
|
182 |
|
183 #endif // __HUIEVENT_H__ |