epoc32/include/mw/akninfopopupnotecontroller.h
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
     1.1 --- a/epoc32/include/mw/akninfopopupnotecontroller.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/mw/akninfopopupnotecontroller.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,283 @@
     1.4 -akninfopopupnotecontroller.h
     1.5 +/*
     1.6 +* Copyright (c) 2005, 2006 Nokia Corporation and/or its subsidiary(-ies).
     1.7 +* All rights reserved.
     1.8 +* This component and the accompanying materials are made available
     1.9 +* 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
    1.10 +* which accompanies this distribution, and is available
    1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.12 +*
    1.13 +* Initial Contributors:
    1.14 +* Nokia Corporation - initial contribution.
    1.15 +*
    1.16 +* Contributors:
    1.17 +*
    1.18 +* Description:  The interface of the info pop-up note
    1.19 +*
    1.20 +*/
    1.21 +
    1.22 +
    1.23 +// ------------------------------------------------------------------------
    1.24 +// How to use this info popup component (basic case):
    1.25 +//
    1.26 +//
    1.27 +//  #include <AknInfoPopupNote.h>
    1.28 +//  CAknInfoPopupNoteController* iPopupController;
    1.29 +//  ...
    1.30 +//  iPopupController = CAknInfoPopupNoteController::NewL();
    1.31 +//  ...
    1.32 +//  iPopupController->SetTextL( strTestText );
    1.33 +//  iPopupController->ShowInfoPopupNote();
    1.34 +//  ...
    1.35 +//  delete iPopupController;
    1.36 +// ------------------------------------------------------------------------
    1.37 +
    1.38 +
    1.39 +#ifndef CAKNINFOPOPUPNOTECONTROLLER_H
    1.40 +#define CAKNINFOPOPUPNOTECONTROLLER_H
    1.41 +
    1.42 +//  INCLUDES
    1.43 +#include <e32base.h>
    1.44 +#include <gulalign.h>
    1.45 +#include "avkon.hrh"
    1.46 +
    1.47 +// FORWARD DECLARATIONS
    1.48 +class CAknInfoPopupNote;
    1.49 +class CAknInfoPopupNoteController;
    1.50 +
    1.51 +// CLASS DECLARATION
    1.52 +
    1.53 +/**
    1.54 + *  Observer class for notifying popup's showing and hiding.
    1.55 + *
    1.56 + *  @lib avkon.lib
    1.57 + *  @since Series 60 3.0
    1.58 + */
    1.59 +class MAknInfoPopupNoteObserver
    1.60 +    {
    1.61 +    public:
    1.62 +
    1.63 +        enum TAknInfoPopupNoteEvent
    1.64 +            {
    1.65 +            EInfoPopupNoteShown,
    1.66 +            EInfoPopupNoteHidden
    1.67 +            };
    1.68 +
    1.69 +        /**
    1.70 +        * Handles events reported from info popup note.
    1.71 +        * @param aController The controller that controls the note, from
    1.72 +        *   where the event originates.
    1.73 +        * @param aEvent The event.
    1.74 +        */
    1.75 +        virtual void HandleInfoPopupNoteEvent(
    1.76 +            CAknInfoPopupNoteController* aController,
    1.77 +            TAknInfoPopupNoteEvent aEvent ) = 0;
    1.78 +    };
    1.79 +
    1.80 +
    1.81 +/**
    1.82 + *  The controller part of popup.
    1.83 + *  It is active object, and uses timer to show popup after specified
    1.84 + *  time interval (default 1 sec.) and popup hides automaticly
    1.85 + *  after an other period (default 10 sec.).
    1.86 + *
    1.87 + *  @lib avkon.lib
    1.88 + *  @since Series 60 3.0
    1.89 + */
    1.90 +class CAknInfoPopupNoteController : public CTimer
    1.91 +    {
    1.92 +public:
    1.93 +    /**
    1.94 +     * The tone played before the dialog is shown.
    1.95 +     * Application specific tones may be played by casting the application
    1.96 +     *  defined Sound ID (SID), to TTone
    1.97 +     */
    1.98 +    enum TTone
    1.99 +        {
   1.100 +        /** No tone is played. */
   1.101 +        ENoTone = 0,
   1.102 +        /** A confirmation tone is played. */
   1.103 +        EConfirmationTone = EAvkonSIDConfirmationTone,
   1.104 +        /** A warning tone is played. */
   1.105 +        EWarningTone = EAvkonSIDWarningTone,
   1.106 +        /** An error tone is played. */
   1.107 +        EErrorTone = EAvkonSIDErrorTone
   1.108 +        };
   1.109 +
   1.110 +public: // Constructors and destructor
   1.111 +
   1.112 +    /**
   1.113 +     * Two-phased constructor.
   1.114 +     */
   1.115 +    IMPORT_C static CAknInfoPopupNoteController* NewL();
   1.116 +
   1.117 +    /**
   1.118 +     * Destructor.
   1.119 +     */
   1.120 +    virtual ~CAknInfoPopupNoteController();
   1.121 +
   1.122 +public: // New functions
   1.123 +
   1.124 +    /**
   1.125 +    * Set time delay period before popup is shown (in milliseconds).
   1.126 +    * (if this isn't set, default delay time before show is 1 sec. )
   1.127 +    * @param aMilliSeconds Wanted delay time in milliseconds.
   1.128 +    */
   1.129 +    IMPORT_C void SetTimeDelayBeforeShow( TInt aMilliSeconds );
   1.130 +
   1.131 +    /**
   1.132 +    * Set time period how long popup is in view (in milliseconds).
   1.133 +    * (if this isn't set, default show time is 10 sec. )
   1.134 +    * @param aMilliSeconds Wanted show time in milliseconds.
   1.135 +    * if set to 0, popup is shown until HideInfoPopupNote is called
   1.136 +    */
   1.137 +    IMPORT_C void SetTimePopupInView( TInt aMilliSeconds );
   1.138 +
   1.139 +    /**
   1.140 +    * Set text to show in popup. If given text is too long for popup,
   1.141 +    * it is truncated.
   1.142 +    * @param aText Text to show in popup.
   1.143 +    */
   1.144 +    IMPORT_C void SetTextL( const TDesC& aText );
   1.145 +
   1.146 +    /**
   1.147 +    * Show popup after delay time (hide possible previous popup immediately)
   1.148 +    * and hide popup again after setted time.
   1.149 +    */
   1.150 +    IMPORT_C void ShowInfoPopupNote();
   1.151 +
   1.152 +    /**
   1.153 +    * Hide popup immediately.
   1.154 +    */
   1.155 +    IMPORT_C void HideInfoPopupNote();
   1.156 +
   1.157 +    /**
   1.158 +    * Adds an observer for the pop-up.
   1.159 +    * @param aObserver The observer to be added.
   1.160 +    */
   1.161 +    IMPORT_C void AddObserverL( const MAknInfoPopupNoteObserver& aObserver );
   1.162 +
   1.163 +    /**
   1.164 +    * Removes an observer from the pop-up.
   1.165 +    * @param aObserver The observer to be removed.
   1.166 +    */
   1.167 +    IMPORT_C void RemoveObserver( const MAknInfoPopupNoteObserver& aObserver );
   1.168 +
   1.169 +    /**
   1.170 +    * Sets the position and alignment of the info pop-up note.
   1.171 +    * @since 3.1
   1.172 +    * @param aPosition The position, where pop-up note is displayed.
   1.173 +    * @param aAlignment Specifies the part of pop-up note that will be aligned
   1.174 +    *    with the given position.
   1.175 +    */
   1.176 +    IMPORT_C void SetPositionAndAlignment( const TPoint& aPosition,
   1.177 +                                           const TGulAlignmentValue& aAlignment );
   1.178 +
   1.179 +    /**
   1.180 +    * Sets the position of the info pop-up note so that it is aligned with the
   1.181 +    * given rectangle as specified in the LAF data. This is intented to be
   1.182 +    * used in conjunction with lists and grids if the application wishes to
   1.183 +    * implement a pop-up that follows lists/grids item highlight.
   1.184 +    * @since 3.1
   1.185 +    * @param aHighlightRect Screen-relative rectangle used to calculate
   1.186 +    *       pop-up's position.
   1.187 +    */
   1.188 +    IMPORT_C void SetPositionByHighlight( const TRect& aHighlightRect );
   1.189 +
   1.190 +    /**
   1.191 +    * Restores the info pop-up note's default position discarding previously
   1.192 +    * set values to position and alignment.
   1.193 +    * @since 3.1
   1.194 +    */
   1.195 +    IMPORT_C void RestoreDefaultPosition();
   1.196 +
   1.197 +    /**
   1.198 +    * Sets the tooltip mode. When tooltip mode is on, info pop-up note is
   1.199 +    * displayed with only one line of text, and the width of the pop-up note
   1.200 +    * depends on the text length.
   1.201 +    * @since 3.1
   1.202 +    * @param aTooltipMode ETrue to set tooltip mode on, EFalse to set it off.
   1.203 +    */
   1.204 +    IMPORT_C void SetTooltipModeL( const TBool aTooltipMode );
   1.205 +
   1.206 +    /**
   1.207 +    * Notifies the observers of the info popup note of an event.
   1.208 +    * @param aEvent The event, of which the observers are notified.
   1.209 +    */
   1.210 +    void NotifyObservers( MAknInfoPopupNoteObserver::TAknInfoPopupNoteEvent aEvent );
   1.211 +
   1.212 +    /**
   1.213 +    * Set the tone to be played when the info popup note is shown
   1.214 +    * @param aTone The tone
   1.215 +    */
   1.216 +    IMPORT_C void SetTone( const TTone& aTone );
   1.217 +
   1.218 +    /**
   1.219 +    * Whether info popup note will be automatically hidden 
   1.220 +    * or not when app ui is faded (true by default) 
   1.221 +    * @since 3.1
   1.222 +    * @param aHide ETrue when hidden, EFalse when shown or controlled externally
   1.223 +    */
   1.224 +    IMPORT_C void HideWhenAppFaded( const TBool aHide );
   1.225 +
   1.226 +protected:
   1.227 +
   1.228 +    /**
   1.229 +	* From CTimer. Cancels an outstanding asynchronous request.
   1.230 +	*/
   1.231 +    void DoCancel();
   1.232 +
   1.233 +private: // From CActive
   1.234 +
   1.235 +    /**
   1.236 +    * Show popup. Called by system framework.
   1.237 +    */
   1.238 +    void RunL();
   1.239 +
   1.240 +private:
   1.241 +
   1.242 +    /**
   1.243 +     * C++ default constructor.
   1.244 +     */
   1.245 +    CAknInfoPopupNoteController();
   1.246 +
   1.247 +    /**
   1.248 +     * By default Symbian 2nd phase constructor is private.
   1.249 +     */
   1.250 +    void ConstructL();
   1.251 +
   1.252 +    /**
   1.253 +    * Play the tone.
   1.254 +    */
   1.255 +    void PlayTone();
   1.256 +
   1.257 +private: // Data
   1.258 +
   1.259 +    enum TInfoPopupNoteState
   1.260 +        {
   1.261 +        EHidden,
   1.262 +        EWaitingToShow,
   1.263 +        EShowing
   1.264 +        };
   1.265 +
   1.266 +    TInfoPopupNoteState iState;
   1.267 +
   1.268 +    // Own. View object for popup's model-view-controller
   1.269 +    CAknInfoPopupNote* iPopup;
   1.270 +
   1.271 +    // Array containing the observers of popup.
   1.272 +    RPointerArray<MAknInfoPopupNoteObserver> iObservers;
   1.273 +
   1.274 +    // Delay before popup show
   1.275 +    TInt iTimeDelayBeforeShow; // in microseconds
   1.276 +
   1.277 +    // How long popup is shown
   1.278 +    TInt iTimeInView; // in microseconds
   1.279 +
   1.280 +    // Specifies the tone
   1.281 +    TTone iTone;
   1.282 +    };
   1.283 +
   1.284 +#endif // CAKNINFOPOPUPNOTECONTROLLER_H
   1.285 +
   1.286 +
   1.287 +// End of File