mulwidgets/alfscrollbarwidget/inc/alfscrollbarcontrol.h
branchRCL_3
changeset 25 4ea6f81c838a
parent 23 514d98f21c43
child 26 0e9bb658ef58
equal deleted inserted replaced
23:514d98f21c43 25:4ea6f81c838a
     1 /*
       
     2 * Copyright (c) 2009 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:  Control interface with utilities for scrollbar widget.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef ALF_SCROLLBARCONTROL_H
       
    19 #define ALF_SCROLLBARCONTROL_H
       
    20 
       
    21 //WidgetModel Includes
       
    22 #include <alf/alfwidgetcontrol.h>
       
    23 #include <alf/alfwidgeteventhandler.h>
       
    24 #include <touchfeedback.h>
       
    25 
       
    26 //Osn Includes
       
    27 #include <osn/ustring.h>
       
    28 
       
    29 //Internal Includes
       
    30 
       
    31 using namespace osncore;
       
    32 using namespace Alf;
       
    33 
       
    34 // Forward declarations
       
    35 //class TAlfCustomEventCommand;
       
    36 
       
    37 const float roundOff = 0.5;
       
    38 namespace Alf
       
    39     {
       
    40 // Forward declaration
       
    41 class AlfScrollBarControl : public CAlfWidgetControl
       
    42     {
       
    43 public:
       
    44 
       
    45     /**
       
    46      * Constructor.
       
    47      */
       
    48     AlfScrollBarControl ( CAlfEnv& aEnv );
       
    49 
       
    50     /** 
       
    51      *  Class Destructor.
       
    52      *  @since S60 ?S60_version 
       
    53      */ 
       
    54     virtual ~AlfScrollBarControl();
       
    55 
       
    56     /**
       
    57      * Sets whether or not tactile feedback is enabled.
       
    58      *
       
    59      * @param aEnabled Whether or not tactile is enabled.
       
    60      */
       
    61     void EnableTactileFeedback( bool aEnabled );
       
    62     
       
    63     /**
       
    64      * Generates the feedback based on the events recieved
       
    65      * 
       
    66      */
       
    67      void TactileEffectOnTouchandHold();  
       
    68     
       
    69     /**
       
    70      * Generates the feedback based on the events recieved
       
    71      * 
       
    72      * @param aEvent Events recieved by the widget on Drag
       
    73      */ 
       
    74      void TactileEffectOnDrag(TAlfEvent& aEvent);
       
    75      
       
    76      /**
       
    77       * Generates the feedback based on the thumb release
       
    78       * or drag on thumb is stopped 
       
    79       */
       
    80      void TactileEffectOnRelease();
       
    81      
       
    82     
       
    83     /**
       
    84      * Returns the state of tactile feedback whether it is enabled/disabled.
       
    85      *
       
    86      */
       
    87     bool IsTactileFeedbackEnabled();
       
    88 
       
    89     // From Base class CAlfControl
       
    90     
       
    91     /**
       
    92      * Notifies the owner that the layout of a visual has been recalculated.
       
    93      * Called only when the EAlfVisualFlagLayoutUpdateNotification flag has
       
    94      * been set for the visual.
       
    95      *
       
    96      * @param aVisual  Visual that has been laid out.
       
    97      */
       
    98     void VisualLayoutUpdated ( CAlfVisual& aVisual );
       
    99 
       
   100     /**
       
   101      * Returns top level layout. Returns NULL if this control does not
       
   102      * implement the IAlfHostAPI interface or if there is no base layout.
       
   103      * 
       
   104      * @return Pointer to top level layout, or NULL if not available.
       
   105      */
       
   106     CAlfLayout* ContainerLayout ( const CAlfControl* aConnected ) const;
       
   107 
       
   108     // From base class CAlfWidgetControl
       
   109     
       
   110     /**
       
   111      * @see IAlfWidgetControl
       
   112      */
       
   113     AlfEventStatus handleEvent( const TAlfEvent& aEvent );
       
   114 
       
   115 
       
   116 private:
       
   117 
       
   118     /**
       
   119      * Rounds float to int
       
   120      * 
       
   121      * @param aFloatValue float value
       
   122      * @return int
       
   123      */
       
   124     inline int roundFloatToInt ( float aFloatValue )
       
   125         {
       
   126         return(int)(aFloatValue + roundOff);
       
   127         }
       
   128 
       
   129 private:
       
   130 
       
   131     /** 
       
   132      * Default contructor
       
   133      */
       
   134     AlfScrollBarControl();
       
   135   
       
   136     /**
       
   137      * height of the Layout.
       
   138      */
       
   139     int mLayoutHeight;
       
   140 
       
   141     /**
       
   142      * width of the Layout.
       
   143      */
       
   144     int mLayoutWidth;
       
   145 
       
   146     /**
       
   147      * tactile is enabled or not.
       
   148      */
       
   149     bool mEnableTactile;
       
   150     
       
   151     /**
       
   152      * Tactile effect for drag started
       
   153      */
       
   154     bool mDragTactileFeedbackStarted;
       
   155 
       
   156     /**
       
   157      * Tactile feedback instance
       
   158      */
       
   159 		MTouchFeedback *mTactilefdbInstance;
       
   160 		
       
   161     }; // class AlfScrollBarControl
       
   162 
       
   163     } // namespace Alf
       
   164 
       
   165 #endif //ALF_SCROLLBARCONTROL_H
       
   166 //End Of File