|
1 /* |
|
2 * Copyright (c) 2007-2008 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: Application key detecting helper class |
|
15 * Version : %version: 2 % << Don't touch! Updated by Synergy at check-out. |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef CMMAPPKEYHANLDER_H |
|
20 #define CMMAPPKEYHANDLER_H |
|
21 |
|
22 #include <e32base.h> // For CActive, link against: euser.lib |
|
23 #include <w32std.h> |
|
24 |
|
25 /** |
|
26 * @ingroup group_matrixmenu |
|
27 * |
|
28 * CMmAppkeyHandler is a helper class. It is a low priority active object. |
|
29 * It is used to detect quick and frequent usage of the application key. |
|
30 * To detect this state the IsActive() method should be invoked. If IsActive() returns |
|
31 * ETrue, this means there is heavy processing which blocks the active object completion, |
|
32 * which may indicate that appkey is being frequently pressed. |
|
33 * |
|
34 * @since S60 v5.0 |
|
35 */ |
|
36 class CMmAppkeyHandler : public CActive |
|
37 { |
|
38 public: |
|
39 /** |
|
40 * Cancel and destroy. |
|
41 */ |
|
42 ~CMmAppkeyHandler(); |
|
43 |
|
44 /** |
|
45 * Two-phased constructor. |
|
46 * @return instance of CMmAppkeyHandler. |
|
47 */ |
|
48 static CMmAppkeyHandler* NewL(); |
|
49 |
|
50 /** |
|
51 * Two-phased constructor. |
|
52 * @return instance of CMmAppkeyHandler. |
|
53 */ |
|
54 static CMmAppkeyHandler* NewLC(); |
|
55 |
|
56 public: |
|
57 // New functions |
|
58 |
|
59 /** |
|
60 * Function for making the initial request. |
|
61 */ |
|
62 void StartL(); |
|
63 |
|
64 private: |
|
65 /** |
|
66 * C++ constructor. |
|
67 */ |
|
68 CMmAppkeyHandler(); |
|
69 |
|
70 /** |
|
71 * Second-phase constructor. |
|
72 */ |
|
73 void ConstructL(); |
|
74 |
|
75 private: |
|
76 /** |
|
77 * From CActive. |
|
78 * Handle completion. |
|
79 */ |
|
80 void RunL(); |
|
81 |
|
82 /** |
|
83 * How to cancel me. |
|
84 * Left without implementation because the AO completes itself in StartL; |
|
85 */ |
|
86 void DoCancel(); |
|
87 |
|
88 /** |
|
89 * Override to handle leaves from RunL(). Default implementation causes |
|
90 * the active scheduler to panic. |
|
91 * |
|
92 * @param aError Error occurred; |
|
93 * @return Error code. |
|
94 */ |
|
95 TInt RunError(TInt aError); |
|
96 |
|
97 }; |
|
98 |
|
99 #endif // CMMAPPKEYHANLDER_H |