* ctrl_resize.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: ctrl_resize.cpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
+ * $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
#include "../events/evt_mouse.hpp"
#include "../events/evt_motion.hpp"
#include "../src/generic_layout.hpp"
+#include "../src/os_factory.hpp"
#include "../utils/position.hpp"
#include "../commands/async_queue.hpp"
#include "../commands/cmd_resize.hpp"
GenericLayout &rLayout, const UString &rHelp,
VarBool *pVisible ):
CtrlFlat( pIntf, rHelp, pVisible ), m_fsm( pIntf ), m_rCtrl( rCtrl ),
- m_rLayout( rLayout ), m_cmdResizeResize( this, &transResizeResize ),
+ m_rLayout( rLayout ), m_cmdOutStill( this, &transOutStill ),
+ m_cmdStillOut( this, &transStillOut ),
+ m_cmdStillStill( this, &transStillStill ),
m_cmdStillResize( this, &transStillResize ),
- m_cmdResizeStill( this, &transResizeStill )
+ m_cmdResizeStill( this, &transResizeStill ),
+ m_cmdResizeResize( this, &transResizeResize )
{
m_pEvt = NULL;
m_xPos = 0;
m_yPos = 0;
// States
- m_fsm.addState( "resize" );
+ m_fsm.addState( "out" );
m_fsm.addState( "still" );
+ m_fsm.addState( "resize" );
// Transitions
+ m_fsm.addTransition( "out", "enter", "still", &m_cmdOutStill );
+ m_fsm.addTransition( "still", "leave", "out", &m_cmdStillOut );
+ m_fsm.addTransition( "still", "motion", "still", &m_cmdStillStill );
m_fsm.addTransition( "resize", "mouse:left:up:none", "still",
&m_cmdResizeStill );
m_fsm.addTransition( "still", "mouse:left:down:none", "resize",
}
+void CtrlResize::transOutStill( SkinObject *pCtrl )
+{
+ CtrlResize *pThis = (CtrlResize*)pCtrl;
+ OSFactory *pOsFactory = OSFactory::instance( pThis->getIntf() );
+ pOsFactory->changeCursor( OSFactory::kResizeNWSE );
+}
+
+
+void CtrlResize::transStillOut( SkinObject *pCtrl )
+{
+ CtrlResize *pThis = (CtrlResize*)pCtrl;
+ OSFactory *pOsFactory = OSFactory::instance( pThis->getIntf() );
+ pOsFactory->changeCursor( OSFactory::kDefaultArrow );
+}
+
+
+void CtrlResize::transStillStill( SkinObject *pCtrl )
+{
+ CtrlResize *pThis = (CtrlResize*)pCtrl;
+ OSFactory *pOsFactory = OSFactory::instance( pThis->getIntf() );
+ pOsFactory->changeCursor( OSFactory::kResizeNWSE );
+}
+
+
void CtrlResize::transStillResize( SkinObject *pCtrl )
{
CtrlResize *pThis = (CtrlResize*)pCtrl;
EvtMouse *pEvtMouse = (EvtMouse*)pThis->m_pEvt;
+ // Set the cursor
+ OSFactory *pOsFactory = OSFactory::instance( pThis->getIntf() );
+ pOsFactory->changeCursor( OSFactory::kResizeNWSE );
+
pThis->m_xPos = pEvtMouse->getXPos();
pThis->m_yPos = pEvtMouse->getYPos();
}
+void CtrlResize::transResizeStill( SkinObject *pCtrl )
+{
+ CtrlResize *pThis = (CtrlResize*)pCtrl;
+
+ // Set the cursor
+ OSFactory *pOsFactory = OSFactory::instance( pThis->getIntf() );
+ pOsFactory->changeCursor( OSFactory::kResizeNWSE );
+
+ pThis->releaseMouse();
+}
+
+
void CtrlResize::transResizeResize( SkinObject *pCtrl )
{
CtrlResize *pThis = (CtrlResize*)pCtrl;
EvtMotion *pEvtMotion = (EvtMotion*)pThis->m_pEvt;
+ // Set the cursor
+ OSFactory *pOsFactory = OSFactory::instance( pThis->getIntf() );
+ pOsFactory->changeCursor( OSFactory::kResizeNWSE );
+
int newWidth = pEvtMotion->getXPos() - pThis->m_xPos + pThis->m_width;
int newHeight = pEvtMotion->getYPos() - pThis->m_yPos + pThis->m_height;
pQueue->remove( "resize" );
pQueue->push( CmdGenericPtr( pCmd ) );
}
-
-
-void CtrlResize::transResizeStill( SkinObject *pCtrl )
-{
- CtrlResize *pThis = (CtrlResize*)pCtrl;
-
- pThis->releaseMouse();
-}
-
* ctrl_resize.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: ctrl_resize.hpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
+ * $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
/// Get the position of the decorated control in the layout, if any
virtual const Position *getPosition() const;
- static void transResizeResize( SkinObject *pCtrl );
+ static void transOutStill( SkinObject *pCtrl );
+ static void transStillOut( SkinObject *pCtrl );
+ static void transStillStill( SkinObject *pCtrl );
static void transStillResize( SkinObject *pCtrl );
static void transResizeStill( SkinObject *pCtrl );
+ static void transResizeResize( SkinObject *pCtrl );
private:
FSM m_fsm;
/// Position of the click that started the resizing
int m_xPos, m_yPos;
/// Callbacks
- Callback m_cmdResizeResize;
+ Callback m_cmdOutStill;
+ Callback m_cmdStillOut;
+ Callback m_cmdStillStill;
Callback m_cmdStillResize;
Callback m_cmdResizeStill;
+ Callback m_cmdResizeResize;
// Size of the layout, before resizing
int m_width, m_height;
* os_factory.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: os_factory.hpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
+ * $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
class OSFactory: public SkinObject
{
public:
+ typedef enum
+ {
+ kDefaultArrow,
+ kResizeNS,
+ kResizeWE,
+ kResizeNWSE,
+ kResizeNESW
+ } CursorType_t;
+
/// Initialization method overloaded in derived classes.
/// It must return false if the init failed.
virtual bool init() { return true; }
/// Get the position of the mouse
virtual void getMousePos( int &rXPos, int &rYPos ) const = 0;
+ /// Change the cursor
+ virtual void changeCursor( CursorType_t type ) const = 0;
+
/// Delete a directory recursively
virtual void rmDir( const string &rPath ) = 0;
* win32_factory.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: win32_factory.cpp,v 1.2 2004/01/27 17:01:51 gbazin Exp $
+ * $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
}
+void Win32Factory::changeCursor( CursorType_t type ) const
+{
+ LPCTSTR id;
+ switch( type )
+ {
+ case kDefaultArrow:
+ id = IDC_ARROW;
+ break;
+ case kResizeNWSE:
+ id = IDC_SIZENWSE;
+ break;
+ case kResizeNS:
+ id = IDC_SIZENS;
+ break;
+ case kResizeWE:
+ id = IDC_SIZEWE;
+ break;
+ case kResizeNESW:
+ id = IDC_SIZENESW;
+ break;
+ default:
+ id = IDC_ARROW;
+ break;
+ }
+
+ HCURSOR hCurs = LoadCursor( NULL, id );
+ SetCursor( hCurs );
+}
+
+
void Win32Factory::rmDir( const string &rPath )
{
WIN32_FIND_DATA find;
* win32_factory.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: win32_factory.hpp,v 1.3 2004/02/27 13:24:12 gbazin Exp $
+ * $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
#ifndef WIN32_FACTORY_HPP
#define WIN32_FACTORY_HPP
-#define _WIN32_WINNT 0x0500
+#ifndef _WIN32_WINNT
+# define _WIN32_WINNT 0x0500
+#endif
#include <windows.h>
#include "../src/os_factory.hpp"
/// Get the position of the mouse
virtual void getMousePos( int &rXPos, int &rYPos ) const;
+ /// Change the cursor
+ virtual void changeCursor( CursorType_t type ) const;
+
/// Delete a directory recursively
virtual void rmDir( const string &rPath );
// We dynamically load msimg32.dll to get a pointer to TransparentBlt()
BOOL (WINAPI *TransparentBlt)( HDC, int, int, int, int,
HDC, int, int, int, int, UINT );
- BOOL (WINAPI *AlphaBlend)( HDC, int, int, int, int, HDC, int, int,
- int, int, BLENDFUNCTION );
+ BOOL (WINAPI *AlphaBlend)( HDC, int, int, int, int,
+ HDC, int, int, int, int, BLENDFUNCTION );
// Idem for user32.dll and SetLayeredWindowAttributes()
BOOL (WINAPI *SetLayeredWindowAttributes)( HWND, COLORREF,
* x11_factory.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: x11_factory.hpp,v 1.2 2004/01/18 00:25:02 asmax Exp $
+ * $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
/// Get the position of the mouse
virtual void getMousePos( int &rXPos, int &rYPos ) const;
+ /// Change the cursor
+ virtual void changeCursor( CursorType_t type ) const { /*TODO*/ }
+
/// Delete a directory recursively
virtual void rmDir( const string &rPath );