|
1 /* |
|
2 * Copyright (c) 2002-2004 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: External rendering plugin wrapper implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 // System include files |
|
19 |
|
20 // User include files |
|
21 #include "xnnode.h" |
|
22 #include "xnuiengine.h" |
|
23 #include "xnappuiadapter.h" |
|
24 |
|
25 #include "xnextrenderingpluginwrapper.h" |
|
26 |
|
27 // ======== MEMBER FUNCTIONS ======== |
|
28 |
|
29 // ---------------------------------------------------------------------------- |
|
30 // CXnExtRenderingPluginWrapper::NewL() |
|
31 // |
|
32 // ---------------------------------------------------------------------------- |
|
33 // |
|
34 CXnExtRenderingPluginWrapper* CXnExtRenderingPluginWrapper::NewL( |
|
35 CXnNodePluginIf& aNode, CXnExtRenderingPluginAdapter& aAdapter ) |
|
36 { |
|
37 CXnExtRenderingPluginWrapper* self = |
|
38 new ( ELeave ) CXnExtRenderingPluginWrapper( aAdapter ); |
|
39 |
|
40 CleanupStack::PushL( self ); |
|
41 self->ConstructL( aNode ); |
|
42 CleanupStack::Pop( self ); |
|
43 return self; |
|
44 } |
|
45 |
|
46 // ---------------------------------------------------------------------------- |
|
47 // CXnExtRenderingPluginWrapper::ConstructL() |
|
48 // |
|
49 // ---------------------------------------------------------------------------- |
|
50 // |
|
51 void CXnExtRenderingPluginWrapper::ConstructL( CXnNodePluginIf& aNode ) |
|
52 { |
|
53 iNode = &aNode; |
|
54 |
|
55 CXnControlAdapter::ConstructL( aNode ); |
|
56 iAdapter->SetEventHandler( this ); |
|
57 } |
|
58 |
|
59 // ---------------------------------------------------------------------------- |
|
60 // CXnExtRenderingPluginWrapper::CXnExtRenderingPluginWrapper() |
|
61 // |
|
62 // ---------------------------------------------------------------------------- |
|
63 // |
|
64 CXnExtRenderingPluginWrapper::CXnExtRenderingPluginWrapper( |
|
65 CXnExtRenderingPluginAdapter& aAdapter ) |
|
66 { |
|
67 iAdapter = &aAdapter; |
|
68 } |
|
69 |
|
70 // ---------------------------------------------------------------------------- |
|
71 // CXnExtRenderingPluginWrapper::~CXnExtRenderingPluginWrapper() |
|
72 // |
|
73 // ---------------------------------------------------------------------------- |
|
74 // |
|
75 CXnExtRenderingPluginWrapper::~CXnExtRenderingPluginWrapper() |
|
76 { |
|
77 delete iAdapter; |
|
78 } |
|
79 |
|
80 // ---------------------------------------------------------------------------- |
|
81 // CXnExtRenderingPluginWrapper::CountComponentControls() |
|
82 // |
|
83 // ---------------------------------------------------------------------------- |
|
84 // |
|
85 TInt CXnExtRenderingPluginWrapper::CountComponentControls() const |
|
86 { |
|
87 return 1; |
|
88 } |
|
89 |
|
90 // ---------------------------------------------------------------------------- |
|
91 // CXnExtRenderingPluginWrapper::ComponentControl() |
|
92 // |
|
93 // ---------------------------------------------------------------------------- |
|
94 // |
|
95 CCoeControl* CXnExtRenderingPluginWrapper::ComponentControl( |
|
96 TInt aIndex ) const |
|
97 { |
|
98 if( aIndex == 0 ) |
|
99 { |
|
100 return iAdapter; |
|
101 } |
|
102 |
|
103 return NULL; |
|
104 } |
|
105 |
|
106 // ---------------------------------------------------------------------------- |
|
107 // CXnExtRenderingPluginWrapper::OfferKeyEventL() |
|
108 // |
|
109 // ---------------------------------------------------------------------------- |
|
110 // |
|
111 TKeyResponse CXnExtRenderingPluginWrapper::OfferKeyEventL( |
|
112 const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
113 { |
|
114 TKeyResponse resp( iAdapter->OfferKeyEventL( aKeyEvent, aType ) ); |
|
115 |
|
116 if ( resp == EKeyWasNotConsumed ) |
|
117 { |
|
118 // iAdapter did't consume the event, pass it to base clsas |
|
119 resp = CXnControlAdapter::OfferKeyEventL( aKeyEvent, aType ); |
|
120 } |
|
121 |
|
122 return resp; |
|
123 } |
|
124 |
|
125 // ---------------------------------------------------------------------------- |
|
126 // CXnExtRenderingPluginWrapper::SizeChanged() |
|
127 // |
|
128 // ---------------------------------------------------------------------------- |
|
129 // |
|
130 void CXnExtRenderingPluginWrapper::SizeChanged() |
|
131 { |
|
132 iAdapter->SetRect( iNode->Rect() ); |
|
133 } |
|
134 |
|
135 // ---------------------------------------------------------------------------- |
|
136 // CXnExtRenderingPluginWrapper::SkinChanged() |
|
137 // |
|
138 // ---------------------------------------------------------------------------- |
|
139 // |
|
140 void CXnExtRenderingPluginWrapper::SkinChanged() |
|
141 { |
|
142 CXnControlAdapter::SkinChanged(); |
|
143 |
|
144 iAdapter->SkinChanged(); |
|
145 } |
|
146 |
|
147 // ---------------------------------------------------------------------------- |
|
148 // CXnExtRenderingPluginWrapper::SetContainerWindowL() |
|
149 // |
|
150 // ---------------------------------------------------------------------------- |
|
151 // |
|
152 void CXnExtRenderingPluginWrapper::SetContainerWindowL( |
|
153 const CCoeControl& aContainer ) |
|
154 { |
|
155 CXnControlAdapter::SetContainerWindowL( aContainer ); |
|
156 |
|
157 iAdapter->SetContainerWindowL( *this ); |
|
158 } |
|
159 |
|
160 // ---------------------------------------------------------------------------- |
|
161 // CXnExtRenderingPluginWrapper::MakeVisible() |
|
162 // |
|
163 // ---------------------------------------------------------------------------- |
|
164 // |
|
165 void CXnExtRenderingPluginWrapper::MakeVisible( TBool aVisible ) |
|
166 { |
|
167 // Base class will call MakeVisible to component controls |
|
168 CXnControlAdapter::MakeVisible( aVisible ); |
|
169 } |
|
170 |
|
171 // ---------------------------------------------------------------------------- |
|
172 // CXnExtRenderingPluginWrapper::FocusChanged() |
|
173 // |
|
174 // ---------------------------------------------------------------------------- |
|
175 // |
|
176 void CXnExtRenderingPluginWrapper::FocusChanged( TDrawNow aDrawNow ) |
|
177 { |
|
178 CXnControlAdapter::FocusChanged( aDrawNow ); |
|
179 |
|
180 TBool focused( IsFocused() ? ETrue : EFalse ); |
|
181 |
|
182 iAdapter->SetFocus( focused, aDrawNow ); |
|
183 } |
|
184 |
|
185 // ---------------------------------------------------------------------------- |
|
186 // CXnExtRenderingPluginWrapper::HandleScreenDeviceChangedL() |
|
187 // |
|
188 // ---------------------------------------------------------------------------- |
|
189 // |
|
190 void CXnExtRenderingPluginWrapper::HandleScreenDeviceChangedL() |
|
191 { |
|
192 CXnControlAdapter::HandleScreenDeviceChangedL(); |
|
193 |
|
194 iAdapter->HandleResourceChange( KEikDynamicLayoutVariantSwitch ); |
|
195 } |
|
196 |
|
197 // ---------------------------------------------------------------------------- |
|
198 // CXnExtRenderingPluginWrapper::DoEnterPowerSaveModeL() |
|
199 // |
|
200 // ---------------------------------------------------------------------------- |
|
201 // |
|
202 void CXnExtRenderingPluginWrapper::DoEnterPowerSaveModeL( |
|
203 TModeEvent /*aEvent*/ ) |
|
204 { |
|
205 iAdapter->EnterPowerSaveModeL(); |
|
206 } |
|
207 |
|
208 // ---------------------------------------------------------------------------- |
|
209 // CXnExtRenderingPluginWrapper::DoExitPowerSaveModeL() |
|
210 // |
|
211 // ---------------------------------------------------------------------------- |
|
212 // |
|
213 void CXnExtRenderingPluginWrapper::DoExitPowerSaveModeL( |
|
214 TModeEvent /*aEvent*/ ) |
|
215 { |
|
216 iAdapter->ExitPowerSaveModeL(); |
|
217 } |
|
218 |
|
219 // ---------------------------------------------------------------------------- |
|
220 // CXnExtRenderingPluginWrapper::HandleEventL() |
|
221 // |
|
222 // ---------------------------------------------------------------------------- |
|
223 // |
|
224 void CXnExtRenderingPluginWrapper::HandleEventL( const TDesC& aEvent, const TDesC8& aDestination ) |
|
225 { |
|
226 |
|
227 CXnNode* node = iNode->Node().UiEngine()->FindNodeByIdL( aDestination ); |
|
228 CXnAppUiAdapter* appui = static_cast<CXnAppUiAdapter*>(iAvkonAppUi); |
|
229 if ( !appui || !node ) |
|
230 { |
|
231 User::Leave( KErrNotFound ); |
|
232 } |
|
233 appui->HandleEventL( aEvent, node->AppIfL() ); |
|
234 } |
|
235 |
|
236 // ---------------------------------------------------------------------------- |
|
237 // CXnExtRenderingPluginWrapper::SetDataL() |
|
238 // |
|
239 // ---------------------------------------------------------------------------- |
|
240 // |
|
241 void CXnExtRenderingPluginWrapper::SetDataL( const TDesC8& aData, const TDesC& aType, TInt aIndex ) |
|
242 { |
|
243 iAdapter->SetDataL( aData, aType, aIndex ); |
|
244 } |
|
245 |
|
246 // End of file |