|
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_CAKNFEPCTRLCOMMONBGCTRL_H |
|
20 #define C_CAKNFEPCTRLCOMMONBGCTRL_H |
|
21 |
|
22 // system includes |
|
23 #include <AknsConstants.h> |
|
24 #include <peninputlayoutbasecontrol.h> |
|
25 |
|
26 struct TCommonBgCtrlSubItem |
|
27 { |
|
28 TRect iRect; |
|
29 TAknsItemID iFrameID; |
|
30 TAknsItemID iCenterID; |
|
31 TBool iIsShow; |
|
32 }; |
|
33 |
|
34 // class declarations |
|
35 /** |
|
36 * Basic functionality for background display |
|
37 * It provides creation from Frame ID and can react according to SizeChanged Msg |
|
38 * |
|
39 * @lib fepcommonctrls.lib |
|
40 * @since S60 v3.2 |
|
41 */ |
|
42 class CAknFepCtrlCommonBgCtrl : public CFepUiBaseCtrl |
|
43 { |
|
44 public: |
|
45 |
|
46 /** |
|
47 * Two-phased constructor. |
|
48 * |
|
49 * @since S60 v3.2 |
|
50 * @param aUiLayout An instance of CFepUiLayout |
|
51 * @param aControlId The control id of input range button |
|
52 * @return The pointer point to CAknFepCtrlCommonBgCtrl type object |
|
53 */ |
|
54 static CAknFepCtrlCommonBgCtrl* NewL(CFepUiLayout* aUiLayout, |
|
55 TInt aControlId, |
|
56 TAknsItemID aFrameID, |
|
57 TAknsItemID aCenterID); |
|
58 |
|
59 /** |
|
60 * Two-phased constructor. |
|
61 * |
|
62 * @since S60 v3.2 |
|
63 * @param aUiLayout An instance of CFepUiLayout |
|
64 * @param aControlId The control id of input range button |
|
65 * @return The pointer point to CAknFepCtrlCommonBgCtrl type object |
|
66 */ |
|
67 static CAknFepCtrlCommonBgCtrl* NewLC(CFepUiLayout* aUiLayout, |
|
68 TInt aControlId, |
|
69 TAknsItemID aFrameID, |
|
70 TAknsItemID aCenterID); |
|
71 /** |
|
72 * Destructor. |
|
73 * |
|
74 * @since S60 v3.2 |
|
75 */ |
|
76 virtual ~CAknFepCtrlCommonBgCtrl(); |
|
77 |
|
78 /** |
|
79 * This function handles the SizeChanged event, it resizes all images and rects |
|
80 * |
|
81 * @since S60 v3.2 |
|
82 * @param aRect New button extent |
|
83 * if only the position of the button changed, no need to reset the images as well |
|
84 * @return Nothing |
|
85 */ |
|
86 void SizeChanged(const TRect& aRect); |
|
87 |
|
88 /** |
|
89 * Check whether this control contains the point |
|
90 * |
|
91 * @since S60 V4.0 |
|
92 * @param aPoint The point to be checked |
|
93 * @return ETrue if control valid region contains the point, otherwise EFalse |
|
94 */ |
|
95 virtual TBool Contains(const TPoint& aPt); |
|
96 |
|
97 /** |
|
98 * Redraw the defined area of background |
|
99 * |
|
100 * @since S60 V4.0 |
|
101 * @param aPoint The point to be checked |
|
102 * @return ETrue if control valid region contains the point, otherwise EFalse |
|
103 */ |
|
104 virtual void ReDrawRect(const TRect& aRect); |
|
105 |
|
106 /** |
|
107 * Add sub background item |
|
108 * |
|
109 * @since S60 V4.0 |
|
110 * @param aSubItem sub background which will show above the background |
|
111 * @return None |
|
112 */ |
|
113 void AddSubBgItemL( const TCommonBgCtrlSubItem& aSubItem ); |
|
114 |
|
115 /** |
|
116 * Show sub background item |
|
117 * |
|
118 * @since S60 V4.0 |
|
119 * @param aIndex item index |
|
120 * @param aShow is show or hide |
|
121 * @return None |
|
122 */ |
|
123 void ShowSubBgItem( TInt aIndex, TBool aShow ); |
|
124 |
|
125 TCommonBgCtrlSubItem& GetSubBgItem( TInt aIndex ); |
|
126 |
|
127 /** |
|
128 * Draws UI |
|
129 * |
|
130 * @since S60 v3.2 |
|
131 * @return None |
|
132 */ |
|
133 void Draw(); |
|
134 |
|
135 /** |
|
136 * Set Frame ID |
|
137 * |
|
138 * @since S60 v3.2 |
|
139 * @param aFrameID The frame ID |
|
140 * @param aCenterID Center bitmap ID |
|
141 * @return None |
|
142 */ |
|
143 void SetFrameID( TAknsItemID aFrameID, TAknsItemID aCenterID ); |
|
144 protected: |
|
145 |
|
146 /** |
|
147 * C++ default constructor. |
|
148 * |
|
149 * @since S60 v3.2 |
|
150 * @param aUiLayout An instance of CFepUiLayout |
|
151 * @param aControlId The control id of input range button |
|
152 * @param aFrameID The frame ID |
|
153 * @param aCenterID Center bitmap ID |
|
154 */ |
|
155 CAknFepCtrlCommonBgCtrl(CFepUiLayout* aUiLayout, |
|
156 TInt aControlId, |
|
157 TAknsItemID aFrameID, |
|
158 TAknsItemID aCenterID); |
|
159 |
|
160 void DrawFrame( CFbsBitGc* aGc, |
|
161 const TRect& aRect, |
|
162 TAknsItemID aFrameID, |
|
163 TAknsItemID aCenterID ); |
|
164 private: |
|
165 /** |
|
166 * The img ID of frame |
|
167 */ |
|
168 TAknsItemID iFrameID; |
|
169 TAknsItemID iCenterID; |
|
170 |
|
171 /** |
|
172 * The sub items of the background |
|
173 */ |
|
174 RArray<TCommonBgCtrlSubItem> iSubItems; |
|
175 }; |
|
176 |
|
177 #endif // C_CAKNFEPCTRLCOMMONBGCTRL_H |
|
178 |
|
179 // End Of File |