landmarksui/uicontrols/inc/CLmkDlgCombiSelectorImpl.h
branchRCL_3
changeset 17 1fc85118c3ae
parent 16 8173571d354e
child 18 870918037e16
equal deleted inserted replaced
16:8173571d354e 17:1fc85118c3ae
     1 /*
       
     2 * Copyright (c) 2004 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:    LandmarksUi Content File -    Common UI's (dialog-based) landmark selector impl class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 #ifndef CLMKDLGCOMBISELECTORIMPL_H
       
    25 #define CLMKDLGCOMBISELECTORIMPL_H
       
    26 
       
    27 //  INCLUDES
       
    28 #include "CLmkDlgSelectorImplBase.h"
       
    29 #include "MLmkListProviderObserver.h"
       
    30 #include "MLmkListMemento.h"
       
    31 #include <eikcmobs.h>       // MEikCommandObserver
       
    32 #include <AknTabObserver.h>
       
    33 // FORWARD DECLARATIONS
       
    34 class CLmkSelectorDialog;
       
    35 class CAknNavigationControlContainer;
       
    36 class CAknTabGroup;
       
    37 class CAknNavigationDecorator;
       
    38 
       
    39 // CLASS DECLARATION
       
    40 
       
    41 /**
       
    42 *  Common UI's (dialog-based) landmark selector impl class.
       
    43 *  This selector contains both landmark by name & by category tabs
       
    44 *  and it utilizes landmark and category selectors to do that.
       
    45 *
       
    46 */
       
    47 class CLmkDlgCombiSelectorImpl : public CLmkDlgSelectorImplBase, public MAknTabObserver
       
    48     {
       
    49     private:    // Type definitions
       
    50 
       
    51         enum TLmkSelectorState
       
    52             {
       
    53             ELmkLandmarkSelector = 0,   // used as index in iSelectors
       
    54             ELmkCategorySelector,       // used as index in iSelectors
       
    55             ELmkFilteredLmSelector,     // used as index in iSelectors
       
    56             ELmkInitialState,
       
    57             ELmkFinalState,
       
    58             };
       
    59 
       
    60         enum TLmkSelectorStateEvent
       
    61             {
       
    62             ELmkSelectorStart = 0,
       
    63             ELmkSelectorStop,
       
    64             ELmkSelectorNavigating,
       
    65             ELmkSelectorAbort,
       
    66             ELmkSelectorNoEvent
       
    67             };
       
    68 
       
    69     public:  // Constructors and destructor
       
    70         /**
       
    71         * Two-phased constructor.
       
    72         * @param aDb database reference
       
    73         * @return newly instantiated object
       
    74         */
       
    75         IMPORT_C static CLmkDlgCombiSelectorImpl* NewL(
       
    76                                     CPosLandmarkDatabase& aDb );
       
    77 
       
    78         /**
       
    79         * Destructor.
       
    80         */
       
    81         ~CLmkDlgCombiSelectorImpl();
       
    82 
       
    83     public: // From CLmkSelectorImplBase
       
    84         void StopExecutionL();
       
    85         TInt ExecuteL( TPosLmItemId& aOpenedItem,
       
    86                        TBool aAlwaysModifyOpened = EFalse );
       
    87         TInt ExecuteL( RArray<TPosLmItemId>& aSelectedItems,
       
    88                        TBool aAlwaysModifySelected = EFalse );
       
    89 
       
    90         void SetupListProviderL();
       
    91         const CLmkListProviderBase& ListProvider() const;
       
    92         void GetDlgResources( TBool aIsSingleSelector,
       
    93                               TInt& aTitlePaneResource,
       
    94                               TInt& aMenuBarResource,
       
    95                               TInt& aDialogResource ) const;
       
    96         
       
    97         void SetDialogTitleL(const TDesC& aTitle);
       
    98 
       
    99     protected: // From CLmkDlgSelectorImplBase
       
   100         void StoreMemento();
       
   101         void RestoreMemento();
       
   102 
       
   103     protected: // From MEikCommandObserver
       
   104         void ProcessCommandL( TInt aCommandId );
       
   105 
       
   106     protected: // From MLmkNavigationObserver
       
   107         TKeyResponse HandleNavigationEventL( const TKeyEvent& aKeyEvent );
       
   108         void HandleLaunchingEventL();
       
   109         void HandleClosingEventL();
       
   110 
       
   111 	protected: // From MAknTabObserver
       
   112 		void TabChangedL( TInt aIndex );
       
   113 
       
   114     protected:  // New functions
       
   115         /**
       
   116         * Handle any state event.
       
   117         * @param aEvent
       
   118         * @return TLmkSelectorStateEvent
       
   119         */
       
   120         TLmkSelectorStateEvent HandleAnyStateEventL(
       
   121                                     TLmkSelectorStateEvent aEvent );
       
   122 
       
   123         /**
       
   124         * Handle initial state event.
       
   125         * @param aEvent
       
   126         * @return TLmkSelectorStateEvent
       
   127         */
       
   128         TLmkSelectorStateEvent HandleInitialStateEventL(
       
   129                                     TLmkSelectorStateEvent aEvent );
       
   130 
       
   131         /**
       
   132         * Handle landmark selector state event.
       
   133         * @param aEvent
       
   134         * @return TLmkSelectorStateEvent
       
   135         */
       
   136         TLmkSelectorStateEvent HandleLandmarkSelectorStateEventL(
       
   137                                     TLmkSelectorStateEvent aEvent );
       
   138 
       
   139         /**
       
   140         * Handle category selector state event.
       
   141         * @param aEvent
       
   142         * @return TLmkSelectorStateEvent
       
   143         */
       
   144         TLmkSelectorStateEvent HandleCategorySelectorStateEventL(
       
   145                                     TLmkSelectorStateEvent aEvent );
       
   146 
       
   147         /**
       
   148         * Handle filtered selector state event.
       
   149         * @param aEvent
       
   150         * @return TLmkSelectorStateEvent
       
   151         */
       
   152         TLmkSelectorStateEvent HandleFilteredLmSelectorStateEventL(
       
   153                                     TLmkSelectorStateEvent aEvent );
       
   154 
       
   155         /**
       
   156         * Handle default state state evelt.
       
   157         * @param aEvent
       
   158         * @return TLmkSelectorStateEvent
       
   159         */
       
   160         TLmkSelectorStateEvent HandleDefaultStateStateEventL(
       
   161                                     TLmkSelectorStateEvent aEvent );
       
   162 
       
   163         /**
       
   164         * Helper method for getting selector corresponding to the
       
   165         * current state. If it doesn't exist yet it is created.
       
   166         * @param aCategoryId is only used when creating filtered lm
       
   167         *        selector which requires a category id for criteria
       
   168         */
       
   169         CLmkDlgSelectorImplBase& CurrentStateSelectorL(
       
   170                             TPosLmItemId aCategoryId = KPosLmNullItemId );
       
   171 
       
   172     protected:  // Constructors and destructor
       
   173         /**
       
   174         * C++ default constructor.
       
   175         * @param aDb
       
   176         * @return newly instantiated object
       
   177         */
       
   178         CLmkDlgCombiSelectorImpl( CPosLandmarkDatabase& aDb );
       
   179 
       
   180         /**
       
   181         * By default Symbian 2nd phase constructor is private.
       
   182         */
       
   183         void ConstructL();
       
   184     private:
       
   185 
       
   186 		/**
       
   187         * Add the individual tabs to tabgroup of NaviPane
       
   188         * @param aaTabGroup
       
   189         * @
       
   190         */
       
   191 		void AddTabsL(CAknTabGroup& aTabGroup);
       
   192 
       
   193 		/**
       
   194         * Fetch the name of the Bitmap file
       
   195         *
       
   196         * @return pointer to name of bitmap file containing tab icons
       
   197         */
       
   198 		HBufC* GetBitmapFilenameLC();
       
   199 
       
   200     private:    // Data
       
   201         /// Current state of this class
       
   202         TLmkSelectorState iSelectorState;
       
   203 
       
   204         /// used when opening a category contents view
       
   205         TInt iCategoryIndex;
       
   206 
       
   207         /// dialog return value
       
   208         TInt iDlgRetVal;
       
   209 
       
   210         RPointerArray<CLmkDlgSelectorImplBase> iSelectors;
       
   211 
       
   212         RPointerArray<MLmkListMemento> iMementos;
       
   213 
       
   214         /// Is user currently navigating between tabs?
       
   215         TBool iNavigating;
       
   216 
       
   217         /// Is user interested in return values even if dialog was cancelled?
       
   218         TBool iAlwaysModify;
       
   219 
       
   220         ///Ref: used in multi selector mode
       
   221         RArray<TPosLmItemId>* iSelectedItems;
       
   222 
       
   223         ///Ref: used in single selector mode
       
   224         TPosLmItemId* iOpenedItem;
       
   225 
       
   226         ///Ref: navi pane reference
       
   227         CAknNavigationControlContainer* iNaviPane;
       
   228 
       
   229         ///Ref: tab group
       
   230         CAknTabGroup* iTabGroup;
       
   231 
       
   232         ///Own: navi decorator
       
   233         CAknNavigationDecorator* iNaviDeco;
       
   234         
       
   235         /// Own: custom title for the landmark selection dialog
       
   236         HBufC* iCustomLandmarksTitle;
       
   237     };
       
   238 
       
   239 #endif      // CLMKDLGCOMBISELECTORIMPL_H
       
   240 
       
   241 // End of File