|
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: toolbar button model |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_HNBUTTONMODEL_H |
|
20 #define C_HNBUTTONMODEL_H |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 class CGulIcon; |
|
25 class CHnAttributeBase; |
|
26 |
|
27 /** |
|
28 * Button model class. |
|
29 * |
|
30 * Class represent a toolbar button. It contains all of the |
|
31 * information essential to displaying a button in the |
|
32 * presentationlayer. |
|
33 * |
|
34 * @lib hnpresentationmodel |
|
35 * @since S60 5.0 |
|
36 * @ingroup group_hnpresentationmodel |
|
37 */ |
|
38 NONSHARABLE_CLASS( CHnButtonModel ) : public CBase |
|
39 { |
|
40 public: |
|
41 |
|
42 /** |
|
43 * Two-phased constructor. |
|
44 * |
|
45 * @since S60 5.0 |
|
46 * @param aIndex Button index in the toolbar. |
|
47 */ |
|
48 IMPORT_C static CHnButtonModel* NewLC( TInt aIndex ); |
|
49 |
|
50 /** |
|
51 * Virtual Destructor. |
|
52 * |
|
53 * @since S60 5.0 |
|
54 */ |
|
55 IMPORT_C ~CHnButtonModel(); |
|
56 |
|
57 /** |
|
58 * Gets icon model. |
|
59 * |
|
60 * @since S60 5.0 |
|
61 * @return Icon for button, NULL if not exist |
|
62 */ |
|
63 IMPORT_C CGulIcon* GetIcon() const; |
|
64 |
|
65 /** |
|
66 * Sets icon for button model. |
|
67 * |
|
68 * @since S60 5.0 |
|
69 * @param aIcon Icon for button, transfers ownership |
|
70 */ |
|
71 IMPORT_C void SetIcon( CHnAttributeBase* aAttribute ); |
|
72 |
|
73 /** |
|
74 * Gets tooltip for button model. |
|
75 * |
|
76 * @since S60 5.0 |
|
77 * @return Help text corresponding to button mdoel |
|
78 */ |
|
79 IMPORT_C const TDesC& GetButtonText() const; |
|
80 |
|
81 /** |
|
82 * Sets help text for button model. |
|
83 * |
|
84 * @since S60 5.0 |
|
85 * @param aToolTip Text to display |
|
86 */ |
|
87 IMPORT_C void SetHelpTextL( const TDesC& aToolTip ); |
|
88 |
|
89 /** |
|
90 * Gets dimmed. |
|
91 * |
|
92 * @since S60 5.0 |
|
93 * @return iDimmed |
|
94 */ |
|
95 IMPORT_C TBool GetDimmed() const; |
|
96 |
|
97 /** |
|
98 * Sets dimmed |
|
99 * |
|
100 * @since S60 5.0 |
|
101 * @param aDimmed Sets button state to dimmed |
|
102 */ |
|
103 IMPORT_C void SetDimmed( TBool aDimmed ); |
|
104 |
|
105 /** |
|
106 * Gets index of button model. |
|
107 * |
|
108 * @since S60 5.0 |
|
109 * @return Index |
|
110 */ |
|
111 IMPORT_C TInt GetIndex() const; |
|
112 |
|
113 /** |
|
114 * Gets command for button model. |
|
115 * |
|
116 * @since S60 5.0 |
|
117 * @return Event id |
|
118 */ |
|
119 IMPORT_C TInt GetEventId() const; |
|
120 |
|
121 /** |
|
122 * Sets command for button model. |
|
123 * |
|
124 * @since S60 5.0 |
|
125 * @param aEventId Id of event to invoke when button pressed |
|
126 */ |
|
127 IMPORT_C void SetEventId( TInt aEventId ); |
|
128 |
|
129 /** |
|
130 * Removes all LIW objects owned by this object. |
|
131 * |
|
132 * LIW objects owned by non-LIW objects that are owned by |
|
133 * this object are also removed. |
|
134 * @since S60 5.0 |
|
135 */ |
|
136 void RemoveLiwObjects(); |
|
137 |
|
138 private: |
|
139 |
|
140 /** |
|
141 * Default constructor. |
|
142 * |
|
143 * @since S60 5.0 |
|
144 * @param aIndex Index of the button, being created. |
|
145 */ |
|
146 CHnButtonModel( TInt aIndex ); |
|
147 |
|
148 /** |
|
149 * Second phase constructor. |
|
150 * |
|
151 * @since S60 5.0 |
|
152 */ |
|
153 void ConstructL(); |
|
154 |
|
155 private: // data |
|
156 |
|
157 /** |
|
158 * Index of button, indicates the position on the toolbar. |
|
159 * Values: 0, 1, 2 applicable. |
|
160 */ |
|
161 TInt iIndex; |
|
162 |
|
163 /** |
|
164 * Event Id. |
|
165 */ |
|
166 TInt iEventId; |
|
167 |
|
168 /** |
|
169 * Text to be displayed as help for button. |
|
170 * Own |
|
171 */ |
|
172 RBuf iToolTip; |
|
173 |
|
174 /** |
|
175 * Indicates if button should be dimmed. |
|
176 */ |
|
177 TBool iDimmed; |
|
178 |
|
179 /** |
|
180 * Icon displayed on the button. |
|
181 * Own |
|
182 */ |
|
183 //CGulIcon* iIcon; |
|
184 |
|
185 /** |
|
186 * Own - icon attribute; |
|
187 */ |
|
188 CHnAttributeBase* iIconAttribute; |
|
189 |
|
190 }; |
|
191 |
|
192 #endif // C_HNBUTTONMODEL_H |