- public:
- /// Create a cursor with 3 images (which are NOT copied, be careful)
- /// If pVisible is NULL, the control is always visible
- CtrlSliderCursor( intf_thread_t *pIntf, const GenericBitmap &rBmpUp,
- const GenericBitmap &rBmpOver,
- const GenericBitmap &rBmpDown,
- const Bezier &rCurve, VarPercent &rVariable,
- VarBool *pVisible, const UString &rTooltip,
- const UString &rHelp );
-
- virtual ~CtrlSliderCursor();
-
- /// Handle an event
- virtual void handleEvent( EvtGeneric &rEvent );
-
- /// Check whether coordinates are inside the control
- virtual bool mouseOver( int x, int y ) const;
-
- /// Draw the control on the given graphics
- virtual void draw( OSGraphics &rImage, int xDest, int yDest );
-
- /// Get the text of the tooltip
- virtual UString getTooltipText() const { return m_tooltip; }
-
- /// Get the type of control (custom RTTI)
- virtual string getType() const { return "slider_cursor"; }
-
- private:
- /// Finite state machine of the control
- FSM m_fsm;
- /// Variable associated to the cursor
- VarPercent &m_rVariable;
- /// Tooltip text
- const UString m_tooltip;
- /// Initial size of the control
- int m_width, m_height;
- /// Position of the cursor
- int m_xPosition, m_yPosition;
- /// Callback objects
- DEFINE_CALLBACK( CtrlSliderCursor, OverDown )
- DEFINE_CALLBACK( CtrlSliderCursor, DownOver )
- DEFINE_CALLBACK( CtrlSliderCursor, OverUp )
- DEFINE_CALLBACK( CtrlSliderCursor, UpOver )
- DEFINE_CALLBACK( CtrlSliderCursor, Move )
- DEFINE_CALLBACK( CtrlSliderCursor, Scroll )
- /// Last saved position of the cursor (stored as a percentage)
- float m_lastPercentage;
- /// Offset between the mouse pointer and the center of the cursor
- int m_xOffset, m_yOffset;
- /// The last received event
- EvtGeneric *m_pEvt;
- /// Images of the cursor in the differents states
- OSGraphics *m_pImgUp, *m_pImgOver, *m_pImgDown;
- /// Current image
- OSGraphics *m_pImg;
- /// Bezier curve of the slider
- const Bezier &m_rCurve;
-
- /// Method called when the position variable is modified
- virtual void onUpdate( Subject<VarPercent,void*> &rVariable, void * );
-
- /// Method to compute the resize factors
- void getResizeFactors( float &rFactorX, float &rFactorY ) const;
-
- /// Call notifyLayout
- void refreshLayout();
+public:
+ /// Create a cursor with 3 images (which are NOT copied, be careful)
+ /// If pVisible is NULL, the control is always visible
+ CtrlSliderCursor( intf_thread_t *pIntf, const GenericBitmap &rBmpUp,
+ const GenericBitmap &rBmpOver,
+ const GenericBitmap &rBmpDown,
+ const Bezier &rCurve, VarPercent &rVariable,
+ VarBool *pVisible, const UString &rTooltip,
+ const UString &rHelp );
+
+ virtual ~CtrlSliderCursor();
+
+ /// Handle an event
+ virtual void handleEvent( EvtGeneric &rEvent );
+
+ /// Check whether coordinates are inside the control
+ virtual bool mouseOver( int x, int y ) const;
+
+ /// Draw the control on the given graphics
+ virtual void draw( OSGraphics &rImage, int xDest, int yDest );
+
+ /// Get the text of the tooltip
+ virtual UString getTooltipText() const { return m_tooltip; }
+
+ /// Get the type of control (custom RTTI)
+ virtual string getType() const { return "slider_cursor"; }
+
+private:
+ /// Finite state machine of the control
+ FSM m_fsm;
+ /// Variable associated to the cursor
+ VarPercent &m_rVariable;
+ /// Tooltip text
+ const UString m_tooltip;
+ /// Initial size of the control
+ int m_width, m_height;
+ /// Position of the cursor
+ int m_xPosition, m_yPosition;
+ /// Callback objects
+ DEFINE_CALLBACK( CtrlSliderCursor, OverDown )
+ DEFINE_CALLBACK( CtrlSliderCursor, DownOver )
+ DEFINE_CALLBACK( CtrlSliderCursor, OverUp )
+ DEFINE_CALLBACK( CtrlSliderCursor, UpOver )
+ DEFINE_CALLBACK( CtrlSliderCursor, Move )
+ DEFINE_CALLBACK( CtrlSliderCursor, Scroll )
+ /// Last saved position of the cursor (stored as a percentage)
+ float m_lastPercentage;
+ /// Offset between the mouse pointer and the center of the cursor
+ int m_xOffset, m_yOffset;
+ /// The last received event
+ EvtGeneric *m_pEvt;
+ /// Images of the cursor in the differents states
+ OSGraphics *m_pImgUp, *m_pImgOver, *m_pImgDown;
+ /// Current image
+ OSGraphics *m_pImg;
+ /// Bezier curve of the slider
+ const Bezier &m_rCurve;
+
+ /// Method called when the position variable is modified
+ virtual void onUpdate( Subject<VarPercent> &rVariable, void * );
+
+ /// Method to compute the resize factors
+ void getResizeFactors( float &rFactorX, float &rFactorY ) const;
+
+ /// Call notifyLayout
+ void refreshLayout();