mobilemessaging/smilui/playerinc/SmilPlayerIndicatorController.h
changeset 79 2981cb3aa489
equal deleted inserted replaced
25:84d9eb65b26f 79:2981cb3aa489
       
     1 /*
       
     2 * Copyright (c) 2005 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: SmilPlayerIndicatorController  declaration
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef SMILPLAYERINDICATORCONTROLLER_H
       
    20 #define SMILPLAYERINDICATORCONTROLLER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <coecntrl.h>
       
    24 #include <coecobs.h>
       
    25 #include "SmilPlayerTimeObserver.h"
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class CSmilPlayerPresentationController;
       
    29 class CSmilPlayerVolumeIndicatorController;
       
    30 class CSmilPlayerTimeIndicatorTimer;
       
    31 class CSmilPlayerPauseIndicatorTimer;
       
    32 class CEikLabel;
       
    33 class CEikImage;
       
    34 class CCoeBrushAndPenContext;
       
    35 class TAknsItemID;
       
    36 
       
    37 // CLASS DECLARATION
       
    38 /**
       
    39 *  Controller class of the indicators.
       
    40 */
       
    41 NONSHARABLE_CLASS(CSmilPlayerIndicatorController) : public CCoeControl,
       
    42                                                     public MCoeForegroundObserver,
       
    43                                                     public MCoeControlObserver,
       
    44                                                     public MSmilPlayerTimeObserver
       
    45     {
       
    46     public: // Constructors and destructor
       
    47 
       
    48         /**
       
    49         * Constructor.
       
    50         *
       
    51         * @param aParent         Parent control.
       
    52         * @param aPresController Presentation controller.
       
    53         * @param aVolumeEnabled  Specifies whether volume is enabled.
       
    54         *
       
    55         * @return pointer to the object
       
    56         */
       
    57         static CSmilPlayerIndicatorController * NewL( const CCoeControl* aParent, 
       
    58                                                       CSmilPlayerPresentationController* aPresController,
       
    59                                                       TBool aVolumeEnabled );
       
    60 
       
    61         /**
       
    62         * Destructor.
       
    63         */
       
    64         virtual ~CSmilPlayerIndicatorController();
       
    65 
       
    66     public: // Functions from base classes
       
    67 
       
    68         /**
       
    69         * From CoeControl
       
    70         * See the documentation from the coecntrl.h
       
    71         */
       
    72         TInt CountComponentControls() const;
       
    73 
       
    74         /**
       
    75         * From CCoeControl
       
    76         * See the documentation from the coecntrl.h
       
    77         */
       
    78         CCoeControl* ComponentControl(TInt aIndex) const;
       
    79 
       
    80         /**
       
    81         * From CCoeControl
       
    82         * See the documentation from the coecntrl.h
       
    83         */
       
    84         TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
       
    85                                      TEventCode aType );
       
    86                                   
       
    87         /**
       
    88         * From MSmilPlayerTimeObserver
       
    89         * See the documentation from the SmilPlayerTimeObserver.h
       
    90         */
       
    91         void TimeChangedL( const TDesC& aTimeString );
       
    92         
       
    93         /**
       
    94         * From MSmilPlayerTimeObserver
       
    95         * See the documentation from the SmilPlayerTimeObserver.h
       
    96         */
       
    97         TInt CurrentTime() const;
       
    98         
       
    99         /**
       
   100         * From MSmilPlayerTimeObserver
       
   101         * See the documentation from the SmilPlayerTimeObserver.h
       
   102         */
       
   103         TInt PresentationDuration() const;
       
   104         
       
   105         /**
       
   106         * From MSmilPlayerTimeObserver
       
   107         * See the documentation from the SmilPlayerTimeObserver.h
       
   108         */
       
   109         TBool IsDurationFinite() const;
       
   110         
       
   111         /**
       
   112         * From MCoeForegroundObserver 
       
   113         * See the documentation from the coemain.h
       
   114         */   
       
   115         void HandleGainingForeground();
       
   116 
       
   117         /**
       
   118         * From MCoeForegroundObserver 
       
   119         * See the documentation from the coemain.h
       
   120         */   
       
   121         void HandleLosingForeground();
       
   122         
       
   123         /** 
       
   124         * From MCoeControlObserver 
       
   125         * See the documentation from the coecobs.h
       
   126         */
       
   127 	    void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
       
   128         
       
   129         /** 
       
   130         * From CCoeControl 
       
   131         * See the documentation from the coecntrl.h
       
   132         */
       
   133         void HandlePointerEventL( const TPointerEvent& aPointerEvent );
       
   134         
       
   135         /** 
       
   136         * From CCoeControl 
       
   137         * See the documentation from the coecntrl.h
       
   138         */
       
   139         void HandleResourceChange( TInt aType );
       
   140         
       
   141     public: // new functions
       
   142         
       
   143         /**
       
   144         * Performs approriate tasks when presentation has been stopped.
       
   145         *
       
   146         * @since 3.0
       
   147         */
       
   148         void Stop();
       
   149         
       
   150         /**
       
   151         * Performs approriate tasks when presentation has been started.
       
   152         *
       
   153         * @since 3.0
       
   154         */
       
   155         void Start();
       
   156         
       
   157         /**
       
   158         * Performs approriate tasks when presentation has been resumed.
       
   159         *
       
   160         * @since 3.0
       
   161         */
       
   162         void Resume();
       
   163         
       
   164         /**
       
   165         * Performs approriate tasks when presentation has been paused.
       
   166         *
       
   167         * @since 3.0
       
   168         */
       
   169         void Pause();
       
   170         
       
   171         /**
       
   172         * Performs approriate tasks when presentation end has been reached.
       
   173         *
       
   174         * @since 3.0
       
   175         */
       
   176         void EndReached();
       
   177 
       
   178         /**
       
   179         * Returns current volume value.
       
   180         *
       
   181         * @since 3.0
       
   182         *
       
   183         * @return Current volume level.
       
   184         */
       
   185         TInt VolumeValue() const;
       
   186         
       
   187         /**
       
   188         * Sets correct layout for indicator.
       
   189         *
       
   190         * @since 3.0
       
   191         */
       
   192         void LayoutIndicators();
       
   193         
       
   194     private:
       
   195 
       
   196         /**
       
   197         * C++ constructor.
       
   198         */
       
   199         CSmilPlayerIndicatorController ( CSmilPlayerPresentationController* aPresController );
       
   200 
       
   201         /**
       
   202         * By default Symbian 2nd phase constructor is private.
       
   203         */
       
   204         void ConstructL( const CCoeControl* aParent, 
       
   205                          TBool aVolumeEnabled );
       
   206         
       
   207         /**
       
   208         * Initializes indicator.
       
   209         */
       
   210         void InitializeIconIndicatorL( CEikImage*& aIndicator, 
       
   211                                       const TAknsItemID& aItem, 
       
   212                                       const TInt aBitmapIndex,
       
   213                                       const TInt aMaskIndex ) const;
       
   214                                       
       
   215         
       
   216         /**
       
   217         * Handles skin change event.
       
   218         */
       
   219         void DoHandleSkinChangeL();
       
   220         
       
   221         /**
       
   222         * Updates the text color from currently used skin.
       
   223         */
       
   224         void UpdateTextColorL();
       
   225         
       
   226         /**
       
   227         * Sets correct bitmap for icon indicator.
       
   228         */
       
   229         void SetIconIndicatorBitmapL( CEikImage*& aIndicator, 
       
   230                                       const TAknsItemID& aItem, 
       
   231                                       const TInt aBitmapIndex,
       
   232                                       const TInt aMaskIndex ) const;
       
   233         
       
   234         /**
       
   235         * Sets specified icons extent to given one.
       
   236         */
       
   237         void SetIconIndicatorExtent( CEikImage* aIconIndicator,
       
   238                                      TRect aExtent ) const;
       
   239         
       
   240     private: // data
       
   241 
       
   242         /** Controller class for this class */
       
   243         CSmilPlayerPresentationController* iPresController;
       
   244         
       
   245         /** Controller class for volume indicator */
       
   246         CSmilPlayerVolumeIndicatorController* iVolumeController;
       
   247         
       
   248         /** Model class for time control. */
       
   249         CSmilPlayerTimeIndicatorTimer* iTimeModel;
       
   250         
       
   251         /** View class for time control*/
       
   252         CEikLabel* iTimeIndicator;
       
   253         
       
   254         /** View class for pause indicator. */
       
   255         CEikImage* iPauseIndicator;
       
   256         
       
   257         /** View class for play indicator. */
       
   258         CEikImage* iPlayIndicator;
       
   259         
       
   260         /** Specifies whether time indicator should be shown. */
       
   261         TBool iShowTimeIndicator;
       
   262     };
       
   263 
       
   264 #endif // SMILPLAYERINDICATORCONTROLLER_H
       
   265 
       
   266 // End of File