|
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: Active Idle Window Server Plug-in implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "aiwspluginanim.h" |
|
20 #include "aiwspluginanimdef.h" |
|
21 #include "keylockhandler.h" |
|
22 #include "numerickeyhandler.h" |
|
23 #include "logslaunchhandler.h" |
|
24 #include "sindlaunchhandler.h" |
|
25 |
|
26 #include <featmgr.h> |
|
27 |
|
28 using namespace AiWsPlugin; |
|
29 |
|
30 CAiWsPluginAnim::CAiWsPluginAnim() |
|
31 { |
|
32 } |
|
33 |
|
34 CAiWsPluginAnim::~CAiWsPluginAnim() |
|
35 { |
|
36 iEventHandlers.ResetAndDestroy(); |
|
37 if ( iFunctions ) |
|
38 { |
|
39 iFunctions->GetRawEvents( EFalse ); |
|
40 } |
|
41 FeatureManager::UnInitializeLib(); |
|
42 } |
|
43 |
|
44 TInt CAiWsPluginAnim::CommandReplyL( TInt /*aOpcode*/, TAny* /*aArgs*/ ) |
|
45 { |
|
46 return KErrNone; |
|
47 } |
|
48 |
|
49 void CAiWsPluginAnim::Command( TInt /*aOpcode*/, TAny* /*aArgs*/ ) |
|
50 { |
|
51 } |
|
52 |
|
53 void CAiWsPluginAnim::Animate( TDateTime* /*aDateTime*/ ) |
|
54 { |
|
55 } |
|
56 |
|
57 void CAiWsPluginAnim::AddEventHandlerAndPopL( CEventHandler* aEventHandler ) |
|
58 { |
|
59 if( aEventHandler ) |
|
60 { |
|
61 aEventHandler->SetUiStateQuery( *this ); |
|
62 iEventHandlers.AppendL( aEventHandler ); |
|
63 CleanupStack::Pop( aEventHandler ); |
|
64 } |
|
65 } |
|
66 |
|
67 void CAiWsPluginAnim::ConstructL( TAny* aArgs, TBool aHasFocus ) |
|
68 { |
|
69 FeatureManager::InitializeLibL(); |
|
70 |
|
71 iFunctions->GetRawEvents( ETrue ); |
|
72 if( !aArgs ) |
|
73 { |
|
74 User::Leave( KErrArgument ); |
|
75 } |
|
76 iWgInfo = *( static_cast<TAiWsPluginAnimInitData*>(aArgs) ); |
|
77 |
|
78 AddEventHandlerAndPopL( CKeyLockHandler::NewLC() ); |
|
79 |
|
80 MAnimGeneralFunctionsWindowExtension* ext = reinterpret_cast<MAnimGeneralFunctionsWindowExtension*> |
|
81 ( iFunctions->ExtendedInterface( |
|
82 MAnimGeneralFunctions::EWindowExtensionInterface ) ); |
|
83 AddEventHandlerAndPopL( CNumericKeyHandler::NewLC( iWgInfo.iTargetWgId, ext ) ); |
|
84 |
|
85 AddEventHandlerAndPopL( CLogsLaunchHandler::NewLC() ); |
|
86 |
|
87 /* Leave this commented code here for now.. 2.5.2007, unclear if needed still in some config. |
|
88 if ( FeatureManager::FeatureSupported( KFeatureIdKeypadNoVoiceKey ) ) |
|
89 { |
|
90 AddEventHandlerAndPopL( CSINDLaunchHandler::NewLC() ); |
|
91 } |
|
92 */ |
|
93 // Update initial focus status |
|
94 FocusChanged( aHasFocus ); |
|
95 } |
|
96 |
|
97 void CAiWsPluginAnim::Redraw() |
|
98 { |
|
99 } |
|
100 |
|
101 void CAiWsPluginAnim::FocusChanged( TBool aState ) |
|
102 { |
|
103 iAiFocused = aState; |
|
104 const TInt handlerCount = iEventHandlers.Count(); |
|
105 for( TInt i = 0; i < handlerCount; ++i ) |
|
106 { |
|
107 iEventHandlers[i]->FocusChanged( aState ); |
|
108 } |
|
109 } |
|
110 |
|
111 TBool CAiWsPluginAnim::OfferRawEvent( const TRawEvent& aRawEvent ) |
|
112 { |
|
113 // Forward event to all event handlers |
|
114 const TInt handlerCount = iEventHandlers.Count(); |
|
115 for( TInt i = 0; i < handlerCount; ++i ) |
|
116 { |
|
117 // All other are made to return EFalse |
|
118 // Except wait for 2ndkeyup and 2ndkeydown of keylock states. |
|
119 if( iEventHandlers[i]->OfferRawEvent( aRawEvent ) ) |
|
120 { |
|
121 return ETrue; |
|
122 } |
|
123 } |
|
124 |
|
125 // Update modifier key status |
|
126 iModifierTracker.Update( aRawEvent ); |
|
127 |
|
128 return EFalse; |
|
129 } |
|
130 |
|
131 TUint CAiWsPluginAnim::Modifiers() const |
|
132 { |
|
133 return iModifierTracker.Status(); |
|
134 } |
|
135 |
|
136 TBool CAiWsPluginAnim::HasFocus() const |
|
137 { |
|
138 return iAiFocused; |
|
139 } |
|
140 |