emailuis/uicomponents/inc/cuicscrollbar.h
branchRCL_3
changeset 12 4ce476e64c59
child 14 b13141f05c3d
equal deleted inserted replaced
11:0396474f30f5 12:4ce476e64c59
       
     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: cuicscrollbar.h
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_UICSCROLLBAR_H
       
    19 #define C_UICSCROLLBAR_H
       
    20 
       
    21 #include <alf/alfcontrol.h>
       
    22 #include <alf/alfbitmapprovider.h>
       
    23 
       
    24 #include "muicscrollbar.h"
       
    25 
       
    26 // Forward declarations
       
    27 
       
    28 class CAlfAnchorLayout;
       
    29 class CAlfDeckLayout;
       
    30 class CAlfImageVisual;
       
    31 class CAlfLayout;
       
    32 class CAlfTexture;
       
    33 
       
    34 /**
       
    35  * Composite image
       
    36  */
       
    37 NONSHARABLE_CLASS( CUiCCompositeImage ) : public CBase
       
    38     {
       
    39 public:
       
    40 
       
    41     /**
       
    42      * Leave safe constructor
       
    43      */
       
    44     static CUiCCompositeImage* NewL( CAlfControl& aControl, CAlfLayout* aParentLayout,
       
    45             CAlfTexture& aTop, CAlfTexture& aMiddle, CAlfTexture& aBottom );
       
    46 
       
    47     /**
       
    48      * Destructor
       
    49      */
       
    50     ~CUiCCompositeImage();
       
    51 
       
    52     /**
       
    53      * Returns layout for this component
       
    54      */
       
    55     CAlfLayout& Layout();
       
    56 
       
    57 private:
       
    58 
       
    59     CUiCCompositeImage();
       
    60     void ConstructL( CAlfControl& aControl, CAlfLayout* aParentLayout,
       
    61             CAlfTexture& aTop, CAlfTexture& aMiddle, CAlfTexture& aBottom );
       
    62     void SetAnchors();
       
    63 
       
    64 private:
       
    65 
       
    66     CAlfAnchorLayout* iLayout;
       
    67     CAlfImageVisual* iTop;
       
    68     CAlfImageVisual* iMiddle;
       
    69     CAlfImageVisual* iBottom;
       
    70 
       
    71     };
       
    72 
       
    73 /**
       
    74  * CUiCScrollBar
       
    75  *
       
    76  */
       
    77 NONSHARABLE_CLASS( CUiCScrollBar ) : public CAlfControl, public MUiCScrollBar,
       
    78         public MAlfBitmapProvider
       
    79     {
       
    80 
       
    81 public:
       
    82 
       
    83     /**
       
    84      * Leave safe constructor
       
    85      */
       
    86     static CUiCScrollBar* NewL( CAlfEnv& aEnv, CAlfLayout* aParentLayout );
       
    87 
       
    88 public: // from MUiCScrollBar
       
    89 
       
    90     /**
       
    91      * @see MUiCScrollBar::Destroy
       
    92      */
       
    93     virtual void Destroy();
       
    94 
       
    95     /**
       
    96      * @see MUiCScrollBar::Show
       
    97      */
       
    98     virtual void Show( const TBool aShow );
       
    99 
       
   100     /**
       
   101      * @see MUiCScrollBar::UpdateModelL
       
   102      */
       
   103     virtual void UpdateModelL( const TUiCScrollBarModel& aModel );
       
   104 
       
   105     /**
       
   106      * @see MUiCScrollBar::ThumbPosition
       
   107      */
       
   108     virtual TInt ThumbPosition() const;
       
   109 
       
   110     /**
       
   111      * @see MUiCScrollBar::SetRect
       
   112      */
       
   113     virtual void SetRect( const TRect& aRect );
       
   114 
       
   115     /**
       
   116      * @see MUiCScrollBar::Redraw
       
   117      */
       
   118     virtual void Redraw();
       
   119 
       
   120     /**
       
   121      * @see MUiCScrollBar::NotifyThemeChanged
       
   122      */
       
   123     virtual void NotifyThemeChanged();
       
   124 
       
   125     /**
       
   126      * @see MUiCScrollBar::LayoutHints
       
   127      */
       
   128     virtual TInt LayoutHints() const;
       
   129 
       
   130 private: // from MAlfEventHandler
       
   131 
       
   132     /**
       
   133      * @see MAlfEventHandler::OfferEventL
       
   134      */
       
   135     virtual TBool OfferEventL( const TAlfEvent& aEvent );
       
   136 
       
   137 private: // from MAlfBitmapProvider
       
   138 
       
   139     /**
       
   140      * @see MAlfBitmapProvider::ProvideBitmapL
       
   141      */
       
   142     virtual void ProvideBitmapL( TInt aId, CFbsBitmap*& aBitmap, CFbsBitmap*& aMaskBitmap );
       
   143 
       
   144 private:
       
   145 
       
   146     /**
       
   147      * Destructor
       
   148      */
       
   149     ~CUiCScrollBar();
       
   150 
       
   151     /**
       
   152      * Constructor
       
   153      */
       
   154     CUiCScrollBar();
       
   155 
       
   156     /**
       
   157      * 2nd constructor
       
   158      */
       
   159     void ConstructL( CAlfEnv& aEnv, CAlfLayout* aParentLayout );
       
   160 
       
   161     /**
       
   162      * Sets anchors for background image and thumb
       
   163      */
       
   164     void SetAnchors();
       
   165 
       
   166     /**
       
   167      * Sets anchors for background
       
   168      */
       
   169     void SetBgAnchors();
       
   170 
       
   171     /**
       
   172      * Sets anchors for thumb
       
   173      */
       
   174     void SetThumbAnchors();
       
   175 
       
   176 private:
       
   177 
       
   178     /**
       
   179      * Custom events
       
   180      */
       
   181     enum TEvent
       
   182         {
       
   183         EFadeOut
       
   184         };
       
   185 
       
   186     /**
       
   187      * Unique bitmaps IDs, make sure these do no overlap with the ones defined
       
   188      * in UI
       
   189      */
       
   190     enum TBitmapId
       
   191         {
       
   192         EThumbTop = 0x10000,
       
   193         EThumbMiddle,
       
   194         EThumbBottom,
       
   195         EBackgroundTop,
       
   196         EBackgroundMiddle,
       
   197         EBackgroundBottom
       
   198         };
       
   199 
       
   200 private:
       
   201 
       
   202     // Container layout
       
   203     CAlfDeckLayout* iDeck;
       
   204 
       
   205     // Scrollbar background layout
       
   206     CAlfAnchorLayout* iBgLayout;
       
   207 
       
   208     // Scrollbar layout
       
   209     CAlfAnchorLayout* iThumbLayout;
       
   210 
       
   211     // Scrollbar background visual
       
   212     CUiCCompositeImage* iBackGroundVisual;
       
   213 
       
   214     // Scrollbar thumb visual
       
   215     CUiCCompositeImage* iThumbVisual;
       
   216 
       
   217     // Scrollbar model
       
   218     TUiCScrollBarModel iModel;
       
   219 
       
   220     };
       
   221 
       
   222 #endif /* C_UICSCROLLBAR_H */