mulwidgets/mulsliderwidget/inc/mulslidercontrol.h
branchRCL_3
changeset 20 0e9bb658ef58
equal deleted inserted replaced
19:4ea6f81c838a 20:0e9bb658ef58
       
     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      * @param aIntensity Intensity of the feedback.If not passed default will be 50
       
   129      */ 
       
   130      void TactileEffectOnDrag(TAlfEvent& aEvent , int aIntensity = 50 );
       
   131      
       
   132      /**
       
   133       * Generates the feedback based on the thumb release
       
   134       * or drag on thumb is stopped 
       
   135       */
       
   136      void TactileEffectOnRelease();
       
   137 
       
   138 private:
       
   139 
       
   140     /**
       
   141      * Rounds float to int
       
   142      * 
       
   143      * @param aFloatValue float value
       
   144      * @return int
       
   145      */
       
   146     inline int roundFloatToInt ( float aFloatValue )
       
   147         {
       
   148         return(int)(aFloatValue + roundOff);
       
   149         }
       
   150         
       
   151     /**
       
   152      * Sets whether or not tactile feedback is enabled.
       
   153      *
       
   154      * @param aEnabled Whether or not tactile is enabled.
       
   155      */
       
   156     void EnableTactileFeedback( bool aEnabled );
       
   157 
       
   158 private:
       
   159 
       
   160     /** 
       
   161      * Default contructor
       
   162      */
       
   163     MulSliderControl();
       
   164     
       
   165     /**
       
   166      * IAlfAttributeOwner implementation. Own.
       
   167      */
       
   168   
       
   169     /**
       
   170      * height of the Layout.
       
   171      */
       
   172     int mLayoutHeight;
       
   173 
       
   174     /**
       
   175      * width of the Layout.
       
   176      */
       
   177     int mLayoutWidth;
       
   178 
       
   179     /**
       
   180      * tactile is enabled or not.
       
   181      */
       
   182     bool mEnableTactile;
       
   183     
       
   184     /**
       
   185      * Tactile Feedback for drag started
       
   186      */
       
   187     bool mDragTactileFeedbackStarted;
       
   188     /**
       
   189      * pointer to get the current tactile instance
       
   190      */
       
   191     MTouchFeedback *mTactilefdbInstance;
       
   192 
       
   193     }; // class MulSliderControl
       
   194 
       
   195     } // namespace Alf
       
   196 
       
   197 #endif //MUL_SLIDERCONTROL_H
       
   198 //End Of File