epoc32/include/mw/akninfopopupnotecontroller.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2005, 2006 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@2
     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
williamr@2
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:  The interface of the info pop-up note
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
// ------------------------------------------------------------------------
williamr@2
    20
// How to use this info popup component (basic case):
williamr@2
    21
//
williamr@2
    22
//
williamr@2
    23
//  #include <AknInfoPopupNote.h>
williamr@2
    24
//  CAknInfoPopupNoteController* iPopupController;
williamr@2
    25
//  ...
williamr@2
    26
//  iPopupController = CAknInfoPopupNoteController::NewL();
williamr@2
    27
//  ...
williamr@2
    28
//  iPopupController->SetTextL( strTestText );
williamr@2
    29
//  iPopupController->ShowInfoPopupNote();
williamr@2
    30
//  ...
williamr@2
    31
//  delete iPopupController;
williamr@2
    32
// ------------------------------------------------------------------------
williamr@2
    33
williamr@2
    34
williamr@2
    35
#ifndef CAKNINFOPOPUPNOTECONTROLLER_H
williamr@2
    36
#define CAKNINFOPOPUPNOTECONTROLLER_H
williamr@2
    37
williamr@2
    38
//  INCLUDES
williamr@2
    39
#include <e32base.h>
williamr@2
    40
#include <gulalign.h>
williamr@2
    41
#include "avkon.hrh"
williamr@2
    42
williamr@2
    43
// FORWARD DECLARATIONS
williamr@2
    44
class CAknInfoPopupNote;
williamr@2
    45
class CAknInfoPopupNoteController;
williamr@2
    46
williamr@2
    47
// CLASS DECLARATION
williamr@2
    48
williamr@2
    49
/**
williamr@2
    50
 *  Observer class for notifying popup's showing and hiding.
williamr@2
    51
 *
williamr@2
    52
 *  @lib avkon.lib
williamr@2
    53
 *  @since Series 60 3.0
williamr@2
    54
 */
williamr@2
    55
class MAknInfoPopupNoteObserver
williamr@2
    56
    {
williamr@2
    57
    public:
williamr@2
    58
williamr@2
    59
        enum TAknInfoPopupNoteEvent
williamr@2
    60
            {
williamr@2
    61
            EInfoPopupNoteShown,
williamr@2
    62
            EInfoPopupNoteHidden
williamr@2
    63
            };
williamr@2
    64
williamr@2
    65
        /**
williamr@2
    66
        * Handles events reported from info popup note.
williamr@2
    67
        * @param aController The controller that controls the note, from
williamr@2
    68
        *   where the event originates.
williamr@2
    69
        * @param aEvent The event.
williamr@2
    70
        */
williamr@2
    71
        virtual void HandleInfoPopupNoteEvent(
williamr@2
    72
            CAknInfoPopupNoteController* aController,
williamr@2
    73
            TAknInfoPopupNoteEvent aEvent ) = 0;
williamr@2
    74
    };
williamr@2
    75
williamr@2
    76
williamr@2
    77
/**
williamr@2
    78
 *  The controller part of popup.
williamr@2
    79
 *  It is active object, and uses timer to show popup after specified
williamr@2
    80
 *  time interval (default 1 sec.) and popup hides automaticly
williamr@2
    81
 *  after an other period (default 10 sec.).
williamr@2
    82
 *
williamr@2
    83
 *  @lib avkon.lib
williamr@2
    84
 *  @since Series 60 3.0
williamr@2
    85
 */
williamr@2
    86
class CAknInfoPopupNoteController : public CTimer
williamr@2
    87
    {
williamr@2
    88
public:
williamr@2
    89
    /**
williamr@2
    90
     * The tone played before the dialog is shown.
williamr@2
    91
     * Application specific tones may be played by casting the application
williamr@2
    92
     *  defined Sound ID (SID), to TTone
williamr@2
    93
     */
williamr@2
    94
    enum TTone
williamr@2
    95
        {
williamr@2
    96
        /** No tone is played. */
williamr@2
    97
        ENoTone = 0,
williamr@2
    98
        /** A confirmation tone is played. */
williamr@2
    99
        EConfirmationTone = EAvkonSIDConfirmationTone,
williamr@2
   100
        /** A warning tone is played. */
williamr@2
   101
        EWarningTone = EAvkonSIDWarningTone,
williamr@2
   102
        /** An error tone is played. */
williamr@2
   103
        EErrorTone = EAvkonSIDErrorTone
williamr@2
   104
        };
williamr@2
   105
williamr@2
   106
public: // Constructors and destructor
williamr@2
   107
williamr@2
   108
    /**
williamr@2
   109
     * Two-phased constructor.
williamr@2
   110
     */
williamr@2
   111
    IMPORT_C static CAknInfoPopupNoteController* NewL();
williamr@2
   112
williamr@2
   113
    /**
williamr@2
   114
     * Destructor.
williamr@2
   115
     */
williamr@2
   116
    virtual ~CAknInfoPopupNoteController();
williamr@2
   117
williamr@2
   118
public: // New functions
williamr@2
   119
williamr@2
   120
    /**
williamr@2
   121
    * Set time delay period before popup is shown (in milliseconds).
williamr@2
   122
    * (if this isn't set, default delay time before show is 1 sec. )
williamr@2
   123
    * @param aMilliSeconds Wanted delay time in milliseconds.
williamr@2
   124
    */
williamr@2
   125
    IMPORT_C void SetTimeDelayBeforeShow( TInt aMilliSeconds );
williamr@2
   126
williamr@2
   127
    /**
williamr@2
   128
    * Set time period how long popup is in view (in milliseconds).
williamr@2
   129
    * (if this isn't set, default show time is 10 sec. )
williamr@2
   130
    * @param aMilliSeconds Wanted show time in milliseconds.
williamr@2
   131
    * if set to 0, popup is shown until HideInfoPopupNote is called
williamr@2
   132
    */
williamr@2
   133
    IMPORT_C void SetTimePopupInView( TInt aMilliSeconds );
williamr@2
   134
williamr@2
   135
    /**
williamr@2
   136
    * Set text to show in popup. If given text is too long for popup,
williamr@2
   137
    * it is truncated.
williamr@2
   138
    * @param aText Text to show in popup.
williamr@2
   139
    */
williamr@2
   140
    IMPORT_C void SetTextL( const TDesC& aText );
williamr@2
   141
williamr@2
   142
    /**
williamr@2
   143
    * Show popup after delay time (hide possible previous popup immediately)
williamr@2
   144
    * and hide popup again after setted time.
williamr@2
   145
    */
williamr@2
   146
    IMPORT_C void ShowInfoPopupNote();
williamr@2
   147
williamr@2
   148
    /**
williamr@2
   149
    * Hide popup immediately.
williamr@2
   150
    */
williamr@2
   151
    IMPORT_C void HideInfoPopupNote();
williamr@2
   152
williamr@2
   153
    /**
williamr@2
   154
    * Adds an observer for the pop-up.
williamr@2
   155
    * @param aObserver The observer to be added.
williamr@2
   156
    */
williamr@2
   157
    IMPORT_C void AddObserverL( const MAknInfoPopupNoteObserver& aObserver );
williamr@2
   158
williamr@2
   159
    /**
williamr@2
   160
    * Removes an observer from the pop-up.
williamr@2
   161
    * @param aObserver The observer to be removed.
williamr@2
   162
    */
williamr@2
   163
    IMPORT_C void RemoveObserver( const MAknInfoPopupNoteObserver& aObserver );
williamr@2
   164
williamr@2
   165
    /**
williamr@2
   166
    * Sets the position and alignment of the info pop-up note.
williamr@2
   167
    * @since 3.1
williamr@2
   168
    * @param aPosition The position, where pop-up note is displayed.
williamr@2
   169
    * @param aAlignment Specifies the part of pop-up note that will be aligned
williamr@2
   170
    *    with the given position.
williamr@2
   171
    */
williamr@2
   172
    IMPORT_C void SetPositionAndAlignment( const TPoint& aPosition,
williamr@2
   173
                                           const TGulAlignmentValue& aAlignment );
williamr@2
   174
williamr@2
   175
    /**
williamr@2
   176
    * Sets the position of the info pop-up note so that it is aligned with the
williamr@2
   177
    * given rectangle as specified in the LAF data. This is intented to be
williamr@2
   178
    * used in conjunction with lists and grids if the application wishes to
williamr@2
   179
    * implement a pop-up that follows lists/grids item highlight.
williamr@2
   180
    * @since 3.1
williamr@2
   181
    * @param aHighlightRect Screen-relative rectangle used to calculate
williamr@2
   182
    *       pop-up's position.
williamr@2
   183
    */
williamr@2
   184
    IMPORT_C void SetPositionByHighlight( const TRect& aHighlightRect );
williamr@2
   185
williamr@2
   186
    /**
williamr@2
   187
    * Restores the info pop-up note's default position discarding previously
williamr@2
   188
    * set values to position and alignment.
williamr@2
   189
    * @since 3.1
williamr@2
   190
    */
williamr@2
   191
    IMPORT_C void RestoreDefaultPosition();
williamr@2
   192
williamr@2
   193
    /**
williamr@2
   194
    * Sets the tooltip mode. When tooltip mode is on, info pop-up note is
williamr@2
   195
    * displayed with only one line of text, and the width of the pop-up note
williamr@2
   196
    * depends on the text length.
williamr@2
   197
    * @since 3.1
williamr@2
   198
    * @param aTooltipMode ETrue to set tooltip mode on, EFalse to set it off.
williamr@2
   199
    */
williamr@2
   200
    IMPORT_C void SetTooltipModeL( const TBool aTooltipMode );
williamr@2
   201
williamr@2
   202
    /**
williamr@2
   203
    * Notifies the observers of the info popup note of an event.
williamr@2
   204
    * @param aEvent The event, of which the observers are notified.
williamr@2
   205
    */
williamr@2
   206
    void NotifyObservers( MAknInfoPopupNoteObserver::TAknInfoPopupNoteEvent aEvent );
williamr@2
   207
williamr@2
   208
    /**
williamr@2
   209
    * Set the tone to be played when the info popup note is shown
williamr@2
   210
    * @param aTone The tone
williamr@2
   211
    */
williamr@2
   212
    IMPORT_C void SetTone( const TTone& aTone );
williamr@2
   213
williamr@2
   214
    /**
williamr@2
   215
    * Whether info popup note will be automatically hidden 
williamr@2
   216
    * or not when app ui is faded (true by default) 
williamr@2
   217
    * @since 3.1
williamr@2
   218
    * @param aHide ETrue when hidden, EFalse when shown or controlled externally
williamr@2
   219
    */
williamr@2
   220
    IMPORT_C void HideWhenAppFaded( const TBool aHide );
williamr@2
   221
williamr@2
   222
protected:
williamr@2
   223
williamr@2
   224
    /**
williamr@2
   225
	* From CTimer. Cancels an outstanding asynchronous request.
williamr@2
   226
	*/
williamr@2
   227
    void DoCancel();
williamr@2
   228
williamr@2
   229
private: // From CActive
williamr@2
   230
williamr@2
   231
    /**
williamr@2
   232
    * Show popup. Called by system framework.
williamr@2
   233
    */
williamr@2
   234
    void RunL();
williamr@2
   235
williamr@2
   236
private:
williamr@2
   237
williamr@2
   238
    /**
williamr@2
   239
     * C++ default constructor.
williamr@2
   240
     */
williamr@2
   241
    CAknInfoPopupNoteController();
williamr@2
   242
williamr@2
   243
    /**
williamr@2
   244
     * By default Symbian 2nd phase constructor is private.
williamr@2
   245
     */
williamr@2
   246
    void ConstructL();
williamr@2
   247
williamr@2
   248
    /**
williamr@2
   249
    * Play the tone.
williamr@2
   250
    */
williamr@2
   251
    void PlayTone();
williamr@2
   252
williamr@2
   253
private: // Data
williamr@2
   254
williamr@2
   255
    enum TInfoPopupNoteState
williamr@2
   256
        {
williamr@2
   257
        EHidden,
williamr@2
   258
        EWaitingToShow,
williamr@2
   259
        EShowing
williamr@2
   260
        };
williamr@2
   261
williamr@2
   262
    TInfoPopupNoteState iState;
williamr@2
   263
williamr@2
   264
    // Own. View object for popup's model-view-controller
williamr@2
   265
    CAknInfoPopupNote* iPopup;
williamr@2
   266
williamr@2
   267
    // Array containing the observers of popup.
williamr@2
   268
    RPointerArray<MAknInfoPopupNoteObserver> iObservers;
williamr@2
   269
williamr@2
   270
    // Delay before popup show
williamr@2
   271
    TInt iTimeDelayBeforeShow; // in microseconds
williamr@2
   272
williamr@2
   273
    // How long popup is shown
williamr@2
   274
    TInt iTimeInView; // in microseconds
williamr@2
   275
williamr@2
   276
    // Specifies the tone
williamr@2
   277
    TTone iTone;
williamr@2
   278
    };
williamr@2
   279
williamr@2
   280
#endif // CAKNINFOPOPUPNOTECONTROLLER_H
williamr@2
   281
williamr@2
   282
williamr@2
   283
// End of File