1 /* |
|
2 * Copyright (c) 2007-2008 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_HNMDMENUITEM_H |
|
21 #define C_HNMDMENUITEM_H |
|
22 |
|
23 #include <e32hashtab.h> |
|
24 #include <e32base.h> |
|
25 #include <xmlengelement.h> |
|
26 #include <hnmenuitemmodel.h> |
|
27 |
|
28 struct THnMdCommonPointers; |
|
29 class CHnCondition; |
|
30 class CLiwGenericParamList; |
|
31 class CHnConditionInterface; |
|
32 |
|
33 /** |
|
34 * Menu Item. |
|
35 * |
|
36 * This class represents items in the Options menu. |
|
37 * |
|
38 * @lib hnmetadatamodel |
|
39 * @since S60 5.0 |
|
40 * @ingroup group_hnmetadatamodel |
|
41 */ |
|
42 NONSHARABLE_CLASS(CHnMdMenuItem) : public CBase |
|
43 { |
|
44 public: |
|
45 /** |
|
46 * Checkes if argument descriptor is equal to one of |
|
47 * menu items elements names. |
|
48 * |
|
49 * @since S60 5.0 |
|
50 * @param aNameToCompare name to compare. |
|
51 * @return ETrue if aNameToCompare is equal to one of |
|
52 * menu items elements names. |
|
53 */ |
|
54 static TBool IsMenuItemElementName(const TDesC8& aNameToCompare); |
|
55 |
|
56 public: |
|
57 |
|
58 /** |
|
59 * Two-phase constructor. |
|
60 * |
|
61 * @since S60 5.0 |
|
62 * @param aElement Xml element. |
|
63 * @param aCmnPtrs Common pointers. |
|
64 * @return Fully constructed object. |
|
65 */ |
|
66 static CHnMdMenuItem* NewL( TXmlEngElement aElement, |
|
67 THnMdCommonPointers* aCmnPtrs ); |
|
68 |
|
69 /** |
|
70 * Two-phase constructor. |
|
71 * |
|
72 * @since S60 5.0 |
|
73 * @param aElement Xml element. |
|
74 * @param aCmnPtrs Common pointers. |
|
75 * @return Fully constructed object. |
|
76 */ |
|
77 static CHnMdMenuItem* NewLC( TXmlEngElement aElement, |
|
78 THnMdCommonPointers* aCmnPtrs ); |
|
79 |
|
80 /** |
|
81 * Standard C++ virtual destructor. |
|
82 * |
|
83 * @since S60 5.0 |
|
84 */ |
|
85 ~CHnMdMenuItem( ); |
|
86 |
|
87 /** |
|
88 * Gets position. |
|
89 * |
|
90 * @since S60 5.0 |
|
91 * @param aMenuModel Menu model. |
|
92 * @param aQueriesResultsList Queries results list. |
|
93 * @param aPos Position of the record in the results list. |
|
94 */ |
|
95 void EvaluateL( CHnMenuItemModel* aMenuModel, |
|
96 const CLiwGenericParamList& aQueriesResultsList, TInt aPos ); |
|
97 |
|
98 public: |
|
99 // from MHnMdMenuItemBase |
|
100 |
|
101 /** |
|
102 * Gets the menu item's name |
|
103 * |
|
104 * @return Name of menu item. |
|
105 */ |
|
106 const TDesC& NameL(); |
|
107 |
|
108 /** |
|
109 * Checks if the menu item is valid. |
|
110 * |
|
111 * @since S60 5.0 |
|
112 * @param aQueryResults Query results. |
|
113 * @param aPos Position. |
|
114 * @return True if a condition is satisfied. |
|
115 */ |
|
116 TBool IsValidL( const CLiwGenericParamList& aQueryResults, |
|
117 TInt aPos = 0 ); |
|
118 |
|
119 private: |
|
120 |
|
121 /** |
|
122 * Standard C++ constructor. |
|
123 * |
|
124 * @since S60 5.0 |
|
125 */ |
|
126 CHnMdMenuItem(); |
|
127 |
|
128 /** |
|
129 * Standard symbian 2nd pahse constructor. |
|
130 * |
|
131 * @since S60 5.0 |
|
132 * @param aElement Xml element. |
|
133 * @param aCmnPtrs Common pointers. |
|
134 */ |
|
135 void ConstructL( TXmlEngElement aElement, |
|
136 THnMdCommonPointers* aCmnPtrs ); |
|
137 |
|
138 /** |
|
139 * Creates children. |
|
140 * |
|
141 * @since S60 5.0 |
|
142 * @param aElement Xml element. |
|
143 * @param aCmnPtrs Common pointers. |
|
144 */ |
|
145 void CreateChildrenL( TXmlEngElement aElement, |
|
146 THnMdCommonPointers* aCmnPtrs ); |
|
147 |
|
148 /** |
|
149 * Appends child item. |
|
150 * |
|
151 * @since S60 5.0 |
|
152 * @param aMenuItem Menu item. |
|
153 */ |
|
154 void AppendChildItemL( CHnMdMenuItem* aMenuItem ); |
|
155 |
|
156 /** |
|
157 * Creates properties. |
|
158 * |
|
159 * @since S60 5.0 |
|
160 * @param aElement Xml element. |
|
161 * @param aCmnPtrs Common pointers. |
|
162 */ |
|
163 void CreatePropertiesL( TXmlEngElement aElement, |
|
164 THnMdCommonPointers* aCmnPtrs ); |
|
165 |
|
166 private: // data |
|
167 |
|
168 /** |
|
169 * Own - Name. |
|
170 */ |
|
171 RBuf iName; |
|
172 |
|
173 /** |
|
174 * Position. |
|
175 */ |
|
176 TInt iPosition; |
|
177 |
|
178 /** |
|
179 * Event element. |
|
180 */ |
|
181 TInt iEvent; |
|
182 |
|
183 /** |
|
184 * Own - Children pointer array. |
|
185 */ |
|
186 RPointerArray<CHnMdMenuItem> iChildren; |
|
187 |
|
188 /** |
|
189 * Own - Name value cache. |
|
190 */ |
|
191 RBuf iNameValueCache; |
|
192 |
|
193 /** |
|
194 * Own - Condition. |
|
195 */ |
|
196 CHnConditionInterface* iCondition; |
|
197 |
|
198 /** |
|
199 * Is menu item "type". |
|
200 */ |
|
201 CHnMenuItemModel::THnMenuItemType iType; |
|
202 |
|
203 }; |
|
204 |
|
205 #endif // C_HNMULMENUITEM_H |
|