photosgallery/slideshow/view/src/shwslideshowvolumecontrol.h
branchRCL_3
changeset 60 5b3385a43d68
child 75 01504893d9cb
equal deleted inserted replaced
59:8e5f6eea9c9f 60:5b3385a43d68
       
     1 /*
       
     2 * Copyright (c) 2007-2008 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:    Slideshow view volume control.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 #ifndef C_SHWSLIDESHOWVOLUMECONTROL_H
       
    23 #define C_SHWSLIDESHOWVOLUMECONTROL_H
       
    24 
       
    25 
       
    26 // INCLUDES
       
    27 #include <alf/alfcontrol.h>
       
    28 
       
    29 // FORWARD DECLARATION
       
    30 class CAlfImageVisual;
       
    31 class CAlfTextVisual;
       
    32 class CFbsBitmap;
       
    33 class CGlxUiUtility;
       
    34 
       
    35 class CAlfAnchorLayout;
       
    36 class CAlfBorderBrush;
       
    37 class CAlfLineVisual;
       
    38 class CAlfCurvePathLayout;
       
    39 class CShwSlideshowVolumeControl;
       
    40 class CAlfImageBrush;
       
    41 class CAlfGridLayout;
       
    42 class CAlfDeckLayout;
       
    43 class CAlfAnchorLayout;
       
    44 
       
    45 // CLASS DECLARATION
       
    46 /**
       
    47  *  Volume control declaration.
       
    48  * @internal reviewed 07/06/2007 by Kimmo Hoikka
       
    49  */
       
    50 // ---------------------------------------------------------------------------
       
    51 // CShwSlideshowVolumeControl declaration
       
    52 // --------------------------------------------------------------------------- 
       
    53 NONSHARABLE_CLASS( CShwSlideshowVolumeControl ) : public CAlfControl
       
    54     {
       
    55 public:
       
    56 
       
    57     /**
       
    58      * Two-phased constructor.
       
    59      *
       
    60      * @return Pointer to newly created object.
       
    61      */
       
    62      static CShwSlideshowVolumeControl* NewL(
       
    63         CAlfEnv& aEnv,
       
    64         CGlxUiUtility& aUtility,
       
    65         TTimeIntervalMicroSeconds32 aInterval = 0);
       
    66 
       
    67     /**
       
    68      * Destructor.
       
    69      */
       
    70     virtual ~CShwSlideshowVolumeControl();
       
    71 
       
    72     /**
       
    73      * Called when the volume is changed.
       
    74      * @param aVolume  The new volume.
       
    75      * @param aMaxVolume  The maximum volume.
       
    76      */
       
    77     void SetVolume(TInt aVolume, TInt aMaxVolume);
       
    78 
       
    79     /**
       
    80      * Notifies the control that its visible has been changed on a display.
       
    81      * This is the earliest time when the control knows the dimensions of
       
    82      * the display it is being shown on.
       
    83      *
       
    84      * @param aIsVisible  ETrue, if the control is now visible on the
       
    85      *			display.   EFalse, if the control is about to the hidden 
       
    86      *			on the display.
       
    87      * @param aDisplay    The display on which the control's visibility 
       
    88      * 			is changing.
       
    89      * @see CHuiControl
       
    90      */	
       
    91     void NotifyControlVisibility(TBool aIsVisible, CAlfDisplay& aDisplay);
       
    92 
       
    93     /**
       
    94      * Called when the control should be redrawn,
       
    95      * e.g. after a change in volume.
       
    96      */
       
    97     void RefreshL();
       
    98 
       
    99     /**
       
   100      * Called when the control should be hidden,
       
   101      * e.g. after a change in volume.
       
   102      */
       
   103     void Hide();
       
   104     
       
   105     /**
       
   106      * Initilize the control textures
       
   107      * e.g. When slideshow engine started or
       
   108      * textures are removed due to foreground lost event
       
   109      */
       
   110     void InitControlTextureL();
       
   111 
       
   112     /**
       
   113      * Called when the control should be shown.
       
   114      * e.g. Key press and tap event
       
   115      */
       
   116     TBool ShowControlL();
       
   117 
       
   118     /**
       
   119      * Method timer calls after time out.
       
   120      */
       
   121     TInt TimerCallback();
       
   122 
       
   123 private:
       
   124 
       
   125     /**
       
   126      * C++ default constructor.
       
   127      */
       
   128     CShwSlideshowVolumeControl( CAlfEnv& aEnv,
       
   129                                 CGlxUiUtility& aUtility,
       
   130                                 TTimeIntervalMicroSeconds32 aInterval);
       
   131 
       
   132     /**
       
   133      * By default Symbian 2nd phase constructor is private.
       
   134      */
       
   135     void ConstructL( );
       
   136 
       
   137     /**
       
   138      * Helper function to retrieve and position the control's visuals
       
   139      */
       
   140     void SetAndLayoutVisualsL();
       
   141 
       
   142     /**
       
   143      * Helper function to convert the current volume to a percentage
       
   144      */	
       
   145     TInt CurrentVolumeAsPercentage();
       
   146 
       
   147     /**
       
   148      * Helper function to setup the visuals when volume is muted
       
   149      */	
       
   150     void SetMuteVisualVisibility();
       
   151 
       
   152     /**
       
   153      * Helper function to setup the visuals when volume is
       
   154      * neither muted nor maximum
       
   155      */	
       
   156     void SetValueVisualVisibilityL(TInt aVolume);
       
   157 
       
   158     /**
       
   159      * Helper function to setup the visuals when volume is maximum
       
   160      */	
       
   161     void CreateFullVolumeVisualsL(TInt aVolume);
       
   162 
       
   163     /**
       
   164      * Helper function to remove the visuals from the layout
       
   165      */	
       
   166     void RemoveLayoutVisuals();
       
   167 
       
   168     /**
       
   169      * Helper function to remove the visuals from the layout
       
   170      */	
       
   171     void RemoveControlVisuals();
       
   172 	
       
   173 private:
       
   174 	
       
   175     CGlxUiUtility& iUtility; // not owned
       
   176     
       
   177     /** main parent layout*/
       
   178     CAlfAnchorLayout* iMainVisual;
       
   179     
       
   180     /* deck layout holds the backgroung visual, mute visual and the value grid */
       
   181     CAlfDeckLayout* iVisualDeck;
       
   182     
       
   183     /**holds the speaker icon and the percentage text*/
       
   184     CAlfGridLayout* iValueGridVisual;
       
   185     
       
   186     CAlfImageBrush* iBrush; // owned
       
   187 
       
   188     // The visual elements of the control
       
   189     CAlfImageVisual* iBackgroundImageVisual; // owned
       
   190     CAlfImageVisual* iMuteImageVisual;		// owned
       
   191     CAlfImageVisual* iSpeakerImageVisual;   // owned
       
   192     CAlfTextVisual* iPercentTextVisual;   	// owned
       
   193 
       
   194     TInt iVolume;		// owned
       
   195     TInt iMaxVolume;	//owned
       
   196 
       
   197     CPeriodic*	iTimer;	// owned
       
   198     TTimeIntervalMicroSeconds32 iInterval; // owned
       
   199 
       
   200     TSize iControlSize; // owned
       
   201     CAlfEnv& iAlfEnv; //not owned
       
   202     };
       
   203 
       
   204 #endif  // C_SHWSLIDESHOWVOLUMECONTROL_H
       
   205 
       
   206 // End of File