/*****************************************************************************
* ctrl_radialslider.cpp
*****************************************************************************
- * Copyright (C) 2003 VideoLAN
+ * Copyright (C) 2003 the VideoLAN team
* $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
- * Olivier Teulière <ipkiss@via.ecp.fr>
+ * Olivier Teulière <ipkiss@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <math.h>
VarBool *pVisible ):
CtrlGeneric( pIntf, rHelp, pVisible ), m_fsm( pIntf ), m_numImg( numImg ),
m_rVariable( rVariable ), m_minAngle( minAngle ), m_maxAngle( maxAngle ),
- m_cmdUpDown( this, &transUpDown ), m_cmdDownUp( this, &transDownUp ),
- m_cmdMove( this, &transMove ), m_position( 0 ), m_lastPos( 0 )
+ m_cmdUpDown( this ), m_cmdDownUp( this ),
+ m_cmdMove( this )
{
// Build the images of the sequence
OSFactory *pOsFactory = OSFactory::instance( getIntf() );
}
-void CtrlRadialSlider::onUpdate( Subject<VarPercent> &rVariable )
+void CtrlRadialSlider::onUpdate( Subject<VarPercent,void*> &rVariable,
+ void *arg )
{
m_position = (int)( m_rVariable.get() * m_numImg );
notifyLayout( m_width, m_height );
}
-void CtrlRadialSlider::transUpDown( SkinObject *pCtrl )
+void CtrlRadialSlider::CmdUpDown::execute()
{
- CtrlRadialSlider *pThis = (CtrlRadialSlider*)pCtrl;
-
- EvtMouse *pEvtMouse = (EvtMouse*)pThis->m_pEvt;
+ EvtMouse *pEvtMouse = (EvtMouse*)m_pParent->m_pEvt;
// Change the position of the cursor, in non-blocking mode
- pThis->setCursor( pEvtMouse->getXPos(), pEvtMouse->getYPos(), false );
+ m_pParent->setCursor( pEvtMouse->getXPos(), pEvtMouse->getYPos(), false );
- pThis->captureMouse();
+ m_pParent->captureMouse();
}
-void CtrlRadialSlider::transDownUp( SkinObject *pCtrl )
+void CtrlRadialSlider::CmdDownUp::execute()
{
- CtrlRadialSlider *pThis = (CtrlRadialSlider*)pCtrl;
-
- pThis->releaseMouse();
+ m_pParent->releaseMouse();
}
-void CtrlRadialSlider::transMove( SkinObject *pCtrl )
+void CtrlRadialSlider::CmdMove::execute()
{
- CtrlRadialSlider *pThis = (CtrlRadialSlider*)pCtrl;
-
- EvtMouse *pEvtMouse = (EvtMouse*)pThis->m_pEvt;
+ EvtMouse *pEvtMouse = (EvtMouse*)m_pParent->m_pEvt;
// Change the position of the cursor, in blocking mode
- pThis->setCursor( pEvtMouse->getXPos(), pEvtMouse->getYPos(), true );
+ m_pParent->setCursor( pEvtMouse->getXPos(), pEvtMouse->getYPos(), true );
}
int y = posY - pPos->getTop() - m_width / 2;
// Compute the polar coordinates. angle is -(-j,OM)
- float r = sqrt(x*x + y*y);
+ float r = sqrt((float)(x*x + y*y));
if( r == 0 )
{
return;