emailuis/uicomponents/inc/fsalfscrollbarlayout.h
changeset 0 8466d47a6819
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: This file defines class CFsAlfScrollbarLayout.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_FSALFSCROLLBARLAYOUT_H
       
    21 #define C_FSALFSCROLLBARLAYOUT_H
       
    22 
       
    23 
       
    24 //<cmail> SF
       
    25 #include <alf/alflayout.h>
       
    26 //</cmail>
       
    27 #include "fsscrollbarset.h"
       
    28 #include "fsscrollbarpluginconstants.h"
       
    29 
       
    30 class CAlfImageBrush;
       
    31 class MAlfVisualOwner;
       
    32 class CAlfDeckLayout;
       
    33 
       
    34 
       
    35 /**
       
    36  * Scrollbar layout.
       
    37  * This class creates a layout visual with scrollbars in it.
       
    38  * Both horizontal and vertical scrollbars are supported. Scrollbars have
       
    39  * three modes: show, hide and auto.
       
    40  * When set to show the scrollbar is always visible.
       
    41  * Hide setting keeps the scrollbar always hidden.
       
    42  * Auto setting determines if the scrollbar is needed or not.
       
    43  * Each scrollbar can have different visibility setting.
       
    44  *
       
    45  *  @code
       
    46  *   ?good_class_usage_example(s)
       
    47  *  @endcode
       
    48  *
       
    49  *  @lib ?library
       
    50  *  @since S60 ?S60_version *** for example, S60 v3.0
       
    51  */
       
    52 class CFsAlfScrollbarLayout : public CAlfLayout
       
    53     {
       
    54 public:
       
    55 
       
    56     /**
       
    57      * Construct a new scrollbar layout and give its ownership to a control.
       
    58      *
       
    59      * @param aOwnerControl Owner control.
       
    60      * @param aParentLayout Parent layout for the new layout.
       
    61      * @return The new scrollbar layout.
       
    62      */
       
    63     IMPORT_C static CFsAlfScrollbarLayout* AddNewL(
       
    64         CAlfControl& aOwnerControl, CAlfLayout* aParentLayout = NULL );
       
    65 
       
    66     /**
       
    67     * Destructor.
       
    68     */
       
    69     virtual ~CFsAlfScrollbarLayout();
       
    70 
       
    71     /**
       
    72      * Set the range of the scrollbar. Will not actually move the scrollbar
       
    73      * until Update() is called.
       
    74      *
       
    75      * @param aStart Smallest value the scrollbar position can be set to.
       
    76      * @param aEnd Largest value the scrollbar position can be set to.
       
    77      * @param aScrollbar The scrollbar at issue.
       
    78      */
       
    79     IMPORT_C void SetRange( TInt aStart, TInt aEnd,
       
    80         TFsScrollbar aScrollbar = EFsScrollbarVertical );
       
    81 
       
    82     /**
       
    83      * Get scrollbar's minimum range value.
       
    84      *
       
    85      * @param aScrollbar The scrollbar at issue.
       
    86      * @return Scrollbar's start range value.
       
    87      */
       
    88     IMPORT_C TInt RangeStart(
       
    89         TFsScrollbar aScrollbar = EFsScrollbarVertical );
       
    90 
       
    91     /**
       
    92      * Get scrollbar's maximum range value.
       
    93      *
       
    94      * @param aScrollbar The scrollbar at issue.
       
    95      * @return Scrollbar's end range value.
       
    96      */
       
    97     IMPORT_C TInt RangeEnd( TFsScrollbar aScrollbar = EFsScrollbarVertical );
       
    98 
       
    99     /**
       
   100      * Set the count of the visible unit.
       
   101      *
       
   102      * @param aThumbSpan Count of the units that is visible at a time.
       
   103      * @param aScrollbar The scrollbar at issue.
       
   104      */
       
   105     IMPORT_C void SetThumbSpan( TInt aThumbSpan,
       
   106         TFsScrollbar aScrollbar = EFsScrollbarVertical );
       
   107 
       
   108     /**
       
   109      * Resolve the count of the units that is visible at a time.
       
   110      *
       
   111      * @param aScrollbar The scrollbar at issue.
       
   112      * @return Count of the units that is visible at a time.
       
   113      */
       
   114     IMPORT_C TInt ThumbSpan(
       
   115         TFsScrollbar aScrollbar = EFsScrollbarVertical );
       
   116 
       
   117     /**
       
   118      * Adjust the vertical scrollbar's width.
       
   119      *
       
   120      * @param aWidth New width.
       
   121      * @param aTransitionTime How long the transition should take visually,
       
   122      * in milliseconds.
       
   123      */
       
   124     IMPORT_C void SetVerticalScrollbarWidth(
       
   125         TInt aWidth, TInt aTransitionTime = 0 );
       
   126 
       
   127     /**
       
   128      * Adjust the horizontal scrollbar's height.
       
   129      *
       
   130      * @param aHeight New height.
       
   131      * @param aTransitionTime How long the transition should take visually,
       
   132      * in milliseconds.
       
   133      */
       
   134     IMPORT_C void SetHorizontalScrollbarHeight(
       
   135         TInt aHeight, TInt aTransitionTime = 0 );
       
   136 
       
   137     /**
       
   138      * Set the position of the scrollbar. Will not actually move the scrollbar
       
   139      * until Update() is called.
       
   140      *
       
   141      * @param aPos Index of the first item visible, i.e. the index of the
       
   142      * topmost item in a list box.
       
   143      * @param aScrollbar The scrollbar at issue.
       
   144      */
       
   145     IMPORT_C void SetScrollbarPos( const TInt aPos,
       
   146         TFsScrollbar aScrollbar = EFsScrollbarVertical );
       
   147 
       
   148     /**
       
   149      * Resolve the current scrollbar position.
       
   150      *
       
   151      * @param aScrollbar The scrollbar at issue.
       
   152      * @return Index of the first item.
       
   153      */
       
   154     IMPORT_C TInt ScrollbarPos(
       
   155         TFsScrollbar aScrollbar = EFsScrollbarVertical );
       
   156 
       
   157     /**
       
   158      * Set the scrollbar visibility.
       
   159      *
       
   160      * @param aVisibility New visibility mode for the scrollbar.
       
   161      * @param aScrollbar The scrollbar at issue.
       
   162      */
       
   163     IMPORT_C void SetVisibilityMode( TFsScrollbarVisibility aVisibility,
       
   164         TFsScrollbar aScrollbar = EFsScrollbarVertical );
       
   165 
       
   166     /**
       
   167      * Resolve the scrollbar visibility.
       
   168      *
       
   169      * @param aVisibility New visibility mode for the scrollbar.
       
   170      * @return Current visibility mode of the selected scrollbar.
       
   171      */
       
   172     IMPORT_C TFsScrollbarVisibility VisibilityMode(
       
   173         TFsScrollbar aScrollbar = EFsScrollbarVertical );
       
   174 
       
   175     /**
       
   176      * Resolve if the specified scrollbar is visible.
       
   177      *
       
   178      * @param aScrollbar The scrollbar at issue.
       
   179      * @return <code>ETrue</code>, if the specified scrollbar is visible.
       
   180      * Otherwise, <code>EFalse</code> is returned if the scrollbar is not
       
   181      * visible.
       
   182      */
       
   183     IMPORT_C TBool IsScrollbarVisible(
       
   184         TFsScrollbar aScrollbar = EFsScrollbarVertical );
       
   185 
       
   186     /**
       
   187      * Change the bar image to custom image. Ownership of the brushes are
       
   188      * changed.
       
   189      *
       
   190      * @param aBarBrush Brush with the new bar image.
       
   191      * @param aThumbBrush Brush with the new thumb image.
       
   192      * @param aScrollbar The scrollbar at issue.
       
   193      */
       
   194     IMPORT_C void SetScrollbarImagesL(
       
   195         CAlfImageBrush* aBarBrush, CAlfImageBrush* aThumbBrush,
       
   196         TFsScrollbar aScrollbar );
       
   197 
       
   198     /**
       
   199      * Update the visibility of scrollbars.
       
   200      *
       
   201      * @param aLayoutTransitionTime How long the transition should take
       
   202      * visually, in milliseconds.
       
   203      */
       
   204     IMPORT_C void Update( TInt aLayoutTransitionTime = 0 );
       
   205 
       
   206 /*IMPORT_C virtual void SetSize( const TAlfRealSize& aSize,
       
   207     TInt aTransitionTime = 0 );
       
   208 
       
   209 IMPORT_C virtual void UpdateChildLayout(
       
   210     TInt aIndex, TInt aTransitionTime = 0 );*/
       
   211 
       
   212     /**
       
   213      * Get the target size of the scrolbar layout without the scrollbars.
       
   214      *
       
   215      * @return Size of the scrollbar layout without the scrollbars.
       
   216      */
       
   217     IMPORT_C TAlfRealPoint LayoutSize();
       
   218 
       
   219 private:
       
   220 
       
   221     CFsAlfScrollbarLayout();
       
   222 
       
   223     void ConstructL( CAlfControl& aOwner );
       
   224 
       
   225     /**
       
   226      * Send a command to server.
       
   227      *
       
   228      * @param aCommandId Id of the command to be sent.
       
   229      * @param aInScrollbarSet Data for the used command.
       
   230      */
       
   231     void SendCommand(
       
   232         TFsScrollbarCommand aCommandId, TFsScrollbarSet& aInScrollbarSet );
       
   233 
       
   234     /**
       
   235      * Send a command to server.
       
   236      *
       
   237      * @param aCommandId Id of the command to be sent.
       
   238      * @param aInScrollbarSet Data for the used command.
       
   239      * @param aInScrollbarSet Placeholder for received data.
       
   240      */
       
   241     void SendCommand( TFsScrollbarCommand aCommandId,
       
   242         TFsScrollbarSet& aInScrollbarSet, TFsScrollbarSet& aOutScrollbarSet );
       
   243 
       
   244     /**
       
   245      * Release custom image reserved memory.
       
   246      *
       
   247      * @param aScrollbar The scrollbar at issue.
       
   248      */
       
   249     void ReleaseCustomImage( TFsScrollbar aScrollbar );
       
   250 
       
   251 private: // data
       
   252 
       
   253     /**
       
   254      * The layout that contains the entire vertical scrollbar.
       
   255      * Not own.
       
   256      */
       
   257     CAlfDeckLayout* iVScrollbarLayout;
       
   258 
       
   259     /**
       
   260      * The layout that contains the entire horizontal scrollbar.
       
   261      * Not own.
       
   262      */
       
   263     CAlfDeckLayout* iHScrollbarLayout;
       
   264 
       
   265     /**
       
   266      * Background image for the vertical scrollbar.
       
   267      * Not own.
       
   268      */
       
   269     CAlfVisual* iVScrollbar;
       
   270 
       
   271     /**
       
   272      * Background image for the horizontal scrollbar.
       
   273      * Not own.
       
   274      */
       
   275     CAlfVisual* iHScrollbar;
       
   276 
       
   277     /**
       
   278      * Visual for the vertical scrollbar thumb (part that scrolls around).
       
   279      * Not own.
       
   280      */
       
   281     CAlfDeckLayout* iVThumb;
       
   282 
       
   283     /**
       
   284      * Visual for the horizontal scrollbar thumb (part that scrolls around).
       
   285      * Not own.
       
   286      */
       
   287     CAlfDeckLayout* iHThumb;
       
   288 
       
   289     /**
       
   290      * ?description_of_pointer_member
       
   291      * Not own.
       
   292      */
       
   293     CAlfControl* iOwnerControl;
       
   294 
       
   295 CAlfImageBrush* iVBarBrush;
       
   296 CAlfImageBrush* iVThumbBrush;
       
   297 CAlfImageBrush* iHBarBrush;
       
   298 CAlfImageBrush* iHThumbBrush;
       
   299     };
       
   300 
       
   301 
       
   302 #endif // C_FSALFSCROLLBARLAYOUT_H