2 * Copyright (c) 2002 - 2006 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
20 #if !defined(__AKNMESSAGEQUERYDIALOG_H__)
21 #define __AKNMESSAGEQUERYDIALOG_H__
23 #include <AknQueryDialog.h>
25 class CAknMessageQueryDialogExtension;
27 _LIT( KOpeningLinkTag, "<AknMessageQuery Link>" );
28 _LIT( KClosingLinkTag, "</AknMessageQuery Link>" );
29 _LIT( KOpeningBoldTag, "<AknMessageQuery Bold>" );
30 _LIT( KClosingBoldTag, "</AknMessageQuery Bold>" );
34 * Message query dialog.
36 * The dialog contains text that can be scrolled page by page.
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.
43 class CAknMessageQueryDialog : public CAknQueryDialog
49 * Two-phased constructor.
51 * @param aMessage Text for the dialog.
52 * @param aTone=ENoTone Tone played by the dialog.
54 IMPORT_C static CAknMessageQueryDialog* NewL(TDesC& aMessage,
55 const TTone& aTone = ENoTone);
60 IMPORT_C ~CAknMessageQueryDialog();
63 * C++ default constructor.
65 * @param aTone Tone played with the dialog.
67 IMPORT_C CAknMessageQueryDialog(const TTone aTone);
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>
77 * @param aMessage Message text inside query. Insert '\\n' to get new line.
79 IMPORT_C void SetMessageTextL(const TDesC& aMessage);
84 * @param aHeader Message query header text
85 * @deprecated - use @c Heading() + @c CAknPopupHeadingPane API instead
87 IMPORT_C void SetHeaderTextL(const TDesC& aHeader);
90 * @deprecated - use tags within text instead.
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.
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.
104 * @param aLinkText Link text inside message.
106 IMPORT_C void SetLinkTextL(const TDesC& aLinkText);
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.
113 * @param aCallBack Points to function which is executed when a link is
114 * activated by a user.
116 IMPORT_C void SetLink(TCallBack& aCallBack);
118 public: // from CCoeControl
121 * From @c CCoeControl.
123 * Handles key events.
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.
132 * @param aKeyEvent The key event.
133 * @param aType The type of key event: @c EEventKey, @c EEventKeyUp or
135 * @return Indicates whether or not the key event was used
138 IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,
142 * From @c CCoeControl.
144 * Handles pointer events
146 * @param aPointerEvent The pointer event.
148 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
150 protected: // from CEikDialog
153 * From @c CEikDialog.
155 * Should be derived to perform pre-layout dialog initialisation.
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.
162 IMPORT_C virtual void PreLayoutDynInitL();
167 * Sets the size and position of the dialog.
169 * Positions the dialog in the centre of the screen by default.
171 * @param aSize Not used.
173 IMPORT_C virtual void SetSizeAndPosition(const TSize& aSize);
180 IMPORT_C virtual void PostLayoutDynInitL();
185 * If the dialog does not have an extension create one.
189 void CreateExtensionL();
192 * Register/Unregister an observer to extendedinputcapabilities.
193 * Registering is done so that we can receive pointer events from edwin.
195 * @param aRegister, if true then registering, in other case unregister
198 void RegisterPointerEventObserver( TBool aRegister );
202 * With multiple link support
204 TInt CountLinks() const;
205 TBool SetNextLinkTextLocationL(const TDesC* aLinkText); // for the non-marked links
207 void ParseMessageTxtL();
208 TBool GetNextTagL(TMsgQueryTag& aTag);
209 void SetMsgFormattingL(TMsgQueryTag aTag);
210 TBool TaggedMessageL();
212 TInt LastLinkInArray();
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.
219 TBool ExecuteLinkL();
225 IMPORT_C void* ExtensionInterface( TUid aInterface );
227 IMPORT_C virtual void CEikDialog_Reserved_1();
228 IMPORT_C virtual void CEikDialog_Reserved_2();
230 IMPORT_C virtual void CAknDialog_Reserved();
232 IMPORT_C virtual void CAknQueryDialog_Reserved();
236 CEikImage* iHeaderImage;
237 // Moved to iMsgQueryExtension
238 // TInt iAnimationId;
239 CAknMessageQueryDialogExtension * iMsgQueryExtension;
245 * From @c MEikCommandObserver.
247 * Acts on the menu selection if menu is showing - pass on to client if
248 * not processed here.
250 * Responds to @c EAknSoftkeyView and @c EAknSoftkeyEmpty commands.
254 IMPORT_C virtual void ProcessCommandL( TInt aCommandId );
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.
260 * @param aParams information on the position tapped and the pointer event
263 void CheckLinkTappedL( TAny* aParams );
269 * C++ default constructor.
271 * @param aMessage Dialog box text.
272 * @param aHeader Header for the dialog.
275 IMPORT_C CAknMessageQueryDialog(TDesC* aMessage, TDesC* aHeader);
278 * C++ default constructor.
280 * @param aMessage Dialog box text.
281 * @param aHeader Header for the dialog.
282 * @param aHeaderImage Image to be inserted to the header.
285 IMPORT_C CAknMessageQueryDialog(TDesC* aMessage,
287 CEikImage *aHeaderImage);
290 * C++ default constructor.
292 * @param aMessage Dialog box text.
293 * @param aHeader Header for the dialog.
294 * @param aTone Tone for the dialog.
297 IMPORT_C CAknMessageQueryDialog(TDesC* aMessage,
302 * C++ default constructor.
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.
310 IMPORT_C CAknMessageQueryDialog(TDesC* aMessage,
312 CEikImage *aHeaderImage,
316 * Sets the dialogs texts.
318 * @param aMessage Text to be inserter into the dialog.
321 IMPORT_C void SetMessageText(TDesC* aMessage);
324 * Sets the dialogs texts.
327 * @param aMessage Text to be inserter into the dialog.
329 IMPORT_C void SetMessageText(const TDesC& aMessage);
332 * Sets the dialogs header texts.
334 * @param aHeader Text to be inserter into the dialogs header.
337 IMPORT_C void SetHeaderText(TDesC* aHeader);
340 * Sets the dialogs header texts.
342 * @param aHeader Text to be inserter into the dialogs header.
345 IMPORT_C void SetHeaderText(const TDesC& aHeader);
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 ).
351 void UpdateSoftkeyLabels();
354 * C++ default constructor.
358 IMPORT_C CAknMessageQueryDialog();
363 #endif // __AKNMESSAGEQUERYDIALOG_H__