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