|
1 /* |
|
2 * Copyright (c) 2002 - 2006 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 * |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #if !defined(__AKNMESSAGEQUERYDIALOG_H__) |
|
21 #define __AKNMESSAGEQUERYDIALOG_H__ |
|
22 |
|
23 #include <AknQueryDialog.h> |
|
24 class CEikImage; |
|
25 class CAknMessageQueryDialogExtension; |
|
26 |
|
27 _LIT( KOpeningLinkTag, "<AknMessageQuery Link>" ); |
|
28 _LIT( KClosingLinkTag, "</AknMessageQuery Link>" ); |
|
29 _LIT( KOpeningBoldTag, "<AknMessageQuery Bold>" ); |
|
30 _LIT( KClosingBoldTag, "</AknMessageQuery Bold>" ); |
|
31 |
|
32 |
|
33 /** |
|
34 * Message query dialog. |
|
35 * |
|
36 * The dialog contains text that can be scrolled page by page. |
|
37 * |
|
38 * If you want to use links and/or bold text among message you |
|
39 * must use @c SetMessageTextL method. Formatting text does not |
|
40 * work through resource file. If there are incorrect/misplaced |
|
41 * tags or tags are within each other, dialog will leave. |
|
42 */ |
|
43 class CAknMessageQueryDialog : public CAknQueryDialog |
|
44 { |
|
45 |
|
46 public: |
|
47 |
|
48 /** |
|
49 * Two-phased constructor. |
|
50 * |
|
51 * @param aMessage Text for the dialog. |
|
52 * @param aTone=ENoTone Tone played by the dialog. |
|
53 */ |
|
54 IMPORT_C static CAknMessageQueryDialog* NewL(TDesC& aMessage, |
|
55 const TTone& aTone = ENoTone); |
|
56 |
|
57 /** |
|
58 * Destructor. |
|
59 */ |
|
60 IMPORT_C ~CAknMessageQueryDialog(); |
|
61 |
|
62 /** |
|
63 * C++ default constructor. |
|
64 * |
|
65 * @param aTone Tone played with the dialog. |
|
66 */ |
|
67 IMPORT_C CAknMessageQueryDialog(const TTone aTone); |
|
68 |
|
69 public: |
|
70 |
|
71 /** |
|
72 * Sets message text. If you have links in your message you can mark |
|
73 * link texts between tags @c <AknMessageQuery Link> and |
|
74 * @c </AknMessageQuery Link> in the message text. For links see also @c SetLink. |
|
75 * Bold text can be achieved using tags @c <AknMessageQuery Bold> and @c </AknMessageQuery Bold> |
|
76 * |
|
77 * @param aMessage Message text inside query. Insert '\\n' to get new line. |
|
78 */ |
|
79 IMPORT_C void SetMessageTextL(const TDesC& aMessage); |
|
80 |
|
81 /** |
|
82 * Sets header text. |
|
83 * |
|
84 * @param aHeader Message query header text |
|
85 * @deprecated - use @c Heading() + @c CAknPopupHeadingPane API instead |
|
86 */ |
|
87 IMPORT_C void SetHeaderTextL(const TDesC& aHeader); |
|
88 |
|
89 /** |
|
90 * @deprecated - use tags within text instead. |
|
91 * |
|
92 * Changes the first occurance of @c aLinkText to a link |
|
93 * within the Message. If you have many links with the same name, |
|
94 * the method will set the links in the order you call them. |
|
95 * Before you set a new link you have to bind the |
|
96 * previous one with a callback by calling @c SetLink() function. |
|
97 * |
|
98 * Note that you don't have to call this function if you have already |
|
99 * marked your links between tags @c <AknMessageQuery Link> and |
|
100 * @c </AknMessageQuery Link> in the Message. In that |
|
101 * case only @c SetLink() method is used. |
|
102 * |
|
103 * @since S60 2.8 |
|
104 * @param aLinkText Link text inside message. |
|
105 */ |
|
106 IMPORT_C void SetLinkTextL(const TDesC& aLinkText); |
|
107 |
|
108 /** |
|
109 * Binds a callback to your link so that the dialog knows |
|
110 * which callback to call when a link is activated by the user. |
|
111 * |
|
112 * @since S60 2.8 |
|
113 * @param aCallBack Points to function which is executed when a link is |
|
114 * activated by a user. |
|
115 */ |
|
116 IMPORT_C void SetLink(TCallBack& aCallBack); |
|
117 |
|
118 public: // from CCoeControl |
|
119 |
|
120 /** |
|
121 * From @c CCoeControl. |
|
122 * |
|
123 * Handles key events. |
|
124 * |
|
125 * If a control wishes to process key events, it should implement this |
|
126 * function. The implementation must ensure that the function returns |
|
127 * @c EKeyWasNotConsumed if it does not do anything in response to a |
|
128 * key event, otherwise, other controls or dialogs may be prevented |
|
129 * from receiving the key event. If it is able to process the event it |
|
130 * should return @c EKeyWasConsumed. |
|
131 * |
|
132 * @param aKeyEvent The key event. |
|
133 * @param aType The type of key event: @c EEventKey, @c EEventKeyUp or |
|
134 * @c EEventKeyDown. |
|
135 * @return Indicates whether or not the key event was used |
|
136 * by this control. |
|
137 */ |
|
138 IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, |
|
139 TEventCode); |
|
140 |
|
141 /** |
|
142 * From @c CCoeControl. |
|
143 * |
|
144 * Handles pointer events |
|
145 * |
|
146 * @param aPointerEvent The pointer event. |
|
147 */ |
|
148 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
149 |
|
150 protected: // from CEikDialog |
|
151 |
|
152 /** |
|
153 * From @c CEikDialog. |
|
154 * |
|
155 * Should be derived to perform pre-layout dialog initialisation. |
|
156 * |
|
157 * This function is called by the dialog framework before the dialog |
|
158 * is sized and laid out. It may be overloaded to initialise the control |
|
159 * values that should influence sizing and layout, the default |
|
160 * implementation is empty. |
|
161 */ |
|
162 IMPORT_C virtual void PreLayoutDynInitL(); |
|
163 |
|
164 /** |
|
165 * From @c CEikDialog |
|
166 * |
|
167 * Sets the size and position of the dialog. |
|
168 * |
|
169 * Positions the dialog in the centre of the screen by default. |
|
170 * |
|
171 * @param aSize Not used. |
|
172 */ |
|
173 IMPORT_C virtual void SetSizeAndPosition(const TSize& aSize); |
|
174 |
|
175 /** |
|
176 * From @c CEikDialog |
|
177 * |
|
178 * Not implemented. |
|
179 */ |
|
180 IMPORT_C virtual void PostLayoutDynInitL(); |
|
181 |
|
182 private: |
|
183 |
|
184 /** |
|
185 * If the dialog does not have an extension create one. |
|
186 * |
|
187 * @since S60 2.8 |
|
188 */ |
|
189 void CreateExtensionL(); |
|
190 |
|
191 /** |
|
192 * Register/Unregister an observer to extendedinputcapabilities. |
|
193 * Registering is done so that we can receive pointer events from edwin. |
|
194 * |
|
195 * @param aRegister, if true then registering, in other case unregister |
|
196 * @since S60 3.2 |
|
197 */ |
|
198 void RegisterPointerEventObserver( TBool aRegister ); |
|
199 |
|
200 /** |
|
201 * @since S60 3.0 |
|
202 * With multiple link support |
|
203 */ |
|
204 TInt CountLinks() const; |
|
205 TBool SetNextLinkTextLocationL(const TDesC* aLinkText); // for the non-marked links |
|
206 |
|
207 void ParseMessageTxtL(); |
|
208 TBool GetNextTagL(TMsgQueryTag& aTag); |
|
209 void SetMsgFormattingL(TMsgQueryTag aTag); |
|
210 TBool TaggedMessageL(); |
|
211 TInt LinksInArray(); |
|
212 TInt LastLinkInArray(); |
|
213 |
|
214 /** |
|
215 * Execute the current link. The link is dehighlighted after the execution. |
|
216 * @return ETrue if the link was executed successfully. EFalse if no link |
|
217 * is selected or there is no control object. |
|
218 */ |
|
219 TBool ExecuteLinkL(); |
|
220 |
|
221 private: |
|
222 /** |
|
223 * From CAknControl |
|
224 */ |
|
225 IMPORT_C void* ExtensionInterface( TUid aInterface ); |
|
226 private: |
|
227 IMPORT_C virtual void CEikDialog_Reserved_1(); |
|
228 IMPORT_C virtual void CEikDialog_Reserved_2(); |
|
229 private: |
|
230 IMPORT_C virtual void CAknDialog_Reserved(); |
|
231 private: |
|
232 IMPORT_C virtual void CAknQueryDialog_Reserved(); |
|
233 private: |
|
234 TDesC* iMessage; |
|
235 TDesC* iHeader; |
|
236 CEikImage* iHeaderImage; |
|
237 // Moved to iMsgQueryExtension |
|
238 // TInt iAnimationId; |
|
239 CAknMessageQueryDialogExtension * iMsgQueryExtension; |
|
240 |
|
241 |
|
242 public: |
|
243 |
|
244 /** |
|
245 * From @c MEikCommandObserver. |
|
246 * |
|
247 * Acts on the menu selection if menu is showing - pass on to client if |
|
248 * not processed here. |
|
249 * |
|
250 * Responds to @c EAknSoftkeyView and @c EAknSoftkeyEmpty commands. |
|
251 * |
|
252 * @since S60 3.0 |
|
253 */ |
|
254 IMPORT_C virtual void ProcessCommandL( TInt aCommandId ); |
|
255 |
|
256 /** |
|
257 * Checks if a link is tapped. If yes and the pointer event was of type |
|
258 * TPointerEvent::EButton1Up, then calls the callback for the tapped link. |
|
259 * |
|
260 * @param aParams information on the position tapped and the pointer event |
|
261 * @since S60 3.2 |
|
262 */ |
|
263 void CheckLinkTappedL( TAny* aParams ); |
|
264 |
|
265 |
|
266 public: |
|
267 |
|
268 /** |
|
269 * C++ default constructor. |
|
270 * |
|
271 * @param aMessage Dialog box text. |
|
272 * @param aHeader Header for the dialog. |
|
273 * @deprecated |
|
274 */ |
|
275 IMPORT_C CAknMessageQueryDialog(TDesC* aMessage, TDesC* aHeader); |
|
276 |
|
277 /** |
|
278 * C++ default constructor. |
|
279 * |
|
280 * @param aMessage Dialog box text. |
|
281 * @param aHeader Header for the dialog. |
|
282 * @param aHeaderImage Image to be inserted to the header. |
|
283 * @deprecated |
|
284 */ |
|
285 IMPORT_C CAknMessageQueryDialog(TDesC* aMessage, |
|
286 TDesC* aHeader, |
|
287 CEikImage *aHeaderImage); |
|
288 |
|
289 /** |
|
290 * C++ default constructor. |
|
291 * |
|
292 * @param aMessage Dialog box text. |
|
293 * @param aHeader Header for the dialog. |
|
294 * @param aTone Tone for the dialog. |
|
295 * @deprecated |
|
296 */ |
|
297 IMPORT_C CAknMessageQueryDialog(TDesC* aMessage, |
|
298 TDesC* aHeader, |
|
299 const TTone aTone); |
|
300 |
|
301 /** |
|
302 * C++ default constructor. |
|
303 * |
|
304 * @param aMessage Dialog box text. |
|
305 * @param aHeader Header for the dialog. |
|
306 * @param aHeaderImage Image to be used in the header. |
|
307 * @param aTone Ton for the dialog. |
|
308 * @deprecated |
|
309 */ |
|
310 IMPORT_C CAknMessageQueryDialog(TDesC* aMessage, |
|
311 TDesC* aHeader, |
|
312 CEikImage *aHeaderImage, |
|
313 const TTone aTone); |
|
314 |
|
315 /** |
|
316 * Sets the dialogs texts. |
|
317 * |
|
318 * @param aMessage Text to be inserter into the dialog. |
|
319 * @deprecated |
|
320 */ |
|
321 IMPORT_C void SetMessageText(TDesC* aMessage); |
|
322 |
|
323 /** |
|
324 * Sets the dialogs texts. |
|
325 * |
|
326 * @deprecated |
|
327 * @param aMessage Text to be inserter into the dialog. |
|
328 */ |
|
329 IMPORT_C void SetMessageText(const TDesC& aMessage); |
|
330 |
|
331 /** |
|
332 * Sets the dialogs header texts. |
|
333 * |
|
334 * @param aHeader Text to be inserter into the dialogs header. |
|
335 * @deprecated |
|
336 */ |
|
337 IMPORT_C void SetHeaderText(TDesC* aHeader); |
|
338 |
|
339 /** |
|
340 * Sets the dialogs header texts. |
|
341 * |
|
342 * @param aHeader Text to be inserter into the dialogs header. |
|
343 * @deprecated |
|
344 */ |
|
345 IMPORT_C void SetHeaderText(const TDesC& aHeader); |
|
346 |
|
347 /** Update softkey labels depending on whether any link is highlighted. |
|
348 * If a link is highlighted, the labels change to "View - <Empty>". |
|
349 * If no link i highlighted, the labels change to their previous values ( Ok - Cancel ). |
|
350 */ |
|
351 void UpdateSoftkeyLabels(); |
|
352 |
|
353 /** |
|
354 * C++ default constructor. |
|
355 * |
|
356 * @deprecated |
|
357 */ |
|
358 IMPORT_C CAknMessageQueryDialog(); |
|
359 |
|
360 }; |
|
361 |
|
362 |
|
363 #endif // __AKNMESSAGEQUERYDIALOG_H__ |
|
364 |
|
365 // End of File |