]> 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
old mode 100755 (executable)
new mode 100644 (file)
index f341c67..39700c8
@@ -1,11 +1,11 @@
 /*****************************************************************************
  * ctrl_move.cpp
  *****************************************************************************
- * Copyright (C) 2003 VideoLAN
- * $Id: ctrl_move.cpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
+ * 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 "ctrl_move.hpp"
 #include "../events/evt_generic.hpp"
 #include "../events/evt_mouse.hpp"
 #include "../events/evt_motion.hpp"
-#include "../src/generic_window.hpp"
+#include "../src/top_window.hpp"
 #include "../src/window_manager.hpp"
 #include "../utils/position.hpp"
 
 
 CtrlMove::CtrlMove( intf_thread_t *pIntf, WindowManager &rWindowManager,
-                    CtrlFlat &rCtrl, GenericWindow &rWindow,
+                    CtrlFlat &rCtrl, TopWindow &rWindow,
                     const UString &rHelp, VarBool *pVisible ):
     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();
 }