epoc32/include/mw/aknlistquerydialog.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
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.
     1 /*
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description: 
    15 *   Implementation of CAknListQueryDialog
    16 *
    17 */
    18 
    19 
    20 #ifndef AKNLISTQUERYDIALOG_H
    21 #define AKNLISTQUERYDIALOG_H
    22 
    23 #include <AknQueryDialog.h>
    24 
    25 class CAknMessageQueryControl;
    26 class CAknListQueryMediatorObserver;
    27 
    28 /**
    29  * List query class.
    30  *
    31  * This class is be used for list or multiselection list queries. 
    32  */
    33 class CAknListQueryDialog : public CAknQueryDialog,
    34                             public MEikListBoxObserver, 
    35                             public MAknIntermediateState
    36 	{
    37     public:
    38         /**
    39          * C++ default constructor.
    40          *
    41          * @param aIndex After the query is dismissed, the index will 
    42          *        hold the value of selected item.
    43          */
    44 	    IMPORT_C CAknListQueryDialog(TInt* aIndex);
    45 
    46         /**
    47          * C++ default constructor.
    48          *
    49          * @param aSelectionIndexArray Will hold the values of selected
    50          *        items (in multiselection list).
    51          */
    52         IMPORT_C CAknListQueryDialog(
    53                   CListBoxView::CSelectionIndexArray* aSelectionIndexArray);
    54 
    55         /**
    56         * Destructor
    57         */
    58 	    IMPORT_C virtual ~CAknListQueryDialog();
    59 
    60         /**
    61          * From @c CEikDialog.   
    62          *
    63          * Sets the type and position of the list box.
    64          *
    65          * @param aSize Not used.
    66          */
    67         IMPORT_C void SetSizeAndPosition(const TSize &aSize);
    68 
    69         /**
    70          * From @c CCoeControl.  
    71          *
    72          * Handles key events. When a key event occurs, @c CONE calls this 
    73          * function for each control on the control stack, until one of them
    74          * returns @c EKeyWasConsumed to indicate that it processed the key
    75          * event.  
    76          *
    77          * @param aKeyEvent The key event.
    78          * @param aType The type of the event: @c EEventKey, @c EEventKeyUp or 
    79          *        @c EEventKeyDown.
    80          * @return Indicates whether or not the key event was 
    81          *         used by this control.
    82          */
    83         IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, 
    84                                              TEventCode aType);
    85 	    
    86         /**
    87          * From @c MEikListBoxObserver. 
    88          *
    89          * Handles events from listbox.
    90          * 
    91          * @param aListBox The listbox which caused the event.
    92          * @param aEventType Type of the event.
    93          */
    94         IMPORT_C void HandleListBoxEventL(CEikListBox* aListBox, 
    95                                           TListBoxEvent aEventType);
    96 
    97         /**
    98          * Sets item text array to the listbox.
    99          *
   100          * @param aItemTextArray Item text array to be added.
   101          */
   102         IMPORT_C void SetItemTextArray(MDesCArray* aItemTextArray);
   103 
   104         /**
   105          * Sets ownership type of the item array.
   106          *
   107          * @param aOwnershipType Type of ownership.
   108          */
   109         IMPORT_C void SetOwnershipType(
   110                         TListBoxModelItemArrayOwnership aOwnershipType);
   111 
   112         /**
   113          * Destroys a possible old icon array in the listbox and installs a new
   114          * one and takes ownership of the new icon array.
   115          *
   116          * @param aIcons Icon pointer which will be installed.
   117          */
   118         IMPORT_C void SetIconArrayL(CArrayPtr<CGulIcon>* aIcons);
   119 
   120         /**
   121          * Gets list query's listbox.
   122          *
   123          * @return The requested list box. 
   124          */
   125         IMPORT_C CEikListBox* ListBox() const;
   126 
   127         /**
   128          * Gets pointer to list query control or @c NULL.
   129          *
   130          * @return Pointer to list query control or in case that there is 
   131          *         no such element a @c NULL pointer. 
   132          */
   133         IMPORT_C CAknListQueryControl* ListControl() const;
   134 
   135         /**
   136          * Gets pointer to message query control or @c NULL.
   137          *
   138          * @return Pointer to message query control or in case that there 
   139          *         is no such element a @c NULL pointer. 
   140          */
   141         IMPORT_C CAknMessageQueryControl* MessageBox() const;
   142 
   143         /**
   144          * Gets pointer to query heading or @c NULL.
   145          *
   146          * @return Pointer to query heading or in case there is no such
   147          *         element a @c NULL pointer. 
   148          */
   149         IMPORT_C CAknPopupHeadingPane* QueryHeading() const;
   150 
   151         /**
   152          * From @c CCoeControl.
   153          *
   154          * Sets the control to be ready for drawing.
   155          */
   156         IMPORT_C void ActivateL();
   157 
   158         /**
   159          * From @c CCoeControl.     
   160          *
   161          * Handles pointer events.
   162          *
   163          * This function gets called whenever a pointer event occurs in the 
   164          * control, i.e. when the pointer is within the control's extent, 
   165          * or when the control has grabbed the pointer. The control should 
   166          * implement this function to handle pointer events.
   167          *
   168          * Note: events of type @c EButton1Down are processed before 
   169          * @c HandlePointerEventL() is called, in order to transfer keyboard 
   170          * focus to the control in which the @c EButton1Down event occurred.
   171          *
   172          * If overriding @c HandlePointerEventL(), the implementation must 
   173          * include a base call to @c CCoeControl's @c HandlePointerEventL().
   174          *
   175          * @param &aPointerEvent The pointer event.
   176          */
   177         IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
   178 
   179     protected:
   180         /**
   181          * From @c CEikDialog.   
   182          *
   183          * This function is called by the @c EIKON dialog framework just
   184          * before the dialog is activated, but before it is sized,
   185          * and before @c PostLayoutDynInitL() is called.
   186          */
   187         IMPORT_C void PreLayoutDynInitL(void);
   188 
   189         /**
   190          * From @c CEikDialog.   
   191          *
   192          * This function is called by the @c EIKON dialog framework 
   193          * just before the dialog is activated, after it has called
   194          * @c PreLayoutDynInitL() and the dialog has been sized.
   195          */
   196         IMPORT_C void PostLayoutDynInitL();
   197 
   198         /**
   199          * From @c CEikDialog.   
   200          *
   201          * This function is called by the @c EIKON framework if the user 
   202          * activates a button in the button panel. It is not called if 
   203          * the @c Cancel button is activated, unless the 
   204          * @c EEikDialogFlagNotifyEsc flag is set.
   205          *
   206          * @param aButtonId The ID of the button that was activated
   207          * @return @c ETrue if the dialog should exit, 
   208          *         and @c EFalse if it should not.
   209          */
   210         IMPORT_C TBool OkToExitL(TInt aButtonId);
   211 
   212         /**
   213          * Gets border style of the list query.
   214          *
   215          * @return Border style (@c AknBorderId type)
   216          */
   217         IMPORT_C TInt BorderStyle();
   218 
   219     protected:
   220         /**
   221          * From @c MAknIntermediateState.
   222          * 
   223          * Tries to close the query with non-leaving way.
   224          */
   225         IMPORT_C void CloseState();
   226 
   227     private:
   228         /**
   229          * Closes the dialog.
   230          *
   231          * Gets called by iIdle.
   232          *
   233          * @param aObj Target dialog to be closed.
   234          * @return @c EFalse always. 
   235          */
   236         static TInt ClosePopup(TAny *aObj);
   237 
   238         /**
   239          * Closes the dialog and accepts selected item.
   240          *
   241          * Gets called by iIdle.
   242          *
   243          * @param aObj Target dialog to be closed. 
   244          * @return @c EFalse always.
   245          */
   246         static TInt ClosePopupAcceptingChanges(TAny *aObj);
   247 
   248     private:
   249         /**
   250         * From @c CAknControl
   251         */
   252         IMPORT_C void* ExtensionInterface( TUid aInterface );
   253 	private: 
   254 		IMPORT_C virtual void CEikDialog_Reserved_1();
   255 		IMPORT_C virtual void CEikDialog_Reserved_2();	
   256 	private: 
   257 		IMPORT_C virtual void CAknDialog_Reserved();
   258 	private:
   259 		IMPORT_C virtual void CAknQueryDialog_Reserved();
   260     private:
   261         // Will hold the index of the selected item
   262         TInt *iIndex;
   263         // Will hold the selected items' indexes
   264         CListBoxView::CSelectionIndexArray *iSelectionIndexArray;
   265         // Was the enter key pressed
   266 	    TBool iEnterKeyPressed;
   267         // Idle object to close the query if it there's no items to show
   268 	    CIdle *iIdle;
   269         // Layout for List query control
   270 	    TAknPopupWindowLayoutDef iLayout;
   271 
   272         CAknListQueryMediatorObserver* iMediatorObs;
   273 
   274         TInt iDragActioned;
   275 
   276     protected:
   277         /**
   278          * Gets search field if it has been set.
   279          *
   280          * @return Pointer to search field. If no search field is used 
   281          *         returns @c NULL.
   282          */
   283         IMPORT_C CAknSearchField* FindBox() const;
   284         
   285     public:
   286         /** 
   287          * Sets the tone for the dialog.
   288          *
   289          * @param aTone Tone to be used by the dialog.
   290          */
   291 	    IMPORT_C void SetTone(TInt aTone);
   292 	    
   293 	    IMPORT_C void HandleResourceChange(TInt aType);
   294 	    
   295 	    
   296     	/**
   297     	* @since 3.1
   298 	    * Override to CEikDialog default functionality
   299 	    * Instantiates mediator support and send a command with given parameters when a 
   300 	    * dialog is brought to display
   301 	    * @param aDialogIndex Unique index to identify a dialog within the category
   302 	    *                     0 has special meaning, it causes implementation to omit all communication
   303 	    *                     with secondary display. (use with sleeping dialogs only)
   304 	    * @param aCatUid  gategory uid, if default paramter is passed, application uid is used
   305 	    *                 as a category
   306 	    * @return void 
   307 	    */
   308 	    IMPORT_C void PublishDialogL(TInt aDialogIndex, TUid aCatUid = KNullUid,  CArrayFixFlat<TInt>* aItemIds = 0);
   309  
   310 	
   311        /* @since 3.1
   312 	    * Instantiates mediator support and passes possible feedback to given intance.
   313 	    * If no observer is set, dialog tries to handle feedback by it self.
   314 	    *
   315 	    * Please note that no commands will be instantiated unless command identifiers are 
   316 	    * are set using PublishDialogL
   317 	    *
   318 	    * @param  aObserver pointer to instance implementing MAknDialogMediatorObserver API
   319 	    *         Can be NULL
   320 	    * @return void 
   321 	    */
   322 	    IMPORT_C void SetMediatorObserver(MAknDialogMediatorObserver* aObserver);	    
   323 	};
   324 
   325 #endif //  AKNLISTQUERYDIALOG_H
   326 
   327 
   328 // End of File