williamr@2: /* williamr@2: * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@2: * 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: * which accompanies this distribution, and is available williamr@2: * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: williamr@2: * Implementation of CAknListQueryDialog williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: #ifndef AKNLISTQUERYDIALOG_H williamr@2: #define AKNLISTQUERYDIALOG_H williamr@2: williamr@2: #include williamr@2: williamr@2: class CAknMessageQueryControl; williamr@2: class CAknListQueryMediatorObserver; williamr@2: williamr@2: /** williamr@2: * List query class. williamr@2: * williamr@2: * This class is be used for list or multiselection list queries. williamr@2: */ williamr@2: class CAknListQueryDialog : public CAknQueryDialog, williamr@2: public MEikListBoxObserver, williamr@2: public MAknIntermediateState williamr@2: { williamr@2: public: williamr@2: /** williamr@2: * C++ default constructor. williamr@2: * williamr@2: * @param aIndex After the query is dismissed, the index will williamr@2: * hold the value of selected item. williamr@2: */ williamr@2: IMPORT_C CAknListQueryDialog(TInt* aIndex); williamr@2: williamr@2: /** williamr@2: * C++ default constructor. williamr@2: * williamr@2: * @param aSelectionIndexArray Will hold the values of selected williamr@2: * items (in multiselection list). williamr@2: */ williamr@2: IMPORT_C CAknListQueryDialog( williamr@2: CListBoxView::CSelectionIndexArray* aSelectionIndexArray); williamr@2: williamr@2: /** williamr@2: * Destructor williamr@2: */ williamr@2: IMPORT_C virtual ~CAknListQueryDialog(); williamr@2: williamr@2: /** williamr@2: * From @c CEikDialog. williamr@2: * williamr@2: * Sets the type and position of the list box. williamr@2: * williamr@2: * @param aSize Not used. williamr@2: */ williamr@2: IMPORT_C void SetSizeAndPosition(const TSize &aSize); williamr@2: williamr@2: /** williamr@2: * From @c CCoeControl. williamr@2: * williamr@2: * Handles key events. When a key event occurs, @c CONE calls this williamr@2: * function for each control on the control stack, until one of them williamr@2: * returns @c EKeyWasConsumed to indicate that it processed the key williamr@2: * event. williamr@2: * williamr@2: * @param aKeyEvent The key event. williamr@2: * @param aType The type of the event: @c EEventKey, @c EEventKeyUp or williamr@2: * @c EEventKeyDown. williamr@2: * @return Indicates whether or not the key event was williamr@2: * used by this control. williamr@2: */ williamr@2: IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, williamr@2: TEventCode aType); williamr@2: williamr@2: /** williamr@2: * From @c MEikListBoxObserver. williamr@2: * williamr@2: * Handles events from listbox. williamr@2: * williamr@2: * @param aListBox The listbox which caused the event. williamr@2: * @param aEventType Type of the event. williamr@2: */ williamr@2: IMPORT_C void HandleListBoxEventL(CEikListBox* aListBox, williamr@2: TListBoxEvent aEventType); williamr@2: williamr@2: /** williamr@2: * Sets item text array to the listbox. williamr@2: * williamr@2: * @param aItemTextArray Item text array to be added. williamr@2: */ williamr@2: IMPORT_C void SetItemTextArray(MDesCArray* aItemTextArray); williamr@2: williamr@2: /** williamr@2: * Sets ownership type of the item array. williamr@2: * williamr@2: * @param aOwnershipType Type of ownership. williamr@2: */ williamr@2: IMPORT_C void SetOwnershipType( williamr@2: TListBoxModelItemArrayOwnership aOwnershipType); williamr@2: williamr@2: /** williamr@2: * Destroys a possible old icon array in the listbox and installs a new williamr@2: * one and takes ownership of the new icon array. williamr@2: * williamr@2: * @param aIcons Icon pointer which will be installed. williamr@2: */ williamr@2: IMPORT_C void SetIconArrayL(CArrayPtr* aIcons); williamr@2: williamr@2: /** williamr@2: * Gets list query's listbox. williamr@2: * williamr@2: * @return The requested list box. williamr@2: */ williamr@2: IMPORT_C CEikListBox* ListBox() const; williamr@2: williamr@2: /** williamr@2: * Gets pointer to list query control or @c NULL. williamr@2: * williamr@2: * @return Pointer to list query control or in case that there is williamr@2: * no such element a @c NULL pointer. williamr@2: */ williamr@2: IMPORT_C CAknListQueryControl* ListControl() const; williamr@2: williamr@2: /** williamr@2: * Gets pointer to message query control or @c NULL. williamr@2: * williamr@2: * @return Pointer to message query control or in case that there williamr@2: * is no such element a @c NULL pointer. williamr@2: */ williamr@2: IMPORT_C CAknMessageQueryControl* MessageBox() const; williamr@2: williamr@2: /** williamr@2: * Gets pointer to query heading or @c NULL. williamr@2: * williamr@2: * @return Pointer to query heading or in case there is no such williamr@2: * element a @c NULL pointer. williamr@2: */ williamr@2: IMPORT_C CAknPopupHeadingPane* QueryHeading() const; williamr@2: williamr@2: /** williamr@2: * From @c CCoeControl. williamr@2: * williamr@2: * Sets the control to be ready for drawing. williamr@2: */ williamr@2: IMPORT_C void ActivateL(); williamr@2: williamr@2: /** williamr@2: * From @c CCoeControl. williamr@2: * williamr@2: * Handles pointer events. williamr@2: * williamr@2: * This function gets called whenever a pointer event occurs in the williamr@2: * control, i.e. when the pointer is within the control's extent, williamr@2: * or when the control has grabbed the pointer. The control should williamr@2: * implement this function to handle pointer events. williamr@2: * williamr@2: * Note: events of type @c EButton1Down are processed before williamr@2: * @c HandlePointerEventL() is called, in order to transfer keyboard williamr@2: * focus to the control in which the @c EButton1Down event occurred. williamr@2: * williamr@2: * If overriding @c HandlePointerEventL(), the implementation must williamr@2: * include a base call to @c CCoeControl's @c HandlePointerEventL(). williamr@2: * williamr@2: * @param &aPointerEvent The pointer event. williamr@2: */ williamr@2: IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); williamr@2: williamr@2: protected: williamr@2: /** williamr@2: * From @c CEikDialog. williamr@2: * williamr@2: * This function is called by the @c EIKON dialog framework just williamr@2: * before the dialog is activated, but before it is sized, williamr@2: * and before @c PostLayoutDynInitL() is called. williamr@2: */ williamr@2: IMPORT_C void PreLayoutDynInitL(void); williamr@2: williamr@2: /** williamr@2: * From @c CEikDialog. williamr@2: * williamr@2: * This function is called by the @c EIKON dialog framework williamr@2: * just before the dialog is activated, after it has called williamr@2: * @c PreLayoutDynInitL() and the dialog has been sized. williamr@2: */ williamr@2: IMPORT_C void PostLayoutDynInitL(); williamr@2: williamr@2: /** williamr@2: * From @c CEikDialog. williamr@2: * williamr@2: * This function is called by the @c EIKON framework if the user williamr@2: * activates a button in the button panel. It is not called if williamr@2: * the @c Cancel button is activated, unless the williamr@2: * @c EEikDialogFlagNotifyEsc flag is set. williamr@2: * williamr@2: * @param aButtonId The ID of the button that was activated williamr@2: * @return @c ETrue if the dialog should exit, williamr@2: * and @c EFalse if it should not. williamr@2: */ williamr@2: IMPORT_C TBool OkToExitL(TInt aButtonId); williamr@2: williamr@2: /** williamr@2: * Gets border style of the list query. williamr@2: * williamr@2: * @return Border style (@c AknBorderId type) williamr@2: */ williamr@2: IMPORT_C TInt BorderStyle(); williamr@2: williamr@2: protected: williamr@2: /** williamr@2: * From @c MAknIntermediateState. williamr@2: * williamr@2: * Tries to close the query with non-leaving way. williamr@2: */ williamr@2: IMPORT_C void CloseState(); williamr@2: williamr@2: private: williamr@2: /** williamr@2: * Closes the dialog. williamr@2: * williamr@2: * Gets called by iIdle. williamr@2: * williamr@2: * @param aObj Target dialog to be closed. williamr@2: * @return @c EFalse always. williamr@2: */ williamr@2: static TInt ClosePopup(TAny *aObj); williamr@2: williamr@2: /** williamr@2: * Closes the dialog and accepts selected item. williamr@2: * williamr@2: * Gets called by iIdle. williamr@2: * williamr@2: * @param aObj Target dialog to be closed. williamr@2: * @return @c EFalse always. williamr@2: */ williamr@2: static TInt ClosePopupAcceptingChanges(TAny *aObj); williamr@2: williamr@2: private: williamr@2: /** williamr@2: * From @c CAknControl williamr@2: */ williamr@2: IMPORT_C void* ExtensionInterface( TUid aInterface ); williamr@2: private: williamr@2: IMPORT_C virtual void CEikDialog_Reserved_1(); williamr@2: IMPORT_C virtual void CEikDialog_Reserved_2(); williamr@2: private: williamr@2: IMPORT_C virtual void CAknDialog_Reserved(); williamr@2: private: williamr@2: IMPORT_C virtual void CAknQueryDialog_Reserved(); williamr@2: private: williamr@2: // Will hold the index of the selected item williamr@2: TInt *iIndex; williamr@2: // Will hold the selected items' indexes williamr@2: CListBoxView::CSelectionIndexArray *iSelectionIndexArray; williamr@2: // Was the enter key pressed williamr@2: TBool iEnterKeyPressed; williamr@2: // Idle object to close the query if it there's no items to show williamr@2: CIdle *iIdle; williamr@2: // Layout for List query control williamr@2: TAknPopupWindowLayoutDef iLayout; williamr@2: williamr@2: CAknListQueryMediatorObserver* iMediatorObs; williamr@2: williamr@2: TInt iDragActioned; williamr@2: williamr@2: protected: williamr@2: /** williamr@2: * Gets search field if it has been set. williamr@2: * williamr@2: * @return Pointer to search field. If no search field is used williamr@2: * returns @c NULL. williamr@2: */ williamr@2: IMPORT_C CAknSearchField* FindBox() const; williamr@2: williamr@2: public: williamr@2: /** williamr@2: * Sets the tone for the dialog. williamr@2: * williamr@2: * @param aTone Tone to be used by the dialog. williamr@2: */ williamr@2: IMPORT_C void SetTone(TInt aTone); williamr@2: williamr@2: IMPORT_C void HandleResourceChange(TInt aType); williamr@2: williamr@2: williamr@2: /** williamr@2: * @since 3.1 williamr@2: * Override to CEikDialog default functionality williamr@2: * Instantiates mediator support and send a command with given parameters when a williamr@2: * dialog is brought to display williamr@2: * @param aDialogIndex Unique index to identify a dialog within the category williamr@2: * 0 has special meaning, it causes implementation to omit all communication williamr@2: * with secondary display. (use with sleeping dialogs only) williamr@2: * @param aCatUid gategory uid, if default paramter is passed, application uid is used williamr@2: * as a category williamr@2: * @return void williamr@2: */ williamr@2: IMPORT_C void PublishDialogL(TInt aDialogIndex, TUid aCatUid = KNullUid, CArrayFixFlat* aItemIds = 0); williamr@2: williamr@2: williamr@2: /* @since 3.1 williamr@2: * Instantiates mediator support and passes possible feedback to given intance. williamr@2: * If no observer is set, dialog tries to handle feedback by it self. williamr@2: * williamr@2: * Please note that no commands will be instantiated unless command identifiers are williamr@2: * are set using PublishDialogL williamr@2: * williamr@2: * @param aObserver pointer to instance implementing MAknDialogMediatorObserver API williamr@2: * Can be NULL williamr@2: * @return void williamr@2: */ williamr@2: IMPORT_C void SetMediatorObserver(MAknDialogMediatorObserver* aObserver); williamr@2: }; williamr@2: williamr@2: #endif // AKNLISTQUERYDIALOG_H williamr@2: williamr@2: williamr@2: // End of File