|
1 /* |
|
2 * Copyright (c) 2002-2005 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: Interface of normal button and multidisplay button |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CAKNFEPCTRLMULTIIMAGEBUTTON_H |
|
20 #define C_CAKNFEPCTRLMULTIIMAGEBUTTON_H |
|
21 |
|
22 // system includes |
|
23 #include <AknsConstants.h> |
|
24 #include <peninputlayoutbasecontrol.h> |
|
25 #include <peninputlayoutbutton.h> |
|
26 #include <peninputcommonbutton.h> |
|
27 |
|
28 // forward declarations |
|
29 class TResourceReader; |
|
30 |
|
31 |
|
32 // class declarations |
|
33 /** |
|
34 * Basic functionality for graphic buttons |
|
35 * It provides creation from resource and can react according to SizeChanged Msg |
|
36 * |
|
37 * @lib fepcommonctrls.lib |
|
38 * @since S60 v3.2 |
|
39 */ |
|
40 class CAknFepCtrlMultiImageButton : public CAknFepCtrlCommonButton |
|
41 { |
|
42 public: |
|
43 |
|
44 /** |
|
45 * Two-phased constructor. |
|
46 * |
|
47 * @since S60 v3.2 |
|
48 * @param aUiLayout An instance of CFepUiLayout |
|
49 * @param aControlId The control id of input range button |
|
50 * @return The pointer point to CAknFepCtrlMultiImageButton type object |
|
51 */ |
|
52 IMPORT_C static CAknFepCtrlMultiImageButton* NewL(CFepUiLayout* aUiLayout, |
|
53 TInt aControlId, |
|
54 TAknsItemID aNormalID, |
|
55 TAknsItemID aPressedID, |
|
56 TAknsItemID aInactiveID); |
|
57 |
|
58 /** |
|
59 * Two-phased constructor. |
|
60 * |
|
61 * @since S60 v3.2 |
|
62 * @param aUiLayout An instance of CFepUiLayout |
|
63 * @param aControlId The control id of input range button |
|
64 * @return The pointer point to CAknFepCtrlMultiImageButton type object |
|
65 */ |
|
66 IMPORT_C static CAknFepCtrlMultiImageButton* NewLC(CFepUiLayout* aUiLayout, |
|
67 TInt aControlId, |
|
68 TAknsItemID aNormalID, |
|
69 TAknsItemID aPressedID, |
|
70 TAknsItemID aInactiveID); |
|
71 /** |
|
72 * Destructor. |
|
73 * |
|
74 * @since S60 v3.2 |
|
75 */ |
|
76 IMPORT_C virtual ~CAknFepCtrlMultiImageButton(); |
|
77 |
|
78 /** |
|
79 * This function creates the input range button from resource. |
|
80 * |
|
81 * @since S60 v3.2 |
|
82 * @param aReader A Reader which is created against the AKN_FEP_BUTTON resource type |
|
83 * @return None |
|
84 */ |
|
85 IMPORT_C void ConstructFromResourceL(TResourceReader& aReader); |
|
86 |
|
87 /** |
|
88 * This function creates the input range button from resource, |
|
89 * before calling this function, caller should set resource id of |
|
90 * range button first |
|
91 * |
|
92 * @since S60 v3.2 |
|
93 * @return None |
|
94 */ |
|
95 IMPORT_C void ConstructFromResourceL(); |
|
96 |
|
97 /** |
|
98 * This function handles the SizeChanged event, it resizes all images and rects |
|
99 * |
|
100 * @since S60 v3.2 |
|
101 * @param aRect New button extent |
|
102 * @param aInnerRect New button inner |
|
103 * @param aIsReloadImages Whether resize images as well, |
|
104 * if only the position of the button changed, no need to reset the images as well |
|
105 * @return Nothing |
|
106 */ |
|
107 IMPORT_C void SizeChanged(TRect aRect, TRect aInnerRect, TBool aIsReloadImages = EFalse); |
|
108 |
|
109 /** |
|
110 * Draws UI |
|
111 * |
|
112 * @since S60 v3.2 |
|
113 * @return None |
|
114 */ |
|
115 IMPORT_C void Draw(); |
|
116 |
|
117 /** |
|
118 * Set text line layout |
|
119 * |
|
120 * @since S60 V4.0 |
|
121 * @param aTextFormat Text line layout to be set |
|
122 * @return None |
|
123 */ |
|
124 inline void SetTextFormat(TAknTextLineLayout aTextFormat); |
|
125 |
|
126 /** |
|
127 * Set text to be shown on button |
|
128 * |
|
129 * @since S60 V4.0 |
|
130 * @param aText Text to be shown on button |
|
131 * @return None |
|
132 */ |
|
133 inline void SetTextL(const TDesC& aText); |
|
134 |
|
135 inline void SetImageFrameId( TAknsItemID aNormalID, |
|
136 TAknsItemID aPressedID, |
|
137 TAknsItemID aInactiveID ); |
|
138 |
|
139 IMPORT_C void Move(const TPoint& aOffset); |
|
140 |
|
141 protected: |
|
142 |
|
143 /** |
|
144 * C++ default constructor. |
|
145 * |
|
146 * @since S60 v3.2 |
|
147 * @param aUiLayout An instance of CFepUiLayout |
|
148 * @param aControlId The control id of input range button |
|
149 */ |
|
150 IMPORT_C CAknFepCtrlMultiImageButton(CFepUiLayout* aUiLayout, |
|
151 TInt aControlId, |
|
152 TAknsItemID aNormalID, |
|
153 TAknsItemID aPressedID, |
|
154 TAknsItemID aInactiveID); |
|
155 |
|
156 |
|
157 void ResizeBitmaps(TSize aInnerSize); |
|
158 |
|
159 void DeleteForgroundRes(); |
|
160 |
|
161 void CreateDimmedMaskL( CFbsBitmap*& aDimmedMask, |
|
162 const CFbsBitmap* aMask |
|
163 /*TScaleMode aScaleMode*/ ); |
|
164 |
|
165 private: |
|
166 /** |
|
167 * Froground bitmap and it's mask |
|
168 */ |
|
169 CFbsBitmap* iForground1Bmp; |
|
170 CFbsBitmap* iForground1BmpMask; |
|
171 |
|
172 /** |
|
173 * Froground Dimmed bitmap's mask |
|
174 */ |
|
175 CFbsBitmap* iForground1DimBmpMask; |
|
176 |
|
177 /** |
|
178 * Froground bitmap's position |
|
179 */ |
|
180 TRect iForground1BmpRect; |
|
181 |
|
182 /** |
|
183 * Froground bitmap and it's mask |
|
184 */ |
|
185 CFbsBitmap* iForground2Bmp; |
|
186 CFbsBitmap* iForground2BmpMask; |
|
187 |
|
188 /** |
|
189 * Froground Dimmed bitmap's mask |
|
190 */ |
|
191 CFbsBitmap* iForground2DimBmpMask; |
|
192 |
|
193 /** |
|
194 * Froground bitmap's position |
|
195 */ |
|
196 TRect iForground2BmpRect; |
|
197 |
|
198 /** |
|
199 * The img ID of button in various states |
|
200 */ |
|
201 TAknsItemID iNormalImgID; |
|
202 TAknsItemID iPressedImgID; |
|
203 TAknsItemID iInactiveImgID; |
|
204 |
|
205 HBufC* iText; |
|
206 TAknTextLineLayout iTextFormat; |
|
207 }; |
|
208 |
|
209 inline void CAknFepCtrlMultiImageButton::SetTextFormat(TAknTextLineLayout aTextFormat) |
|
210 { |
|
211 iTextFormat = aTextFormat; |
|
212 } |
|
213 |
|
214 inline void CAknFepCtrlMultiImageButton::SetTextL(const TDesC& aText) |
|
215 { |
|
216 delete iText; |
|
217 iText = NULL; |
|
218 iText = aText.AllocL(); |
|
219 } |
|
220 |
|
221 inline void CAknFepCtrlMultiImageButton::SetImageFrameId( TAknsItemID aNormalID, |
|
222 TAknsItemID aPressedID, |
|
223 TAknsItemID aInactiveID ) |
|
224 { |
|
225 iNormalImgID = aNormalID; |
|
226 iPressedImgID = aPressedID; |
|
227 iInactiveImgID = aInactiveID; |
|
228 } |
|
229 #endif // C_CAKNFEPCTRLMULTIIMAGEBUTTON_H |
|
230 |
|
231 // End Of File |