34
|
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: Node of the layout tree
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// User includes
|
|
20 |
#include "xnnodepluginif.h"
|
|
21 |
#include "xnnode.h"
|
|
22 |
#include "xnuiengine.h"
|
|
23 |
#include "xncomponentnodeimpl.h"
|
|
24 |
#include "xnproperty.h"
|
|
25 |
#include "xntype.h"
|
|
26 |
#include "xndomdocument.h"
|
|
27 |
#include "xnodt.h"
|
|
28 |
|
|
29 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
30 |
|
|
31 |
// -----------------------------------------------------------------------------
|
|
32 |
// CXnNodePluginIf::CXnNodePluginIf()
|
|
33 |
// C++ default constructor can NOT contain any code, that
|
|
34 |
// might leave.
|
|
35 |
// -----------------------------------------------------------------------------
|
|
36 |
//
|
|
37 |
CXnNodePluginIf::CXnNodePluginIf( CXnNode& aNode )
|
|
38 |
{
|
|
39 |
iNode = &aNode;
|
|
40 |
}
|
|
41 |
|
|
42 |
// -----------------------------------------------------------------------------
|
|
43 |
// CXnNodePluginIf::ViewNodeImpl
|
|
44 |
// -----------------------------------------------------------------------------
|
|
45 |
//
|
|
46 |
EXPORT_C CXnViewNodeImpl* CXnNodePluginIf::ViewNodeImpl()
|
|
47 |
{
|
|
48 |
return iNode->ViewNodeImpl();
|
|
49 |
}
|
|
50 |
|
|
51 |
// -----------------------------------------------------------------------------
|
|
52 |
// CXnNodePluginIf::ComponentNodeImpl
|
|
53 |
// -----------------------------------------------------------------------------
|
|
54 |
//
|
|
55 |
EXPORT_C CXnComponentNodeImpl* CXnNodePluginIf::ComponentNodeImpl()
|
|
56 |
{
|
|
57 |
return iNode->ComponentNodeImpl();
|
|
58 |
}
|
|
59 |
|
|
60 |
// -----------------------------------------------------------------------------
|
|
61 |
// CXnNodePluginIf::IsDrawingAllowed
|
|
62 |
// -----------------------------------------------------------------------------
|
|
63 |
//
|
|
64 |
TBool CXnNodePluginIf::IsDrawingAllowed() const
|
|
65 |
{
|
|
66 |
return EFalse;
|
|
67 |
}
|
|
68 |
|
|
69 |
// -----------------------------------------------------------------------------
|
|
70 |
// CXnNodePluginIf::Type()
|
|
71 |
// Returns control type.
|
|
72 |
// -----------------------------------------------------------------------------
|
|
73 |
//
|
|
74 |
EXPORT_C CXnType* CXnNodePluginIf::Type()
|
|
75 |
{
|
|
76 |
return iNode->Type();
|
|
77 |
}
|
|
78 |
|
|
79 |
// -----------------------------------------------------------------------------
|
|
80 |
// CXnNodePluginIf::Parent
|
|
81 |
// Get component parent
|
|
82 |
// -----------------------------------------------------------------------------
|
|
83 |
//
|
|
84 |
EXPORT_C CXnNodePluginIf* CXnNodePluginIf::ParentL() const
|
|
85 |
{
|
|
86 |
CXnNode* node = iNode->Parent();
|
|
87 |
if ( !node )
|
|
88 |
{
|
|
89 |
return NULL;
|
|
90 |
}
|
|
91 |
return &( node->PluginIfL() );
|
|
92 |
}
|
|
93 |
|
|
94 |
// -----------------------------------------------------------------------------
|
|
95 |
// CXnNodePluginIf::AddChildL
|
|
96 |
// Adds a child to this container.
|
|
97 |
// -----------------------------------------------------------------------------
|
|
98 |
//
|
|
99 |
EXPORT_C void CXnNodePluginIf::AddChildL( CXnNodePluginIf* aChild )
|
|
100 |
{
|
|
101 |
iNode->AddChildL( &( aChild->Node() ) );
|
|
102 |
}
|
|
103 |
|
|
104 |
// -----------------------------------------------------------------------------
|
|
105 |
// CXnNodePluginIf::Children
|
|
106 |
// -----------------------------------------------------------------------------
|
|
107 |
//
|
|
108 |
EXPORT_C RPointerArray< CXnNodePluginIf > CXnNodePluginIf::ChildrenL()
|
|
109 |
{
|
|
110 |
RPointerArray< CXnNode >& nodes = iNode->Children();
|
|
111 |
RPointerArray< CXnNodePluginIf > pluginNodes;
|
|
112 |
CleanupClosePushL( pluginNodes );
|
|
113 |
|
|
114 |
TInt count = nodes.Count();
|
|
115 |
for ( TInt i = 0; i < count; ++i )
|
|
116 |
{
|
|
117 |
pluginNodes.AppendL( &nodes[i]->PluginIfL() );
|
|
118 |
}
|
|
119 |
CleanupStack::Pop( &pluginNodes );
|
|
120 |
// Compiler will generate bitwise copy ctor, thus
|
|
121 |
// caller of this function must call reset or close for copied RPointerArrays,
|
|
122 |
// which is very nasty thing to do...
|
|
123 |
return pluginNodes;
|
|
124 |
}
|
|
125 |
|
|
126 |
// -----------------------------------------------------------------------------
|
|
127 |
// CXnNodePluginIf::SetPCDataL
|
|
128 |
// -----------------------------------------------------------------------------
|
|
129 |
//
|
|
130 |
EXPORT_C void CXnNodePluginIf::SetPCDataL( const TDesC8& aData )
|
|
131 |
{
|
|
132 |
iNode->SetPCDataL( aData );
|
|
133 |
}
|
|
134 |
|
|
135 |
// -----------------------------------------------------------------------------
|
|
136 |
// CXnNodePluginIf::GetPCData
|
|
137 |
// -----------------------------------------------------------------------------
|
|
138 |
//
|
|
139 |
EXPORT_C const TDesC8& CXnNodePluginIf::GetPCData() const
|
|
140 |
{
|
|
141 |
return iNode->GetPCData();
|
|
142 |
}
|
|
143 |
|
|
144 |
// -----------------------------------------------------------------------------
|
|
145 |
// CXnNodePluginIf::SetPropertyL
|
|
146 |
// Set a property.
|
|
147 |
// -----------------------------------------------------------------------------
|
|
148 |
//
|
|
149 |
EXPORT_C void CXnNodePluginIf::SetPropertyL( CXnProperty* aProperty )
|
|
150 |
{
|
|
151 |
iNode->SetPropertyL( aProperty );
|
|
152 |
}
|
|
153 |
|
|
154 |
// -----------------------------------------------------------------------------
|
|
155 |
// CXnNodePluginIf::SetPropertyL
|
|
156 |
// Set a property.
|
|
157 |
// -----------------------------------------------------------------------------
|
|
158 |
//
|
|
159 |
EXPORT_C void CXnNodePluginIf::SetPropertyWithoutNotificationL( CXnProperty* aProperty )
|
|
160 |
{
|
|
161 |
iNode->SetPropertyWithoutNotificationL( aProperty );
|
|
162 |
}
|
|
163 |
|
|
164 |
// -----------------------------------------------------------------------------
|
|
165 |
// CXnNodePluginIf::GetProperty
|
|
166 |
// Gets a property.
|
|
167 |
// -----------------------------------------------------------------------------
|
|
168 |
//
|
|
169 |
EXPORT_C CXnProperty* CXnNodePluginIf::GetPropertyL( CXnProperty& /*aProperty*/ ) const
|
|
170 |
{
|
|
171 |
return NULL; // iNode->GetPropertyL( aProperty );
|
|
172 |
}
|
|
173 |
|
|
174 |
// -----------------------------------------------------------------------------
|
|
175 |
// CXnNodePluginIf::GetProperty
|
|
176 |
// Gets a property.
|
|
177 |
// -----------------------------------------------------------------------------
|
|
178 |
//
|
|
179 |
EXPORT_C CXnProperty* CXnNodePluginIf::GetPropertyL( const TDesC8& aKey ) const
|
|
180 |
{
|
|
181 |
return iNode->GetPropertyL( aKey );
|
|
182 |
}
|
|
183 |
|
|
184 |
// -----------------------------------------------------------------------------
|
|
185 |
// CXnNodePluginIf::SetStateL
|
|
186 |
// Set a state
|
|
187 |
// -----------------------------------------------------------------------------
|
|
188 |
//
|
|
189 |
EXPORT_C void CXnNodePluginIf::SetStateL( const TDesC8& aState )
|
|
190 |
{
|
|
191 |
iNode->SetStateL( aState );
|
|
192 |
}
|
|
193 |
|
|
194 |
// -----------------------------------------------------------------------------
|
|
195 |
// CXnNodePluginIf::UnsetState
|
|
196 |
// Unset a pseudoclass
|
|
197 |
// -----------------------------------------------------------------------------
|
|
198 |
//
|
|
199 |
EXPORT_C void CXnNodePluginIf::UnsetStateL( const TDesC8& aState )
|
|
200 |
{
|
|
201 |
iNode->UnsetStateL( aState );
|
|
202 |
}
|
|
203 |
|
|
204 |
// -----------------------------------------------------------------------------
|
|
205 |
// CXnNodePluginIf::IsFocusedState
|
|
206 |
// -----------------------------------------------------------------------------
|
|
207 |
//
|
|
208 |
EXPORT_C TBool CXnNodePluginIf::IsFocusedState()
|
|
209 |
{
|
|
210 |
return iNode->IsStateSet( _L8( "focus" ) );
|
|
211 |
}
|
|
212 |
|
|
213 |
// -----------------------------------------------------------------------------
|
|
214 |
// CXnNodePluginIf::SetRect
|
|
215 |
// -----------------------------------------------------------------------------
|
|
216 |
//
|
|
217 |
EXPORT_C void CXnNodePluginIf::SetRect( const TRect& aRect )
|
|
218 |
{
|
|
219 |
iNode->SetRect( aRect );
|
|
220 |
}
|
|
221 |
|
|
222 |
// -----------------------------------------------------------------------------
|
|
223 |
// CXnNodePluginIf::Rect
|
|
224 |
// -----------------------------------------------------------------------------
|
|
225 |
//
|
|
226 |
EXPORT_C TRect CXnNodePluginIf::Rect()
|
|
227 |
{
|
|
228 |
return iNode->Rect();
|
|
229 |
}
|
|
230 |
|
|
231 |
// -----------------------------------------------------------------------------
|
|
232 |
// CXnNodePluginIf::SetBorderRect
|
|
233 |
// -----------------------------------------------------------------------------
|
|
234 |
//
|
|
235 |
EXPORT_C void CXnNodePluginIf::SetBorderRect( const TRect& aRect )
|
|
236 |
{
|
|
237 |
iNode->SetBorderRect( aRect );
|
|
238 |
}
|
|
239 |
|
|
240 |
// -----------------------------------------------------------------------------
|
|
241 |
// CXnNodePluginIf::BorderRect
|
|
242 |
// -----------------------------------------------------------------------------
|
|
243 |
//
|
|
244 |
EXPORT_C TRect CXnNodePluginIf::BorderRect()
|
|
245 |
{
|
|
246 |
return iNode->BorderRect();
|
|
247 |
}
|
|
248 |
|
|
249 |
// -----------------------------------------------------------------------------
|
|
250 |
// CXnNodePluginIf::SetMarginRect
|
|
251 |
// -----------------------------------------------------------------------------
|
|
252 |
//
|
|
253 |
EXPORT_C void CXnNodePluginIf::SetMarginRect( const TRect& aRect )
|
|
254 |
{
|
|
255 |
iNode->SetMarginRect( aRect );
|
|
256 |
}
|
|
257 |
|
|
258 |
// -----------------------------------------------------------------------------
|
|
259 |
// CXnNodePluginIf::MarginRect
|
|
260 |
// -----------------------------------------------------------------------------
|
|
261 |
//
|
|
262 |
EXPORT_C TRect CXnNodePluginIf::MarginRect()
|
|
263 |
{
|
|
264 |
return iNode->MarginRect();
|
|
265 |
}
|
|
266 |
|
|
267 |
// -----------------------------------------------------------------------------
|
|
268 |
// CXnNodePluginIf::SetPaddingRect
|
|
269 |
// -----------------------------------------------------------------------------
|
|
270 |
//
|
|
271 |
EXPORT_C void CXnNodePluginIf::SetPaddingRect( const TRect& aRect )
|
|
272 |
{
|
|
273 |
iNode->SetPaddingRect( aRect );
|
|
274 |
}
|
|
275 |
|
|
276 |
// -----------------------------------------------------------------------------
|
|
277 |
// CXnNodePluginIf::PaddingRect
|
|
278 |
// -----------------------------------------------------------------------------
|
|
279 |
//
|
|
280 |
EXPORT_C TRect CXnNodePluginIf::PaddingRect()
|
|
281 |
{
|
|
282 |
return iNode->PaddingRect();
|
|
283 |
}
|
|
284 |
|
|
285 |
// -----------------------------------------------------------------------------
|
|
286 |
// CXnNodePluginIf::UiEngine
|
|
287 |
// -----------------------------------------------------------------------------
|
|
288 |
//
|
|
289 |
EXPORT_C TXnUiEnginePluginIf* CXnNodePluginIf::UiEngineL()
|
|
290 |
{
|
|
291 |
return &( iNode->UiEngine()->PluginIfL() );
|
|
292 |
}
|
|
293 |
|
|
294 |
// -----------------------------------------------------------------------------
|
|
295 |
// CXnNodePluginIf::SetLayoutCapable
|
|
296 |
// -----------------------------------------------------------------------------
|
|
297 |
//
|
|
298 |
EXPORT_C void CXnNodePluginIf::SetLayoutCapable( const TBool aLayoutCapable )
|
|
299 |
{
|
|
300 |
iNode->SetLayoutCapable( aLayoutCapable );
|
|
301 |
}
|
|
302 |
|
|
303 |
// -----------------------------------------------------------------------------
|
|
304 |
// Get internal node
|
|
305 |
// -----------------------------------------------------------------------------
|
|
306 |
//
|
|
307 |
CXnNode& CXnNodePluginIf::Node()
|
|
308 |
{
|
|
309 |
return *iNode;
|
|
310 |
}
|
|
311 |
|
|
312 |
// -----------------------------------------------------------------------------
|
|
313 |
// Get app interface
|
|
314 |
// -----------------------------------------------------------------------------
|
|
315 |
//
|
|
316 |
EXPORT_C CXnNodeAppIf& CXnNodePluginIf::AppIfL()
|
|
317 |
{
|
|
318 |
return iNode->AppIfL();
|
|
319 |
}
|
|
320 |
|
|
321 |
// -----------------------------------------------------------------------------
|
|
322 |
// CXnNodePluginIf::MakeInterfaceL
|
|
323 |
// Create a component interface according to the given type.
|
|
324 |
// -----------------------------------------------------------------------------
|
|
325 |
//
|
|
326 |
EXPORT_C XnComponentInterface::MXnComponentInterface* CXnNodePluginIf::MakeInterfaceL(
|
|
327 |
const TDesC8& aType )
|
|
328 |
{
|
|
329 |
return iNode->MakeInterfaceL( aType );
|
|
330 |
}
|
|
331 |
|
|
332 |
// -----------------------------------------------------------------------------
|
|
333 |
// CXnNodePluginIf::DisplayL
|
|
334 |
// -----------------------------------------------------------------------------
|
|
335 |
//
|
|
336 |
EXPORT_C CXnProperty* CXnNodePluginIf::DisplayL()
|
|
337 |
{
|
|
338 |
return iNode->DisplayL();
|
|
339 |
}
|
|
340 |
|
|
341 |
// -----------------------------------------------------------------------------
|
|
342 |
// CXnNodePluginIf::VisibilityL
|
|
343 |
// -----------------------------------------------------------------------------
|
|
344 |
//
|
|
345 |
EXPORT_C CXnProperty* CXnNodePluginIf::VisibilityL()
|
|
346 |
{
|
|
347 |
return iNode->VisibilityL();
|
|
348 |
}
|
|
349 |
|
|
350 |
// -----------------------------------------------------------------------------
|
|
351 |
// CXnNodePluginIf::LabelL
|
|
352 |
// -----------------------------------------------------------------------------
|
|
353 |
//
|
|
354 |
EXPORT_C CXnProperty* CXnNodePluginIf::LabelL()
|
|
355 |
{
|
|
356 |
return iNode->LabelL();
|
|
357 |
}
|
|
358 |
|
|
359 |
// -----------------------------------------------------------------------------
|
|
360 |
// CXnNodePluginIf::IdL
|
|
361 |
// -----------------------------------------------------------------------------
|
|
362 |
//
|
|
363 |
EXPORT_C CXnProperty* CXnNodePluginIf::IdL()
|
|
364 |
{
|
|
365 |
return iNode->IdL();
|
|
366 |
}
|
|
367 |
|
|
368 |
// -----------------------------------------------------------------------------
|
|
369 |
// CXnNodePluginIf::SetHandleTooltip
|
|
370 |
// -----------------------------------------------------------------------------
|
|
371 |
//
|
|
372 |
EXPORT_C void CXnNodePluginIf::SetHandleTooltip( TBool aFlag )
|
|
373 |
{
|
|
374 |
iNode->SetHandleTooltip( aFlag );
|
|
375 |
}
|
|
376 |
|
|
377 |
// -----------------------------------------------------------------------------
|
|
378 |
// -----------------------------------------------------------------------------
|
|
379 |
//
|
|
380 |
EXPORT_C void CXnNodePluginIf::ReportTriggerEventL(
|
|
381 |
const TDesC8& aTriggerName,
|
|
382 |
const TDesC8& aValueName,
|
|
383 |
const TDesC8& aValue )
|
|
384 |
{
|
|
385 |
CXnNode* trigger = CXnNode::NewL();
|
|
386 |
CleanupStack::PushL( trigger );
|
|
387 |
CXnType* type = CXnType::NewL( XnPropertyNames::action::KTrigger );
|
|
388 |
CleanupStack::PushL( type );
|
|
389 |
CXnNodeImpl* impl = CXnNodeImpl::NewL( type );
|
|
390 |
CleanupStack::Pop( type );
|
|
391 |
trigger->SetImpl( impl );
|
|
392 |
trigger->SetUiEngine( *iNode->UiEngine() );
|
|
393 |
|
|
394 |
CXnDomPropertyValue* nameValue = CXnDomPropertyValue::NewL(
|
|
395 |
iNode->UiEngine()->ODT()->DomDocument().StringPool() );
|
|
396 |
CleanupStack::PushL( nameValue );
|
|
397 |
nameValue->SetStringValueL( CXnDomPropertyValue::EString, aTriggerName );
|
|
398 |
|
|
399 |
CXnProperty* name = CXnProperty::NewL(
|
|
400 |
XnPropertyNames::action::trigger::KName,
|
|
401 |
nameValue,
|
|
402 |
*iNode->UiEngine()->ODT()->DomDocument().StringPool() );
|
|
403 |
|
|
404 |
CleanupStack::Pop( nameValue );
|
|
405 |
CleanupStack::PushL( name );
|
|
406 |
trigger->SetPropertyL( name );
|
|
407 |
CleanupStack::Pop( name );
|
|
408 |
|
|
409 |
CXnDomPropertyValue* indexValue = CXnDomPropertyValue::NewL(
|
|
410 |
iNode->UiEngine()->ODT()->DomDocument().StringPool() );
|
|
411 |
CleanupStack::PushL( indexValue );
|
|
412 |
indexValue->SetStringValueL( CXnDomPropertyValue::EString, aValue );
|
|
413 |
|
|
414 |
CXnProperty* index = CXnProperty::NewL(
|
|
415 |
aValueName,
|
|
416 |
indexValue,
|
|
417 |
*iNode->UiEngine()->ODT()->DomDocument().StringPool() );
|
|
418 |
|
|
419 |
CleanupStack::Pop( indexValue );
|
|
420 |
CleanupStack::PushL( index );
|
|
421 |
trigger->SetPropertyL( index );
|
|
422 |
CleanupStack::Pop( index );
|
|
423 |
|
|
424 |
iNode->ReportXuikonEventL( *trigger, 0 );
|
|
425 |
|
|
426 |
CleanupStack::PopAndDestroy( trigger );
|
|
427 |
}
|
|
428 |
|
|
429 |
// -----------------------------------------------------------------------------
|
|
430 |
// CXnNodePluginIf::PathL
|
|
431 |
// -----------------------------------------------------------------------------
|
|
432 |
//
|
|
433 |
EXPORT_C CXnProperty* CXnNodePluginIf::PathL()
|
|
434 |
{
|
|
435 |
return iNode->PathL();
|
|
436 |
}
|
|
437 |
|
|
438 |
// -----------------------------------------------------------------------------
|
|
439 |
// CXnNodePluginIf::MaskPathL
|
|
440 |
// -----------------------------------------------------------------------------
|
|
441 |
//
|
|
442 |
EXPORT_C CXnProperty* CXnNodePluginIf::MaskPathL()
|
|
443 |
{
|
|
444 |
return iNode->MaskPathL();
|
|
445 |
}
|
|
446 |
|
|
447 |
// -----------------------------------------------------------------------------
|
|
448 |
// CXnNodePluginIf::SetDirtyL
|
|
449 |
// -----------------------------------------------------------------------------
|
|
450 |
//
|
|
451 |
EXPORT_C void CXnNodePluginIf::SetDirtyL()
|
|
452 |
{
|
|
453 |
const TDesC8& type( iNode->Type()->Type() );
|
|
454 |
|
|
455 |
if ( iNode->IsAdaptive( ETrue ) )
|
|
456 |
{
|
|
457 |
iNode->SetDirtyL( XnDirtyLevel::ELayoutAndRender );
|
|
458 |
}
|
|
459 |
else
|
|
460 |
{
|
|
461 |
iNode->SetDirtyL( XnDirtyLevel::ERender );
|
|
462 |
}
|
|
463 |
|
|
464 |
// If node's parent is tooltip, it must be relayouted because it will
|
|
465 |
// grow based on childs
|
|
466 |
CXnNode* parent( iNode->Parent() );
|
|
467 |
|
|
468 |
if ( parent && parent->Type()->Type() == _L8( "tooltip" ) )
|
|
469 |
{
|
|
470 |
parent->SetDirtyL( XnDirtyLevel::ELayoutAndRender );
|
|
471 |
}
|
|
472 |
}
|
|
473 |
|
|
474 |
// -----------------------------------------------------------------------------
|
|
475 |
// CXnNodePluginIf::Namespace
|
|
476 |
// -----------------------------------------------------------------------------
|
|
477 |
//
|
|
478 |
EXPORT_C const TDesC8& CXnNodePluginIf::Namespace()
|
|
479 |
{
|
|
480 |
return iNode->Namespace();
|
|
481 |
}
|
|
482 |
|
|
483 |
// -----------------------------------------------------------------------------
|
|
484 |
// CXnNodePluginIf::ControlL
|
|
485 |
// Gets the control associated to this node
|
|
486 |
// -----------------------------------------------------------------------------
|
|
487 |
//
|
|
488 |
EXPORT_C CXnControlAdapter* CXnNodePluginIf::Control() const
|
|
489 |
{
|
|
490 |
return iNode->Control();
|
|
491 |
}
|