|
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 // INCLUDES |
|
19 #include "xnnode.h" |
|
20 #include "xnnodeappif.h" |
|
21 #include "xntype.h" |
|
22 #include "xnuiengine.h" |
|
23 #include "xndomnode.h" |
|
24 #include "xncomponent.h" |
|
25 #include "xncomponentnodeimpl.h" |
|
26 |
|
27 // ============================ MEMBER FUNCTIONS =============================== |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // CXnNodeAppIf::CXnNodeAppIf() |
|
31 // C++ default constructor can NOT contain any code, that |
|
32 // might leave. |
|
33 // ----------------------------------------------------------------------------- |
|
34 // |
|
35 CXnNodeAppIf::CXnNodeAppIf( CXnNode& aNode ) |
|
36 { |
|
37 iNode = &aNode; |
|
38 } |
|
39 |
|
40 // ----------------------------------------------------------------------------- |
|
41 // CXnNodeAppIf::Type() |
|
42 // Returns control type. |
|
43 // ----------------------------------------------------------------------------- |
|
44 // |
|
45 EXPORT_C CXnType* CXnNodeAppIf::Type() |
|
46 { |
|
47 return iNode->Type(); |
|
48 } |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // CXnNodeAppIf::SetPCDataL |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 EXPORT_C void CXnNodeAppIf::SetPCDataL( const TDesC8& aData ) |
|
55 { |
|
56 iNode->SetPCDataL( aData ); |
|
57 } |
|
58 |
|
59 // ----------------------------------------------------------------------------- |
|
60 // CXnNodeAppIf::GetPCData |
|
61 // ----------------------------------------------------------------------------- |
|
62 // |
|
63 EXPORT_C const TDesC8& CXnNodeAppIf::GetPCData() const |
|
64 { |
|
65 return iNode->GetPCData(); |
|
66 } |
|
67 |
|
68 // ----------------------------------------------------------------------------- |
|
69 // CXnNodeAppIf::SetPropertyL |
|
70 // Set a property. |
|
71 // ----------------------------------------------------------------------------- |
|
72 // |
|
73 EXPORT_C void CXnNodeAppIf::SetPropertyL( CXnProperty* aProperty ) |
|
74 { |
|
75 iNode->SetPropertyL( aProperty ); |
|
76 } |
|
77 |
|
78 // ----------------------------------------------------------------------------- |
|
79 // CXnNodeAppIf::SetPropertyArrayL |
|
80 // Set a property array. |
|
81 // ----------------------------------------------------------------------------- |
|
82 // |
|
83 EXPORT_C void CXnNodeAppIf::SetPropertyArrayL( |
|
84 RPointerArray< CXnProperty >* aPropertyArray ) |
|
85 { |
|
86 iNode->SetPropertyArrayL( aPropertyArray ); |
|
87 } |
|
88 |
|
89 // ----------------------------------------------------------------------------- |
|
90 // CXnNodeAppIf::GetProperty |
|
91 // Gets a property. |
|
92 // ----------------------------------------------------------------------------- |
|
93 // |
|
94 EXPORT_C CXnProperty* CXnNodeAppIf::GetPropertyL( CXnProperty& /*aProperty*/ ) const |
|
95 { |
|
96 return NULL;//return iNode->GetPropertyL(aProperty); |
|
97 } |
|
98 |
|
99 // ----------------------------------------------------------------------------- |
|
100 // CXnNodeAppIf::GetProperty |
|
101 // Gets a property. |
|
102 // ----------------------------------------------------------------------------- |
|
103 // |
|
104 EXPORT_C CXnProperty* CXnNodeAppIf::GetPropertyL( const TDesC8& aKey ) const |
|
105 { |
|
106 return iNode->GetPropertyL( aKey ); |
|
107 } |
|
108 |
|
109 // ----------------------------------------------------------------------------- |
|
110 // CXnNodeAppIf::SetStateL |
|
111 // Set a state |
|
112 // ----------------------------------------------------------------------------- |
|
113 // |
|
114 EXPORT_C void CXnNodeAppIf::SetStateL( const TDesC8& aState ) |
|
115 { |
|
116 iNode->SetStateL( aState ); |
|
117 } |
|
118 |
|
119 // ----------------------------------------------------------------------------- |
|
120 // CXnNodeAppIf::IsStateSet |
|
121 // Check whether a state is set or not |
|
122 // ----------------------------------------------------------------------------- |
|
123 // |
|
124 EXPORT_C TBool CXnNodeAppIf::IsStateSet( const TDesC8& aState ) |
|
125 { |
|
126 return iNode->IsStateSet( aState ); |
|
127 } |
|
128 |
|
129 // ----------------------------------------------------------------------------- |
|
130 // CXnNodeAppIf::UnsetState |
|
131 // Unset a pseudoclass |
|
132 // ----------------------------------------------------------------------------- |
|
133 // |
|
134 EXPORT_C void CXnNodeAppIf::UnsetStateL( const TDesC8& aState ) |
|
135 { |
|
136 iNode->UnsetStateL( aState ); |
|
137 } |
|
138 |
|
139 // ----------------------------------------------------------------------------- |
|
140 // CXnNodeAppIf::Rect |
|
141 // ----------------------------------------------------------------------------- |
|
142 // |
|
143 EXPORT_C TRect CXnNodeAppIf::Rect() |
|
144 { |
|
145 return iNode->Rect(); |
|
146 } |
|
147 |
|
148 // ----------------------------------------------------------------------------- |
|
149 // CXnNodeAppIf::BorderRect |
|
150 // ----------------------------------------------------------------------------- |
|
151 // |
|
152 EXPORT_C TRect CXnNodeAppIf::BorderRect() |
|
153 { |
|
154 return iNode->BorderRect(); |
|
155 } |
|
156 |
|
157 // ----------------------------------------------------------------------------- |
|
158 // CXnNodeAppIf::MarginRect |
|
159 // ----------------------------------------------------------------------------- |
|
160 // |
|
161 EXPORT_C TRect CXnNodeAppIf::MarginRect() |
|
162 { |
|
163 return iNode->MarginRect(); |
|
164 } |
|
165 |
|
166 // ----------------------------------------------------------------------------- |
|
167 // CXnNodeAppIf::PaddingRect |
|
168 // ----------------------------------------------------------------------------- |
|
169 // |
|
170 EXPORT_C TRect CXnNodeAppIf::PaddingRect() |
|
171 { |
|
172 return iNode->PaddingRect(); |
|
173 } |
|
174 |
|
175 // ----------------------------------------------------------------------------- |
|
176 // CXnNodeAppIf::UiEngine |
|
177 // ----------------------------------------------------------------------------- |
|
178 // |
|
179 EXPORT_C TXnUiEngineAppIf* CXnNodeAppIf::UiEngineL() |
|
180 { |
|
181 return &(iNode->UiEngine()->AppIfL()); |
|
182 } |
|
183 |
|
184 // ----------------------------------------------------------------------------- |
|
185 // Get internal node |
|
186 // ----------------------------------------------------------------------------- |
|
187 // |
|
188 CXnNode& CXnNodeAppIf::Node() |
|
189 { |
|
190 return *iNode; |
|
191 } |
|
192 |
|
193 // ----------------------------------------------------------------------------- |
|
194 // CXnNodeAppIf::MakeInterfaceL |
|
195 // Create a component interface according to the given type. |
|
196 // ----------------------------------------------------------------------------- |
|
197 // |
|
198 EXPORT_C XnComponentInterface::MXnComponentInterface* CXnNodeAppIf::MakeInterfaceL( |
|
199 const TDesC8& aType ) |
|
200 { |
|
201 return iNode->MakeInterfaceL( aType ); |
|
202 } |
|
203 |
|
204 // ----------------------------------------------------------------------------- |
|
205 // CXnNodeAppIf::Children |
|
206 // ----------------------------------------------------------------------------- |
|
207 // |
|
208 EXPORT_C RPointerArray< CXnNodeAppIf > CXnNodeAppIf::ChildrenL() |
|
209 { |
|
210 RPointerArray< CXnNode >& nodes = iNode->Children(); |
|
211 RPointerArray< CXnNodeAppIf > appNodes; |
|
212 CleanupClosePushL( appNodes ); |
|
213 TInt count = nodes.Count(); |
|
214 for ( TInt i = 0; i < count; ++i ) |
|
215 { |
|
216 appNodes.AppendL( &nodes[i]->AppIfL() ); |
|
217 } |
|
218 CleanupStack::Pop( &appNodes ); |
|
219 // Compiler will generate bitwise copy ctor, thus |
|
220 // caller of this function must call reset or close for copied RPointerArrays, |
|
221 // which is very nasty thing to do... |
|
222 return appNodes; |
|
223 } |
|
224 |
|
225 // ----------------------------------------------------------------------------- |
|
226 // CXnNodeAppIf::ParentL |
|
227 // ----------------------------------------------------------------------------- |
|
228 // |
|
229 EXPORT_C CXnNodeAppIf* CXnNodeAppIf::ParentL() const |
|
230 { |
|
231 CXnNode* parent = iNode->Parent(); |
|
232 if ( !parent ) |
|
233 { |
|
234 return NULL; |
|
235 } |
|
236 return &( parent->AppIfL() ); |
|
237 } |
|
238 |
|
239 // ----------------------------------------------------------------------------- |
|
240 // CXnNodeAppIf::InternalDomNodeType |
|
241 // ----------------------------------------------------------------------------- |
|
242 // |
|
243 EXPORT_C const TDesC8& CXnNodeAppIf::InternalDomNodeType() const |
|
244 { |
|
245 CXnDomNode* node = iNode->DomNode(); |
|
246 if ( node ) |
|
247 { |
|
248 return node->Name(); |
|
249 } |
|
250 return KNullDesC8; |
|
251 } |
|
252 |
|
253 // ----------------------------------------------------------------------------- |
|
254 // CXnNodeAppIf::ShowTooltipsL |
|
255 // ----------------------------------------------------------------------------- |
|
256 // |
|
257 EXPORT_C void CXnNodeAppIf::ShowTooltipsL() |
|
258 { |
|
259 iNode->ShowTooltipsL(); |
|
260 } |
|
261 |
|
262 // ----------------------------------------------------------------------------- |
|
263 // CXnNodeAppIf::HideTooltipsL |
|
264 // ----------------------------------------------------------------------------- |
|
265 // |
|
266 EXPORT_C void CXnNodeAppIf::HideTooltipsL() |
|
267 { |
|
268 iNode->HideTooltipsL(); |
|
269 } |
|
270 |
|
271 // ----------------------------------------------------------------------------- |
|
272 // CXnNodeAppIf::Namespace |
|
273 // ----------------------------------------------------------------------------- |
|
274 // |
|
275 EXPORT_C const TDesC8& CXnNodeAppIf::Namespace() |
|
276 { |
|
277 CXnDomNode* node = iNode->DomNode(); |
|
278 if ( node ) |
|
279 { |
|
280 return node->Namespace(); |
|
281 } |
|
282 return KNullDesC8; |
|
283 } |
|
284 |
|
285 // ----------------------------------------------------------------------------- |
|
286 // CXnNodeAppIf::Component |
|
287 // ----------------------------------------------------------------------------- |
|
288 // |
|
289 EXPORT_C CXnComponent& CXnNodeAppIf::Component() |
|
290 { |
|
291 return *iNode->ComponentNodeImpl()->Component(); |
|
292 } |