epoc32/include/mw/AknGlobalMsgQuery.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@4
     1
/*
williamr@4
     2
* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
williamr@4
     3
* All rights reserved.
williamr@4
     4
* This component and the accompanying materials are made available
williamr@4
     5
* under the terms of "Eclipse Public License v1.0"
williamr@4
     6
* which accompanies this distribution, and is available
williamr@4
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@4
     8
*
williamr@4
     9
* Initial Contributors:
williamr@4
    10
* Nokia Corporation - initial contribution.
williamr@4
    11
*
williamr@4
    12
* Contributors:
williamr@4
    13
*
williamr@4
    14
* Description:  Uses notification framework to show a global message query.
williamr@4
    15
*
williamr@4
    16
*/
williamr@4
    17
williamr@4
    18
#ifndef __AKNGLOBALMSGQUERY_H__
williamr@4
    19
#define __AKNGLOBALMSGQUERY_H__
williamr@4
    20
williamr@4
    21
#include <AknNotify.h>
williamr@4
    22
#include <AknNotifyStd.h>
williamr@4
    23
#include <AknQueryDialog.h>
williamr@4
    24
#include <AknsItemID.h>
williamr@4
    25
williamr@4
    26
class CAknSDData;
williamr@4
    27
williamr@4
    28
/**
williamr@4
    29
* CAknGlobalMsgQuery
williamr@4
    30
*   Uses notification framework to show a global message query.
williamr@4
    31
*   Usage:
williamr@4
    32
*       Create an active object, start it and pass its TRequestStatus as a
williamr@4
    33
*       parameter to ShowMsgQueryL. After the user presses a softkey,
williamr@4
    34
*       the request status will hold the id of the pressed softkey. E.g. 
williamr@4
    35
*       If the user selected Cancel, the request status will hold -1.
williamr@4
    36
*
williamr@4
    37
*   Example 1. Show the global message query:
williamr@4
    38
*        if ( iListObserver )
williamr@4
    39
*            {
williamr@4
    40
*            iListObserver->Cancel();
williamr@4
    41
*            delete iListObserver;
williamr@4
    42
*            }
williamr@4
    43
*        iMsgObserver = new(ELeave) CGlobalMsgObserver(iEikonEnv);
williamr@4
    44
*        iMsgObserver->Start();
williamr@4
    45
*        iGlobalMsgQuery->ShowMsgQueryL(
williamr@4
    46
*            iMsgObserver->iStatus, iMsgText, 
williamr@4
    47
*            R_AVKON_SOFTKEYS_OK_CANCEL, iMsgHeader,
williamr@4
    48
*            iHeaderImageFile, EImageId, EMaskId );
williamr@4
    49
*
williamr@4
    50
*   Example 2. Get and handle the result in active object.
williamr@4
    51
*        void CMyActiveObject::RunL() 
williamr@4
    52
*            {
williamr@4
    53
*            TBuf<120> msg = _L("Received: ");
williamr@4
    54
*            msg.AppendNum( iStatus.Int() );
williamr@4
    55
*            iEnv->InfoMsg(msg);
williamr@4
    56
*            Cancel();
williamr@4
    57
*            }
williamr@4
    58
*
williamr@4
    59
*   Example 3. Update the query (softkeys)
williamr@4
    60
*       iGlobalMsgQuery->UpdateMsgQuery( R_AVKON_SOFTKEYS_BACK );
williamr@4
    61
*
williamr@4
    62
*   Example 4. Cancel the query
williamr@4
    63
*       iGlobalMsgQuery->CancelMsgQuery();
williamr@4
    64
*
williamr@4
    65
* NOTE !!! All descriptors passed as parameters need to be class members, i.e.
williamr@4
    66
*           they cannot be local variables of a method. That is because
williamr@4
    67
*           they need to exist when server gets the message.
williamr@4
    68
*/
williamr@4
    69
williamr@4
    70
NONSHARABLE_CLASS(CAknGlobalMsgQuery) : public CBase
williamr@4
    71
    {
williamr@4
    72
    public:
williamr@4
    73
        IMPORT_C static CAknGlobalMsgQuery* NewL();
williamr@4
    74
        IMPORT_C static CAknGlobalMsgQuery* NewLC();
williamr@4
    75
        IMPORT_C ~CAknGlobalMsgQuery();
williamr@4
    76
williamr@4
    77
        /**
williamr@4
    78
        * Shows global message query synchronously.
williamr@4
    79
        *
williamr@4
    80
        * @param    aMsgText        Message text.
williamr@4
    81
        * @param    aHeaderText     Header text.
williamr@4
    82
        * @param    aSoftkeys       Softkey resource.
williamr@4
    83
        * @param    aStatus         TRequestStatus which will be completed when user
williamr@4
    84
        *                           selects one item from the list query.
williamr@4
    85
        */
williamr@4
    86
        IMPORT_C void ShowMsgQueryL( 
williamr@4
    87
            TRequestStatus& aStatus,
williamr@4
    88
            const TDesC& aMsgText,
williamr@4
    89
            TInt aSoftkeys,
williamr@4
    90
            const TDesC& aHeaderText,
williamr@4
    91
            const TDesC& aHeaderImageFile,
williamr@4
    92
            TInt aImageId = 0,
williamr@4
    93
            TInt aImageMaskId = -1,
williamr@4
    94
            CAknQueryDialog::TTone aTone = CAknQueryDialog::ENoTone);
williamr@4
    95
williamr@4
    96
        /**
williamr@4
    97
        * Update the softkeys of the message query.
williamr@4
    98
        *
williamr@4
    99
        * @param    aSoftkeys  New resource for softkeys.
williamr@4
   100
        */
williamr@4
   101
        IMPORT_C void UpdateMsgQuery( TInt aSoftkeys );
williamr@4
   102
williamr@4
   103
        /**
williamr@4
   104
        * Cancel the message query.
williamr@4
   105
        */
williamr@4
   106
        IMPORT_C void CancelMsgQuery();
williamr@4
   107
williamr@4
   108
        /**
williamr@4
   109
        * Set delay after which query will be removed from screen after message is completed.
williamr@4
   110
        * Can be used to get around problems with global query exit and CrossCheckForeground probs.
williamr@4
   111
        * Must be called before ShowMsgQueryL in order to be effective.
williamr@4
   112
        * 
williamr@4
   113
        * @param aDelay   Time in microsecond, after which query will be removed from display.
williamr@4
   114
        * @since  S60 2.1
williamr@4
   115
        */
williamr@4
   116
        IMPORT_C void SetExitDelay(TInt aDelay);
williamr@4
   117
williamr@4
   118
        /**
williamr@4
   119
        * Set Skin id for query header image. Must be called before ShowMsgQueryL in order to have 
williamr@4
   120
        * effect. No need to use this method if image from avkon.mbm is used.
williamr@4
   121
        *
williamr@4
   122
        * @aparam aId   SkinId for image in query. If image not found from active skin, image 
williamr@4
   123
        *               definitions used in ShowMsgQueryL used instead.
williamr@4
   124
        * @since S60 2.6
williamr@4
   125
        */      
williamr@4
   126
        IMPORT_C void SetImageSkinId( TAknsItemID& aId );
williamr@4
   127
williamr@4
   128
        /**
williamr@4
   129
        * Sets additional information to be sent to secondary display. Takes ownership of object.
williamr@4
   130
        * Must be called before sending data to notifier to have effect.
williamr@4
   131
        *
williamr@4
   132
        * @param aData Data to be sent to cover UI.
williamr@4
   133
        * @internal to S60
williamr@4
   134
        * @since S60 3.1
williamr@4
   135
        */
williamr@4
   136
        IMPORT_C void SetSecondaryDisplayData(CAknSDData* aData);
williamr@4
   137
    
williamr@4
   138
    private:
williamr@4
   139
        CAknGlobalMsgQuery();
williamr@4
   140
        void ConstructL(); 
williamr@4
   141
williamr@4
   142
    private:
williamr@4
   143
        TAknGlobalQueryCmd iCmd;
williamr@4
   144
        TInt iSoftkeys;
williamr@4
   145
        TInt iImageId;
williamr@4
   146
        TInt iImageMaskId;
williamr@4
   147
        CAknQueryDialog::TTone iTone;
williamr@4
   148
        RNotifier iNotify;
williamr@4
   149
        CBufFlat *iBuffer;
williamr@4
   150
        TPtrC8 iBufferPtr;
williamr@4
   151
        TInt iDelay;
williamr@4
   152
        TInt   iSkinsMajorId;
williamr@4
   153
        TInt   iSkinsMinorId;
williamr@4
   154
        CAknSDData* iAknSDData;
williamr@4
   155
        TBuf8<1> iResultBuf; // Not really used, but needed to prevent buffer handling errors.
williamr@4
   156
    };
williamr@4
   157
williamr@4
   158
#endif // __AKNGLOBALMSGQUERY_H__