|
1 /* |
|
2 * Copyright (c) 2005-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: Phonebook 2 input absorber. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPBK2INPUTABSORBER_H |
|
20 #define CPBK2INPUTABSORBER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <coecntrl.h> // CCoeControl |
|
24 #include <eikcmobs.h> // MEikCommandObserver |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class CEikAppUi; |
|
28 class CEikButtonGroupContainer; |
|
29 |
|
30 // CLASS DECLARATION |
|
31 |
|
32 /** |
|
33 * Phonebook 2 input absorber. |
|
34 * A control which absorbs all the keyboard and CBA events. |
|
35 */ |
|
36 class CPbk2InputAbsorber : public CCoeControl, |
|
37 private MEikCommandObserver |
|
38 { |
|
39 public: // Constructors and destructor |
|
40 |
|
41 /** |
|
42 * Creates a new instance of this class. |
|
43 * |
|
44 * @param aCbaResource Resource id of softkeys to use. |
|
45 * Defaults to empty softkeys. |
|
46 * @return A new instance of this class. |
|
47 */ |
|
48 IMPORT_C static CPbk2InputAbsorber* NewL( |
|
49 TInt aCbaResource = 0 ); |
|
50 |
|
51 /** |
|
52 * Creates a new instance of this class. |
|
53 * |
|
54 * @param aCbaResource Resource id of softkeys to use. |
|
55 * Defaults to empty softkeys. |
|
56 * @return A new instance of this class. |
|
57 */ |
|
58 IMPORT_C static CPbk2InputAbsorber* NewLC( |
|
59 TInt aCbaResource = 0 ); |
|
60 |
|
61 /** |
|
62 * Destructor. |
|
63 */ |
|
64 ~CPbk2InputAbsorber(); |
|
65 |
|
66 public: // Interface |
|
67 |
|
68 /** |
|
69 * Sets an observer for the softkey commands. |
|
70 * |
|
71 * @param aCmdObserver The observer to set. |
|
72 */ |
|
73 IMPORT_C void SetCommandObserver( |
|
74 MEikCommandObserver* aCmdObserver ); |
|
75 |
|
76 /** |
|
77 * Waits until StopWait() is called or this object is destroyed. |
|
78 */ |
|
79 IMPORT_C void Wait(); |
|
80 |
|
81 /** |
|
82 * Makes Wait() return. |
|
83 */ |
|
84 IMPORT_C void StopWait(); |
|
85 |
|
86 /** |
|
87 * Returns ETrue if Wait() is called. |
|
88 */ |
|
89 IMPORT_C TBool IsWaiting() const; |
|
90 |
|
91 private: // From CCoeControl |
|
92 TKeyResponse OfferKeyEventL( |
|
93 const TKeyEvent& aKeyEvent, |
|
94 TEventCode aType ); |
|
95 |
|
96 private: // From MEikCommandObserver |
|
97 void ProcessCommandL( |
|
98 TInt aCommandId ); |
|
99 |
|
100 private: // Implementation |
|
101 CPbk2InputAbsorber(); |
|
102 void ConstructL( |
|
103 TInt aCbaResource ); |
|
104 void InitControlL(); |
|
105 void CaptureEventsL(); |
|
106 void InitCbaL( |
|
107 TInt aCbaResource ); |
|
108 |
|
109 private: // Data |
|
110 /// Ref: Application UI reference |
|
111 CEikAppUi* iAppUi; |
|
112 /// Own: Button group container |
|
113 CEikButtonGroupContainer* iCba; |
|
114 /// Ref: Softkey command observer |
|
115 MEikCommandObserver* iCmdObserver; |
|
116 /// Own: Active scheduler waiter |
|
117 CActiveSchedulerWait* iWait; |
|
118 }; |
|
119 |
|
120 #endif // CPBK2INPUTABSORBER_H |
|
121 |
|
122 // End of File |