landmarksui/uicontrols/inc/CLmkDlgSelectorImplBase.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 -    Base class for common ui selectors (dialog-based).
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 #ifndef CLMKDLGSELECTORIMPLBASE_H
       
    25 #define CLMKDLGSELECTORIMPLBASE_H
       
    26 
       
    27 //  INCLUDES
       
    28 #include "CLmkSelectorImplBase.h"
       
    29 #include "MLmkNavigationObserver.h"
       
    30 #include "MLmkDlgMenuObserver.h"
       
    31 #include <eikcmobs.h>       // MEikCommandObserver
       
    32 
       
    33 // FORWARD DECLARATIONS
       
    34 class MObjectProvider;
       
    35 class CEikonEnv;
       
    36 class CLmkSelectorDialog;
       
    37 class TCoeHelpContext;
       
    38 class CEikTextListBox;
       
    39 
       
    40 // CLASS DECLARATION
       
    41 
       
    42 /**
       
    43 * Base class for common ui selectors (dialog-based).
       
    44 * During implementation it was noticed that pre-selection indexes
       
    45 * cause difficulties and some refactoring could be done to make the
       
    46 * code easier to read and maintain.
       
    47 *
       
    48 */
       
    49 class CLmkDlgSelectorImplBase
       
    50 : public CLmkSelectorImplBase,
       
    51   public MEikCommandObserver,
       
    52   public MLmkNavigationObserver,
       
    53   public MLmkDlgMenuObserver
       
    54     {
       
    55     public:  // Constructors and destructor
       
    56         /**
       
    57         * Destructor.
       
    58         */
       
    59         ~CLmkDlgSelectorImplBase();
       
    60 
       
    61     public: // New functions
       
    62         /**
       
    63         * Selector implementation parent receives observed events when
       
    64         * any of the base class's observation methods is executed.
       
    65         * @param aParent parent of this selector implementor
       
    66         */
       
    67         void SetSelectorImplParent( CLmkDlgSelectorImplBase* aParent );
       
    68 
       
    69         /**
       
    70         * Object provider mechanism.
       
    71         * @param aParent parent object
       
    72         */
       
    73         IMPORT_C void SetMopParent( MObjectProvider* aParent );
       
    74 
       
    75         /**
       
    76         * Runs single item selection dialog.
       
    77         * @param aOpenedItem contains output selection id
       
    78         * @param aAlwaysModifyOpened if ETrue then highlighted item
       
    79         *        is set to aOpenedItem even if dialog was cancelled
       
    80         * @return !=0 if accepted, 0 if canceled
       
    81         */
       
    82         virtual TInt ExecuteL( TPosLmItemId& aOpenedItem,
       
    83                                TBool aAlwaysModifyOpened = EFalse );
       
    84 
       
    85         /**
       
    86         * Runs multiple item selection dialog.
       
    87         * aSelectedItems is used as both input and output parameter
       
    88         * (i.e. if a non-empty array is given then those items are
       
    89         * marked selected by default.
       
    90         * @param aSelectedItems contains input/output selection id(s)
       
    91         * @param aAlwaysModifySelected if ETrue then selected items
       
    92         *        are set to aSelectedItems even if dialog was cancelled
       
    93         * @return !=0 if accepted, 0 if canceled
       
    94         */
       
    95         virtual TInt ExecuteL( RArray<TPosLmItemId>& aSelectedItems,
       
    96                                TBool aAlwaysModifySelected = EFalse );
       
    97 
       
    98         /**
       
    99         * Runs single item selection dialog. This method is mainly
       
   100         * targeted for internal use within LmkUi component.
       
   101         * @param aOpenedItem contains output selection index
       
   102         * @return !=0 if accepted, 0 if canceled
       
   103         */
       
   104         virtual TInt ExecuteL( TInt& aOpenedItem );
       
   105 
       
   106         /**
       
   107         * Runs multiple item selection dialog. This method is mainly
       
   108         * targeted for internal use within LmkUi component.
       
   109         * aSelectedItems is used as both input and output parameter
       
   110         * (i.e. if a non-empty array is given then those items are
       
   111         * marked selected by default.
       
   112         * @param aSelectedItems contains input/output selection indexes
       
   113         * @return !=0 if accepted, 0 if canceled
       
   114         */
       
   115         virtual TInt ExecuteL( CArrayFix<TInt>& aSelectedItems );
       
   116 
       
   117          /**
       
   118       	* Stores the empty dialog label
       
   119         * @param aLabelRes Label resource id
       
   120         */
       
   121         virtual void SetEmptyDlgLabel( TInt aLabelPrimRes ,TInt aLabelSecRes );
       
   122 
       
   123        // Added for accepting dynamically changing title pane parameter
       
   124 		virtual TInt ExecuteL( CArrayFix<TInt>& aSelectedItems, TPtrC aTitlePaneText );
       
   125 
       
   126         /**
       
   127         * Template method implemented by the subclass and called by
       
   128         * the base class.
       
   129         */
       
   130         virtual void GetDlgResources( TBool aIsSingleSelector,
       
   131                                       TInt& aTitlePaneResource,
       
   132                                       TInt& aMenuBarResource,
       
   133                                       TInt& aDialogResource ) const = 0;
       
   134 
       
   135 
       
   136 
       
   137         /**
       
   138         * Template method called by the base class,
       
   139         * implemented by the subclass if dialog has a help.
       
   140         * Base class implementation returns null help context.
       
   141         * @return aContext help context
       
   142         */
       
   143         virtual TCoeHelpContext HelpContext() const;
       
   144 
       
   145         virtual void StopExecutionL();
       
   146 
       
   147         virtual void SetDialogTitleL(const TDesC& aTitle);
       
   148 
       
   149     public: // From CLmkSelectorImplBase
       
   150         MLmkListMemento* MementoL();
       
   151         TInt ListVisibleItemCount();
       
   152         TInt ListMarkedItemCountL();
       
   153 
       
   154     protected: // From MEikCommandObserver
       
   155         void ProcessCommandL( TInt aCommandId );
       
   156 
       
   157     protected: // From MLmkDlgMenuObserver
       
   158         void DynInitDlgMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
       
   159 
       
   160     protected: // From MLmkListProviderObserver
       
   161         void HandleListProviderEvent( TLmkListProviderEventType aEvent );
       
   162         void HandleListProviderError( TInt aError );
       
   163 
       
   164     protected: // From MLmkNavigationObserver
       
   165         TKeyResponse HandleNavigationEventL( const TKeyEvent& aKeyEvent );
       
   166         void HandleLaunchingEventL();
       
   167         void HandleClosingEventL();
       
   168 
       
   169         /**
       
   170         * Check whether Coordinates has to be hidden.
       
   171         */
       
   172         void CheckHideCoordinateL( );
       
   173 
       
   174     protected: // Constructors and destructor
       
   175         /**
       
   176         * C++ default constructor.
       
   177         * @param aDb
       
   178         * @return newly instantiate object
       
   179         */
       
   180         CLmkDlgSelectorImplBase( CPosLandmarkDatabase& aDb );
       
   181 
       
   182         /**
       
   183         * By default Symbian 2nd phase constructor is private.
       
   184         */
       
   185         void BaseConstructL();
       
   186 
       
   187     private: // New functions
       
   188 
       
   189         /**
       
   190         * Internal helper function which attempts to read indexes
       
   191         * corresponding to stored lm item ids and to set them as
       
   192         * selected in the listbox.
       
   193         */
       
   194         void RetrySetPreSelectedL();
       
   195 
       
   196     protected: // Data
       
   197         ///Ref: parent selector
       
   198         CLmkDlgSelectorImplBase* iSelectorImplParent;
       
   199 
       
   200         ///Ref: mop parent
       
   201         MObjectProvider* iMopParent;
       
   202 
       
   203         ///Own: Note that iDialog is a dynamic object which can be accessed
       
   204         ///     between HandleLaunchingEventL() & HandleClosingEventL().
       
   205         CLmkSelectorDialog* iDialog;
       
   206         TInt iCurrentLabelPrimResource;
       
   207         TInt iCurrentLabelSecResource;
       
   208 
       
   209         //It will be ETrue when help has to be hidden.
       
   210         TBool iIsHideHelp;
       
   211 
       
   212     private: // Data
       
   213         // These should not be used by subclasses, their content is
       
   214         // guaranteed to be correct only within this class.
       
   215 
       
   216         ///Latest provider event recorded by this class
       
   217         TLmkListProviderEventType iDlgSelectorImplBaseLatestListEvent;
       
   218 
       
   219         ///Ref: items to be set marked when provider gets ready if it
       
   220         ///     wasn't ready when ExecuteL() was called
       
   221         const RArray<TPosLmItemId>* iInputSelectedItems;
       
   222 
       
   223         // user-specified title for the dialog
       
   224         HBufC* iTitle;
       
   225         
       
   226     };
       
   227 
       
   228 #endif      // CLMKDLGSELECTORIMPLBASE_H
       
   229 
       
   230 // End of File