emailuis/uicomponents/inc/fscontrolbarvisualiser.h
changeset 0 8466d47a6819
child 1 12c456ceeff2
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     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:  Visualiser class for control bar.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_FSCONTROLBARVISUALISER_H
       
    20 #define C_FSCONTROLBARVISUALISER_H
       
    21 
       
    22 #include <gdi.h>
       
    23 
       
    24 class CAlfDeckLayout;
       
    25 class CAlfVisual;
       
    26 class CAlfLayout;
       
    27 class CAlfTexture;
       
    28 class CAlfFrameBrush;
       
    29 class CAlfImageBrush;
       
    30 class CAlfGradientBrush;
       
    31 class CAlfTexture;
       
    32 class CFsControlBar;
       
    33 class CFsControlBarModel;
       
    34 
       
    35 
       
    36 /**
       
    37  *  Visualiser class of ControlBar component
       
    38  *
       
    39  *  @code
       
    40  *
       
    41  *  @endcode
       
    42  *
       
    43  *  @lib fs_generic.lib
       
    44  */
       
    45 NONSHARABLE_CLASS( CFsControlBarVisualiser ) : public CBase
       
    46     {
       
    47 
       
    48 public:
       
    49 
       
    50     /**
       
    51      * Two-phased constructor.
       
    52      *
       
    53      * @param aParentControl Parent control.
       
    54      * @param aModel Model of control bar.
       
    55      */
       
    56     static CFsControlBarVisualiser* NewL(
       
    57         CFsControlBar& aParentControl,
       
    58         CFsControlBarModel& aModel );
       
    59 
       
    60     /**
       
    61      * Destructor
       
    62      */
       
    63     virtual ~CFsControlBarVisualiser();
       
    64 
       
    65     /**
       
    66      * Starts redrawing of the control bar.
       
    67      *
       
    68      * @param aScreenSizeChanged Screen size changed -> bar's width
       
    69      * has to be recalculated.
       
    70      */
       
    71     void RefreshL( TBool aScreenSizeChanged = EFalse );
       
    72 
       
    73     /**
       
    74      * Sets bar's background color.
       
    75      *
       
    76      * @param aColor Background color to be set.
       
    77      */
       
    78     void SetBackgroundColor( const TRgb& aColor );
       
    79 
       
    80     /**
       
    81      * Clears bar's background color. Bar is transparent.
       
    82      */
       
    83     IMPORT_C virtual void ClearBackgroundColor();
       
    84 
       
    85     /**
       
    86      * Sets bar's image.
       
    87      *
       
    88      * @param aImage Background image to be set.
       
    89      */
       
    90     void SetBackgroundImageL( CAlfTexture& aImage );
       
    91 
       
    92     /**
       
    93      * Clears bar's background image.
       
    94      */
       
    95     void ClearBackgroundImage();
       
    96 
       
    97     /**
       
    98      * Update the size of the controlbar layout.
       
    99      */
       
   100     void UpdateSizeL();
       
   101 
       
   102     /**
       
   103      * Retrieves layouter of the control bar.
       
   104      *
       
   105      * @return Control bar's layouter.
       
   106      */
       
   107     CAlfDeckLayout* Layout();
       
   108 
       
   109     /**
       
   110      * Sets transition time for selector.
       
   111      *
       
   112      * @param aTransitionTime Transition time in miliseconds.
       
   113      */
       
   114     void SetSelectorTransitionTimeL( TInt aTransitionTime );
       
   115 
       
   116     /**
       
   117      * Set selector image.
       
   118      * Gaines the ownership of the brush.
       
   119      *
       
   120      * @param aSelectorBrush New selector brush.
       
   121      * @param aOpacity Opacity of the selector.
       
   122      */
       
   123     void SetSelectorImageL( CAlfBrush* aSelectorBrush, TReal32 aOpacity );
       
   124 
       
   125     /**
       
   126      * Hides selector. Invoked when bar is focused no more.
       
   127      */
       
   128     void HideSelector();
       
   129 
       
   130     /**
       
   131      * Reorder the visuals. Button visual are build from two separate visual,
       
   132      * background and content. Those are arranged so that the background
       
   133      * visual are set at back and contents are to front. Selector visual is
       
   134      * placed between them.
       
   135      */
       
   136     void ReorderVisuals();
       
   137 
       
   138     /**
       
   139      * Enables selector drawing.
       
   140      * NOTE: Do not change focus state. Item might be focused altough
       
   141      *       selector is not visible.
       
   142      *  @param aShow if ETrue selector can be drawn.
       
   143      *  @param aFromTouch tells that was method called after touch event.
       
   144      */
       
   145     void MakeSelectorVisible( TBool aShow, TBool aFromTouch = EFalse );
       
   146 
       
   147 private:
       
   148 
       
   149     /**
       
   150      * Constructor.
       
   151      *
       
   152      * @param aParentControl Parent control.
       
   153      * @param aModel Model of control bar.
       
   154      */
       
   155     CFsControlBarVisualiser( CFsControlBar& aParentControl,
       
   156         CFsControlBarModel& aModel );
       
   157 
       
   158     /**
       
   159      * Second phase constructor.
       
   160      */
       
   161     void ConstructL();
       
   162 
       
   163     /**
       
   164      * Draws selector over selected (focused) button.
       
   165      *
       
   166      * @param aSelectedButtonIndex Index of the button.
       
   167      * @param aFastDraw Updates selector's position without any transition
       
   168      * delay.
       
   169      */
       
   170     void DrawSelectorL( const TInt aSelectedButtonIndex, TBool aFastDraw );
       
   171 
       
   172 private: // data
       
   173 
       
   174     /**
       
   175      * Model of control bar.
       
   176      * Not own.
       
   177      */
       
   178     CFsControlBarModel& iModel;
       
   179 
       
   180     /**
       
   181      * Parent control.
       
   182      * Not own.
       
   183      */
       
   184     CFsControlBar& iParent;
       
   185 
       
   186     /**
       
   187      * Layout for control bar.
       
   188      * Not own.
       
   189      */
       
   190     CAlfDeckLayout* iBarLayout;
       
   191 
       
   192     /**
       
   193      * Background layout for control bar.
       
   194      * Not own.
       
   195      */
       
   196     CAlfLayout* iBgLayout;
       
   197 
       
   198     /**
       
   199      * Background color.
       
   200      */
       
   201     CAlfGradientBrush* iBgColor;
       
   202 
       
   203     /**
       
   204      * Brush with the default background image.
       
   205      * Owned.
       
   206      */
       
   207     CAlfFrameBrush* iDefaultBgBrush;
       
   208 
       
   209     /**
       
   210      * Brush with the background image.
       
   211      * Owned.
       
   212      */
       
   213     CAlfImageBrush* iBgImage;
       
   214 
       
   215     /**
       
   216      * Visual for image of selector.
       
   217      * Not own.
       
   218      */
       
   219     CAlfVisual* iSelector;
       
   220 
       
   221     /**
       
   222      * Brush for selector.
       
   223      * Owned.
       
   224      */
       
   225     CAlfBrush* iSelectorBrush;
       
   226 
       
   227     /**
       
   228      * Selector's opacity.
       
   229      */
       
   230     TReal32 iSelectorOpacity;
       
   231 
       
   232     /**
       
   233      * Index of last selected button.
       
   234      */
       
   235     TInt iLastSelectedButton;
       
   236 
       
   237     /**
       
   238      * Flag that states if event was received after touch event.
       
   239      */
       
   240     TBool iTouchPressed;
       
   241     };
       
   242 
       
   243 
       
   244 #endif // C_FSCONTROLBARVISUALISER_H