vtuis/videotelui/inc/CVtUiZoomControl.h
changeset 0 ed9695c8bcbe
child 8 07d1685f0cd4
equal deleted inserted replaced
-1:000000000000 0:ed9695c8bcbe
       
     1 /*
       
     2 * Copyright (c) 2004, 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:  Navi pane zoom indicator control for 
       
    15 *                Video Telephone application.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef CVTUIZOOMCONTROL_H
       
    22 #define CVTUIZOOMCONTROL_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include    <coecntrl.h>
       
    26 #include    <aknutils.h>
       
    27 #include    "CVtUiBitmapManager.h"
       
    28 
       
    29 // CLASS DECLARATION
       
    30 
       
    31 /**
       
    32 *  Navi pane zoom indicator control for Video Telephone application.
       
    33 *
       
    34 *  @since Series 60 2.6
       
    35 */
       
    36 class CVtUiZoomControl
       
    37     : public CCoeControl
       
    38     {
       
    39     public: // Constructors and destructor
       
    40         
       
    41         /**
       
    42         * C++ constructor.
       
    43         * @param aBitmapManager bitmap manager.
       
    44         */
       
    45         CVtUiZoomControl( CVtUiBitmapManager& aBitmapManager );
       
    46 
       
    47         /**
       
    48         * Symbian constructor.
       
    49         */
       
    50         void ConstructL();
       
    51 
       
    52         /**
       
    53         * C++ destructor.
       
    54         */
       
    55         ~CVtUiZoomControl();
       
    56 
       
    57     public: // New functions
       
    58 
       
    59         /**
       
    60         * Sets zoom parameters.
       
    61         * @param aStepCount amount of steps, 0 if zooming disabled.
       
    62         * @param aCurrentStep current step, 0 .. aStepCount.
       
    63         */
       
    64         void SetZoomParams( 
       
    65             const TInt aStepCount, 
       
    66             const TInt aCurrentStep );
       
    67 
       
    68         /**
       
    69         * Commits changes.
       
    70         */
       
    71         void CommitL();
       
    72 
       
    73         /**
       
    74         * Returns ETrue if zooming is enabled.
       
    75         * @return ETrue if enabled.
       
    76         */
       
    77         TBool IsZoomEnabled() const;
       
    78 
       
    79         /**
       
    80         * Gets zoom parameters.
       
    81         * @param aStepCount amount of steps, 0 if zooming disabled.
       
    82         * @param aCurrentStep current step, 0 .. aStepCount.
       
    83         */
       
    84         void GetZoomParams(
       
    85             TInt& aStepCount,
       
    86             TInt& aCurrentStep ) const;
       
    87 
       
    88         /**
       
    89         * Updates zoom. This method should be called periodically during zooming.
       
    90         * @return ETrue if zoom step was updated.
       
    91         */
       
    92         TBool UpdateZoomL();
       
    93 
       
    94         /**
       
    95         * Stops zoom. 
       
    96         */
       
    97         void StopZoom();
       
    98 
       
    99     public: // Functions from base classes
       
   100 
       
   101         /**
       
   102         * From CCoeControl, handles key events.
       
   103         * @param aKeyEvent key event.
       
   104         * @param aType type of event.
       
   105         * @return response indicating if key was consumed.
       
   106         */
       
   107         virtual TKeyResponse OfferKeyEventL(
       
   108             const TKeyEvent& aKeyEvent,
       
   109             TEventCode aType );
       
   110 
       
   111         /**
       
   112         * From CCoeControl, handles resource change.
       
   113         * @param aType type of change.
       
   114         */ 
       
   115         virtual void HandleResourceChange(
       
   116             TInt aType );
       
   117 
       
   118     protected: // Functions from base classes
       
   119 
       
   120         /**
       
   121         * From CCoeControl, draws the control.
       
   122         * @param aRect area to be drawn.
       
   123         */
       
   124         virtual void Draw( const TRect& aRect ) const;
       
   125 
       
   126         /**
       
   127         * From CCoeControl, handles size changes.
       
   128         */
       
   129         virtual void SizeChanged();
       
   130 
       
   131         /**
       
   132         * From CCoeControl, handles position changes.
       
   133         */
       
   134         virtual void PositionChanged();
       
   135 
       
   136     private:
       
   137 
       
   138         /**
       
   139         * Calculates amount of steps to be shown.
       
   140         * @param aFullSteps amount of full steps.
       
   141         * @param aPartialStep partial steps, 0 .. 255.
       
   142         */
       
   143         void DetermineSteps(
       
   144             TInt& aFullSteps,
       
   145             TInt& aPartialStep ) const;
       
   146 
       
   147         /**
       
   148         * Generates zoom mask bitmap.
       
   149         * @param aAreaBitmap maximum bitmap, ownership not transferred.
       
   150         * @param aPartial partial amount.
       
   151         * @param aRow area row number.
       
   152         * @param aRowSize size of the row.
       
   153         * @return ETrue if successful, EFalse otherwise.
       
   154         */
       
   155         TBool GenerateZoomMaskBitmap(
       
   156             CFbsBitmap* aMaskBitmap,
       
   157             const TInt aPartial,
       
   158             const TInt aRow,
       
   159             const TSize& aRowSize ) const;
       
   160 
       
   161         /**
       
   162         * Generates zoom mask bitmap.
       
   163         * @param aAreaBitmap maximum bitmap, ownership not transferred.
       
   164         * @param aPartial partial amount.
       
   165         * @param aRow area row number.
       
   166         * @param aRowSize size of the row.
       
   167         */
       
   168         void DoGenerateZoomMaskBitmap(
       
   169             CFbsBitmap* aMaskBitmap,
       
   170             const TInt aPartial,
       
   171             const TInt aRow,
       
   172             const TSize& aRowSize ) const;
       
   173 
       
   174         /**
       
   175         * Creates bitmaps.
       
   176         * @return error code.
       
   177         */
       
   178         TInt CreateBitmaps();
       
   179 
       
   180         /**
       
   181         * Creates bitmaps.
       
   182         */
       
   183         void CreateBitmapsL();
       
   184 
       
   185         /**
       
   186         * Returns size of the temporary bitmaps.
       
   187         * @return size of the temporary bitmaps.
       
   188         */
       
   189         TSize SizeOfBitmap() const;
       
   190 
       
   191         /**
       
   192         * Gets position and source rect.
       
   193         * @param aPosition it will contain position.
       
   194         * @param aSourceRect it will contain source rectangle.
       
   195         * @param aZoomStep zoom step.
       
   196         */
       
   197         void GetPositionAndRect(
       
   198             TPoint& aPosition,
       
   199             TRect& aSourceRect,
       
   200             const TInt aZoomStep ) const;
       
   201 
       
   202     private:
       
   203 
       
   204         // Inner class.
       
   205         class CBitmap;
       
   206 
       
   207         // Reference to bitmap manager.
       
   208         CVtUiBitmapManager& iBitmapManager;
       
   209 
       
   210         // Zoom direction bitmap identifier.
       
   211         TVtUiBitmapPoolId iZoomDirId;
       
   212 
       
   213         // Zoom area bitmap identifier.
       
   214         TVtUiBitmapPoolId iZoomAreaId;
       
   215 
       
   216         // Zoom min bitmap identifier.
       
   217         TVtUiBitmapPoolId iZoomMinId;
       
   218 
       
   219         // Zoom max bitmap identifier.
       
   220         TVtUiBitmapPoolId iZoomMaxId;
       
   221 
       
   222         // Zoom pane rectangle.
       
   223         TRect iZoomPaneRect;
       
   224 
       
   225         // Zoom direction layout.
       
   226         TAknLayoutRect iZoomDirLayout;
       
   227 
       
   228         // Zoom area layout.
       
   229         TAknLayoutRect iZoomAreaLayout;
       
   230 
       
   231         // Current step, 0 .. iMaxZoomStep.
       
   232         TInt iCurrentZoomStep;
       
   233         
       
   234         // Maximum step.
       
   235         TInt iMaxZoomStep;
       
   236 
       
   237         // Used partial value used in iZoomMaskBitmap
       
   238         // generation.
       
   239         mutable TInt iZoomMaskPartial;
       
   240 
       
   241         // Used row value used in iZoomMaskBitmap
       
   242         // generation.
       
   243         mutable TInt iZoomMaskRow;
       
   244 
       
   245         // Owned partial soft mask.
       
   246         CBitmap* iZoomPartialMask;
       
   247         
       
   248         // Owned partial shade (soft mask).
       
   249         CBitmap* iZoomPartialShade;
       
   250 
       
   251         // Owned partial shade mask.
       
   252         CBitmap* iZoomPartialShadeMask;
       
   253 
       
   254         // Zoom direction +1 or -1. 0 if no
       
   255         // zoom ongoing.
       
   256         TInt iZoomDirection;
       
   257 
       
   258         // Zoom step at the start of zooming.
       
   259         TInt iZoomStepStart;
       
   260 
       
   261         // Start time of zooming.
       
   262         TTime iZoomStartTime;
       
   263 
       
   264     };
       
   265 
       
   266 #endif      // CVTUIZOOMCONTROL_H
       
   267 
       
   268 // End of File