|
1 /* |
|
2 * Copyright (c) 2006 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: Instance of this class catches key events when activated |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "CCAInputAbsorber.h" |
|
22 #include <eikenv.h> |
|
23 #include <eikappui.h> |
|
24 #include <avkon.rsg> |
|
25 |
|
26 // ============================ MEMBER FUNCTIONS =============================== |
|
27 |
|
28 // ----------------------------------------------------------------------------- |
|
29 // CCAInputAbsorber::CCAInputAbsorber |
|
30 // C++ default constructor can NOT contain any code, that |
|
31 // might leave. |
|
32 // ----------------------------------------------------------------------------- |
|
33 // |
|
34 CCAInputAbsorber::CCAInputAbsorber() |
|
35 { |
|
36 } |
|
37 |
|
38 // ----------------------------------------------------------------------------- |
|
39 // CCAInputAbsorber::ConstructL |
|
40 // Symbian 2nd phase constructor can leave. |
|
41 // ----------------------------------------------------------------------------- |
|
42 // |
|
43 void CCAInputAbsorber::ConstructL() |
|
44 { |
|
45 CreateWindowL(); |
|
46 SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) ); |
|
47 ActivateL(); |
|
48 ClaimPointerGrab( ETrue ); |
|
49 iAppUi = iEikonEnv->EikAppUi(); |
|
50 } |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // CCAInputAbsorber::NewL |
|
54 // Two-phased constructor. |
|
55 // ----------------------------------------------------------------------------- |
|
56 // |
|
57 CCAInputAbsorber* CCAInputAbsorber::NewL() |
|
58 { |
|
59 CCAInputAbsorber* self = new( ELeave ) CCAInputAbsorber; |
|
60 |
|
61 CleanupStack::PushL( self ); |
|
62 self->ConstructL(); |
|
63 CleanupStack::Pop( self ); |
|
64 |
|
65 return self; |
|
66 } |
|
67 |
|
68 |
|
69 // Destructor |
|
70 CCAInputAbsorber::~CCAInputAbsorber() |
|
71 { |
|
72 if ( iIsCaptured ) |
|
73 { |
|
74 if ( iAppUi ) |
|
75 { |
|
76 iAppUi->RemoveFromStack( this ); |
|
77 } |
|
78 } |
|
79 } |
|
80 |
|
81 // --------------------------------------------------------- |
|
82 // CCAInputAbsorber::CaptureEventsL() |
|
83 // (other items were commented in a header). |
|
84 // --------------------------------------------------------- |
|
85 // |
|
86 void CCAInputAbsorber::CaptureEventsL() |
|
87 { |
|
88 if ( !iIsCaptured ) |
|
89 { |
|
90 iAppUi->AddToStackL( this ); |
|
91 SetPointerCapture(); |
|
92 } |
|
93 |
|
94 iIsCaptured = ETrue; |
|
95 } |
|
96 |
|
97 // --------------------------------------------------------- |
|
98 // CCAInputAbsorber::Release() |
|
99 // (other items were commented in a header). |
|
100 // --------------------------------------------------------- |
|
101 // |
|
102 void CCAInputAbsorber::Release() |
|
103 { |
|
104 if ( iIsCaptured ) |
|
105 { |
|
106 iAppUi->RemoveFromStack( this ); |
|
107 SetPointerCapture( EFalse ); |
|
108 } |
|
109 |
|
110 iIsCaptured = EFalse; |
|
111 } |
|
112 |
|
113 |
|
114 // --------------------------------------------------------- |
|
115 // CCAInputAbsorber::IsCaptured() |
|
116 // (other items were commented in a header). |
|
117 // --------------------------------------------------------- |
|
118 // |
|
119 TBool CCAInputAbsorber::IsCaptured() const |
|
120 { |
|
121 return iIsCaptured; |
|
122 } |
|
123 |
|
124 |
|
125 // ----------------------------------------------------------------------------- |
|
126 // CCAInputAbsorber::OfferKeyEventL |
|
127 // (other items were commented in a header). |
|
128 // ----------------------------------------------------------------------------- |
|
129 // |
|
130 TKeyResponse CCAInputAbsorber::OfferKeyEventL( const TKeyEvent& /*aKeyEvent*/, |
|
131 TEventCode /*aType*/ ) |
|
132 { |
|
133 // consume all keys |
|
134 return EKeyWasConsumed; |
|
135 } |
|
136 |
|
137 // ----------------------------------------------------------------------------- |
|
138 // CCAInputAbsorber::HandlePointerEventL |
|
139 // (other items were commented in a header). |
|
140 // ----------------------------------------------------------------------------- |
|
141 // |
|
142 void CCAInputAbsorber::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
|
143 { |
|
144 // For debugging purposes. |
|
145 CCoeControl::HandlePointerEventL( aPointerEvent ); |
|
146 } |
|
147 |
|
148 // End of File |