mpxplugins/viewplugins/views/inc/mpxcommoncontainer.h
changeset 0 ff3acec5bc43
child 21 a1247965635c
equal deleted inserted replaced
-1:000000000000 0:ff3acec5bc43
       
     1 /*
       
     2 * Copyright (c) 2006 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:  MPX common container definition.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef MMPXCOMMONCONTAINER_H
       
    21 #define MMPXCOMMONCONTAINER_H
       
    22 
       
    23 
       
    24 // INCLUDES
       
    25 #include <coecntrl.h>
       
    26 #include "mpxcommonlistboxarrayobserver.h"
       
    27 #include "mpxcommonlistboxarraybase.h"
       
    28 #include "mpxviewcontainer.h"
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CEikMenuPane;
       
    32 class MEikCommandObserver;
       
    33 class MEikListBoxObserver;
       
    34 class MMPXCommonListBoxArrayObserver;
       
    35 
       
    36 // CLASS DECLARATION
       
    37 
       
    38 /**
       
    39  *  Abstract class for common container.
       
    40  *  The view class should implement the following virtual function
       
    41  *  from MEikCommandObserver
       
    42  *
       
    43  *  virtual void ProcessCommandL(TInt aCommandId);
       
    44  *
       
    45  *  common container uses this to pass commands back to the view class
       
    46  *  the commands supported are defined in mpxcommoncontainer.hrh
       
    47  *
       
    48  *  view container class owns this class to access List box commands, receive
       
    49  *  CoeControl events and GetHelpContext(). The view container class should
       
    50  *  implement the following virtual functions from MViewContainer
       
    51  *
       
    52  *  virtual void HandleKeyEvent();
       
    53  *  virtual void HandleHelpContent();
       
    54  *
       
    55  *  common container uses this to pass CoeControl events back to the view
       
    56  *  container class.
       
    57  *
       
    58  *  view class should handle the following commands in ProcessCommandL
       
    59  *  from MEikCommandObserver:
       
    60  *
       
    61  *  EMPXCmdCommonDelete  // delete key pressed
       
    62  *  EMPXCmdCommonResourceChange  // resource change
       
    63  *
       
    64  *  @lib mpxcommoncontainer.lib
       
    65  *  @since S60 v3.1
       
    66  */
       
    67 class MMPXCommonContainer
       
    68     {
       
    69 public:
       
    70 
       
    71     enum TMPXCommonContainerCollectionType
       
    72         {
       
    73         EMPXCommonContainerMusic,
       
    74         EMPXCommonContainerPodcast
       
    75         };
       
    76 
       
    77     /**
       
    78      * Destructor.
       
    79      */
       
    80     virtual ~MMPXCommonContainer() {};
       
    81 
       
    82     /**
       
    83      * Return Coe Control
       
    84      *
       
    85      * @since 3.2
       
    86      */
       
    87     virtual CCoeControl* CoeControl() = 0;
       
    88 
       
    89     /**
       
    90      * Set View Container
       
    91      *
       
    92      * @since 3.2
       
    93      */
       
    94     virtual void SetViewContainer( MMPXViewContainer* aViewContainer ) = 0;
       
    95 
       
    96     /**
       
    97      * Set command observer for container
       
    98      *
       
    99      * @since 3.2
       
   100      */
       
   101     virtual void SetCommandObserver(
       
   102         MEikCommandObserver* aCommandObserver ) = 0;
       
   103 
       
   104     /**
       
   105      * Set list box observer for container
       
   106      *
       
   107      * @since 3.2
       
   108      */
       
   109     virtual void SetListBoxObserver( MEikListBoxObserver* aObserver ) = 0;
       
   110 
       
   111     /**
       
   112      * Set layout for all elements and set sizes for icons.
       
   113      *
       
   114      * @since 3.1
       
   115      */
       
   116     virtual void UpdateLayout() = 0;
       
   117 
       
   118     /**
       
   119      * Returns list box array, ownership not transfered
       
   120      *
       
   121      * @since 3.1
       
   122      * @return A pointer to the list box array
       
   123      */
       
   124     virtual CMPXCommonListBoxArrayBase* ListBoxArray() const = 0;
       
   125 
       
   126     /**
       
   127      * Sets list box array, ownership not transfered
       
   128      *
       
   129      * @since 3.1
       
   130      * @param A pointer to the list box array
       
   131      */
       
   132     virtual void SetListBoxArrayL(
       
   133         CMPXCommonListBoxArrayBase* aListBoxArray) = 0;
       
   134 
       
   135     /**
       
   136      * Return number of listbox items shown in the current listbox.
       
   137      *
       
   138      * @since 3.1
       
   139      * @return The number of items shown in the list box
       
   140      */
       
   141     virtual TInt CurrentListItemCount() const = 0;
       
   142 
       
   143     /**
       
   144      * Return total number of listbox items in the listbox.
       
   145      *
       
   146      * @since 3.1
       
   147      * @return Total items in the list box
       
   148      */
       
   149     virtual TInt TotalListItemCount() const = 0;
       
   150 
       
   151     /**
       
   152      * Gets top listbox item index (relative to the original listbox).
       
   153      * @return Top listbox item index
       
   154      *
       
   155      * @since 3.1
       
   156      */
       
   157     virtual TInt TopLbxItemIndex() const = 0;
       
   158 
       
   159     /**
       
   160      * Gets bottom listbox item index (relative to the original listbox).
       
   161      * @return Bottom listbox item index
       
   162      *
       
   163      * @since 3.1
       
   164      */
       
   165     virtual TInt BottomLbxItemIndex() const = 0;
       
   166 
       
   167     /**
       
   168      * Gets current listbox item index (relative to the original listbox).
       
   169      * @return Current listbox item index
       
   170      *
       
   171      * @since 3.1
       
   172      */
       
   173     virtual TInt CurrentLbxItemIndex() const = 0;
       
   174 
       
   175     /**
       
   176      * Get current selected listbox items indices (relative to the original
       
   177      * listbox). Ownership not transferred.
       
   178      *
       
   179      * @since 3.1
       
   180      * @return Current listbox item indices
       
   181      */
       
   182     virtual const CArrayFix<TInt>* CurrentSelectionIndicesL() const = 0;
       
   183 
       
   184     /**
       
   185      * Sewt current selected listbox items indices
       
   186      *
       
   187      * @since 3.1
       
   188      * @param aIndices Array of selection indices, ownership not transfered
       
   189      */
       
   190     virtual void SetCurrentSelectionIndicesL( CArrayFix<TInt>* aIndices ) const = 0;
       
   191 
       
   192     /**
       
   193      * Set top listbox item index.
       
   194      *
       
   195      * @since 3.1
       
   196      * @param aIndex Actual listbox index.
       
   197      */
       
   198     virtual void SetLbxTopItemIndex( TInt aIndex ) = 0;
       
   199 
       
   200     /**
       
   201      * Set current listbox item index.
       
   202      *
       
   203      * @since 3.1
       
   204      * @param aIndex Actual listbox index.
       
   205      */
       
   206     virtual void SetLbxCurrentItemIndex( TInt aIndex ) = 0;
       
   207 
       
   208     /**
       
   209      * Set current listbox item index and highlight it.
       
   210      *
       
   211      * @since 3.1
       
   212      * @param aIndex Actual listbox index.
       
   213      */
       
   214     virtual void SetLbxCurrentItemIndexAndDraw( TInt aIndex ) = 0;
       
   215 
       
   216     /**
       
   217      * Clear listbox selection.
       
   218      *
       
   219      * @since 3.1
       
   220      */
       
   221     virtual void ClearLbxSelection() = 0;
       
   222 
       
   223     /**
       
   224      * Sets list box backround text. This text is visible if the list box
       
   225      * has no items.
       
   226      *
       
   227      * @param aText The text for the empty list box background.
       
   228      * @since 3.2
       
   229      */
       
   230     virtual void SetLbxEmptyTextL( const TDesC& aText ) = 0;
       
   231 
       
   232     /**
       
   233      * Draws list box item index
       
   234      *
       
   235      * @since 3.2
       
   236      */
       
   237     virtual void DrawLbxItem( TInt aIndex ) = 0;
       
   238 
       
   239     /**
       
   240      * Set Find box's focus.
       
   241      *
       
   242      * @since 3.1
       
   243      * @param aFocus ETrue if set focus on FindBox. Otherwise, EFalse.
       
   244      */
       
   245     virtual void SetFindBoxFocus( TBool aFocus ) = 0;
       
   246 
       
   247     /**
       
   248      * Handle listbox item addition.
       
   249      *
       
   250      * @since 3.1
       
   251      */
       
   252     virtual void HandleLbxItemAdditionL() = 0;
       
   253 
       
   254     /**
       
   255      * Handle listbox item addition, preserving the current display index.
       
   256      *
       
   257      * @since 3.1
       
   258      */
       
   259     virtual void HandleLbxItemAdditionPreserveIndexL() = 0;
       
   260 
       
   261     /**
       
   262      * Handle listbox item removal.
       
   263      *
       
   264      * @since 3.1
       
   265      */
       
   266     virtual void HandleLbxItemRemovalL() = 0;
       
   267 
       
   268     /**
       
   269      * Show/hide find box
       
   270      *
       
   271      * @since 3.1
       
   272      * @param aIsVisible ETrue to set findbox visible. Otherwise, EFalse
       
   273      */
       
   274     virtual void SetFindBoxVisibilityL( TBool aIsVisible ) = 0;
       
   275 
       
   276     /**
       
   277      * Determine find box visibility
       
   278      *
       
   279      * @since 3.1
       
   280      * @return ETrue if find box is currently visible, EFalse otherwise
       
   281      */
       
   282     virtual TBool FindBoxVisibility() = 0;
       
   283 
       
   284     /**
       
   285      * Restore the PopupCBA of find box
       
   286      */
       
   287     virtual void RestoreFindBoxPopupCBA() = 0;
       
   288 
       
   289     /**
       
   290      * Calculate the top index of the visible items
       
   291      *
       
   292      * @since 3.1
       
   293      * @param aBottomIndex the bottom index of the visible items
       
   294      * @return top index
       
   295      */
       
   296     virtual TInt CalculateTopIndex( TInt aBottomIndex ) = 0;
       
   297 
       
   298     /**
       
   299      * Creates the container
       
   300      *
       
   301      * @since 3.1
       
   302      * @param aCollectionType collection type
       
   303      */
       
   304     virtual void ConstructContainerL( TMPXCommonContainerCollectionType aCollectionType ) = 0;
       
   305 
       
   306     /**
       
   307      * Enable/disable find box
       
   308      *
       
   309      * @since 3.1
       
   310      * @aEnable ETrue to enable find box, EFalse to disable
       
   311      */
       
   312     virtual void EnableFindBox( TBool aEnable ) = 0;
       
   313 
       
   314     /**
       
   315      * Enable/disable marking
       
   316      *
       
   317      * @since 3.1
       
   318      * @aEnable ETrue to enable marking, EFalse to disable
       
   319      */
       
   320     virtual void EnableMarking( TBool aEnable ) = 0;
       
   321 
       
   322     /**
       
   323      * Custom handling of commands for markable lists.
       
   324      */
       
   325     virtual void HandleMarkableListProcessCommandL( TInt aCommand ) = 0;
       
   326 
       
   327     /**
       
   328      * Custom handling of menu pane for markable lists
       
   329      */
       
   330     virtual void HandleMarkableListDynInitMenuPane(
       
   331         TInt aResourceId,
       
   332         CEikMenuPane* aMenuPane ) = 0;
       
   333 
       
   334 
       
   335     /**
       
   336      * Handle listbox array events
       
   337      *
       
   338      *  @param aEvent list box event
       
   339      */
       
   340     virtual void HandleListBoxArrayEventL(
       
   341         MMPXCommonListBoxArrayObserver::TMPXCommonListBoxArrayEvents aEvent ) = 0;
       
   342 
       
   343     /**
       
   344      * Handles key events.
       
   345      *
       
   346      * @param aKeyEvent The key event.
       
   347      * @param aType The type of key event.
       
   348      */
       
   349     virtual TKeyResponse HandleKeyEventL(
       
   350         const TKeyEvent& aKeyEvent,
       
   351         TEventCode aType ) = 0;
       
   352 
       
   353     /**
       
   354      * Activate the container
       
   355      */
       
   356     virtual void ActivateContainerL() = 0;
       
   357     };
       
   358 
       
   359 /**
       
   360  *  Factory class to create the common container
       
   361  *
       
   362  *  @lib mpxcommoncontainer.lib
       
   363  *  @since S60 v3.2
       
   364  */
       
   365 class CMPXCommonContainerFactory : CBase
       
   366     {
       
   367 public:
       
   368     /**
       
   369     * Factory function to create the common container
       
   370     */
       
   371     IMPORT_C static MMPXCommonContainer* NewL();
       
   372     };
       
   373 
       
   374 #endif  // MMPXCOMMONCONTAINER_H
       
   375 
       
   376 // End of File