63
|
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: Phonebook 2 view graph related classes.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef CPBK2VIEWGRAPH_H
|
|
20 |
#define CPBK2VIEWGRAPH_H
|
|
21 |
|
|
22 |
// INCLUDES
|
|
23 |
#include <e32base.h>
|
|
24 |
#include <Pbk2ViewInfo.hrh>
|
|
25 |
|
|
26 |
// FORWARD DECLARATIONS
|
|
27 |
class CPbk2ViewNode;
|
|
28 |
class TResourceReader;
|
|
29 |
|
|
30 |
// CLASS DECLARATION
|
|
31 |
|
|
32 |
/**
|
|
33 |
* Phonebook 2 view transition class.
|
|
34 |
*/
|
|
35 |
class TPbk2ViewTransition
|
|
36 |
{
|
|
37 |
public: // Data
|
|
38 |
/// Own: ID of an event triggering this transition
|
|
39 |
TPbk2ViewTransitionEvent iEvent;
|
|
40 |
/// Own: Target node view id
|
|
41 |
TUid iTargetViewId;
|
|
42 |
/// Ref: Node to activate if this transition is accepted
|
|
43 |
CPbk2ViewNode* iNode;
|
|
44 |
};
|
|
45 |
|
|
46 |
/**
|
|
47 |
* Phonebook 2 view navigation node class.
|
|
48 |
*/
|
|
49 |
class CPbk2ViewNode : public CBase
|
|
50 |
{
|
|
51 |
public: // Constructor and destructor
|
|
52 |
|
|
53 |
/**
|
|
54 |
* Constructor.
|
|
55 |
*
|
|
56 |
* @param aViewId View id of this node.
|
|
57 |
* @param aDefaultPrevViewId This views default
|
|
58 |
* previous view id.
|
|
59 |
* @param aExitNode ETrue if an exit node.
|
|
60 |
* @param aTabGroupId Tab group id.
|
|
61 |
* @param aTabGroupOrdering Tab group ordering item.
|
|
62 |
* @param aTabResourceId Tab resource id. Can be defined as 0,
|
|
63 |
* which means that the tab should be
|
|
64 |
* created by hand.
|
|
65 |
* @param aTransitionReader A resource reader pointed to an
|
|
66 |
* array of PBK2_VIEW_TRANSITION's.
|
|
67 |
* @return New instance of this class.
|
|
68 |
*/
|
|
69 |
IMPORT_C static CPbk2ViewNode* NewL(
|
|
70 |
TUid aViewId,
|
|
71 |
TUid aDefaultPrevViewId,
|
|
72 |
TBool aExitNode,
|
|
73 |
TPbk2TabGroupId aTabGroupId,
|
|
74 |
TPbk2TabGroupOrdering aTabGroupOrdering,
|
|
75 |
TInt aTabResourceId,
|
|
76 |
TResourceReader& aTransitionReader );
|
|
77 |
|
|
78 |
/**
|
|
79 |
* Destructor.
|
|
80 |
*/
|
|
81 |
~CPbk2ViewNode();
|
|
82 |
|
|
83 |
public: // Interface
|
|
84 |
|
|
85 |
/**
|
|
86 |
* Returns the view id of this node.
|
|
87 |
*
|
|
88 |
* @return View id of this node.
|
|
89 |
*/
|
|
90 |
inline TUid ViewId() const;
|
|
91 |
|
|
92 |
/**
|
|
93 |
* Returns the default previous node.
|
|
94 |
*
|
|
95 |
* @return Default previous node.
|
|
96 |
*/
|
|
97 |
inline CPbk2ViewNode* DefaultPreviousNode() const;
|
|
98 |
|
|
99 |
/**
|
|
100 |
* Returns the currently set previous node.
|
|
101 |
*
|
|
102 |
* @return Currently set previous node.
|
|
103 |
*/
|
|
104 |
inline CPbk2ViewNode* PreviousNode() const;
|
|
105 |
|
|
106 |
/**
|
|
107 |
* Returns ETrue if this is an exit node.
|
|
108 |
. *
|
|
109 |
* @return ETrue if an exit node, EFalse otherwise.
|
|
110 |
*/
|
|
111 |
inline TBool ExitNode() const;
|
|
112 |
|
|
113 |
/**
|
|
114 |
* Returns tab group id.
|
|
115 |
*
|
|
116 |
* @return Tab group id.
|
|
117 |
*/
|
|
118 |
inline TPbk2TabGroupId TabGroupId() const;
|
|
119 |
|
|
120 |
/**
|
|
121 |
* Returns the ordering item of this node in the tab group.
|
|
122 |
*
|
|
123 |
* @return Tab group ordering item.
|
|
124 |
*/
|
|
125 |
inline TPbk2TabGroupOrdering TabGroupOrdering() const;
|
|
126 |
|
|
127 |
/**
|
|
128 |
* Returns a tab resource id pointing to a PBK2_VIEW_NODE_TAB.
|
|
129 |
*
|
|
130 |
* @return Tab resource id.
|
|
131 |
*/
|
|
132 |
inline TInt TabResourceId() const;
|
|
133 |
|
|
134 |
/**
|
|
135 |
* Sets previous node to aNode.
|
|
136 |
*
|
|
137 |
* @param aNode The node to set.
|
|
138 |
*/
|
|
139 |
inline void SetPreviousNode(
|
|
140 |
CPbk2ViewNode* aNode );
|
|
141 |
|
|
142 |
/**
|
|
143 |
* Returns the number of transitions from this node.
|
|
144 |
*
|
|
145 |
* @return Number of transitions.
|
|
146 |
*/
|
|
147 |
inline TInt TransitionCount() const;
|
|
148 |
|
|
149 |
/**
|
|
150 |
* Returns aIndex:th transition from this node.
|
|
151 |
*
|
|
152 |
* @param aIndex The transition index to query.
|
|
153 |
* @return View transition.
|
|
154 |
*/
|
|
155 |
inline const TPbk2ViewTransition& TransitionAt(
|
|
156 |
TInt aIndex ) const;
|
|
157 |
|
|
158 |
/**
|
|
159 |
* Returns ETrue if this node contains a transition equal to
|
|
160 |
* aTransition.
|
|
161 |
*
|
|
162 |
* @param aTransition The transition to look for.
|
|
163 |
* @return ETrue if transition found, EFalse otherwise.
|
|
164 |
*/
|
|
165 |
IMPORT_C TBool FindTransition(
|
|
166 |
const TPbk2ViewTransition& aTransition ) const;
|
|
167 |
|
|
168 |
/**
|
|
169 |
* Sets the ordering item of this node in the tab group.
|
|
170 |
*
|
|
171 |
* @param aTabGroupOrdering Tab group ordering item.
|
|
172 |
*/
|
|
173 |
inline void SetTabGroupOrdering(
|
|
174 |
TPbk2TabGroupOrdering aTabGroupOrdering );
|
|
175 |
|
|
176 |
/**
|
|
177 |
* Sets this nodes tab resource id.
|
|
178 |
*
|
|
179 |
* @param aTabResourceId Tab resource id.
|
|
180 |
* @see PBK2_VIEW_NODE_TAB
|
|
181 |
*/
|
|
182 |
inline void SetTabResourceId(
|
|
183 |
TInt aTabResourceId );
|
|
184 |
|
|
185 |
private: // Implementation
|
|
186 |
CPbk2ViewNode(); // private contructor for internal use
|
|
187 |
CPbk2ViewNode(
|
|
188 |
TUid aViewId,
|
|
189 |
TUid aDefaultPrevViewId,
|
|
190 |
TBool aExitNode,
|
|
191 |
TPbk2TabGroupId aTabGroupId,
|
|
192 |
TPbk2TabGroupOrdering aTabGroupOrdering,
|
|
193 |
TInt aTabResourceId );
|
|
194 |
TPbk2ViewTransition* FindTransition(
|
|
195 |
TPbk2ViewTransitionEvent aEvent );
|
|
196 |
void ReadTransitionsL(
|
|
197 |
TResourceReader& aResReader);
|
|
198 |
|
|
199 |
private: // Data
|
|
200 |
/// Own: View id
|
|
201 |
TUid iViewId;
|
|
202 |
/// Own: Default previous node id
|
|
203 |
TUid iDefaultPrevViewId;
|
|
204 |
/// Ref: Default previous node
|
|
205 |
CPbk2ViewNode* iDefaultPreviousNode;
|
|
206 |
/// Ref: Previous node
|
|
207 |
CPbk2ViewNode* iPreviousNode;
|
|
208 |
/// Own: Indicates whether this is an exit node
|
|
209 |
TBool iExitNode;
|
|
210 |
/// Own: Transitions array
|
|
211 |
CArrayFixFlat<TPbk2ViewTransition> iTransitions;
|
|
212 |
/// Own: Tab group id
|
|
213 |
TPbk2TabGroupId iTabGroupId;
|
|
214 |
/// Own: Ordering item in tab group
|
|
215 |
TPbk2TabGroupOrdering iTabGroupOrdering;
|
|
216 |
/// Own: Tab resource id
|
|
217 |
TInt iTabResourceId;
|
|
218 |
|
|
219 |
private: // Friends
|
|
220 |
friend class CPbk2ViewGraph;
|
|
221 |
};
|
|
222 |
|
|
223 |
|
|
224 |
/**
|
|
225 |
* Phonebook 2 view navigation graph class.
|
|
226 |
*/
|
|
227 |
class CPbk2ViewGraph : public CBase
|
|
228 |
{
|
|
229 |
public: // Constructors and destructor
|
|
230 |
|
|
231 |
/**
|
|
232 |
* Creates a new view graph from a PBK2_VIEW_GRAPH resource.
|
|
233 |
*
|
|
234 |
* @param aResReader Resource reader pointed
|
|
235 |
* to a PBK2_VIEW_GRAPH resource.
|
|
236 |
* @return A new instance of this class.
|
|
237 |
*/
|
|
238 |
IMPORT_C static CPbk2ViewGraph* NewL(
|
|
239 |
TResourceReader& aResReader );
|
|
240 |
|
|
241 |
/**
|
|
242 |
* Destructor.
|
|
243 |
*/
|
|
244 |
~CPbk2ViewGraph();
|
|
245 |
|
|
246 |
public: // Interface
|
|
247 |
|
|
248 |
/**
|
|
249 |
* Returns node with given resource id, NULL if not found.
|
|
250 |
*
|
|
251 |
* @param aViewId Id of the node to found.
|
|
252 |
* @return View node.
|
|
253 |
*/
|
|
254 |
IMPORT_C CPbk2ViewNode* FindNodeWithViewId(
|
|
255 |
TUid aViewId ) const;
|
|
256 |
|
|
257 |
/**
|
|
258 |
* Modifies existing view graph. Updates transitions and
|
|
259 |
* appends new view node according to given resource reader.
|
|
260 |
*
|
|
261 |
* @param aResReader Resource reader pointed
|
|
262 |
* to a PBK2_VIEW_GRAPH resource.
|
|
263 |
*/
|
|
264 |
IMPORT_C void ModifyViewGraphL(
|
|
265 |
TResourceReader& aResReader );
|
|
266 |
|
|
267 |
/**
|
|
268 |
* Appends and links aNode to the view graph structure.
|
|
269 |
* Takes ownership of the node.
|
|
270 |
*
|
|
271 |
* @param aNode Node to add to the view graph.
|
|
272 |
*/
|
|
273 |
IMPORT_C void AddViewNodeL(
|
|
274 |
CPbk2ViewNode* aNode );
|
|
275 |
|
|
276 |
/**
|
|
277 |
* Finds and returns the ids of the views that are in
|
|
278 |
* the specified tab group. Returned array is sorted in
|
|
279 |
* the proper tab group ordering of the views.
|
|
280 |
*
|
|
281 |
* @param aTabGroupId Id of the tab group to investigate.
|
|
282 |
* @return Array of views in the tab group.
|
|
283 |
*/
|
|
284 |
IMPORT_C RPointerArray<CPbk2ViewNode> FindViewsInTabGroupL(
|
|
285 |
TPbk2TabGroupId aTabGroupId ) const;
|
|
286 |
|
|
287 |
/**
|
|
288 |
* Returns view graph node count.
|
|
289 |
*
|
|
290 |
* @return Node count.
|
|
291 |
*/
|
|
292 |
inline TInt Count() const;
|
|
293 |
|
|
294 |
/**
|
|
295 |
* Returns view graph node at aIndex.
|
|
296 |
*
|
|
297 |
* @param aIndex Index to query.
|
|
298 |
* @return View node.
|
|
299 |
*/
|
|
300 |
inline const CPbk2ViewNode& operator[](
|
|
301 |
TInt aIndex ) const;
|
|
302 |
|
|
303 |
private: // Implementation
|
|
304 |
inline CPbk2ViewGraph();
|
|
305 |
void ConstructL(
|
|
306 |
TResourceReader& aResReader );
|
|
307 |
void AppendNodesFromResourceL(
|
|
308 |
TResourceReader& aResReader );
|
|
309 |
void LinkNodesWithTransitions();
|
|
310 |
|
|
311 |
private: // Types
|
|
312 |
/// Definition of the view node array type
|
|
313 |
typedef CArrayPtrFlat<CPbk2ViewNode> CPbk2ViewNodeArray;
|
|
314 |
|
|
315 |
private: // Data
|
|
316 |
/// Own: Array of view nodes
|
|
317 |
CPbk2ViewNodeArray* iNodes;
|
|
318 |
};
|
|
319 |
|
|
320 |
// INLINE FUNCTIONS
|
|
321 |
|
|
322 |
// --------------------------------------------------------------------------
|
|
323 |
// CPbk2ViewNode::ViewId
|
|
324 |
// --------------------------------------------------------------------------
|
|
325 |
//
|
|
326 |
inline TUid CPbk2ViewNode::ViewId() const
|
|
327 |
{
|
|
328 |
return iViewId;
|
|
329 |
}
|
|
330 |
|
|
331 |
// --------------------------------------------------------------------------
|
|
332 |
// CPbk2ViewNode::DefaultPreviousNode
|
|
333 |
// --------------------------------------------------------------------------
|
|
334 |
//
|
|
335 |
inline CPbk2ViewNode* CPbk2ViewNode::DefaultPreviousNode() const
|
|
336 |
{
|
|
337 |
return iDefaultPreviousNode;
|
|
338 |
}
|
|
339 |
|
|
340 |
// --------------------------------------------------------------------------
|
|
341 |
// CPbk2ViewNode::PreviousNode
|
|
342 |
// --------------------------------------------------------------------------
|
|
343 |
//
|
|
344 |
inline CPbk2ViewNode* CPbk2ViewNode::PreviousNode() const
|
|
345 |
{
|
|
346 |
return iPreviousNode;
|
|
347 |
}
|
|
348 |
|
|
349 |
// --------------------------------------------------------------------------
|
|
350 |
// CPbk2ViewNode::ExitNode
|
|
351 |
// --------------------------------------------------------------------------
|
|
352 |
//
|
|
353 |
inline TBool CPbk2ViewNode::ExitNode() const
|
|
354 |
{
|
|
355 |
return iExitNode;
|
|
356 |
}
|
|
357 |
|
|
358 |
// --------------------------------------------------------------------------
|
|
359 |
// CPbk2ViewNode::TabGroupId
|
|
360 |
// --------------------------------------------------------------------------
|
|
361 |
//
|
|
362 |
inline TPbk2TabGroupId CPbk2ViewNode::TabGroupId() const
|
|
363 |
{
|
|
364 |
return iTabGroupId;
|
|
365 |
}
|
|
366 |
|
|
367 |
// --------------------------------------------------------------------------
|
|
368 |
// CPbk2ViewNode::TabGroupOrdering
|
|
369 |
// --------------------------------------------------------------------------
|
|
370 |
//
|
|
371 |
inline TPbk2TabGroupOrdering CPbk2ViewNode::TabGroupOrdering() const
|
|
372 |
{
|
|
373 |
return iTabGroupOrdering;
|
|
374 |
}
|
|
375 |
|
|
376 |
// --------------------------------------------------------------------------
|
|
377 |
// CPbk2ViewNode::TabResourceId
|
|
378 |
// --------------------------------------------------------------------------
|
|
379 |
//
|
|
380 |
inline TInt CPbk2ViewNode::TabResourceId() const
|
|
381 |
{
|
|
382 |
return iTabResourceId;
|
|
383 |
}
|
|
384 |
|
|
385 |
// --------------------------------------------------------------------------
|
|
386 |
// CPbk2ViewNode::SetPreviousNode
|
|
387 |
// --------------------------------------------------------------------------
|
|
388 |
//
|
|
389 |
inline void CPbk2ViewNode::SetPreviousNode( CPbk2ViewNode* aNode )
|
|
390 |
{
|
|
391 |
iPreviousNode = aNode;
|
|
392 |
}
|
|
393 |
|
|
394 |
// --------------------------------------------------------------------------
|
|
395 |
// CPbk2ViewNode::TransitionCount
|
|
396 |
// --------------------------------------------------------------------------
|
|
397 |
//
|
|
398 |
inline TInt CPbk2ViewNode::TransitionCount() const
|
|
399 |
{
|
|
400 |
return iTransitions.Count();
|
|
401 |
}
|
|
402 |
|
|
403 |
// --------------------------------------------------------------------------
|
|
404 |
// CPbk2ViewNode::TransitionAt
|
|
405 |
// --------------------------------------------------------------------------
|
|
406 |
//
|
|
407 |
inline const TPbk2ViewTransition& CPbk2ViewNode::TransitionAt
|
|
408 |
( TInt aIndex ) const
|
|
409 |
{
|
|
410 |
// iTransitions::operator[] will check aIndex
|
|
411 |
return iTransitions[aIndex];
|
|
412 |
}
|
|
413 |
|
|
414 |
// --------------------------------------------------------------------------
|
|
415 |
// CPbk2ViewNode::SetTabGroupOrdering
|
|
416 |
// --------------------------------------------------------------------------
|
|
417 |
//
|
|
418 |
inline void CPbk2ViewNode::SetTabGroupOrdering
|
|
419 |
( TPbk2TabGroupOrdering aTabGroupOrdering )
|
|
420 |
{
|
|
421 |
iTabGroupOrdering = aTabGroupOrdering;
|
|
422 |
}
|
|
423 |
|
|
424 |
// --------------------------------------------------------------------------
|
|
425 |
// CPbk2ViewNode::SetTabResourceId
|
|
426 |
// --------------------------------------------------------------------------
|
|
427 |
//
|
|
428 |
inline void CPbk2ViewNode::SetTabResourceId( TInt aTabResourceId )
|
|
429 |
{
|
|
430 |
iTabResourceId = aTabResourceId;
|
|
431 |
}
|
|
432 |
|
|
433 |
// --------------------------------------------------------------------------
|
|
434 |
// CPbk2ViewGraph::CPbk2ViewGraph
|
|
435 |
// --------------------------------------------------------------------------
|
|
436 |
//
|
|
437 |
inline CPbk2ViewGraph::CPbk2ViewGraph()
|
|
438 |
{
|
|
439 |
}
|
|
440 |
|
|
441 |
// --------------------------------------------------------------------------
|
|
442 |
// CPbk2ViewGraph::Count
|
|
443 |
// --------------------------------------------------------------------------
|
|
444 |
//
|
|
445 |
inline TInt CPbk2ViewGraph::Count() const
|
|
446 |
{
|
|
447 |
return iNodes->Count();
|
|
448 |
}
|
|
449 |
|
|
450 |
// --------------------------------------------------------------------------
|
|
451 |
// CPbk2ViewGraph::operator[]
|
|
452 |
// --------------------------------------------------------------------------
|
|
453 |
//
|
|
454 |
inline const CPbk2ViewNode& CPbk2ViewGraph::operator[]( TInt aIndex ) const
|
|
455 |
{
|
|
456 |
// iNodes::operator[] will check aIndex
|
|
457 |
return *iNodes->At( aIndex );
|
|
458 |
}
|
|
459 |
|
|
460 |
#endif // CPBK2VIEWGRAPH_H
|
|
461 |
|
|
462 |
// End of File
|