|
1 /* |
|
2 * Copyright (c) 2002 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: |
|
15 * Container class for bio controls |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef MSGBIOBODYCONTROL_H |
|
22 #define MSGBIOBODYCONTROL_H |
|
23 |
|
24 |
|
25 // INCLUDES |
|
26 |
|
27 #include <MsgBaseControl.h> // for CMsgBaseControl |
|
28 #include <mmsgbiocontrol.h> // for MMsgBioControl |
|
29 #include <msvstd.h> // for TMsvId |
|
30 #include <msvapi.h> |
|
31 #include <MsgEditor.hrh> |
|
32 |
|
33 // CONSTANTS |
|
34 // MACROS |
|
35 // DATA TYPES |
|
36 // FUNCTION PROTOTYPES |
|
37 |
|
38 // FORWARD DECLARATIONS |
|
39 |
|
40 class CMsgBioControl; |
|
41 class MMsgBioControlObserver; |
|
42 class CMsgBioControlFactory; |
|
43 class RFs; |
|
44 class TMsgHeaderBadgeInfo; |
|
45 class CGulIcon; |
|
46 class CMsvSession; |
|
47 class CEikMenuPane; |
|
48 class CMsgBioControl; |
|
49 class CMsvSession; |
|
50 |
|
51 |
|
52 // CLASS DECLARATION |
|
53 |
|
54 /** |
|
55 * The container class for bio controls, which is contained in the CMsgBody |
|
56 * class of the editor base classes. |
|
57 */ |
|
58 class CMsgBioBodyControl : |
|
59 public CMsgBaseControl, |
|
60 public MMsgBioBodyControl |
|
61 { |
|
62 |
|
63 public: |
|
64 |
|
65 /** |
|
66 * Two-phased constructor. |
|
67 * @param aBioControlObserver Reference to the Bio control observer. |
|
68 * @param aBioMsgType The type of Bio message. |
|
69 * @param aId Id of the message. |
|
70 * @param aIsEditor Flags the new Bio control as editor or viewer. |
|
71 * @return The newly created CMsgBioBodyControl. |
|
72 */ |
|
73 IMPORT_C static CMsgBioBodyControl* NewL( |
|
74 MMsgBioControlObserver& aBioControlObserver, |
|
75 const TUid& aBioMsgType, |
|
76 TMsvId aId, |
|
77 TMsgBioMode aEditorOrViewerMode, |
|
78 CMsvSession& aSession); |
|
79 |
|
80 /** |
|
81 * The destructor. |
|
82 */ |
|
83 IMPORT_C ~CMsgBioBodyControl(); |
|
84 |
|
85 /** |
|
86 * From CCoeControl. Handles commands. |
|
87 * @param The command |
|
88 */ |
|
89 IMPORT_C TBool HandleBioCommandL(TInt aCommand); |
|
90 |
|
91 /** |
|
92 * Returns the header text. (ownership transferred) |
|
93 * @return The header text. |
|
94 */ |
|
95 IMPORT_C HBufC* HeaderTextL(void) const; |
|
96 |
|
97 /** |
|
98 * This is called by the application for allowing the Bio control to |
|
99 * add a menu item. |
|
100 * @param aMenuPane Reference to the applications menu. |
|
101 */ |
|
102 IMPORT_C void SetMenuCommandSetL(CEikMenuPane& aMenuPane); |
|
103 |
|
104 /** |
|
105 * Gives access to the Bio Control. |
|
106 * This is needed only in special cases. |
|
107 * @return Reference to the Bio Control. |
|
108 */ |
|
109 IMPORT_C CMsgBioControl& BioControl(void); |
|
110 |
|
111 public: // from CMsgBaseControl |
|
112 |
|
113 /** |
|
114 * Returns the current control rect. From CMsgBaseControl. |
|
115 * @return The current control rect. |
|
116 */ |
|
117 IMPORT_C TRect CurrentLineRect(); |
|
118 |
|
119 /** |
|
120 * From CMsgBaseControl. Calculates, sets and gives size of control. |
|
121 * Calculates and sets the size of the control and returns new size as |
|
122 * reference aSize. |
|
123 * @param aSize The size |
|
124 */ |
|
125 IMPORT_C void SetAndGetSizeL(TSize& aSize); |
|
126 |
|
127 /** |
|
128 * From CMsgBaseControl. Handles clipboard operation. |
|
129 * @param aFunc The clipboard command to be handled. |
|
130 */ |
|
131 IMPORT_C void ClipboardL(TMsgClipboardFunc aFunc); |
|
132 |
|
133 /** |
|
134 * From CMsgBaseControl. Handles editing operation. |
|
135 * @param aFunc The editing command to be handled. |
|
136 */ |
|
137 IMPORT_C void EditL(TMsgEditFunc aFunc); |
|
138 |
|
139 /** |
|
140 * From CMsgBaseControl. Returns edit permission flags. |
|
141 * @return Edit permission flags |
|
142 */ |
|
143 IMPORT_C TUint32 EditPermission() const; |
|
144 |
|
145 /** |
|
146 * From CMsgBaseControl. Checks if focus change is possible. |
|
147 * @param aDirection The direction of focus to check for. |
|
148 * @return ETrue or EFalse |
|
149 */ |
|
150 IMPORT_C TBool IsFocusChangePossible( |
|
151 TMsgFocusDirection aDirection) const; |
|
152 |
|
153 /** |
|
154 * Checks if cursor location is on the topmost or downmost position. |
|
155 * @param aLocation Top or bottom to check for. |
|
156 * @return ETrue or EFalse |
|
157 */ |
|
158 IMPORT_C TBool IsCursorLocation(TMsgCursorLocation aLocation) const; |
|
159 |
|
160 /** |
|
161 * Returns approximate height of the control. |
|
162 * @return ?description |
|
163 */ |
|
164 IMPORT_C TInt VirtualHeight(); |
|
165 |
|
166 /** |
|
167 * Returns a topmost visible text position. |
|
168 * @return ?description |
|
169 */ |
|
170 IMPORT_C TInt VirtualVisibleTop(); |
|
171 |
|
172 /** |
|
173 * Performs the internal scrolling of control if needed. |
|
174 * Default implementation does not perform any scrolling and returns that |
|
175 * zero pixels were scrolled. |
|
176 * @since 3.2 |
|
177 * @param aPixelsToScroll Amount of pixels to scroll. |
|
178 * @param aDirection Scrolling direction. |
|
179 * @return Amount of pixels the where scrolled. Zero value means the component cannot |
|
180 * be scrolled to that direction anymore and view should be moved. |
|
181 */ |
|
182 IMPORT_C TInt ScrollL( TInt aPixelsToScroll, TMsgScrollDirection aDirection ); |
|
183 |
|
184 /** |
|
185 * Prepares control for viewing. |
|
186 * @since 3.2 |
|
187 * @param aEvent The event type |
|
188 * @param aParam Event related parameters |
|
189 */ |
|
190 IMPORT_C void NotifyViewEvent( TMsgViewEvent aEvent, TInt aParam ); |
|
191 |
|
192 public: // from CCoeControl |
|
193 |
|
194 /** |
|
195 * A CCoeControl virtual for handling key events. |
|
196 * @param aKeyEvent The key event. |
|
197 * @param aType TEventCode |
|
198 * @return EKeyWasConsumed or EKeyWasNotConsumed |
|
199 */ |
|
200 TKeyResponse OfferKeyEventL( |
|
201 const TKeyEvent& aKeyEvent, |
|
202 TEventCode aType); |
|
203 |
|
204 public: // from MMsgBioBodyControl |
|
205 |
|
206 /** |
|
207 * |
|
208 * @param aRequest event type. |
|
209 * @param aDelta |
|
210 */ |
|
211 IMPORT_C TBool HandleBaseControlEventRequestL( |
|
212 TMsgBioControlEventRequest aRequest, |
|
213 TInt aDelta = 0); |
|
214 |
|
215 protected: // from CMsgBaseControl |
|
216 |
|
217 /** |
|
218 * Implementation of pure virtual in CMsgBaseControl. Prepares for read |
|
219 * only or non read only state. This implementation does not do anything. |
|
220 * @param aReadOnly Prepare for read only or non read only. |
|
221 */ |
|
222 void PrepareForReadOnly(TBool aReadOnly); |
|
223 |
|
224 protected: // from CCoeControl |
|
225 |
|
226 /** |
|
227 * From CCoeControl. Gives the number of sub controls. |
|
228 * @return The number of sub controls. |
|
229 */ |
|
230 TInt CountComponentControls() const; |
|
231 |
|
232 /** |
|
233 * From CCoeControl. Returns a pointer to a certain sub control. |
|
234 * @param aIndex Index of the control to be returned. |
|
235 */ |
|
236 CCoeControl* ComponentControl(TInt aIndex) const; |
|
237 |
|
238 /** |
|
239 * From CCoeControl. Called by CONE framework. |
|
240 * Gives this control a chance to manage layout of its sub controls. |
|
241 */ |
|
242 void SizeChanged(); |
|
243 |
|
244 /** |
|
245 * Handles the change of focus. |
|
246 * @param aDrawNow |
|
247 */ |
|
248 void FocusChanged(TDrawNow aDrawNow); |
|
249 |
|
250 /** |
|
251 * From CCoeControl. Parent sets the container window using this. |
|
252 * @param aContainer The parent control. |
|
253 */ |
|
254 void SetContainerWindowL(const CCoeControl& aContainer); |
|
255 |
|
256 private: // construction |
|
257 |
|
258 /** |
|
259 * Second phase constructor. |
|
260 * @param aObserver MMsgBioControlObserver |
|
261 * @param aBioMsgType Bio Message type |
|
262 * @param aId Id of the message in Message Server. |
|
263 * @param aIsEditor Flags the control as being either editor or viewer |
|
264 */ |
|
265 void ConstructL( |
|
266 MMsgBioControlObserver& aBioControlObserver, |
|
267 const TUid& aBioMsgType, |
|
268 TMsvId aId, |
|
269 TMsgBioMode aEditorOrViewerMode); |
|
270 |
|
271 /** |
|
272 * Constructor |
|
273 */ |
|
274 CMsgBioBodyControl(CMsvSession& aSession); |
|
275 |
|
276 private: // not available |
|
277 |
|
278 /** |
|
279 * The default constructor is hidden away from outsiders |
|
280 */ |
|
281 CMsgBioBodyControl(); |
|
282 |
|
283 /** |
|
284 * Copy contructor prohibited. |
|
285 */ |
|
286 CMsgBioBodyControl(const CMsgBioBodyControl& aSource); |
|
287 |
|
288 /** |
|
289 * Assignment operator prohibited. |
|
290 */ |
|
291 const CMsgBioBodyControl& operator=( |
|
292 const CMsgBioBodyControl& aSource); |
|
293 |
|
294 protected: |
|
295 |
|
296 /** |
|
297 * Owns the factory. The factory needs to exist during the whole life |
|
298 * of the Bio Control. |
|
299 */ |
|
300 CMsgBioControlFactory* iBioControlFactory; |
|
301 |
|
302 /** |
|
303 * Owns the Bio Control. |
|
304 */ |
|
305 CMsgBioControl* iBioControl; |
|
306 |
|
307 private: |
|
308 |
|
309 /** |
|
310 * The session is owned here. |
|
311 */ |
|
312 CMsvSession& iSession; |
|
313 }; |
|
314 |
|
315 #endif // MSGBIOBODYCONTROL_H |
|
316 |
|
317 // End of File |