mpxplugins/viewplugins/views/collectionview/inc/mpxcollectionviewcontainer.h
changeset 0 ff3acec5bc43
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 Collection view container implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CMPXCOLLECTIONVIEWCONTAINER_H
       
    21 #define CMPXCOLLECTIONVIEWCONTAINER_H
       
    22 
       
    23 
       
    24 // INCLUDES
       
    25 #include <mpxcommonframeworkdefs.h> // TMPXItemId
       
    26 #include "mpxviewcontainer.h"
       
    27 #include "mpxcommoncontainer.h"
       
    28 
       
    29 // FORWARD DECLARATION
       
    30 class TAknsItemID;
       
    31 class CAknContextPane;
       
    32 class CMPXCommonContainerFactory;
       
    33 class MMPXCommonContainer;
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 /**
       
    38  *  MPX Collection view container.
       
    39  *
       
    40  *  @lib mpxcollectionview.lib
       
    41  *  @since S60 v3.1
       
    42  */
       
    43 NONSHARABLE_CLASS( CMPXCollectionViewContainer )
       
    44     : public CBase
       
    45     , public MMPXViewContainer
       
    46     , public MMPXCommonListBoxArrayObserver
       
    47     {
       
    48 public:
       
    49 
       
    50     /**
       
    51      * Two-phased constructor.
       
    52      *
       
    53      * @since 5.1
       
    54      * @param aView Command observer.
       
    55      * @param aObserver MEikListBoxObserver
       
    56      * @param aIsEmbedded ETrue to indicate that view is embedded
       
    57      * @return Pointer to newly created object.
       
    58      */
       
    59     static CMPXCollectionViewContainer* NewL(
       
    60         MEikCommandObserver* aView,
       
    61         MEikListBoxObserver* aObserver,
       
    62         TBool aIsEmbedded );
       
    63 
       
    64     /**
       
    65      * Destructor.
       
    66      */
       
    67     virtual ~CMPXCollectionViewContainer();
       
    68 
       
    69     /**
       
    70      * Sets playback status with item id
       
    71      *
       
    72      * @param aId item id of the song
       
    73      * @param aStatus status of the song
       
    74      */
       
    75     void SetPlaybackStatusByIdL( TMPXItemId aId, TMPXPlaybackState aStatus, TInt aIndex = 0 );
       
    76 
       
    77     /**
       
    78      * Get current playback index
       
    79      *
       
    80      * @return Current playback index, KErrNotFound if nothing is playing
       
    81      */
       
    82     TInt PlaybackIndex();
       
    83 
       
    84     /**
       
    85      * Activates reorder mode
       
    86      *
       
    87      * @param aEnable ETrue to enable reorder mode, EFalse to disable
       
    88      */
       
    89     void ActivateReorderMode( TBool aEnable );
       
    90 
       
    91     /**
       
    92      * Set reorder mode
       
    93      *
       
    94      * @param aEnable ETrue to enable reorder mode, EFalse to disable reorder mode
       
    95      * @param aIndex current selected index
       
    96      */
       
    97     void SetReorderGrabbedMode( TBool aEnable, TInt aIndex = 0 );
       
    98 
       
    99     /**
       
   100      * Determines if it's currently in reorder mode
       
   101      *
       
   102      * @return ETrue if in reorder mode, EFalse otherwise
       
   103      */
       
   104     TBool IsInReorderMode();
       
   105 
       
   106     /**
       
   107      * Move current reorder index relatively
       
   108      *
       
   109      * @param aDirection +1 to move down, -1 to move up
       
   110      */
       
   111     void MoveReorderIndex( TInt aDirection );
       
   112 
       
   113     /**
       
   114      * Set current reorder index
       
   115      *
       
   116      * @param aIndex current reorder index
       
   117      */
       
   118     void SetReorderIndex( TInt aIndex );
       
   119 
       
   120     /**
       
   121      * Confirm reorder
       
   122      */
       
   123     void ConfirmReorderL();
       
   124 
       
   125     /**
       
   126      * Cancel reorder
       
   127      */
       
   128     void CancelReorder();
       
   129 
       
   130     /**
       
   131      * Gets original index of currently selected item in reorder mode
       
   132      */
       
   133     TInt GetOriginalIndex();
       
   134 
       
   135     /**
       
   136      * Update Titlepane icon to reorder image
       
   137      */
       
   138     void UpdateReorderTitleIconL();
       
   139 
       
   140     /**
       
   141      * Update titlepane to use original icon
       
   142      */
       
   143     void RestoreOriginalTitleIconL();
       
   144 
       
   145     /**
       
   146      * Content is ready
       
   147      */
       
   148     void ContentIsReady( TBool aReady );
       
   149 
       
   150     /**
       
   151      * Return common container
       
   152      *
       
   153      * @since 3.2
       
   154      */
       
   155     MMPXCommonContainer* Common();
       
   156 
       
   157 // from base class MMPXViewContainer
       
   158 
       
   159     /**
       
   160      * Handles key events.
       
   161      *
       
   162      * @param aKeyEvent The key event.
       
   163      * @param aType The type of key event.
       
   164      */
       
   165     TKeyResponse HandleKeyEventL(
       
   166         const TKeyEvent& aKeyEvent,
       
   167         TEventCode aType );
       
   168 
       
   169     /**
       
   170      * Handles the retrieval of the view container's help context.
       
   171      *
       
   172      * @param aContext The control's help context.
       
   173      */
       
   174     void HandleHelpContext( TCoeHelpContext& aContext ) const;
       
   175 
       
   176     /**
       
   177      * Returns the indicators for the specified item within the view container
       
   178      *
       
   179      * @param aIndex specified array index
       
   180      * @return Indicator icon indices
       
   181      */
       
   182     RArray<TInt> IndicatorsL( TInt aIndex );
       
   183 
       
   184 private:
       
   185 
       
   186     /**
       
   187      * C++ constructor.
       
   188      */
       
   189     CMPXCollectionViewContainer(
       
   190         MEikCommandObserver* aView,
       
   191         MEikListBoxObserver* aObserver,
       
   192         TBool aIsEmbedded);
       
   193 
       
   194     /**
       
   195      * Symbian 2nd phase constructor.
       
   196      */
       
   197     void ConstructL();
       
   198 
       
   199     /**
       
   200      * Creates listbox array
       
   201      */
       
   202     CMPXCommonListBoxArrayBase* CreateListBoxArrayL();
       
   203 
       
   204 // from base class MMPXCommonListBoxArrayObserver
       
   205 
       
   206     /**
       
   207      * From MMPXCommonListBoxArrayObserver.
       
   208      * Handle listbox array events
       
   209      *
       
   210      *  @param aEvent list box event
       
   211      */
       
   212     void HandleListBoxArrayEventL(
       
   213         MMPXCommonListBoxArrayObserver::TMPXCommonListBoxArrayEvents aEvent );
       
   214 
       
   215 private: // data member
       
   216 
       
   217     MMPXCommonContainer*            iCommonContainer; // Owned
       
   218     MEikCommandObserver*            iView; // not owned
       
   219     MEikListBoxObserver*            iListBoxObserver; // not owned
       
   220     CAknContextPane*                iContextPane;    // Not owned
       
   221     CMPXCollectionViewListBoxArray* iLbxArray; // Not owned
       
   222     CEikImage*                      iNewIcon;  // New context icon, owned
       
   223     CEikImage*                      iOrigIcon;  // New context icon, not owned
       
   224     TBool                           iReorder;
       
   225     TBool                           iReady;
       
   226     TBool                           iIsEmbedded;
       
   227     };
       
   228 
       
   229 #endif  // CMPXCOLLECTIONVIEWCONTAINER_H
       
   230 
       
   231 // End of File