classicui_plat/personalisation_framework_api/inc/PslnFWBaseView.h
changeset 37 89c890c70182
parent 34 6b5204869ed5
child 45 667edd0b8678
equal deleted inserted replaced
34:6b5204869ed5 37:89c890c70182
     1 /*
       
     2 * Copyright (c) 2005-2007 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:  Base class for application specific skin views.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_PSLNFWBASEVIEW_H
       
    20 #define C_PSLNFWBASEVIEW_H
       
    21 
       
    22 #include "pslnfwplugininterface.h"
       
    23 #include <ConeResLoader.h>
       
    24 #include <eikclb.h>
       
    25 
       
    26 class CPslnFWBaseContainer;
       
    27 class CAknNavigationDecorator;
       
    28 class CAknNavigationControlContainer;
       
    29 
       
    30 /**
       
    31 *  CPslnFWBaseView view class.
       
    32 *  Base class for Psln plugin views.
       
    33 *
       
    34 *  @lib PslnFramework.lib
       
    35 *  @since S60 v3.1
       
    36 */
       
    37 class CPslnFWBaseView : public CPslnFWPluginInterface, public MEikListBoxObserver
       
    38     {
       
    39 
       
    40 public:
       
    41 
       
    42     /**
       
    43     * C++ default constructor
       
    44     */
       
    45     IMPORT_C CPslnFWBaseView();
       
    46 
       
    47     /**
       
    48     * Symbian OS default constructor.
       
    49     */
       
    50     IMPORT_C virtual void ConstructL() = 0;
       
    51 
       
    52     /**
       
    53     * Destructor.
       
    54     */
       
    55     IMPORT_C ~CPslnFWBaseView();
       
    56 
       
    57     /**
       
    58     * This function is used to set the current item in the listbox.
       
    59     * @param aIndex Current item.
       
    60     */
       
    61     IMPORT_C virtual void SetCurrentItem( TInt aIndex );
       
    62 
       
    63     /**
       
    64     * Returns the container this view has.
       
    65     * @return pointer to container, does not transfer ownership.
       
    66     */
       
    67     IMPORT_C CPslnFWBaseContainer* Container();
       
    68 
       
    69     /**
       
    70     * Opens the nearest localized resourcefile using aResourceLoader.
       
    71     * aResourceLoader should be opened only once before closing it.
       
    72     * Otherwise it will raise a panic. Therefore it is better to have
       
    73     * multiple resource loaders. Uses KDC_RESOURCE_FILES_DIR.
       
    74     *
       
    75     * @param aResourceFileName Drive and name of resource file in format
       
    76     *                          <path>:<rsc_file_name>
       
    77     * @param aResourceLoader Resource loader for the resource. The loader
       
    78     *                        must not be opened allready or it will raise
       
    79     *                        a panic. It is caller's responsibility to
       
    80     *                        close the resource loader after using the
       
    81     *                        resource.
       
    82     */
       
    83     IMPORT_C void OpenLocalizedResourceFileL(
       
    84         const TDesC& aResourceFileName,
       
    85         RConeResourceLoader& aResourceLoader );
       
    86 
       
    87     /**
       
    88     * Sames as above, except API user can defined path where to look for
       
    89     * resource file.
       
    90     *
       
    91     * @param aResourceFileName Drive and name of resource file in format
       
    92     *                          <path>:<rsc_file_name>
       
    93     * @param aResourceLoader Resource loader for the resource. The loader
       
    94     *                        must not be opened allready or it will raise
       
    95     *                        a panic. It is caller's responsibility to
       
    96     *                        close the resource loader after using the
       
    97     *                        resource.
       
    98     * @param aPath           Path to the resource file. Preferably use
       
    99     *                        data caging literals.
       
   100     */
       
   101     IMPORT_C void OpenLocalizedResourceFileL(
       
   102         const TDesC& aResourceFileName,
       
   103         RConeResourceLoader& aResourceLoader,
       
   104         const TDesC* aPath );
       
   105 
       
   106     /**
       
   107     * Overrides default navi pane decorator with given one.
       
   108     * @param aDecorator navi pane decorator to use.
       
   109     */
       
   110     IMPORT_C virtual void SetNaviPaneDecorator(
       
   111         CAknNavigationDecorator* aDecorator );
       
   112 
       
   113     /**
       
   114     * From CAknView.
       
   115     * Called when view is activated.
       
   116     * @param aPrevViewId previous view id.
       
   117     * @param aCustomMessageId custom message id.
       
   118     * @param aCustomMessage custom message content.
       
   119     */
       
   120     IMPORT_C void DoActivateL( const TVwsViewId& aPrevViewId,
       
   121                                TUid aCustomMessageId,
       
   122                                const TDesC8& aCustomMessage );
       
   123 
       
   124     /**
       
   125     * From CAknView.
       
   126     * Called when view is deactivated.
       
   127     */
       
   128     IMPORT_C void DoDeactivate();
       
   129 
       
   130     /**
       
   131     * Sets tab index for the view. Since application might insert
       
   132     * the view into a tab group with different location than the
       
   133     * plugin wants. It is necessary that the application informs
       
   134     * plugin the real location. Negative index or index that
       
   135     * are greater than tabgroup's last position are ignored.
       
   136     *
       
   137     * @param aMyTabIndex real tab index of the plugin in the tab group.
       
   138     *
       
   139     */
       
   140     IMPORT_C void SetTabIndex( TInt aMyTabIndex );
       
   141 
       
   142     /**
       
   143     * Returns the real tab index for the plugin. See API SetTabIndex
       
   144     * for details, when using this API might be necessary.
       
   145     * It is recommended that this API is used instead of hardcoded
       
   146     * constants for tab index, since Psln Framework might assign the
       
   147     * plugin to some other location than the plugin prefers.
       
   148     *
       
   149     * @return the real tab index for the plugin. KErrNotFound is returned,
       
   150     * if the tab index has not been set.
       
   151     */
       
   152     IMPORT_C TInt GetTabIndex() const;
       
   153 
       
   154 protected:
       
   155 
       
   156     /**
       
   157     * Sets the correct navi pane for the view (eg. tabs, string etc.).
       
   158     * Use when tab group is not to be shown, or plugin handles the tab group
       
   159     * itself.
       
   160     */
       
   161     IMPORT_C virtual void SetNaviPaneL();
       
   162 
       
   163     /**
       
   164     * Deprecated.
       
   165     */
       
   166     IMPORT_C virtual void CreateNaviPaneContextL( TInt aResourceId );
       
   167 
       
   168     /**
       
   169     * Creates container,
       
   170     */
       
   171     IMPORT_C virtual void CreateContainerL();
       
   172 
       
   173     /**
       
   174     * Create new container. Called by DoActivateL().
       
   175     * Implemented by sub-class.
       
   176     */
       
   177     IMPORT_C virtual void NewContainerL() = 0;
       
   178 
       
   179     /**
       
   180     * Sets the correct navi pane for the view (eg. tabs, string etc.).
       
   181     * @param aTabLocation indicates the location of view within the Appui
       
   182     *                     owned tabgroup.
       
   183     */
       
   184     IMPORT_C virtual void SetNaviPaneL( const TInt aTabLocation );
       
   185 
       
   186     /**
       
   187     * From MEikListBoxObserver.
       
   188     * Handles listbox events.
       
   189     * @param aListBox listbox pointer.
       
   190     * @param aEventType event type.
       
   191     */
       
   192     void HandleListBoxEventL( CEikListBox* aListBox,
       
   193         TListBoxEvent aEventType );
       
   194 
       
   195     /**
       
   196     * Adds given resource text as MSK to CBA.
       
   197     *
       
   198     * @param aResourceId middle softkey label.
       
   199     * @param aCommandId command that should be performed when MSK
       
   200     *        is pressed.
       
   201     * @since S60 v3.1
       
   202     */
       
   203     IMPORT_C virtual void SetMiddleSoftKeyLabelL(
       
   204         const TInt aResourceId,
       
   205         const TInt aCommandId );
       
   206 
       
   207     /**
       
   208     * Handles Download and Help commands.
       
   209     * Unknown commands are forwarded to appUi.
       
   210     * @param aCommand command ID - it should match commands given in the psln.hrh.
       
   211     */
       
   212     IMPORT_C virtual void HandleCommandL( TInt aCommand );
       
   213 
       
   214     /**
       
   215     * Plugins should implement this virtual method. It allows that the plugin provides a resource
       
   216     * ID that the framework should use as title text for the view.
       
   217     * @param aResourceId resource ID of title text to use.
       
   218     *
       
   219     * @since 5.0
       
   220     * NOTE that the resource file should be loaded and open.
       
   221     */
       
   222     IMPORT_C virtual void SetTitlePaneL( TInt& aResourceId );
       
   223 
       
   224 private:
       
   225 
       
   226     /**
       
   227     * Handles listbox selection. Called by HandleListBoxEventL.
       
   228     * Implement by sub-class.
       
   229     */
       
   230     virtual void HandleListBoxSelectionL() = 0;
       
   231 
       
   232     /**
       
   233     * Checks if the tab group is not one of the static views' locations.
       
   234     */
       
   235     TBool IsValidLocation( const TInt& aLoc ) const;
       
   236 
       
   237 protected: // data
       
   238 
       
   239     /**
       
   240     * View UID that was previously active before this view was activated.
       
   241     */
       
   242     TVwsViewId iPrevViewId;
       
   243 
       
   244     /**
       
   245     * Pointer to the container
       
   246     * Own.
       
   247     */
       
   248     CPslnFWBaseContainer* iContainer;
       
   249 
       
   250     /**
       
   251     * Navi pane.
       
   252     * Not own.
       
   253     */
       
   254     CAknNavigationDecorator* iNaviPaneContext;
       
   255 
       
   256     /**
       
   257     * Pointer to the navi control container
       
   258     * Not own.
       
   259     */
       
   260     CAknNavigationControlContainer* iNaviControlContainer;
       
   261 
       
   262     /**
       
   263     * Currently selected listbox item.
       
   264     */
       
   265     TInt iCurrentItem;
       
   266 
       
   267     /**
       
   268     * First item in the listbox.
       
   269     */
       
   270     TInt iTopItemIndex;
       
   271 
       
   272     /**
       
   273     * Resource loader.
       
   274     */
       
   275     RConeResourceLoader iResourceLoader;
       
   276 
       
   277     /**
       
   278     * Real tab group index for the view.
       
   279     */
       
   280     TInt iMyTabIndex;
       
   281     };
       
   282 
       
   283 #endif // C_PSLNFWBASEVIEW_H
       
   284 
       
   285 // End of File