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