|
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 #ifndef HNMDBUTTON_H_ |
|
20 #define HNMDBUTTON_H_ |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 struct THnMdCommonPointers; |
|
25 class CHnCondition; |
|
26 class CLiwGenericParamList; |
|
27 class CGulIcon; |
|
28 class CHnMdValueImage; |
|
29 class CHnMdValueText; |
|
30 class TXmlEngElement; |
|
31 class CHnConditionInterface; |
|
32 class CHnAttributeBase; |
|
33 |
|
34 /** |
|
35 * Toolbar button. |
|
36 * |
|
37 * This class represents the toolbar button. |
|
38 * |
|
39 * @lib hnmetadatamodel |
|
40 * @since S60 5.0 |
|
41 * @ingroup group_hnmetadatamodel |
|
42 */ |
|
43 NONSHARABLE_CLASS( CHnMdButton ) : public CBase |
|
44 { |
|
45 public: |
|
46 |
|
47 /** |
|
48 * Two-phase constructor. |
|
49 * |
|
50 * @since S60 5.0 |
|
51 * @param aElement Xml element. |
|
52 * @param aCmnPtrs Common pointers. |
|
53 * @return Constructed object. |
|
54 */ |
|
55 static CHnMdButton* NewLC( TXmlEngElement aElement, |
|
56 THnMdCommonPointers* aCmnPtrs ); |
|
57 |
|
58 /** |
|
59 * Standard C++ virtual destructor. |
|
60 * |
|
61 * @since S60 5.0 |
|
62 */ |
|
63 ~CHnMdButton( ); |
|
64 |
|
65 /** |
|
66 * Checks if the button should be added. |
|
67 * |
|
68 * @since S60 5.0 |
|
69 * @param aQueryResults Query results in the form of a CLiwGenericParamList. |
|
70 * @param aPos Position of the record in the above results. |
|
71 * @return True if valid. |
|
72 */ |
|
73 TBool ValidateToAddL( const CLiwGenericParamList& aQueryResults, |
|
74 TInt aPos = 0 ); |
|
75 |
|
76 /** |
|
77 * Checks if the button should be added. |
|
78 * |
|
79 * @since S60 5.0 |
|
80 * @param aQueryResults Query results in the form of a CLiwGenericParamList. |
|
81 * @param aPos Position of the record in the above results. |
|
82 * @return True if valid. |
|
83 */ |
|
84 TBool ValidateToDimmL( const CLiwGenericParamList& aQueryResults, |
|
85 TInt aPos = 0 ); |
|
86 |
|
87 /** |
|
88 * Gets the id for event generated by this button. |
|
89 * |
|
90 * @return Event Id. |
|
91 */ |
|
92 TInt GetEventId() const; |
|
93 |
|
94 /** |
|
95 * Gets the index of button. |
|
96 * |
|
97 * @return Index. |
|
98 */ |
|
99 TInt GetIndex() const; |
|
100 |
|
101 /** |
|
102 * Evaluates button text. |
|
103 * |
|
104 * @param aQueryResults Results from service. |
|
105 * @param aPos Position of item, needed for parsing the path to query. |
|
106 * @return Button text |
|
107 */ |
|
108 const TPtrC EvaluateButtonTextL( |
|
109 const CLiwGenericParamList& aQueryResults, TInt aPos = 0 ); |
|
110 |
|
111 /** |
|
112 * Evaluates and returns an icon for the button. |
|
113 * |
|
114 * @param aQueriesResultsList Results from service. |
|
115 * @param aPos Position of item. |
|
116 * @return bit map |
|
117 */ |
|
118 // CGulIcon* EvaluateIconL( const CLiwGenericParamList& aQueriesResultsList, |
|
119 // TInt aPos ) const; |
|
120 CHnAttributeBase* EvaluateIconL( const CLiwGenericParamList& aQueriesResultsList, |
|
121 TInt aPos ) const; |
|
122 private: |
|
123 /** |
|
124 * Standard C++ constructor. |
|
125 * |
|
126 * @since S60 5.0 |
|
127 */ |
|
128 CHnMdButton(); |
|
129 |
|
130 /** |
|
131 * Standard symbian 2nd pahse constructor. |
|
132 * |
|
133 * @since S60 5.0 |
|
134 * @param aElement Xml element. |
|
135 * @param aCmnPtrs Common pointers. |
|
136 */ |
|
137 void ConstructL( TXmlEngElement aElement, |
|
138 THnMdCommonPointers* aCmnPtrs ); |
|
139 |
|
140 private: // data |
|
141 |
|
142 /** |
|
143 * Own - Help text string handler. |
|
144 */ |
|
145 CHnMdValueText* iButtonText; |
|
146 |
|
147 /** |
|
148 * Index. |
|
149 */ |
|
150 TInt iIndex; |
|
151 |
|
152 /** |
|
153 * Event element. |
|
154 */ |
|
155 TInt iEventId; |
|
156 |
|
157 /** |
|
158 * Own - Condition - if passed, button is added to toolbar. |
|
159 */ |
|
160 CHnConditionInterface* iConditionAdd; |
|
161 |
|
162 /** |
|
163 * Own - Condition - if passed, button is dimmed. |
|
164 */ |
|
165 CHnConditionInterface* iConditionDimm; |
|
166 |
|
167 /** |
|
168 * Own - Keeps icon for button. |
|
169 */ |
|
170 CHnMdValueImage* iIcon; |
|
171 |
|
172 }; |
|
173 |
|
174 #endif // HNMDBUTTON_H_ |