|
1 /* |
|
2 * Copyright (c) 2010 Ixonos Plc. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "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 * Ixonos Plc |
|
14 * |
|
15 * Description: |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 /* |
|
21 * File: ResizeControl.h |
|
22 * Created: 22-10-2004 |
|
23 * Author: Wellu Mäkinen |
|
24 */ |
|
25 |
|
26 #ifndef RESIZECONTROL_H |
|
27 #define RESIZECONTROL_H |
|
28 |
|
29 // INCLUDES |
|
30 #include "PreviewControlBase.h" |
|
31 #include "ImageEditorPluginBaseDefs.h" |
|
32 #include "SingleParamControlObserver.h" |
|
33 |
|
34 // FORWARD DECLARATIONS |
|
35 class CCoeControl; |
|
36 class CAknView; |
|
37 class CPluginInfo; |
|
38 class CSystemParameters; |
|
39 class CImageEditorResizePlugin; |
|
40 |
|
41 /* CLASS: CResizeControl |
|
42 * |
|
43 * CResizeControl represents a single parameter adjustment UI control, |
|
44 * that can be used by any of the plug-ins just by defining a UI type to |
|
45 * resource file. |
|
46 */ |
|
47 class CResizeControl : public CPreviewControlBase, |
|
48 public MSingleParControlObserver |
|
49 { |
|
50 |
|
51 public: |
|
52 |
|
53 /** @name Methods:*/ |
|
54 //@{ |
|
55 /** NewL factory method, pops cleanupstack |
|
56 * |
|
57 * @param aRect - control rectangle |
|
58 * @param aParent - pointer to window owning control |
|
59 * @return - pointer to the newly created CResizeControl instance |
|
60 */ |
|
61 static CResizeControl * NewL ( |
|
62 const TRect & aRect, |
|
63 CCoeControl * aParent |
|
64 ); |
|
65 |
|
66 /* ConstructL |
|
67 * |
|
68 * @see CImageEditorControlBase |
|
69 */ |
|
70 virtual void ConstructL ( |
|
71 const TRect & aRect, |
|
72 CCoeControl * aParent |
|
73 ); |
|
74 |
|
75 /** Destructor |
|
76 * |
|
77 * @param - |
|
78 * @return - |
|
79 */ |
|
80 virtual ~CResizeControl (); |
|
81 |
|
82 /* SetView |
|
83 * |
|
84 * @see CImageEditorControlBase |
|
85 */ |
|
86 virtual void SetView (CAknView * aView); |
|
87 |
|
88 /* SetSelectedUiItemL |
|
89 * |
|
90 * @see CImageEditorControlBase |
|
91 */ |
|
92 virtual void SetSelectedUiItemL (CPluginInfo * aItem); |
|
93 |
|
94 /** PrepareL |
|
95 * |
|
96 * @see CImageEditorControlBase |
|
97 * |
|
98 */ |
|
99 virtual void PrepareL (); |
|
100 |
|
101 /* OfferKeyEventL |
|
102 * |
|
103 * @see CImageEditorControlBase |
|
104 */ |
|
105 virtual TKeyResponse OfferKeyEventL ( |
|
106 const TKeyEvent & aKeyEvent, |
|
107 TEventCode aType |
|
108 ); |
|
109 |
|
110 /** HandlePointerEventL |
|
111 * |
|
112 * @see CCoeControl |
|
113 */ |
|
114 virtual void HandlePointerEventL( const TPointerEvent &aPointerEvent ); |
|
115 |
|
116 /* CountComponentControls |
|
117 * |
|
118 * @see CImageEditorControlBase |
|
119 */ |
|
120 virtual TInt CountComponentControls() const; |
|
121 |
|
122 /* ComponentControl |
|
123 * |
|
124 * @see CImageEditorControlBase |
|
125 */ |
|
126 virtual CCoeControl * ComponentControl (TInt aIndex) const; |
|
127 |
|
128 /* HandlePluginCommandL |
|
129 * |
|
130 * @see CImageEditorControlBase |
|
131 */ |
|
132 virtual void HandlePluginCommandL (const TInt aCommand); |
|
133 |
|
134 /* GetSoftkeyIndexL |
|
135 * |
|
136 * @see CImageEditorControlBase |
|
137 */ |
|
138 virtual TInt GetSoftkeyIndexL (); |
|
139 |
|
140 /* GetNaviPaneTextL |
|
141 * |
|
142 * @see CImageEditorControlBase |
|
143 */ |
|
144 // virtual TPtrC GetNaviPaneTextL ( |
|
145 // TBool& aLeftNaviPaneScrollButtonVisibile, |
|
146 // TBool& aRightNaviPaneScrollButtonVisible); |
|
147 |
|
148 /* GetDimmedMenuItems |
|
149 * |
|
150 * @see CImageEditorControlBase |
|
151 */ |
|
152 virtual TBitField GetDimmedMenuItems (); |
|
153 |
|
154 /* SetSysteParameters |
|
155 * |
|
156 * Sets reference to system parameters to plug-in. |
|
157 * |
|
158 * @param aWidth - image width |
|
159 * @return - |
|
160 */ |
|
161 void SetSystemParameters (CSystemParameters * aSysPars, CImageEditorResizePlugin* aParent); |
|
162 |
|
163 /** ParamOperation |
|
164 * |
|
165 * @see MSingleParControlObserver |
|
166 */ |
|
167 virtual void ParamOperation (const TParamOperation aOperation); |
|
168 |
|
169 /* ShowPopupNote |
|
170 * |
|
171 * @see CImageEditorPluginBase |
|
172 */ |
|
173 virtual void ShowPopupNote (); |
|
174 |
|
175 //@} |
|
176 |
|
177 |
|
178 protected: |
|
179 |
|
180 /** @name Methods:*/ |
|
181 //@{ |
|
182 |
|
183 //@} |
|
184 |
|
185 /** @name Members:*/ |
|
186 //@{ |
|
187 |
|
188 //@} |
|
189 |
|
190 private: |
|
191 |
|
192 /** @name Methods:*/ |
|
193 //@{ |
|
194 /** Default constructor |
|
195 * |
|
196 * @param - |
|
197 * @return - |
|
198 */ |
|
199 CResizeControl (); |
|
200 |
|
201 /* SizeChanged |
|
202 * |
|
203 * @see CImageEditorControlBase |
|
204 */ |
|
205 virtual void SizeChanged(); |
|
206 |
|
207 /* Draw |
|
208 * |
|
209 * @see CImageEditorControlBase |
|
210 */ |
|
211 virtual void Draw (const TRect & aRect) const; |
|
212 |
|
213 /* ComputeAndSetSliderParameters |
|
214 * |
|
215 * Computers and sets parameters for slider. |
|
216 * |
|
217 * @param - |
|
218 * @return - |
|
219 */ |
|
220 void ComputeAndSetSliderParameters (CImageEditorResizePlugin* aParent); |
|
221 |
|
222 /* ComputeSizeAndScale |
|
223 * |
|
224 * Computers current image size and scale. |
|
225 * |
|
226 * @param - |
|
227 * @return - |
|
228 */ |
|
229 void ComputeSizeAndScale(); |
|
230 |
|
231 /* ComputeImageSizes |
|
232 * |
|
233 * Computers available target sizes. |
|
234 * |
|
235 * @param - |
|
236 * @return - |
|
237 */ |
|
238 void ComputeImageSizes(); |
|
239 |
|
240 /* PopulateParamArray |
|
241 * |
|
242 * Add target size to param array if appropriate. |
|
243 * |
|
244 * @param - |
|
245 * @return - |
|
246 */ |
|
247 void PopulateParamArray(const TSize& aTargetSize); |
|
248 |
|
249 /** GetParam |
|
250 * |
|
251 * @see MSingleParControlObserver |
|
252 */ |
|
253 virtual TReal GetParam() const; |
|
254 |
|
255 //@} |
|
256 |
|
257 /** @name Members:*/ |
|
258 //@{ |
|
259 |
|
260 /// Plug-in UI control |
|
261 CCoeControl * iControl; |
|
262 /// Reference to view |
|
263 // CAknView * iEditorView; |
|
264 /// Plug-in info |
|
265 CPluginInfo * iPluginInfo; |
|
266 /// Reference to system parameters |
|
267 CSystemParameters * iSysPars; |
|
268 /// Navi pane text |
|
269 // TBuf<64> iNaviPaneText; |
|
270 /// Array of allowed heights / widths |
|
271 RArray<TInt> iParamArray; |
|
272 /// Original input image size |
|
273 TSize iOrigSize; |
|
274 /// Current image size |
|
275 TSize iSize; |
|
276 // Initial position |
|
277 TInt iInitPosition; |
|
278 // Array for storing parameter strings (from rss file) |
|
279 CDesCArray * iParameters; |
|
280 // Preview buffer |
|
281 CFbsBitmap * iBufBitmap; |
|
282 |
|
283 //@} |
|
284 |
|
285 }; |
|
286 |
|
287 |
|
288 |
|
289 #endif |