mulwidgets/mulsliderwidget/inc/mulslidercontrol.h
changeset 17 3eca7e70b1b8
parent 3 4526337fb576
equal deleted inserted replaced
3:4526337fb576 17:3eca7e70b1b8
     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 slider widget.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef MUL_SLIDERCONTROL_H
       
    19 #define MUL_SLIDERCONTROL_H
       
    20 
       
    21 //WidgetModel Includes
       
    22 #include <alf/alfwidgetcontrol.h>
       
    23 #include <alf/alfwidgeteventhandler.h>
       
    24 #include "alf/alfelement.h"
       
    25 #include <touchfeedback.h>
       
    26 //Osn Includes
       
    27 #include <osn/ustring.h>
       
    28 
       
    29 
       
    30 using namespace osncore;
       
    31 using namespace Alf;
       
    32 
       
    33 // Forward declarations
       
    34 class TAlfCustomEventCommand;
       
    35 
       
    36 const float roundOff = 0.5;
       
    37 namespace Alf
       
    38     {
       
    39     // Forward declaration
       
    40 class IAlfModel;
       
    41 class AlfModelOperation;
       
    42 class MulSliderControl : public CAlfWidgetControl
       
    43     {
       
    44 public:
       
    45 
       
    46     /**
       
    47      * Constructor.
       
    48      */
       
    49     MulSliderControl ( CAlfEnv& aEnv );
       
    50 
       
    51     /** 
       
    52      *  Class Destructor.
       
    53      *  @since S60 ?S60_version 
       
    54      */ 
       
    55     virtual ~MulSliderControl();
       
    56 
       
    57     //--------------------------------------------------------------------------
       
    58 	//Overriden Apis from Base class CAlfControl
       
    59 	//--------------------------------------------------------------------------
       
    60 	//
       
    61 
       
    62     /**
       
    63      * Notifies the owner that the layout of a visual has been recalculated.
       
    64      * Called only when the EAlfVisualFlagLayoutUpdateNotification flag has
       
    65      * been set for the visual.
       
    66      *
       
    67      * @param aVisual  Visual that has been laid out.
       
    68      */
       
    69     void VisualLayoutUpdated ( CAlfVisual& aVisual );
       
    70 
       
    71     /**
       
    72      * Returns top level layout. Returns NULL if this control does not
       
    73      * implement the IAlfHostAPI interface or if there is no base layout.
       
    74      * 
       
    75      * @return Pointer to top level layout, or NULL if not available.
       
    76      */
       
    77     CAlfLayout* ContainerLayout ( const CAlfControl* aConnected ) const;
       
    78 
       
    79 // from base class CAlfWidgetControl
       
    80 
       
    81     /**
       
    82      * @see IAlfWidgetControl
       
    83      */
       
    84     AlfEventStatus handleEvent( const TAlfEvent& aEvent );
       
    85 
       
    86     /**
       
    87      * Update the presentation according to the data changes.
       
    88      *
       
    89      * @since S60 ?S60_version
       
    90      * @param aArrayOfOperation An Array containing the operations performed on
       
    91      * the model.
       
    92      */
       
    93     void dataChanging ( const AlfModelOperation& aOperation );
       
    94     
       
    95     /**
       
    96      * removes an element.
       
    97      */
       
    98     void removeAndDestroyElement(const IAlfElement& aElement );
       
    99 
       
   100 
       
   101 // From base class IAlfInterfaceBase
       
   102 
       
   103     /**
       
   104      * From IAlfInterfaceBase.
       
   105      * Getter for interfaces provided by the control classes.
       
   106      * Derived classes should always call the base class method
       
   107      * from the overridden MakeInterface.
       
   108      *
       
   109      * @since S60 ?S60_version
       
   110      * @param aType A descriptor to identify the type of the queried interface.
       
   111      * @return The queried interface, or NULL if the interface is not
       
   112      *         supported or available.
       
   113      */
       
   114     IAlfInterfaceBase* makeInterface ( const IfId& aType );
       
   115 
       
   116 public: 
       
   117     
       
   118     /**
       
   119      * Generates the feedback based on the events recieved
       
   120      * 
       
   121      */
       
   122      void TactileEffectOnTouchandHold();  
       
   123     
       
   124     /**
       
   125      * Generates the feedback based on the events recieved
       
   126      * 
       
   127      * @param aEvent Events recieved by the widget on Drag
       
   128      */ 
       
   129      void TactileEffectOnDrag(TAlfEvent& aEvent);
       
   130      
       
   131      /**
       
   132       * Generates the feedback based on the thumb release
       
   133       * or drag on thumb is stopped 
       
   134       */
       
   135      void TactileEffectOnRelease();
       
   136 
       
   137 private:
       
   138 
       
   139     /**
       
   140      * Rounds float to int
       
   141      * 
       
   142      * @param aFloatValue float value
       
   143      * @return int
       
   144      */
       
   145     inline int roundFloatToInt ( float aFloatValue )
       
   146         {
       
   147         return(int)(aFloatValue + roundOff);
       
   148         }
       
   149         
       
   150     /**
       
   151      * Sets whether or not tactile feedback is enabled.
       
   152      *
       
   153      * @param aEnabled Whether or not tactile is enabled.
       
   154      */
       
   155     void EnableTactileFeedback( bool aEnabled );
       
   156 
       
   157 private:
       
   158 
       
   159     /** 
       
   160      * Default contructor
       
   161      */
       
   162     MulSliderControl();
       
   163     
       
   164     /**
       
   165      * IAlfAttributeOwner implementation. Own.
       
   166      */
       
   167   
       
   168     /**
       
   169      * height of the Layout.
       
   170      */
       
   171     int mLayoutHeight;
       
   172 
       
   173     /**
       
   174      * width of the Layout.
       
   175      */
       
   176     int mLayoutWidth;
       
   177 
       
   178     /**
       
   179      * tactile is enabled or not.
       
   180      */
       
   181     bool mEnableTactile;
       
   182     
       
   183     /**
       
   184      * Tactile Feedback for drag started
       
   185      */
       
   186     bool mDragTactileFeedbackStarted;
       
   187     /**
       
   188      * pointer to get the current tactile instance
       
   189      */
       
   190     MTouchFeedback *mTactilefdbInstance;
       
   191 
       
   192     }; // class MulSliderControl
       
   193 
       
   194     } // namespace Alf
       
   195 
       
   196 #endif //MUL_SLIDERCONTROL_H
       
   197 //End Of File