2 * Copyright (c) 2005, 2006 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: The interface of the info pop-up note
19 // ------------------------------------------------------------------------
20 // How to use this info popup component (basic case):
23 // #include <AknInfoPopupNote.h>
24 // CAknInfoPopupNoteController* iPopupController;
26 // iPopupController = CAknInfoPopupNoteController::NewL();
28 // iPopupController->SetTextL( strTestText );
29 // iPopupController->ShowInfoPopupNote();
31 // delete iPopupController;
32 // ------------------------------------------------------------------------
35 #ifndef CAKNINFOPOPUPNOTECONTROLLER_H
36 #define CAKNINFOPOPUPNOTECONTROLLER_H
43 // FORWARD DECLARATIONS
44 class CAknInfoPopupNote;
45 class CAknInfoPopupNoteController;
50 * Observer class for notifying popup's showing and hiding.
53 * @since Series 60 3.0
55 class MAknInfoPopupNoteObserver
59 enum TAknInfoPopupNoteEvent
66 * Handles events reported from info popup note.
67 * @param aController The controller that controls the note, from
68 * where the event originates.
69 * @param aEvent The event.
71 virtual void HandleInfoPopupNoteEvent(
72 CAknInfoPopupNoteController* aController,
73 TAknInfoPopupNoteEvent aEvent ) = 0;
78 * The controller part of popup.
79 * It is active object, and uses timer to show popup after specified
80 * time interval (default 1 sec.) and popup hides automaticly
81 * after an other period (default 10 sec.).
84 * @since Series 60 3.0
86 class CAknInfoPopupNoteController : public CTimer
90 * The tone played before the dialog is shown.
91 * Application specific tones may be played by casting the application
92 * defined Sound ID (SID), to TTone
96 /** No tone is played. */
98 /** A confirmation tone is played. */
99 EConfirmationTone = EAvkonSIDConfirmationTone,
100 /** A warning tone is played. */
101 EWarningTone = EAvkonSIDWarningTone,
102 /** An error tone is played. */
103 EErrorTone = EAvkonSIDErrorTone
106 public: // Constructors and destructor
109 * Two-phased constructor.
111 IMPORT_C static CAknInfoPopupNoteController* NewL();
116 virtual ~CAknInfoPopupNoteController();
118 public: // New functions
121 * Set time delay period before popup is shown (in milliseconds).
122 * (if this isn't set, default delay time before show is 1 sec. )
123 * @param aMilliSeconds Wanted delay time in milliseconds.
125 IMPORT_C void SetTimeDelayBeforeShow( TInt aMilliSeconds );
128 * Set time period how long popup is in view (in milliseconds).
129 * (if this isn't set, default show time is 10 sec. )
130 * @param aMilliSeconds Wanted show time in milliseconds.
131 * if set to 0, popup is shown until HideInfoPopupNote is called
133 IMPORT_C void SetTimePopupInView( TInt aMilliSeconds );
136 * Set text to show in popup. If given text is too long for popup,
138 * @param aText Text to show in popup.
140 IMPORT_C void SetTextL( const TDesC& aText );
143 * Show popup after delay time (hide possible previous popup immediately)
144 * and hide popup again after setted time.
146 IMPORT_C void ShowInfoPopupNote();
149 * Hide popup immediately.
151 IMPORT_C void HideInfoPopupNote();
154 * Adds an observer for the pop-up.
155 * @param aObserver The observer to be added.
157 IMPORT_C void AddObserverL( const MAknInfoPopupNoteObserver& aObserver );
160 * Removes an observer from the pop-up.
161 * @param aObserver The observer to be removed.
163 IMPORT_C void RemoveObserver( const MAknInfoPopupNoteObserver& aObserver );
166 * Sets the position and alignment of the info pop-up note.
168 * @param aPosition The position, where pop-up note is displayed.
169 * @param aAlignment Specifies the part of pop-up note that will be aligned
170 * with the given position.
172 IMPORT_C void SetPositionAndAlignment( const TPoint& aPosition,
173 const TGulAlignmentValue& aAlignment );
176 * Sets the position of the info pop-up note so that it is aligned with the
177 * given rectangle as specified in the LAF data. This is intented to be
178 * used in conjunction with lists and grids if the application wishes to
179 * implement a pop-up that follows lists/grids item highlight.
181 * @param aHighlightRect Screen-relative rectangle used to calculate
184 IMPORT_C void SetPositionByHighlight( const TRect& aHighlightRect );
187 * Restores the info pop-up note's default position discarding previously
188 * set values to position and alignment.
191 IMPORT_C void RestoreDefaultPosition();
194 * Sets the tooltip mode. When tooltip mode is on, info pop-up note is
195 * displayed with only one line of text, and the width of the pop-up note
196 * depends on the text length.
198 * @param aTooltipMode ETrue to set tooltip mode on, EFalse to set it off.
200 IMPORT_C void SetTooltipModeL( const TBool aTooltipMode );
203 * Notifies the observers of the info popup note of an event.
204 * @param aEvent The event, of which the observers are notified.
206 void NotifyObservers( MAknInfoPopupNoteObserver::TAknInfoPopupNoteEvent aEvent );
209 * Set the tone to be played when the info popup note is shown
210 * @param aTone The tone
212 IMPORT_C void SetTone( const TTone& aTone );
215 * Whether info popup note will be automatically hidden
216 * or not when app ui is faded (true by default)
218 * @param aHide ETrue when hidden, EFalse when shown or controlled externally
220 IMPORT_C void HideWhenAppFaded( const TBool aHide );
225 * From CTimer. Cancels an outstanding asynchronous request.
229 private: // From CActive
232 * Show popup. Called by system framework.
239 * C++ default constructor.
241 CAknInfoPopupNoteController();
244 * By default Symbian 2nd phase constructor is private.
255 enum TInfoPopupNoteState
262 TInfoPopupNoteState iState;
264 // Own. View object for popup's model-view-controller
265 CAknInfoPopupNote* iPopup;
267 // Array containing the observers of popup.
268 RPointerArray<MAknInfoPopupNoteObserver> iObservers;
270 // Delay before popup show
271 TInt iTimeDelayBeforeShow; // in microseconds
273 // How long popup is shown
274 TInt iTimeInView; // in microseconds
276 // Specifies the tone
280 #endif // CAKNINFOPOPUPNOTECONTROLLER_H