epoc32/include/mw/AknGlobalListQuery.h
branchSymbian3
changeset 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/mw/AknGlobalListQuery.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -0,0 +1,168 @@
     1.4 +/*
     1.5 +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:  Uses notification framework to show a global list query.
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +#ifndef __AKNGLOBALLISTQUERY_H__
    1.22 +#define __AKNGLOBALLISTQUERY_H__
    1.23 +
    1.24 +#include <AknNotify.h>
    1.25 +#include <AknNotifyStd.h>
    1.26 +#include <bamdesca.h>
    1.27 +
    1.28 +class CAknSDData;
    1.29 +
    1.30 +// Default index for list query
    1.31 +const TInt KGlobalListQueryDefaultIndex = 0;
    1.32 +
    1.33 +_LIT( KGlobalListQueryItemSeparator, "\n");
    1.34 +
    1.35 +/**
    1.36 +* CAknGlobalListQuery
    1.37 +*   Uses notification framework to show a global list query.
    1.38 +*   Usage:
    1.39 +*       Create an active object, start it and pass its TRequestStatus as a
    1.40 +*       parameter to ShowListQueryL. After the user selects one item from
    1.41 +*       the list query, the request status will hold the number of the
    1.42 +*       selected item. If the user selected Cancel, the request status will
    1.43 +*       hold -1.
    1.44 +*
    1.45 +*   Example 1. Show the global list query:
    1.46 +*        CDesCArray* textArray = iCoeEnv->ReadDesCArrayResourceL( R_GLOBAL_LIST_ARRAY );
    1.47 +*        CleanupStack::PushL(textArray);
    1.48 +*        TInt result = -555;
    1.49 +*        if ( iListObserver )
    1.50 +*            {
    1.51 +*            iListObserver->Cancel();
    1.52 +*            delete iListObserver;
    1.53 +*            }
    1.54 +*        iListObserver = new(ELeave) CGlobalListObserver(iEikonEnv);
    1.55 +*        iListObserver->Start();
    1.56 +*        iGlobalListQuery->ShowListQueryL(textArray, iListObserver->iStatus, 4);
    1.57 +*        CleanupStack::PopAndDestroy(); // textArray
    1.58 +*
    1.59 +*   Example 2. Get and handle the result in active object.
    1.60 +*        void CMyActiveObject::RunL() 
    1.61 +*            {
    1.62 +*            TBuf<120> msg = _L("Received: ");
    1.63 +*            msg.AppendNum( iStatus.Int() );
    1.64 +*            iEnv->InfoMsg(msg);
    1.65 +*            Cancel();
    1.66 +*            }
    1.67 +*/
    1.68 +NONSHARABLE_CLASS(CAknGlobalListQuery) : public CBase
    1.69 +    {
    1.70 +    public:
    1.71 +        /**
    1.72 +        * Two-phased constructor.
    1.73 +        */
    1.74 +        IMPORT_C static CAknGlobalListQuery* NewL();
    1.75 +
    1.76 +        /**
    1.77 +        * Two-phased constructor. Leaves the instance to cleanupstack
    1.78 +        */
    1.79 +        IMPORT_C static CAknGlobalListQuery* NewLC();
    1.80 +
    1.81 +        /**
    1.82 +        * Destructor
    1.83 +        */
    1.84 +        IMPORT_C ~CAknGlobalListQuery();
    1.85 +
    1.86 +        /**
    1.87 +        * Shows global list query synchronously.
    1.88 +        *
    1.89 +        * @param    aItems  Strings for items
    1.90 +        * @param    aStatus TRequestStatus which will be completed when user
    1.91 +        *                   selects one item from the list query.
    1.92 +        * @param    aIndex  Index which item in the list will be highlighted 
    1.93 +        */
    1.94 +        IMPORT_C void ShowListQueryL( 
    1.95 +            const MDesCArray* aItems,
    1.96 +            TRequestStatus& aStatus,
    1.97 +            const TInt aIndex = KGlobalListQueryDefaultIndex);
    1.98 +
    1.99 +        /**
   1.100 +        * Move selection up.
   1.101 +        */
   1.102 +        IMPORT_C void MoveSelectionUp();
   1.103 +
   1.104 +        /**
   1.105 +        * Move selection down.
   1.106 +        */
   1.107 +        IMPORT_C void MoveSelectionDown();
   1.108 +
   1.109 +        /**
   1.110 +        * Select currently selected item in the list.
   1.111 +        */
   1.112 +        IMPORT_C void SelectItem();
   1.113 +
   1.114 +        /**
   1.115 +        * Cancel the list query.
   1.116 +        */
   1.117 +        IMPORT_C void CancelListQuery();
   1.118 +
   1.119 +        /**
   1.120 +        * Sets the heading for the query. In order to have effect, the heading must be set before 
   1.121 +        * calling ShowListQueryL.
   1.122 +        *
   1.123 +        * @param    aHeading  Heading string.
   1.124 +        * @since 2.1
   1.125 +        */
   1.126 +        IMPORT_C void SetHeadingL(const TDesC& aHeading);
   1.127 +
   1.128 +        /**
   1.129 +        * Sets additional information to be sent to secondary display. Takes ownership of object.
   1.130 +        * Must be called before sending data to notifier to have effect.
   1.131 +        *
   1.132 +        * @param aData Data to be sent to cover UI.
   1.133 +        * @internal to S60
   1.134 +        * @since S60 3.1
   1.135 +        */
   1.136 +        IMPORT_C void SetSecondaryDisplayData(CAknSDData* aData);
   1.137 +        
   1.138 +    private:
   1.139 +        /**
   1.140 +        * Updates list query.
   1.141 +        */
   1.142 +        IMPORT_C void UpdateListQuery();
   1.143 +
   1.144 +    private:
   1.145 +        /**
   1.146 +        * Default constructor.
   1.147 +        */
   1.148 +        CAknGlobalListQuery();
   1.149 +
   1.150 +        /**
   1.151 +        * EPOC constructor.
   1.152 +        */
   1.153 +        void ConstructL(); 
   1.154 +
   1.155 +    private:
   1.156 +        // Command id.
   1.157 +        TAknGlobalQueryCmd iCmd;
   1.158 +        // Notifier handle.
   1.159 +        RNotifier iNotify;
   1.160 +        // Index to set which item will be selected.
   1.161 +        TInt iIndex;
   1.162 +        // Buffer to hold the variables passed to server.
   1.163 +        CBufFlat *iBuffer;
   1.164 +        // Pointer to buffer.
   1.165 +        TPtrC8 iBufferPtr;
   1.166 +        HBufC* iHeading;
   1.167 +        CAknSDData* iAknSDData;
   1.168 +        TBuf8<1> iResultBuf; // Not really used, but needed to prevent buffer handling errors.
   1.169 +    };
   1.170 +
   1.171 +#endif // __AKNGLOBALLISTQUERY_H__