mpxplugins/viewplugins/views/inc/mpxcommonplaybackviewcontainer.h
changeset 0 ff3acec5bc43
child 1 8118492f1bdf
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 playback view's container implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CMPXCOMMONPLAYBACKVIEWCONTAINER_H
       
    21 #define CMPXCOMMONPLAYBACKVIEWCONTAINER_H
       
    22 
       
    23 
       
    24 // INCLUDES
       
    25 #include <coecntrl.h>
       
    26 
       
    27 #include "mpxcommonplaybackviewdefs.h"
       
    28 #include "mpxalbumartutilobserver.h"
       
    29 #include "mpxbutton.h"
       
    30 #include "mpxplaybackframeworkdefs.h"
       
    31 
       
    32 
       
    33 // FORWARD DECLARATIONS
       
    34 class MEikCommandObserver;
       
    35 class MAknsControlContext;
       
    36 class CAknIconArray;
       
    37 class CMPXPlaybackViewInfoLabel;
       
    38 class MMPXLayoutSwitchObserver;
       
    39 class CMPXCommonUiHelper;
       
    40 class CMPXButtonManager;
       
    41 class MMPXPlaybackViewLayout;
       
    42 
       
    43 // CLASS DECLARATION
       
    44 
       
    45 /**
       
    46  *  Container class for audio view.
       
    47  *
       
    48  *  @lib mpxplaybackview.lib
       
    49  *  @since S60 v3.0
       
    50  */
       
    51 class CMPXCommonPlaybackViewContainer : public CCoeControl,
       
    52                                                  public MMPXAlbumArtUtilObserver,
       
    53                                                  public MMPXButtonCmdObserver
       
    54     {
       
    55 public:
       
    56 
       
    57     /**
       
    58      * Symbian 2nd phase constructor.
       
    59      *
       
    60      * @param aRect Frame rectangle for container.
       
    61      */
       
    62     IMPORT_C virtual void ConstructL( const TRect& aRect );
       
    63 
       
    64     /**
       
    65      * Destructor.
       
    66      */
       
    67     IMPORT_C virtual ~CMPXCommonPlaybackViewContainer();
       
    68 
       
    69     /**
       
    70      * Updates time indicators.
       
    71      *
       
    72      * @since S60 3.0
       
    73      * @param  aPlaybackPosInSeconds, New playback postions
       
    74      * @param  aTotalLengthInSeconds, Clips duration
       
    75      */
       
    76     IMPORT_C virtual void UpdateTimeIndicatorsL(
       
    77         TInt aPlaybackPosInSeconds,
       
    78         TInt aTotalLengthInSeconds );
       
    79 
       
    80     /**
       
    81      * Updates label
       
    82      *
       
    83      * @since S60 3.0
       
    84      * @param aLabel Label which is updated
       
    85      * @param aText New text value
       
    86      */
       
    87     IMPORT_C virtual void UpdateLabelL(
       
    88         TMPXPbvTextIndicator aLabel,
       
    89         const TDesC& aText );
       
    90 
       
    91     /**
       
    92      * Sets main pane mode.
       
    93      *
       
    94      * @since S60 3.0
       
    95      * @param aMode Playback mode.
       
    96      */
       
    97     IMPORT_C virtual void SetMode( TMPXPbvPlaybackMode aMode );
       
    98 
       
    99     /**
       
   100      * Set random mode.
       
   101      *
       
   102      * @since S60 3.0
       
   103      * @param aRandomMode ETrue if random is on.
       
   104      */
       
   105     IMPORT_C virtual void SetRandomMode( TBool aRandomMode );
       
   106 
       
   107     /**
       
   108      * Set repeat mode.
       
   109      *
       
   110      * @since S60 3.0
       
   111      * @param aRepeatAll ETrue if repeat all is on.
       
   112      * @param aRepeatOne ETrue if repeat one is on.
       
   113      */
       
   114     IMPORT_C virtual void SetRepeatMode(
       
   115         TBool aRepeatAll,
       
   116         TBool aRepeatOne );
       
   117 
       
   118     /**
       
   119      * Set Real Audio mode.
       
   120      *
       
   121      * @since S60 3.2
       
   122      * @param aRealAudioMode ETrue if a Real Audio file is being played.
       
   123      */
       
   124     IMPORT_C virtual void SetRealAudioMode( TBool aRealAudioMode );
       
   125 
       
   126     /**
       
   127     * Update buttons according to current state.
       
   128     *
       
   129     * @since 3.0
       
   130     */
       
   131     IMPORT_C virtual void UpdateButtons( TMPXPlaybackState aState );
       
   132 
       
   133     /**
       
   134      * Set layout for all elements and set sizes for icons.
       
   135      *
       
   136      * @since S60 3.0
       
   137      */
       
   138     IMPORT_C virtual void UpdateLayout();
       
   139 
       
   140     /**
       
   141      * Updates duration label.
       
   142      *
       
   143      * @since S60 3.0
       
   144      * @param  aTotalLengthInSeconds, Clips duration
       
   145      */
       
   146     IMPORT_C virtual void UpdateDurationLabelL( TInt aTotalLengthInSeconds );
       
   147 
       
   148     /**
       
   149      * Force softkey label colors to what is specified in skin
       
   150      * for Music Player soft keys.
       
   151      *
       
   152      * @since S60 3.0
       
   153      */
       
   154     IMPORT_C virtual void UpdateSoftkeyColors();
       
   155 
       
   156     /**
       
   157      * Handles foreground events
       
   158      *
       
   159      * @since S60 3.0
       
   160      * @param aForeground ETrue if app is going to foreground, EFalse otherwise
       
   161      */
       
   162     IMPORT_C virtual void HandleForegroundEventL( TBool aForeground );
       
   163 
       
   164 // from base class MMPXAlbumArtUtilObserver
       
   165 
       
   166     /**
       
   167      * From MMPXAlbumArtUtilObserver.
       
   168      * Notify that extraction of album art started.
       
   169      */
       
   170     IMPORT_C virtual void ExtractAlbumArtStarted();
       
   171 
       
   172     /**
       
   173      * From MMPXAlbumArtUtilObserver.
       
   174      * Album art is extracted from file and ready to use.
       
   175      *
       
   176      * @param aBitmap a converted image. Ownership is transferred.
       
   177      * @param aErr error code
       
   178      */
       
   179     IMPORT_C virtual void ExtractAlbumArtCompleted(
       
   180         CFbsBitmap* aBitmap,
       
   181         TInt aErr );
       
   182 
       
   183 // from base class CoeControl
       
   184 
       
   185     /**
       
   186      * From CoeControl.
       
   187      * Handles key events.
       
   188      *
       
   189      * @param aKeyEvent The key event.
       
   190      * @param aType The type of key event.
       
   191      */
       
   192     IMPORT_C virtual TKeyResponse OfferKeyEventL(
       
   193         const TKeyEvent& aKeyEvent,
       
   194         TEventCode aType );
       
   195 
       
   196     /**
       
   197      * From CoeControl.
       
   198      * Handles a change to the control's resources.
       
   199      *
       
   200      * @param aType A message UID value.
       
   201      */
       
   202     IMPORT_C virtual void HandleResourceChange( TInt aType );
       
   203 
       
   204     /**
       
   205      * From CoeControl.
       
   206      * Gets the control's help context.
       
   207      *
       
   208      * @param aContext The control's help context.
       
   209      */
       
   210     IMPORT_C virtual void GetHelpContext( TCoeHelpContext& aContext ) const;
       
   211 
       
   212     /**
       
   213      * Starts marquee for a playback label
       
   214      *
       
   215      * @param aLabel Label to start marquee
       
   216      */
       
   217     IMPORT_C virtual void StartMarquee( TMPXPbvTextIndicator aLabel );
       
   218 
       
   219 protected:
       
   220 
       
   221     /**
       
   222      * Create background images
       
   223      */
       
   224     IMPORT_C virtual void CreateBackgroundImagesL();
       
   225 
       
   226     /**
       
   227      * Creates labels.
       
   228      */
       
   229     IMPORT_C virtual void CreateLabelsL();
       
   230 
       
   231     /**
       
   232      * Creates icons.
       
   233      * Any subclass which overrides this must call this base class method
       
   234      * first or else the common icons will not be created.
       
   235      */
       
   236     IMPORT_C virtual void CreateIconsL();
       
   237 
       
   238     /**
       
   239      * Deletes all icon objects.
       
   240      */
       
   241     IMPORT_C void FreeIcons();
       
   242 
       
   243     /**
       
   244      * Draw an icon
       
   245      *
       
   246      * @since 3.0
       
   247      * @param aGc            Graphics context to draw to
       
   248      * @param aDirtyRect     Part of the screen that needs redrawing
       
   249      * @param aIndicatorRect Position for the icon
       
   250      * @param aIcon          Icon and mask
       
   251      * @param aInvertMask    Invert mask (see CBitmapContext::BitBltMasked)
       
   252      */
       
   253     IMPORT_C virtual void DrawIndicator(
       
   254         CBitmapContext& aGc,
       
   255         const TRect& aDirtyRect,
       
   256         const TRect& aIndicatorRect,
       
   257         const CGulIcon* aIcon,
       
   258         TBool aInvertMask = ETrue ) const;
       
   259 
       
   260     /**
       
   261      * Redraw part of the screen to the bitmap context.
       
   262      *
       
   263      * @param aRect Area to be redrawn.
       
   264      * @param aGc Graphics context to draw to.
       
   265      */
       
   266     IMPORT_C virtual void RedrawRect(
       
   267         const TRect& aRect,
       
   268         CBitmapContext& aGc) const;
       
   269 
       
   270     /**
       
   271      * Update progress bar graphics based on current playback
       
   272      * and download position.
       
   273      */
       
   274     IMPORT_C virtual void UpdateProgressBarGraphics();
       
   275 
       
   276     /**
       
   277      * Update progress bar graphics and redraw.
       
   278      */
       
   279     IMPORT_C virtual void RefreshProgressBar();
       
   280 
       
   281     /**
       
   282      * Update label text color according to skin
       
   283      */
       
   284     IMPORT_C virtual void UpdateLabelColorsL();
       
   285 
       
   286     /**
       
   287      * Update skin control context for background
       
   288      *
       
   289      * @param aRect Area to be updated.
       
   290      */
       
   291     IMPORT_C virtual void UpdateBackgroundSkinControlContext( const TRect& aRect );
       
   292 
       
   293     /**
       
   294      * Set FMTX mode.
       
   295      *
       
   296      * @since S60 3.2
       
   297      * @param aFMTXMode ETrue if the view supports FMTX label.
       
   298      */
       
   299     IMPORT_C virtual void SetFMTXMode( TBool aFMTXMode );
       
   300 
       
   301 // from base class CoeControl
       
   302 
       
   303     /**
       
   304      * From CCoeControl.
       
   305      * Responds to changes to the size and position of the contents of this
       
   306      * control.
       
   307      */
       
   308     IMPORT_C virtual void SizeChanged();
       
   309 
       
   310     /**
       
   311      * From CCoeControl.
       
   312      * Gets the number of controls contained in a compound control.
       
   313      *
       
   314      * @return The number of component controls contained by this control.
       
   315      */
       
   316     IMPORT_C virtual TInt CountComponentControls() const;
       
   317 
       
   318     /**
       
   319      * From CCoeControl.
       
   320      * Gets an indexed component of a compound control.
       
   321      *
       
   322      * @param aIndex The index of the control.
       
   323      * @return The component control with an index of aIndex.
       
   324      */
       
   325     IMPORT_C virtual CCoeControl* ComponentControl( TInt aIndex ) const;
       
   326 
       
   327     /**
       
   328      * From CCoeControl.
       
   329      * Draws the control.
       
   330      *
       
   331      * @param aRect The rectangular region of the control to be drawn.
       
   332      */
       
   333     IMPORT_C virtual void Draw( const TRect& aRect ) const;
       
   334 
       
   335 // from base class MMPXButtonCmdObserver
       
   336 
       
   337     /**
       
   338      * From MMPXButtonCmdObserver
       
   339      * Handle a button command.
       
   340      * @param aCommand Command id, as specified in the button constructor.
       
   341      */
       
   342    IMPORT_C virtual void HandleButtonCommandL( TInt aCommand );
       
   343 
       
   344     /**
       
   345      * From CCoeControl.
       
   346      * Handle events from the touch screen
       
   347      * since 5.0
       
   348      */
       
   349     IMPORT_C virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent);
       
   350 
       
   351 public:
       
   352 
       
   353     /**
       
   354      * Gets song position (from touch progress bar)
       
   355      * since 5.0
       
   356      */
       
   357     IMPORT_C virtual TInt GetNewSongPosition();
       
   358     
       
   359     /**
       
   360      * Sets song position (from currently playback position)
       
   361      * since 5.0
       
   362      */
       
   363     void SetNewSongPosition( const TInt64& aPositon );
       
   364 
       
   365     /**
       
   366      * Restore Buttons' state in some special case
       
   367      *
       
   368      * @since S60 3.0
       
   369      */
       
   370     void RestoreButtons( TMPXPlaybackState aState );
       
   371 
       
   372     TInt CallSetPosition();
       
   373 
       
   374     static TInt CallSetPosition( TAny* aAny );
       
   375     
       
   376     /**
       
   377      * Sets the ordinal position of a window.
       
   378      *
       
   379      * @param aNewOrdinalPosition The window's new ordinal position
       
   380      * 
       
   381      * @since S60 3.0
       
   382      */
       
   383     void AdjustOrdinalPosition( TInt aNewOrdinalPosition );
       
   384 
       
   385 private:
       
   386 
       
   387     /**
       
   388      * Set layout for all elements and set sizes for icons.
       
   389      */
       
   390     void DoUpdateLayoutL();
       
   391 
       
   392  protected:   // data
       
   393 
       
   394     MEikCommandObserver* iCommandObserver;  // not owned
       
   395     MMPXLayoutSwitchObserver*    iLayoutObserver;   // not owned
       
   396     RPointerArray<CMPXPlaybackViewInfoLabel> iLabels;   // owned
       
   397 
       
   398     CFbsBitmap* iOffScreenBitmap;       // owned
       
   399     CFbsBitGc* iOSBitmapContext;        // owned
       
   400     CFbsBitmapDevice* iOSBitmapDevice;  // owned
       
   401 
       
   402     HBufC* iMinSecFormatString;         // owned
       
   403     HBufC* iShortFormatString;          // owned
       
   404 
       
   405     CGulIcon* iPlayIcon;                // owned
       
   406     CGulIcon* iPauseIcon;               // owned
       
   407     CGulIcon* iRandomIcon;              // owned
       
   408     CGulIcon* iRepeatOneIcon;           // owned
       
   409     CGulIcon* iRepeatAllIcon;           // owned
       
   410 
       
   411     CGulIcon* iDownloadSlider;          // owned
       
   412     CGulIcon* iPlaybackSlider;          // owned
       
   413     CGulIcon* iSliderBackground;        // owned
       
   414 
       
   415     CGulIcon* iDefaultAlbumArt;         // owned
       
   416     CFbsBitmap* iTrackAlbumArt;         // owned
       
   417 
       
   418 #ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
       
   419     CGulIcon* iRealIcon;                // owned
       
   420 #endif
       
   421 
       
   422     MAknsControlContext* iBackground;   // owned
       
   423 
       
   424     CMPXCommonUiHelper* iCommonUiHelper;    // owned
       
   425 
       
   426     TRect iBackgroundLayout;
       
   427     TRect iIconLayout;
       
   428     TRect iRandomIconRect;
       
   429     TRect iRepeatIconRect;
       
   430     TRect iSliderPaneRect;
       
   431     TRect iSliderBackgroundRect;
       
   432     TRect iPlaybackSliderRect;
       
   433     TRect iDownloadSliderRect;
       
   434     TRect iAlbumArtRect;
       
   435 #ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
       
   436     TRect iRealIconRect;
       
   437 #endif
       
   438 
       
   439     TMPXPbvPlaybackMode iMode;
       
   440 
       
   441     TBool iRepeatAllMode;
       
   442     TBool iRepeatOneMode;
       
   443     TBool iRandomMode;
       
   444 #ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
       
   445     TBool iRealAudioMode;
       
   446 #endif
       
   447     TBool iFMTXMode;
       
   448 
       
   449     TRect iCurrentLayout;
       
   450 
       
   451     // Progress bar position - download
       
   452     TReal iDownloadRatio;
       
   453 
       
   454     // Progress bar position - playback
       
   455     TReal iPlaybackRatio;
       
   456 
       
   457     TBool iEqualizerEnabled;
       
   458     TBool iEnableButtons;
       
   459     TBool iEnableVolumeIndicator;
       
   460     TBool iEnableMarquee;
       
   461     TBool iDisplayAlbumArt;
       
   462     TBool iPrerollCompleted;
       
   463 
       
   464     CMPXButtonManager*  iButtonManager; // owned
       
   465     CIdle* iIdle;
       
   466     TInt iIdleTaskCompleted;
       
   467     MMPXPlaybackViewLayout* iLayout;    // not owned
       
   468     CPeriodic* iSeekTimer;
       
   469 
       
   470     TInt iTrackTotalLengthInSeconds;
       
   471     TInt64 iNewSongPosition; // Final position from touch progress bar
       
   472     TBool iTouchDown;        // Flag indicating touch progress bar is in use
       
   473     TBool iActiveView;
       
   474 
       
   475     // mutable is used so that conts Draw method can change the state
       
   476     mutable TBool iRefreshBackBuffer; 
       
   477     TBool iDragProgressBar; //Flag drag progress bar
       
   478     };
       
   479 
       
   480 #endif  // CMPXCOMMONPLAYBACKVIEWCONTAINER_H
       
   481 
       
   482 // End of File