camerauis/cameraapp/generic/inc/CamCaptureSetupSlider.h
branchRCL_3
changeset 24 bac7acad7cb3
equal deleted inserted replaced
23:61bc0f252b2b 24:bac7acad7cb3
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Class for showing the EV slider*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 #ifndef __CCAMCAPTURESETUPSLIDER_H
       
    20 #define __CCAMCAPTURESETUPSLIDER_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <coecntrl.h>
       
    24 #include <AknUtils.h>                       // for TAknLayoutText
       
    25  
       
    26 #include "CamSettingsInternal.hrh"
       
    27 #include "CamSettings.hrh"  
       
    28 #include "Cam.hrh"
       
    29 #include "CamSettingValueObserver.h"
       
    30 
       
    31 
       
    32 /**
       
    33 * Utility class used to group together related layout information into one
       
    34 * object, and construct itself using a supplied resource reader.
       
    35 *
       
    36 *  @since 2.8
       
    37 */
       
    38 class CCamSliderLegend : public CBase
       
    39     {
       
    40 public:
       
    41     virtual ~CCamSliderLegend();
       
    42 
       
    43     CCamSliderLegend( TBool aFullySkinned=EFalse );
       
    44     /**
       
    45     * Constructs the layout information for a text object
       
    46     * @since 5.0
       
    47     * @param aRect The parent rect for the layout entries
       
    48     * @param aLayout Layout for the text
       
    49     */
       
    50     void ConstructTextL(
       
    51             TResourceReader& aReader,
       
    52             const TRect& aRect,
       
    53             const TAknTextComponentLayout& aLayout );
       
    54  
       
    55     /**
       
    56     * Constructs the layout information for an icon object
       
    57     * @since 5.0
       
    58     * @param aRect The parent rect for the layout entries
       
    59     * @param aLayout Layout for the icon
       
    60     */
       
    61     void ConstructIconL(
       
    62             TResourceReader& aReader,
       
    63             const TRect& aRect,
       
    64             const TAknWindowComponentLayout& aLayout );
       
    65 
       
    66     /**
       
    67     * Draws the legend
       
    68     * @since 2.8
       
    69     * @param aGc The window contest to use for the drawing 
       
    70     */
       
    71     void Draw( CWindowGc& aGc ) const;
       
    72 
       
    73     /**
       
    74     * Returns the rect for the legend
       
    75     * @since 2.8
       
    76     * @return The rect for the legend
       
    77     */
       
    78     TRect Rect() const;
       
    79     
       
    80 private:
       
    81     TCamSliderLegendItem iItem;
       
    82     TAknLayoutText iPosition; 
       
    83     HBufC* iText;
       
    84 	TAknLayoutRect iIconRect;
       
    85 	CFbsBitmap* iBitmap;
       
    86 	CFbsBitmap* iMask;
       
    87     TBool iFullySkinned;
       
    88     };
       
    89 
       
    90 
       
    91 
       
    92 /**
       
    93 *  Slider for showing Exposure Value in capture settings 
       
    94 *
       
    95 *  @since 2.8
       
    96 */
       
    97 class CCamCaptureSetupSlider : public CCoeControl
       
    98     {
       
    99     public:  // Constructors and destructor
       
   100         
       
   101         /**
       
   102         * Two-phased constructor.
       
   103         */
       
   104         static CCamCaptureSetupSlider* NewL( const CCoeControl* aParent, 
       
   105                                              MCamSettingValueObserver* aObserver,
       
   106                                              TCamSettingItemIds aSettingType,
       
   107                                              TInt aSteps,
       
   108                                              TBool aFullySkinned=EFalse );
       
   109         
       
   110         /**
       
   111         * Destructor.
       
   112         */
       
   113         virtual ~CCamCaptureSetupSlider();
       
   114 
       
   115     public: // New functions
       
   116         
       
   117         /**
       
   118         * Sets up the range and initial value of the slider
       
   119         * @since 2.8
       
   120         * @param aValue The value to start with on the slider.                  
       
   121         */        
       
   122         void InitializeL( TInt aValue );
       
   123 
       
   124         /**
       
   125         * Returns the minium slider value
       
   126         * @since 2.8
       
   127         * @return The minimum slider value                  
       
   128         */  
       
   129         TInt MinValue() const;
       
   130 
       
   131         /**
       
   132         * Returns the maximum slider value
       
   133         * @since 2.8
       
   134         * @return The maximum slider value                  
       
   135         */  
       
   136         TInt MaxValue() const;
       
   137 
       
   138                 
       
   139         /**
       
   140         * Sets the minimum and maximum values of the slider control
       
   141         * @since 3.0
       
   142         * @param aMin The minimum slider value
       
   143         * @param aMax The maximum slider value
       
   144         */              
       
   145         void SetRange( TInt aMin, TInt aMax );
       
   146 
       
   147     public: // Functions from base classes
       
   148 
       
   149         /**
       
   150         * From CCoeControl
       
   151         * @since 2.8
       
   152         * @param aRect Rect indicating the specific area to draw
       
   153         */        
       
   154         void Draw( const TRect& aRect ) const;
       
   155 
       
   156         /**
       
   157         * From CCoeControl
       
   158         * @since 2.8
       
   159         * @param aKeyEvent Details of the key event
       
   160         * @param aType The keypress type
       
   161         * @return TKeyResponse whether the key event was handled or ignored
       
   162         */     
       
   163         TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) ;
       
   164 
       
   165         /**
       
   166         * From CCoeControl
       
   167         * @since 2.8
       
   168         * @return The minimum size required for the control to display
       
   169         */     
       
   170         TSize MinimumSize();   
       
   171 
       
   172         /**
       
   173         * From CCoeControl
       
   174         * @since 2.8
       
   175         */    
       
   176         void SizeChanged();
       
   177         
       
   178         /**
       
   179         * From CCoeControl
       
   180         * @
       
   181         */   
       
   182         void HandlePointerEventL(const TPointerEvent& aPointerEvent);
       
   183         
       
   184     protected:  // New functions
       
   185 
       
   186     protected:  // Functions from base classes
       
   187 
       
   188     private:
       
   189 
       
   190         /**
       
   191         * C++ default constructor.
       
   192         */
       
   193         CCamCaptureSetupSlider( MCamSettingValueObserver* aObserver, 
       
   194                                 TCamSettingItemIds aSettingType,
       
   195                                 TInt aSteps, TBool aFullySkinned=EFalse );
       
   196 
       
   197         /**
       
   198         * By default Symbian 2nd phase constructor is private.
       
   199         */
       
   200         void ConstructL( const CCoeControl* aParent );
       
   201         
       
   202         /**
       
   203         * Called to read the layout information from a resource 
       
   204         * @since 2.8
       
   205         */  
       
   206         void ReadLayoutL();
       
   207 
       
   208         /*
       
   209         *  Read touch layout
       
   210         */
       
   211         void TouchLayoutL();
       
   212 
       
   213         /*
       
   214         *  Read non-touch layout
       
   215         */        
       
   216         void NonTouchLayoutL();
       
   217 
       
   218         /*
       
   219         *  Read touch contrast layout
       
   220         */        
       
   221         void TouchContrastLayoutL( const TRect& aParentRect );
       
   222 
       
   223         /*
       
   224         *  Read non-touch contrast layout
       
   225         */        
       
   226         void NonTouchContrastLayoutL( const TRect& aParentRect );
       
   227 
       
   228         /*
       
   229         *  Read touch exposure value layout
       
   230         */        
       
   231         void TouchEVLayoutL( const TRect& aParentRect );
       
   232 
       
   233         /*
       
   234         *  Read non-touch exposure value layout
       
   235         */
       
   236         void NonTouchEVLayoutL( const TRect& aParentRect );
       
   237 
       
   238         /*
       
   239         *  Initialzing slider values
       
   240         */
       
   241         void InitializeSliderValuesL();
       
   242         
       
   243         
       
   244     public:     // Data
       
   245     
       
   246     protected:  // Data
       
   247 
       
   248     private:    // Data
       
   249 
       
   250         // Bitmap and mask for slider "shaft"
       
   251         CFbsBitmap* iBitmapShaft;
       
   252         CFbsBitmap* iBitmapShaftMask;
       
   253 
       
   254         // Bitmap and mask for slider "thumb"
       
   255         CFbsBitmap* iBitmapThumb;        
       
   256         CFbsBitmap* iBitmapThumbMask;
       
   257 
       
   258         // Bitmap and mask for pressed slider "thumb"
       
   259         CFbsBitmap* iBitmapThumbSelected;        
       
   260         CFbsBitmap* iBitmapThumbSelectedMask;
       
   261 
       
   262         // Bitmap and mask for slider "thumb" currently in use
       
   263         CFbsBitmap* iBitmapThumbCurrent;        
       
   264         CFbsBitmap* iBitmapThumbCurrentMask;
       
   265         
       
   266         // Current level to be indicated by the thumb
       
   267         TInt iValue;
       
   268         
       
   269         // Pointer to the observer of slider events
       
   270         MCamSettingValueObserver* iSettingObserver;        
       
   271 
       
   272         // Point of where the top-left of the thumb bitmap will be drawn
       
   273         TPoint iThumbPoint;
       
   274                               
       
   275         // The values that 
       
   276         RPointerArray <CCamSliderLegend> iLegendArray;   
       
   277  
       
   278         // Layout structure for the Shaft
       
   279         TAknLayoutRect iShaftLayout;
       
   280 
       
   281         // Layout structure for the Thumb
       
   282         TAknLayoutRect iThumbLayout;
       
   283 
       
   284         // Main parent 
       
   285         TRect iLayoutAreaRect;  
       
   286 
       
   287         // The minimum size the control requires to be drawn
       
   288         TSize iMinimumSize;
       
   289 
       
   290         // The parent control of the slider
       
   291         const CCoeControl* iParentControl;
       
   292 
       
   293         // The maximum slider value
       
   294         TInt iMaxSliderValue;
       
   295 
       
   296         // The minium slider value
       
   297         TInt iMinSliderValue;
       
   298 
       
   299         // the number of slider values
       
   300         TInt iNumSliderValues;
       
   301 
       
   302         // Identifies which setting is being edited
       
   303         TCamSettingItemIds iSettingType;
       
   304         
       
   305         // number of slider steps
       
   306         TInt iSteps;
       
   307         // Drawing mode
       
   308         TBool iFullySkinned;
       
   309     };
       
   310 
       
   311 #endif      // __CCAMCAPTURESETUPSLIDER_H   
       
   312             
       
   313 // End of File