photosgallery/slideshow/view/src/shwslideshowvolumecontrol.h
changeset 0 4e91876724a2
child 24 ea65f74e6de4
equal deleted inserted replaced
-1:000000000000 0:4e91876724a2
       
     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      * Called when the control should be shown.
       
   107      * e.g. Key press and tap event
       
   108      */
       
   109     TBool ShowControlL();
       
   110 
       
   111     /**
       
   112      * Method timer calls after time out.
       
   113      */
       
   114     TInt TimerCallback();
       
   115 
       
   116 private:
       
   117 
       
   118     /**
       
   119      * C++ default constructor.
       
   120      */
       
   121     CShwSlideshowVolumeControl( CAlfEnv& aEnv,
       
   122                                 CGlxUiUtility& aUtility,
       
   123                                 TTimeIntervalMicroSeconds32 aInterval);
       
   124 
       
   125     /**
       
   126      * By default Symbian 2nd phase constructor is private.
       
   127      */
       
   128     void ConstructL( );
       
   129 
       
   130     /**
       
   131      * Helper function to retrieve and position the control's visuals
       
   132      */
       
   133     void SetAndLayoutVisualsL();
       
   134 
       
   135     /**
       
   136      * Helper function to convert the current volume to a percentage
       
   137      */	
       
   138     TInt CurrentVolumeAsPercentage();
       
   139 
       
   140     /**
       
   141      * Helper function to setup the visuals when volume is muted
       
   142      */	
       
   143     void SetMuteVisualVisibility();
       
   144 
       
   145     /**
       
   146      * Helper function to setup the visuals when volume is
       
   147      * neither muted nor maximum
       
   148      */	
       
   149     void SetValueVisualVisibilityL(TInt aVolume);
       
   150 
       
   151     /**
       
   152      * Helper function to setup the visuals when volume is maximum
       
   153      */	
       
   154     void CreateFullVolumeVisualsL(TInt aVolume);
       
   155 
       
   156     /**
       
   157      * Helper function to remove the visuals from the layout
       
   158      */	
       
   159     void RemoveLayoutVisuals();
       
   160 
       
   161     /**
       
   162      * Helper function to remove the visuals from the layout
       
   163      */	
       
   164     void RemoveControlVisuals();
       
   165 	
       
   166 private:
       
   167 	
       
   168     CGlxUiUtility& iUtility; // not owned
       
   169     
       
   170     /** main parent layout*/
       
   171     CAlfAnchorLayout* iMainVisual;
       
   172     
       
   173     /* deck layout holds the backgroung visual, mute visual and the value grid */
       
   174     CAlfDeckLayout* iVisualDeck;
       
   175     
       
   176     /**holds the speaker icon and the percentage text*/
       
   177     CAlfGridLayout* iValueGridVisual;
       
   178     
       
   179     CAlfImageBrush* iBrush; // owned
       
   180 
       
   181     // The visual elements of the control
       
   182     CAlfImageVisual* iBackgroundImageVisual; // owned
       
   183     CAlfImageVisual* iMuteImageVisual;		// owned
       
   184     CAlfImageVisual* iSpeakerImageVisual;   // owned
       
   185     CAlfTextVisual* iPercentTextVisual;   	// owned
       
   186 
       
   187     TInt iVolume;		// owned
       
   188     TInt iMaxVolume;	//owned
       
   189 
       
   190     CPeriodic*	iTimer;	// owned
       
   191     TTimeIntervalMicroSeconds32 iInterval; // owned
       
   192 
       
   193     TSize iControlSize; // owned
       
   194     CAlfEnv& iAlfEnv; //not owned
       
   195     };
       
   196 
       
   197 #endif  // C_SHWSLIDESHOWVOLUMECONTROL_H
       
   198 
       
   199 // End of File