|
1 /* |
|
2 * Copyright (c) 2006-2009 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: Abstract base class for all tree leaves. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_AKNTREELEAF_H |
|
20 #define C_AKNTREELEAF_H |
|
21 |
|
22 |
|
23 #include "akntreeitem.h" |
|
24 |
|
25 |
|
26 /** |
|
27 * Abstract base class for all tree leaves. |
|
28 * |
|
29 * The items in tree structure are divided into leaves and nodes. The |
|
30 * division does not represent the dynamic states of the tree items; leaves |
|
31 * are tree items that cannot have any children, while nodes can, but do not |
|
32 * necessarily have any. |
|
33 * |
|
34 * @lib aknhlist.lib |
|
35 * @since S60 v3.2 |
|
36 */ |
|
37 NONSHARABLE_CLASS( CAknTreeLeaf ) : public CAknTreeItem |
|
38 { |
|
39 |
|
40 public: |
|
41 |
|
42 /** Tree leaf flags. These flags can be set to the leaf at the time of |
|
43 its construction or with @c SetFlags() method. The first 16 bits |
|
44 are used by used by this class, and the other 16 bits can be used |
|
45 by derived classes. |
|
46 */ |
|
47 enum TAknTreeLeafFlags |
|
48 { |
|
49 /** Leaf is marked. */ |
|
50 EMarked = 0x0001, |
|
51 /** Leaf is persistent. */ |
|
52 EPersistent = 0x0002, |
|
53 /** Marking change for the leaf is disabled. */ |
|
54 EMarkingDisabled = 0x0004 |
|
55 }; |
|
56 |
|
57 /** |
|
58 * Destructor. |
|
59 */ |
|
60 virtual ~CAknTreeLeaf(); |
|
61 |
|
62 // from base class CAknTreeItem |
|
63 |
|
64 /** |
|
65 * From CAknTreeItem. |
|
66 * Leaf. |
|
67 * |
|
68 * @return Pointer to leaf object. |
|
69 */ |
|
70 CAknTreeLeaf* Leaf(); |
|
71 |
|
72 /** |
|
73 * From CAknTreeItem. |
|
74 * Leaf. |
|
75 * |
|
76 * @return Pointer to leaf object. |
|
77 */ |
|
78 const CAknTreeLeaf* Leaf() const; |
|
79 |
|
80 /** |
|
81 * From CAknTreeItem. |
|
82 * Checks whether the leaf is marked. |
|
83 * |
|
84 * @return @c ETrue, if the leaf is marked. |
|
85 */ |
|
86 TBool IsMarked() const; |
|
87 |
|
88 /** |
|
89 * From CAknTreeItem. |
|
90 * Sets the leaf is marked or unmarked. |
|
91 * |
|
92 * @param aMarked @c ETrue to set item marked, @c EFalse to unmarked. |
|
93 */ |
|
94 void SetMarked( TBool aMarked ); |
|
95 |
|
96 /** |
|
97 * From CAknTreeItem. |
|
98 * Checks whether leaf is markable. |
|
99 * |
|
100 * @return @c ETrue if marking is enabled, otherwise @c EFalse. |
|
101 */ |
|
102 TBool IsMarkable() const; |
|
103 |
|
104 /** |
|
105 * From CAknTreeItem. |
|
106 * Enabled or disables the marking changes for the leaf. By default, |
|
107 * each leaf is set markable. |
|
108 * |
|
109 * @param aMarkable @c ETrue to enable marking, @c EFalse to disable it. |
|
110 */ |
|
111 void SetMarkable( TBool aMarkable ); |
|
112 |
|
113 /** |
|
114 * From CAknTreeItem. |
|
115 * Checks whether the leaf is set persistent. |
|
116 * |
|
117 * @return @c ETrue, if the leaf is persistent. |
|
118 */ |
|
119 TBool IsPersistent() const; |
|
120 |
|
121 /** |
|
122 * From CAknTreeItem. |
|
123 * Sets whether the leaf is persistent. |
|
124 * |
|
125 * @param aPersistent @c ETrue to set item persistent, @c EFalse to set |
|
126 * item non-persistent. |
|
127 */ |
|
128 void SetPersistent( TBool aPersistent ); |
|
129 |
|
130 /** |
|
131 * From CAkntreeItem. |
|
132 * Checks whether the item has any persistent descendants. |
|
133 * |
|
134 * @return @c EFalse is always returned for a leaf object. |
|
135 */ |
|
136 TBool HasPersistentDescendants() const; |
|
137 |
|
138 /** |
|
139 * From CAknTreeItem. |
|
140 * Checks whether the item can be removed from the tree when its parent |
|
141 * node is being collapsed. |
|
142 * |
|
143 * Leaves that have been set marked or persistent cannot be removed from |
|
144 * the tree automatically on collapse events. |
|
145 * |
|
146 * @return @c ETrue, if the leaf can be removed from the tree. |
|
147 */ |
|
148 TBool IsRemovableFromCollapsedNode() const; |
|
149 |
|
150 protected: |
|
151 |
|
152 /** |
|
153 * Default C++ constructor. |
|
154 */ |
|
155 CAknTreeLeaf(); |
|
156 |
|
157 /** |
|
158 * C++ constructor. |
|
159 * |
|
160 * @param aFlags Flags for the tree leaf. The possible flags are defined |
|
161 * in @c TAknTreeLeafFlags enumeration. |
|
162 */ |
|
163 CAknTreeLeaf( TUint32 aFlags ); |
|
164 |
|
165 /** |
|
166 * Returns the flags set for the leaf. |
|
167 * |
|
168 * @return Flags. |
|
169 */ |
|
170 TUint32 Flags() const; |
|
171 |
|
172 /** |
|
173 * Sets flags for the leaf. |
|
174 * |
|
175 * @param aFlags Flags for the leaf. First 16 flags are reserved for use |
|
176 * of @c CAknTreeLeaf class, but the other 16 flags can be used by |
|
177 * derived classes. |
|
178 */ |
|
179 void SetFlags( TUint32 aFlags ); |
|
180 |
|
181 private: // data |
|
182 |
|
183 /** |
|
184 * Flags for a leaf. |
|
185 */ |
|
186 TUint32 iFlags; |
|
187 |
|
188 }; |
|
189 |
|
190 |
|
191 #endif // C_AKNTREELEAF_H |