]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins2/controls/ctrl_move.cpp
skins2: improve refresh of layouts
[vlc] / modules / gui / skins2 / controls / ctrl_move.cpp
index baaf487f0ee6bd00956af1138a237b847f373b7b..39700c839b270c110318596b40ff117d07fd9d07 100644 (file)
@@ -5,7 +5,7 @@
  * $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
@@ -19,7 +19,7 @@
  *
  * 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 "ctrl_move.hpp"
@@ -37,9 +37,9 @@ CtrlMove::CtrlMove( intf_thread_t *pIntf, WindowManager &rWindowManager,
     CtrlFlat( pIntf, rHelp, pVisible ), m_fsm( pIntf ),
     m_rWindowManager( rWindowManager ),
     m_rCtrl( rCtrl ), m_rWindow( rWindow ),
-    m_cmdMovingMoving( this, &transMovingMoving ),
-    m_cmdStillMoving( this, &transStillMoving ),
-    m_cmdMovingStill( this, &transMovingStill )
+    m_cmdMovingMoving( this ),
+    m_cmdStillMoving( this ),
+    m_cmdMovingStill( this )
 {
     m_pEvt = NULL;
     m_xPos = 0;
@@ -66,9 +66,9 @@ bool CtrlMove::mouseOver( int x, int y ) const
 }
 
 
-void CtrlMove::draw( OSGraphics &rImage, int xDest, int yDest )
+void CtrlMove::draw( OSGraphics &rImage, int xDest, int yDest, int w, int h )
 {
-    m_rCtrl.draw( rImage, xDest, yDest );
+    m_rCtrl.draw( rImage, xDest, yDest, w, h );
 }
 
 
@@ -80,12 +80,25 @@ void CtrlMove::setLayout( GenericLayout *pLayout, const Position &rPosition )
 }
 
 
+void CtrlMove::unsetLayout( )
+{
+    m_rCtrl.unsetLayout();
+    CtrlGeneric::unsetLayout();
+}
+
+
 const Position *CtrlMove::getPosition() const
 {
     return m_rCtrl.getPosition();
 }
 
 
+void CtrlMove::onResize()
+{
+    m_rCtrl.onResize();
+}
+
+
 void CtrlMove::handleEvent( EvtGeneric &rEvent )
 {
     m_pEvt = &rEvent;
@@ -96,39 +109,35 @@ void CtrlMove::handleEvent( EvtGeneric &rEvent )
 }
 
 
-void CtrlMove::transStillMoving( SkinObject *pCtrl )
+void CtrlMove::CmdStillMoving::execute()
 {
-    CtrlMove *pThis = (CtrlMove*)pCtrl;
-    EvtMouse *pEvtMouse = (EvtMouse*)pThis->m_pEvt;
+    EvtMouse *pEvtMouse = (EvtMouse*)m_pParent->m_pEvt;
 
-    pThis->m_xPos = pEvtMouse->getXPos();
-    pThis->m_yPos = pEvtMouse->getYPos();
+    m_pParent->m_xPos = pEvtMouse->getXPos();
+    m_pParent->m_yPos = pEvtMouse->getYPos();
 
-    pThis->captureMouse();
+    m_pParent->captureMouse();
 
-    pThis->m_rWindowManager.startMove( pThis->m_rWindow );
+    m_pParent->m_rWindowManager.startMove( m_pParent->m_rWindow );
 }
 
 
-void CtrlMove::transMovingMoving( SkinObject *pCtrl )
+void CtrlMove::CmdMovingMoving::execute()
 {
-    CtrlMove *pThis = (CtrlMove*)pCtrl;
-    EvtMotion *pEvtMotion = (EvtMotion*)pThis->m_pEvt;
+    EvtMotion *pEvtMotion = (EvtMotion*)m_pParent->m_pEvt;
 
-    int xNewLeft = pEvtMotion->getXPos() - pThis->m_xPos +
-                   pThis->m_rWindow.getLeft();
-    int yNewTop = pEvtMotion->getYPos() - pThis->m_yPos +
-                  pThis->m_rWindow.getTop();
+    int xNewLeft = pEvtMotion->getXPos() - m_pParent->m_xPos +
+                   m_pParent->m_rWindow.getLeft();
+    int yNewTop = pEvtMotion->getYPos() - m_pParent->m_yPos +
+                  m_pParent->m_rWindow.getTop();
 
-    pThis->m_rWindowManager.move( pThis->m_rWindow, xNewLeft, yNewTop );
+    m_pParent->m_rWindowManager.move( m_pParent->m_rWindow, xNewLeft, yNewTop );
 }
 
 
-void CtrlMove::transMovingStill( SkinObject *pCtrl )
+void CtrlMove::CmdMovingStill::execute()
 {
-    CtrlMove *pThis = (CtrlMove*)pCtrl;
-
-    pThis->releaseMouse();
+    m_pParent->releaseMouse();
 
-    pThis->m_rWindowManager.stopMove();
+    m_pParent->m_rWindowManager.stopMove();
 }