1 /* |
|
2 * Copyright (c) 2007-2008 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: message editer class |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __CIMCVAPPMESSAGEEDITOR__H |
|
19 #define __CIMCVAPPMESSAGEEDITOR__H |
|
20 |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include <coecntrl.h> |
|
24 #include <eikedwin.h> |
|
25 #include <eikrted.h> |
|
26 #include <eikedwin.h> |
|
27 #include <AknUtils.h> |
|
28 |
|
29 // FORWARD DECLARATION |
|
30 class CAknInputFrame; |
|
31 class MIMCVTapEventObserver; |
|
32 class CIMCVAppView; |
|
33 class CIMCVAppMessageExtensionsHandler; |
|
34 /** |
|
35 * Helper class to get editor content events. |
|
36 * @since S60 v5.0 |
|
37 */ |
|
38 class MIMCVAppMessageEditorObserver |
|
39 { |
|
40 public: // Enumerations |
|
41 enum TEditorEvent |
|
42 { |
|
43 EEditorContentCleared = 0, |
|
44 EEditorContentChanged |
|
45 }; |
|
46 |
|
47 public: // New methods |
|
48 |
|
49 /** |
|
50 * Handle editor event. |
|
51 */ |
|
52 virtual void HandleMessageEditorEventL( TEditorEvent aEvent ) = 0; |
|
53 |
|
54 protected: |
|
55 |
|
56 /** |
|
57 * Destructor for protection. |
|
58 */ |
|
59 virtual ~MIMCVAppMessageEditorObserver() {}; |
|
60 }; |
|
61 |
|
62 /** |
|
63 * Message Editor for meco application. |
|
64 * It looks just like a search field. |
|
65 * |
|
66 * @imcvappui.exe |
|
67 * @since Series 60 1.2 |
|
68 */ |
|
69 class CIMCVAppMessageEditor: |
|
70 public CCoeControl, |
|
71 public MCoeControlObserver, |
|
72 public MEikEdwinObserver |
|
73 { |
|
74 public: |
|
75 /** |
|
76 * Two-phased constructor. Leaves on failure. |
|
77 * @since Series60 1.2 |
|
78 * @param aParent Parent control |
|
79 * @return The constructed Goto Pane control |
|
80 */ |
|
81 static CIMCVAppMessageEditor* NewL |
|
82 ( |
|
83 const CCoeControl* aParent, |
|
84 TDesC& mbmPath, |
|
85 CIMCVAppView& aAppView, |
|
86 CIMCVAppMessageExtensionsHandler& aExtensionHandler |
|
87 ); |
|
88 |
|
89 /** |
|
90 * Destructor. |
|
91 */ |
|
92 virtual ~CIMCVAppMessageEditor(); |
|
93 |
|
94 /** |
|
95 * See description in calslbs.h. |
|
96 */ |
|
97 void HandleFindSizeChanged(); |
|
98 |
|
99 |
|
100 public: // from MCoeControlObserver |
|
101 |
|
102 /** |
|
103 * Handle control event. |
|
104 * @since Series60 1.2 |
|
105 * @param aControl The control |
|
106 * @param aEventType Event type |
|
107 */ |
|
108 void HandleControlEventL |
|
109 ( CCoeControl* aControl, TCoeEvent aEventType ); |
|
110 /** |
|
111 * Catches EEventTextUpdate event. |
|
112 * @since Series60 1.2 |
|
113 * @param aKeyEvent |
|
114 * @param aType |
|
115 * @return |
|
116 */ |
|
117 virtual void HandleEdwinEventL(CEikEdwin* aEdwin,TEdwinEvent aEventType); |
|
118 |
|
119 public: // from CCoeControl |
|
120 |
|
121 /** |
|
122 * Handle key event. |
|
123 * @since Series60 1.2 |
|
124 * @param aKeyEvent The key event |
|
125 * @param aType Key event type |
|
126 * @return Response (was the key event consumed?) |
|
127 */ |
|
128 virtual TKeyResponse OfferKeyEventL |
|
129 ( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
130 |
|
131 /** |
|
132 * HandlePointerEventL |
|
133 * From CCoeControl |
|
134 * |
|
135 */ |
|
136 void HandlePointerEventL(const TPointerEvent& /*aPointerEvent*/); |
|
137 |
|
138 private: // From MObjectProvider |
|
139 |
|
140 /** |
|
141 * @see MObjectProvider |
|
142 */ |
|
143 TTypeUid::Ptr MopSupplyObject(TTypeUid aId); |
|
144 |
|
145 public: // from CCoeControl |
|
146 |
|
147 /** |
|
148 * Count component controls. |
|
149 * @since Series60 1.2 |
|
150 * @return Number of component controls |
|
151 */ |
|
152 virtual TInt CountComponentControls() const; |
|
153 |
|
154 /** |
|
155 * Get a component control by index. |
|
156 * @since Series60 1.2 |
|
157 * @param aIndex Index of component control to be returned |
|
158 * @return Component control or NULL |
|
159 */ |
|
160 virtual CCoeControl* ComponentControl( TInt aIndex ) const; |
|
161 |
|
162 |
|
163 public: // Text manipulation |
|
164 |
|
165 /** |
|
166 * Lengt of the text in the editor. |
|
167 * @since Series60 1.2 |
|
168 * @return The text length |
|
169 */ |
|
170 TInt TextLength() const; |
|
171 |
|
172 |
|
173 /** |
|
174 * Set text. |
|
175 * @since Series60 1.2 |
|
176 * @param aTxt Text to set |
|
177 * appended if needed. |
|
178 */ |
|
179 virtual void SetTextL( const TDesC& aTxt ); |
|
180 |
|
181 /** |
|
182 * Returns editor control of goto pane. |
|
183 * @since Series60 1.2 |
|
184 * @return editor control of goto pane |
|
185 */ |
|
186 CEikRichTextEditor& Editor() const; |
|
187 |
|
188 /** |
|
189 * Sets message editor observer. |
|
190 * @since S60 v3.2 |
|
191 * @param aObserver Pointer to observer, ownership not transfered. |
|
192 */ |
|
193 void SetMessageEditorObserver( MIMCVAppMessageEditorObserver* aObserver ); |
|
194 /** |
|
195 * This method is called when observed object is tapped |
|
196 * @since S60 v5.0 |
|
197 * @param aEvent Event which happened in touchable control |
|
198 * @param aControlId in which control the event occured |
|
199 * @return none |
|
200 */ |
|
201 void SetTapObserver( MIMCVTapEventObserver* aObserver, TUint aId ); |
|
202 |
|
203 |
|
204 private: // Construct / destruct |
|
205 /** |
|
206 * Constructor. |
|
207 * @param |
|
208 */ |
|
209 CIMCVAppMessageEditor(CIMCVAppView& aAppView, |
|
210 CIMCVAppMessageExtensionsHandler& aExtensionHandler); |
|
211 |
|
212 /** |
|
213 * Second-phase constructor. Leaves on failure. |
|
214 * @param aParent Parent control |
|
215 */ |
|
216 void ConstructL( const CCoeControl* aParent, TDesC& mbmPath ); |
|
217 |
|
218 private: |
|
219 |
|
220 /** |
|
221 * Notifies message editor observer when needed. |
|
222 * @since S60 v5.0 |
|
223 * @param aOldLen Editor content length before editing. |
|
224 * @param aCurLen Editor content current length |
|
225 */ |
|
226 void NotifyObserverIfNeededL( TInt aOldLen, TInt aCurLen ) const; |
|
227 |
|
228 |
|
229 protected: // from CCoeControl |
|
230 |
|
231 /** |
|
232 * Handle size change, lay out and draw components. |
|
233 */ |
|
234 virtual void SizeChanged(); |
|
235 |
|
236 /** |
|
237 * Handle focus change. |
|
238 * @since Series60 1.2 |
|
239 * @param aDrawNow Draw now? |
|
240 */ |
|
241 virtual void FocusChanged( TDrawNow aDrawNow ); |
|
242 |
|
243 private: // data |
|
244 |
|
245 // Editor. Owned. |
|
246 CEikRichTextEditor* iEditor; |
|
247 |
|
248 // Input frame. Owned. |
|
249 CAknInputFrame* iInputFrame; |
|
250 // Not owned. |
|
251 MIMCVAppMessageEditorObserver* iEditorObserver; |
|
252 // Not owned. Pointer to observer |
|
253 MIMCVTapEventObserver* iTapObserver; |
|
254 // ID which needs to be reported back to TapObserver |
|
255 TUint iTapControlId; |
|
256 // does not own. Reference to the AppView object |
|
257 CIMCVAppView& iAppView; |
|
258 //does not own. reference to the smiley extension handler |
|
259 CIMCVAppMessageExtensionsHandler& iExtensionHandler; |
|
260 |
|
261 TInt iServiceId; |
|
262 |
|
263 // Owns |
|
264 CAknsBasicBackgroundControlContext* iBgContext; |
|
265 |
|
266 |
|
267 }; |
|
268 |
|
269 #endif |
|