|
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 * Draw plugin control class header. |
|
17 * |
|
18 */ |
|
19 |
|
20 #ifndef IMAGEEDITORDRAWCONTROL_H |
|
21 #define IMAGEEDITORDRAWCONTROL_H |
|
22 |
|
23 // INCLUDES |
|
24 #include "PreviewControlBase.h" |
|
25 #include "MTimerCallBack.h" |
|
26 |
|
27 #include <coecntrl.h> |
|
28 #include <ConeResLoader.h> |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class CAknView; |
|
32 class CFbsBitmap; |
|
33 class CPluginInfo; |
|
34 class CSystemParameters; |
|
35 class CJPTimer; |
|
36 class CAknInfoPopupNoteController; |
|
37 class CDrawPath; |
|
38 |
|
39 /* CLASS: CImageEditorDrawControl |
|
40 * |
|
41 * CImageEditorDrawControl is a control for text insertion plug-in. |
|
42 * |
|
43 */ |
|
44 class CImageEditorDrawControl : public CPreviewControlBase, |
|
45 public MTimerCallBack |
|
46 { |
|
47 public: |
|
48 |
|
49 /** @name Methods:*/ |
|
50 //@{ |
|
51 |
|
52 /** NewL factory method |
|
53 * |
|
54 * @param aRect - control rectangle |
|
55 * @param aParent - pointer to window owning control |
|
56 * @return pointer to created CImageEditorDrawControl object |
|
57 */ |
|
58 static CImageEditorDrawControl* NewL( |
|
59 const TRect& aRect, |
|
60 CCoeControl* aParent |
|
61 ); |
|
62 |
|
63 /** Destructor */ |
|
64 ~CImageEditorDrawControl(); |
|
65 |
|
66 protected: // From CImageEditorControlBase |
|
67 /** Second phase constructor |
|
68 * |
|
69 * @see CImageEditorControlBase |
|
70 */ |
|
71 void ConstructL( |
|
72 const TRect& aRect, |
|
73 CCoeControl* aParent |
|
74 ); |
|
75 |
|
76 /* Setter for view reference |
|
77 * |
|
78 * @see CImageEditorControlBase |
|
79 */ |
|
80 void SetView(CAknView* aView); |
|
81 |
|
82 /* SetSelectedUiItemL |
|
83 * |
|
84 * @see CImageEditorControlBase |
|
85 */ |
|
86 void SetSelectedUiItemL(CPluginInfo* aItem); |
|
87 |
|
88 /** PrepareL |
|
89 * |
|
90 * @see CImageEditorControlBase |
|
91 */ |
|
92 void PrepareL(); |
|
93 |
|
94 /* OfferKeyEventL |
|
95 * |
|
96 * @see CImageEditorControlBase |
|
97 */ |
|
98 TKeyResponse OfferKeyEventL( |
|
99 const TKeyEvent& aKeyEvent, |
|
100 TEventCode aType |
|
101 ); |
|
102 |
|
103 /* HandlePointerEventL |
|
104 * |
|
105 * @see CImageEditorControlBase |
|
106 */ |
|
107 void HandlePointerEventL( const TPointerEvent &aPointerEvent ); |
|
108 |
|
109 /* HandlePluginCommandL |
|
110 * |
|
111 * @see CImageEditorControlBase |
|
112 */ |
|
113 void HandlePluginCommandL(const TInt aCommand); |
|
114 |
|
115 /* GetSoftkeyIndexL |
|
116 * |
|
117 * @see CImageEditorControlBase |
|
118 */ |
|
119 TInt GetSoftkeyIndexL(); |
|
120 |
|
121 /* GetContextMenuResourceId |
|
122 * |
|
123 * @see CImageEditorControlBase |
|
124 */ |
|
125 TInt GetContextMenuResourceId(); |
|
126 |
|
127 /* GetDimmedMenuItems |
|
128 * |
|
129 * @see CImageEditorControlBase |
|
130 */ |
|
131 TBitField GetDimmedMenuItems(); |
|
132 |
|
133 /* GetNaviPaneTextL |
|
134 * |
|
135 * @see CImageEditorControlBase |
|
136 */ |
|
137 TPtrC GetNaviPaneTextL( |
|
138 TBool& aLeftNaviPaneScrollButtonVisibile, |
|
139 TBool& aRightNaviPaneScrollButtonVisible); |
|
140 public: |
|
141 /* GetParam |
|
142 * |
|
143 * Gets pointer to the parameter struct. |
|
144 * @return - pointer to MIA parameter struct |
|
145 */ |
|
146 TDesC& GetParam(); |
|
147 |
|
148 /* SetSysteParameters |
|
149 * |
|
150 * Sets reference to system parameters to plug-in. |
|
151 * @param aSysPars - System parameters instance |
|
152 */ |
|
153 void SetSystemParameters(const CSystemParameters* aSysPars); |
|
154 |
|
155 /* IsReadyToRender |
|
156 * |
|
157 * @return - ETrue when control is ready render |
|
158 */ |
|
159 TBool IsReadyToRender() const; |
|
160 |
|
161 protected: |
|
162 |
|
163 /* GetHelpContext |
|
164 * |
|
165 * @see CCoeControl |
|
166 */ |
|
167 virtual void GetHelpContext(TCoeHelpContext& aContext) const; |
|
168 |
|
169 /* TimerCallBack |
|
170 * |
|
171 * @see MTimerCallBack |
|
172 */ |
|
173 void TimerCallBack(); |
|
174 |
|
175 //@} |
|
176 |
|
177 |
|
178 protected: |
|
179 |
|
180 /** @name Methods:*/ |
|
181 //@{ |
|
182 /* SizeChanged |
|
183 * |
|
184 * @see CImageEditorControlBase |
|
185 */ |
|
186 void SizeChanged(); |
|
187 |
|
188 //@} |
|
189 |
|
190 /** @name Members:*/ |
|
191 //@{ |
|
192 |
|
193 //@} |
|
194 |
|
195 private: |
|
196 |
|
197 CImageEditorDrawControl (); |
|
198 |
|
199 /** Draw |
|
200 * |
|
201 * @see CImageEditorControlBase |
|
202 * |
|
203 */ |
|
204 virtual void Draw (const TRect & aRect) const; |
|
205 |
|
206 private: // Implementation |
|
207 void NaviDown(); |
|
208 void NaviUp(); |
|
209 void NaviRight(); |
|
210 void NaviLeft(); |
|
211 void SelectSizeL(); |
|
212 void StoreTempParams(); |
|
213 void RestoreTempParams(); |
|
214 void RenderTextImageL(); |
|
215 void LoadIndicatorL ( TInt aBitmapInd, TInt aMaskInd ); |
|
216 TPoint ComputeIndicatorPosition() const; |
|
217 void StoreParameters(TBool aLastItem, TBool aDone); |
|
218 void StorePosAndScaleRelScreen(); |
|
219 void RestorePosAndScaleRelScreen(); |
|
220 void StorePosAndScaleRelImage(); |
|
221 void RestorePosAndScaleRelImage(); |
|
222 void ClipPosition(); |
|
223 void SetPositionOnImage( TPoint aPointedPosition ); |
|
224 TPoint GetPositionOnView(); |
|
225 void ShowTooltip(); |
|
226 TSize ScaledLineSize( TSize aOriginalSize ) const; |
|
227 |
|
228 //@} |
|
229 |
|
230 /** @name Members:*/ |
|
231 //@{ |
|
232 |
|
233 /// Ref: to Editor view |
|
234 CAknView* iEditorView; |
|
235 |
|
236 /// Source image size |
|
237 const CSystemParameters* iSysPars; |
|
238 |
|
239 /// Ref: to Plug-in info |
|
240 CPluginInfo* iItem; |
|
241 |
|
242 /// Own: Navigation pane text |
|
243 HBufC* iNaviPaneText; |
|
244 |
|
245 /// X position |
|
246 TInt iX; |
|
247 /// Y position |
|
248 TInt iY; |
|
249 /// Color |
|
250 TRgb iRgb; |
|
251 |
|
252 /// Timer for fast key events |
|
253 CJPTimer* iTimer; |
|
254 TUint32 iKeyCode; |
|
255 |
|
256 /// Pressed key event code |
|
257 TInt iPressedKeyScanCode; |
|
258 |
|
259 /// Number of ticks since timer start |
|
260 TInt iTickCount; |
|
261 |
|
262 /// Multiplier to control the navigation movement speed |
|
263 TInt iNaviStepMultiplier; |
|
264 |
|
265 /// Showing Ok options menu, where some items are dimmed |
|
266 TBool iDisplayingOkOptionsMenu; |
|
267 |
|
268 /// Own: State indicator glyph |
|
269 CFbsBitmap* iIndicator; |
|
270 CFbsBitmap* iIndicatorMask; |
|
271 |
|
272 /// Ready to render |
|
273 TBool iReadyToRender; |
|
274 |
|
275 /// Parameter |
|
276 TBuf<256> iParam; |
|
277 |
|
278 // Popup controller |
|
279 CAknInfoPopupNoteController* iPopupController; |
|
280 // Tooltip texts |
|
281 HBufC* iTooltipResize; |
|
282 |
|
283 // Previous pen position. Make touch rotating and resizing possible |
|
284 TPoint iPointerPosition; |
|
285 // Multiplier to control the rotating speed by touch |
|
286 TInt iTouchAngleMultiplier; |
|
287 |
|
288 /// Resource reader |
|
289 RConeResourceLoader iResLoader; |
|
290 /// Line size |
|
291 TSize iSize; |
|
292 /// Own: drawn paths |
|
293 RPointerArray<CDrawPath> iPaths; |
|
294 |
|
295 //@} |
|
296 |
|
297 }; |
|
298 |
|
299 |
|
300 #endif |