28 |
27 |
29 #include "PreviewControlBase.h" |
28 #include "PreviewControlBase.h" |
30 |
29 |
31 class CFbsBitmap; |
30 class CFbsBitmap; |
32 //class TAknLayoutText; |
31 //class TAknLayoutText; |
33 |
32 |
34 NONSHARABLE_CLASS( CSelectionPopup ):public CPreviewControlBase |
33 NONSHARABLE_CLASS( CSelectionPopup ) : public CPreviewControlBase |
35 { |
34 { |
36 |
35 |
37 public: |
36 public: |
38 |
37 |
39 /** Default constructor, cannot leave. |
38 /** Default constructor, cannot leave. |
40 * |
39 * |
41 * @since S60 5.0 |
40 * @since S60 5.0 |
42 * @param - |
41 * @param - |
43 * @return - |
42 * @return - |
44 */ |
43 */ |
45 CSelectionPopup(); |
44 CSelectionPopup(TRgb& aCurrentColor, const TRect& aImageRect); |
46 |
45 |
47 /** Destructor |
46 /** Destructor |
48 * |
47 * |
49 * @since S60 5.0 |
48 * @since S60 5.0 |
50 * @param - |
49 * @param - |
51 * @return - |
50 * @return - |
52 */ |
51 */ |
53 ~CSelectionPopup (); |
52 ~CSelectionPopup(); |
54 |
53 |
55 /** Second phase constructor |
54 /** Second phase constructor |
56 * |
55 * |
57 * @since S60 5.0 |
56 * @since S60 5.0 |
58 * @param aParent - Parent control |
57 * @param aParent - Parent control |
59 * @return - |
58 * @return - |
60 */ |
59 */ |
61 void ConstructL ( CCoeControl* aParent ); |
60 void ConstructL(CCoeControl* aParent); |
62 |
61 |
63 /** OfferKeyEventL |
62 /** OfferKeyEventL |
64 * |
63 * |
65 * @see CCoeControl |
64 * @see CCoeControl |
66 */ |
65 */ |
67 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, |
66 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); |
68 TEventCode aType ); |
67 |
69 |
68 /** HandlePointerEventL |
70 /** HandlePointerEventL |
69 * |
71 * |
70 * @see CCoeControl |
72 * @see CCoeControl |
71 */ |
73 */ |
72 void HandlePointerEventL(const TPointerEvent &aPointerEvent); |
74 void HandlePointerEventL( const TPointerEvent &aPointerEvent ); |
73 |
75 |
74 public: |
76 public: //new methods |
75 //new methods |
77 |
76 |
78 /** GridRect |
77 /** GridRect |
79 * |
78 * |
80 * Returns popup component's rectangle area |
79 * Returns popup component's rectangle area |
81 * |
80 * |
82 * @since S60 5.0 |
81 * @since S60 5.0 |
83 * @param - |
82 * @param - |
84 * @return TRect The area of the popup |
83 * @return TRect The area of the popup |
85 */ |
84 */ |
86 TRect GridRect() const; |
85 TRect GridRect() const; |
87 |
86 |
88 /** HighlightedItemPressed |
87 /** HighlightedItemPressed |
89 * |
88 * |
90 * This function can be used to check whether user has pressed (by stylus) |
89 * This function can be used to check whether user has pressed (by stylus) |
91 * currently highlighted color item. |
90 * currently highlighted color item. |
92 * |
91 * |
93 * @since S60 5.0 |
92 * @since S60 5.0 |
94 * @param aPosition position value to be checked. |
93 * @param aPosition position value to be checked. |
95 * @return ETrue if aPosition is in the rect area of currently highlighted |
94 * @return ETrue if aPosition is in the rect area of currently highlighted |
96 * plugin item, EFalse otherwise. |
95 * plugin item, EFalse otherwise. |
97 */ |
96 */ |
98 TBool HighlightedItemPressed( TPoint aPosition ) const; |
97 TBool HighlightedItemPressed(TPoint aPosition) const; |
99 |
98 |
100 /** SetSelectedValue |
99 /** SetSelectedValue |
101 * |
100 * |
102 * Set currently highlighted item |
101 * Set currently highlighted item |
103 * |
102 * |
104 * @param aSelected selected item index. |
103 * @param aSelected selected item index. |
105 * @since S60 5.0 |
104 * @since S60 5.0 |
106 */ |
105 */ |
107 void SetSelectedValue( TInt aSelected ); |
106 void SetSelectedValue(TInt aSelected); |
108 |
107 |
109 /** GetSelectedValue |
108 /** GetSelectedValue |
110 * |
109 * |
111 * Returns current highlighted item value |
110 * Returns current highlighted item value |
112 * |
111 * |
113 * @since S60 5.0 |
112 * @since S60 5.0 |
114 * @return TInt Currently selected value |
113 * @return TInt Currently selected value |
115 */ |
114 */ |
116 TInt GetSelectedValue() const; |
115 TInt GetSelectedValue() const; |
117 |
116 |
118 private: |
117 private: |
119 |
118 |
120 /** CreateColorBitmapsL |
119 /** CreateColorBitmapsL |
121 * |
120 * |
122 * Creates a bitmap array |
121 * Creates a bitmap array |
123 * |
122 * |
124 * @since S60 5.0 |
123 * @since S60 5.0 |
125 * @param aSize Size that color bitmaps should be created to |
124 * @param aSize Size that color bitmaps should be created to |
126 * @return - |
125 * @return - |
127 */ |
126 */ |
128 void CreateColorBitmapsL( TSize aSize ); |
127 void CreateColorBitmapsL(TSize aSize); |
129 |
128 |
130 protected: |
129 protected: |
131 |
130 |
132 /** SizeChanged |
131 /** SizeChanged |
133 * |
132 * |
134 * @see CCoeControl |
133 * @see CCoeControl |
135 */ |
134 */ |
136 virtual void SizeChanged(); |
135 virtual void SizeChanged(); |
137 |
136 |
138 /** Draw |
137 /** Draw |
139 * |
138 * |
140 * @see CCoeControl |
139 * @see CCoeControl |
141 */ |
140 */ |
142 virtual void Draw( const TRect& aRect ) const; |
141 virtual void Draw(const TRect& aRect) const; |
143 |
142 |
144 |
143 private: |
145 private: |
144 |
146 |
145 // Popup graphic bitmaps |
147 // Popup graphic bitmaps |
146 CFbsBitmap* iPopupCenter; |
148 CFbsBitmap* iPopupCenter; |
147 CFbsBitmap* iPopupCenterMask; |
149 CFbsBitmap* iPopupCenterMask; |
148 CFbsBitmap* iPopupCornerTL; |
150 CFbsBitmap* iPopupCornerTL; |
149 CFbsBitmap* iPopupCornerTLMask; |
151 CFbsBitmap* iPopupCornerTLMask; |
150 CFbsBitmap* iPopupCornerTR; |
152 CFbsBitmap* iPopupCornerTR; |
151 CFbsBitmap* iPopupCornerTRMask; |
153 CFbsBitmap* iPopupCornerTRMask; |
152 CFbsBitmap* iPopupCornerBL; |
154 CFbsBitmap* iPopupCornerBL; |
153 CFbsBitmap* iPopupCornerBLMask; |
155 CFbsBitmap* iPopupCornerBLMask; |
154 CFbsBitmap* iPopupCornerBR; |
156 CFbsBitmap* iPopupCornerBR; |
155 CFbsBitmap* iPopupCornerBRMask; |
157 CFbsBitmap* iPopupCornerBRMask; |
156 CFbsBitmap* iPopupSideL; |
158 CFbsBitmap* iPopupSideL; |
157 CFbsBitmap* iPopupSideLMask; |
159 CFbsBitmap* iPopupSideLMask; |
158 CFbsBitmap* iPopupSideR; |
160 CFbsBitmap* iPopupSideR; |
159 CFbsBitmap* iPopupSideRMask; |
161 CFbsBitmap* iPopupSideRMask; |
160 CFbsBitmap* iPopupSideT; |
162 CFbsBitmap* iPopupSideT; |
161 CFbsBitmap* iPopupSideTMask; |
163 CFbsBitmap* iPopupSideTMask; |
162 CFbsBitmap* iPopupSideB; |
164 CFbsBitmap* iPopupSideB; |
163 CFbsBitmap* iPopupSideBMask; |
165 CFbsBitmap* iPopupSideBMask; |
164 |
166 |
165 // Popup rects |
167 // Popup rects |
166 TRect iPopupCenterRect; |
168 TRect iPopupCenterRect; |
167 TRect iPopupCornerTLRect; |
169 TRect iPopupCornerTLRect; |
168 TRect iPopupCornerTRRect; |
170 TRect iPopupCornerTRRect; |
169 TRect iPopupCornerBLRect; |
171 TRect iPopupCornerBLRect; |
170 TRect iPopupCornerBRRect; |
172 TRect iPopupCornerBRRect; |
171 TRect iPopupSideLRect; |
173 TRect iPopupSideLRect; |
172 TRect iPopupSideRRect; |
174 TRect iPopupSideRRect; |
173 TRect iPopupSideTRect; |
175 TRect iPopupSideTRect; |
174 TRect iPopupSideBRect; |
176 TRect iPopupSideBRect; |
175 TRect iHeadingRect; |
177 TRect iHeadingRect; |
176 |
178 |
177 // Format and layout information of the heading text |
179 // Format and layout information of the heading text |
178 TAknLayoutText iLayoutTextHeading; |
180 TAknLayoutText iLayoutTextHeading; |
179 |
181 |
180 // Contains rectangles of all grid highlight items |
182 // Contains rectangles of all grid highlight items |
181 RArray<TRect> iHighlightRectsArray; |
183 RArray< TRect > iHighlightRectsArray; |
182 |
184 |
183 // Contains rectangles of all grid color items |
185 // Contains rectangles of all grid color items |
184 RArray<TRect> iGridRectsArray; |
186 RArray< TRect > iGridRectsArray; |
185 |
187 |
186 // Color bitmaps |
188 // Color bitmaps |
187 RPointerArray<CFbsBitmap> iColorBitmapsArray; |
189 RPointerArray < CFbsBitmap > iColorBitmapsArray; |
188 |
190 |
189 // Used values |
191 // Used values |
190 RArray<TInt> iItemArray; |
192 RArray< TInt > iItemArray; |
191 |
193 |
192 TInt iCurrentItem; |
194 TInt iCurrentItem; |
193 |
195 |
194 TRgb iCurrentColor; |
196 |
195 |
197 }; |
196 TRect iImageRect; |
198 |
197 }; |
199 |
198 |
200 NONSHARABLE_CLASS( CSelectionDialog ): public CAknDialog |
199 NONSHARABLE_CLASS( CSelectionDialog ) : public CAknDialog |
201 { |
200 { |
202 public: |
201 public: |
203 |
202 |
204 /** RunDlgLD |
203 /** RunDlgLD |
205 * |
204 * |
206 * @param aBitmap - background bitmap |
205 * @param aBitmap - background bitmap |
207 * @param aRect - Rect for the dialog |
206 * @param aRect - Rect for the dialog |
208 * @param aSelection - Selected value to be returned |
207 * @param aSelection - Selected value to be returned |
209 * @return - ExecuteLD() return value |
208 * @return - ExecuteLD() return value |
210 */ |
209 */ |
211 static TInt RunDlgLD( const CFbsBitmap* aBitmap, |
210 static TInt RunDlgLD(const CFbsBitmap* aBitmap, const TRect& aRect, |
212 const TRect& aRect, |
211 TInt& aSelection, TRgb& aCurrentColor, const TRect& aImageRect); |
213 TInt& aSelection ); |
212 |
214 |
213 virtual ~CSelectionDialog(); |
215 |
214 |
216 virtual ~CSelectionDialog(); |
215 /** OkToExitL |
217 |
216 * |
218 /** OkToExitL |
217 * From CAknDialog update member variables . |
219 * |
218 * @param aButtonId The ID of the button that was activated. |
220 * From CAknDialog update member variables . |
219 * @return Should return ETrue if the dialog should exit, |
221 * @param aButtonId The ID of the button that was activated. |
220 * and EFalse if it should not |
222 * @return Should return ETrue if the dialog should exit, |
221 */ |
223 * and EFalse if it should not |
222 TBool OkToExitL(TInt aButtonId); |
224 */ |
223 |
225 TBool OkToExitL( TInt aButtonId ); |
224 /** Draw |
226 |
225 * |
227 /** Draw |
226 * |
228 * |
227 * @see CAknDialog |
229 * |
228 * |
230 * @see CAknDialog |
229 */ |
231 * |
230 void Draw(const TRect& aRect) const; |
232 */ |
231 |
233 void Draw(const TRect& aRect) const; |
232 /** SizeChanged |
234 |
233 * |
235 /** SizeChanged |
234 * |
236 * |
235 * @see CCoeControl |
237 * |
236 * |
238 * @see CCoeControl |
237 */ |
239 * |
238 virtual void SizeChanged(); |
240 */ |
239 |
241 virtual void SizeChanged(); |
240 /** OfferKeyEventL |
242 |
241 * |
243 /** OfferKeyEventL |
242 * @see CCoeControl |
244 * |
243 * |
245 * @see CCoeControl |
244 */ |
246 * |
245 virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, |
247 */ |
246 TEventCode aType); |
248 virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); |
247 |
249 |
248 /** HandlePointerEventL |
250 /** HandlePointerEventL |
249 * |
251 * |
250 * @see CCoeControl |
252 * @see CCoeControl |
251 */ |
253 */ |
252 virtual void HandlePointerEventL(const TPointerEvent &aPointerEvent); |
254 virtual void HandlePointerEventL( const TPointerEvent &aPointerEvent ); |
253 |
255 |
254 /** PreLayoutDynInitL |
256 /** PreLayoutDynInitL |
255 * |
257 * |
256 * @see CEikDialog |
258 * @see CEikDialog |
257 * |
259 * |
258 */ |
260 */ |
259 virtual void PreLayoutDynInitL(); |
261 virtual void PreLayoutDynInitL(); |
260 |
262 |
261 /** CountComponentControls |
263 /** CountComponentControls |
262 * |
264 * |
263 * @see CCoeControl |
265 * @see CCoeControl |
264 * |
266 * |
265 */ |
267 */ |
266 TInt CountComponentControls() const; |
268 TInt CountComponentControls() const; |
267 |
269 |
268 /** ComponentControl |
270 /** ComponentControl |
269 * |
271 * |
270 * @see CCoeControl |
272 * @see CCoeControl |
271 * |
273 * |
272 */ |
274 */ |
273 virtual CCoeControl* ComponentControl(TInt aIndex) const; |
275 virtual CCoeControl* ComponentControl(TInt aIndex) const; |
274 |
276 |
275 private: |
277 private: // implementation |
276 // implementation |
278 |
277 |
279 CSelectionDialog( TInt& aSelectino ); |
278 CSelectionDialog(TInt& aSelectino); |
280 void ConstructL( const CFbsBitmap* aBitmap, const TRect& aRect); |
279 void ConstructL(const CFbsBitmap* aBitmap, const TRect& aRect, |
281 |
280 TRgb& aCurrentColor, const TRect& aImageRect); |
282 private: |
281 |
283 |
282 private: |
284 // Own: popup component |
283 |
285 CSelectionPopup* iPopup; |
284 // Own: popup component |
286 |
285 CSelectionPopup* iPopup; |
287 // Ref: Selected color |
286 |
288 TInt& iCurrentValue; |
287 // Ref: Selected color |
289 |
288 TInt& iCurrentValue; |
290 }; |
289 }; |
291 |
290 |
292 #endif // _SELECTIONPOPUP_H |
291 #endif // _SELECTIONPOPUP_H |