|
1 /* |
|
2 * Copyright (c) 2005-2005 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: header file of layout timer |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_LAYOUTTIMER_H |
|
20 #define C_LAYOUTTIMER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <peninputlayoutminterface.h> |
|
24 |
|
25 /** |
|
26 * CLayoutTimer |
|
27 * |
|
28 * Layout timer class. Several timers are used in hwr layout. Refer to TTimeType. |
|
29 * |
|
30 * @lib peninputlayoutcontrol.lib |
|
31 * @since S60 v4.0 |
|
32 */ |
|
33 NONSHARABLE_CLASS(CLayoutTimer) : public CActive |
|
34 { |
|
35 public: |
|
36 /** Layout timer type */ |
|
37 enum TTimeType |
|
38 { |
|
39 ECharacterTimer, |
|
40 EStrokeTimer, |
|
41 ECandidateClearTimer, |
|
42 EDragbarMoveTimer, |
|
43 ELongPressTimer, |
|
44 EOthers |
|
45 }; |
|
46 |
|
47 // Constructors and destructor |
|
48 /** |
|
49 * Two-phased constructor. |
|
50 * |
|
51 * @since S60 v4.0 |
|
52 * @param aTimerHandler The callback timer function |
|
53 * @param aType Timer type. Default value is stroke timer |
|
54 * @param aAutoFalg Flag tells whether the timer will be active again |
|
55 * ETrue, if it's automatically set active after RunL. Default is EFalse |
|
56 * @return The created timer |
|
57 */ |
|
58 static CLayoutTimer* NewL(MTimerHandler* aTimerHandler , |
|
59 TTimeType aMode = EStrokeTimer , TBool aAutoFlag = EFalse); |
|
60 /** |
|
61 * Destructor. Frees all used resources. |
|
62 * |
|
63 * @since S60 V4.0 |
|
64 */ |
|
65 ~CLayoutTimer(); |
|
66 |
|
67 /** |
|
68 * sets the timer |
|
69 * |
|
70 * @since S60 v4.0 |
|
71 * @param aDelay Timer interval |
|
72 */ |
|
73 void SetTimer(TTimeIntervalMicroSeconds32 aDelay); |
|
74 |
|
75 private: |
|
76 /** |
|
77 * Constructor |
|
78 * |
|
79 * @since S60 v4.0 |
|
80 * @param aTimerHandler The callback timer function |
|
81 * @param aType Timer type. Default value is stroke timer |
|
82 * @param aAutoFalg Flag tells whether the timer will be active again |
|
83 */ |
|
84 CLayoutTimer(MTimerHandler* aTimerHandler,TTimeType aMode,TBool bAutoRepeat); |
|
85 |
|
86 /** |
|
87 * second phase constructor |
|
88 * |
|
89 * @since S60 v4.0 |
|
90 */ |
|
91 void ConstructL(); |
|
92 |
|
93 //from base class CActive |
|
94 |
|
95 /** |
|
96 * From CActive |
|
97 * will be called when stroke timer ends |
|
98 * |
|
99 * @since S60 v4.0 |
|
100 */ |
|
101 void RunL(); |
|
102 |
|
103 /** |
|
104 * From CActive |
|
105 * will be called if RunL leaves |
|
106 * |
|
107 * @since S60 v4.0 |
|
108 */ |
|
109 TInt RunError(TInt aError); |
|
110 |
|
111 /** |
|
112 * From CActive |
|
113 * will be called when stroke timer has been cancelled |
|
114 * |
|
115 * @since S60 v4.0 |
|
116 */ |
|
117 void DoCancel(); |
|
118 |
|
119 private: |
|
120 |
|
121 /** |
|
122 * timer object |
|
123 */ |
|
124 RTimer iTimer; |
|
125 |
|
126 /** |
|
127 * Timer type |
|
128 */ |
|
129 TTimeType iType; |
|
130 |
|
131 /** |
|
132 * flag for auto repat event |
|
133 */ |
|
134 TBool iAutoRepeat; |
|
135 |
|
136 /** |
|
137 * timer interval |
|
138 */ |
|
139 TTimeIntervalMicroSeconds32 iInterval; |
|
140 |
|
141 /** |
|
142 * Timer event handler |
|
143 * Not own |
|
144 */ |
|
145 MTimerHandler* iTimerHandler; |
|
146 }; |
|
147 #endif //C_LAYOUTTIMER_H |