Commit a9b95148 authored by Olivier Teulière's avatar Olivier Teulière

* skins2/*: - show/hide do not bypass the window manager anymore

             - transformed some pointers into references
parent 1fd23e2c
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* cmd_show_window.hpp * cmd_show_window.hpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: cmd_show_window.hpp,v 1.2 2004/01/18 19:54:45 asmax Exp $ * $Id$
* *
* Authors: Cyril Deguet <asmax@via.ecp.fr> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr> * Olivier Teulire <ipkiss@via.ecp.fr>
...@@ -27,23 +27,27 @@ ...@@ -27,23 +27,27 @@
#include "cmd_generic.hpp" #include "cmd_generic.hpp"
#include "../src/generic_window.hpp" #include "../src/generic_window.hpp"
#include "../src/window_manager.hpp"
/// Command to show a window /// Command to show a window
class CmdShowWindow: public CmdGeneric class CmdShowWindow: public CmdGeneric
{ {
public: public:
CmdShowWindow( intf_thread_t *pIntf, GenericWindow &rWin ): CmdShowWindow( intf_thread_t *pIntf, WindowManager &rWinManager,
CmdGeneric( pIntf ), m_rWin( rWin ) {} GenericWindow &rWin ):
CmdGeneric( pIntf ), m_rWinManager( rWinManager ), m_rWin( rWin ) {}
virtual ~CmdShowWindow() {} virtual ~CmdShowWindow() {}
/// This method does the real job of the command /// This method does the real job of the command
virtual void execute() { m_rWin.show(); } virtual void execute() { m_rWinManager.show( m_rWin ); }
/// Return the type of the command /// Return the type of the command
virtual string getType() const { return "show window"; } virtual string getType() const { return "show window"; }
private: private:
/// Reference to the window manager
WindowManager &m_rWinManager;
/// Reference to the window /// Reference to the window
GenericWindow &m_rWin; GenericWindow &m_rWin;
}; };
...@@ -53,17 +57,20 @@ class CmdShowWindow: public CmdGeneric ...@@ -53,17 +57,20 @@ class CmdShowWindow: public CmdGeneric
class CmdHideWindow: public CmdGeneric class CmdHideWindow: public CmdGeneric
{ {
public: public:
CmdHideWindow( intf_thread_t *pIntf, GenericWindow &rWin ): CmdHideWindow( intf_thread_t *pIntf, WindowManager &rWinManager,
CmdGeneric( pIntf ), m_rWin( rWin ) {} GenericWindow &rWin ):
CmdGeneric( pIntf ), m_rWinManager( rWinManager ), m_rWin( rWin ) {}
virtual ~CmdHideWindow() {} virtual ~CmdHideWindow() {}
/// This method does the real job of the command /// This method does the real job of the command
virtual void execute() { m_rWin.hide(); } virtual void execute() { m_rWinManager.hide( m_rWin ); }
/// Return the type of the command /// Return the type of the command
virtual string getType() const { return "hide window"; } virtual string getType() const { return "hide window"; }
private: private:
/// Reference to the window manager
WindowManager &m_rWinManager;
/// Reference to the window /// Reference to the window
GenericWindow &m_rWin; GenericWindow &m_rWin;
}; };
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* ctrl_move.cpp * ctrl_move.cpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: ctrl_move.cpp,v 1.2 2004/02/29 16:49:55 asmax Exp $ * $Id$
* *
* Authors: Cyril Deguet <asmax@via.ecp.fr> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr> * Olivier Teulire <ipkiss@via.ecp.fr>
...@@ -106,7 +106,7 @@ void CtrlMove::transStillMoving( SkinObject *pCtrl ) ...@@ -106,7 +106,7 @@ void CtrlMove::transStillMoving( SkinObject *pCtrl )
pThis->captureMouse(); pThis->captureMouse();
pThis->m_rWindowManager.startMove( &pThis->m_rWindow ); pThis->m_rWindowManager.startMove( pThis->m_rWindow );
} }
...@@ -120,7 +120,7 @@ void CtrlMove::transMovingMoving( SkinObject *pCtrl ) ...@@ -120,7 +120,7 @@ void CtrlMove::transMovingMoving( SkinObject *pCtrl )
int yNewTop = pEvtMotion->getYPos() - pThis->m_yPos + int yNewTop = pEvtMotion->getYPos() - pThis->m_yPos +
pThis->m_rWindow.getTop(); pThis->m_rWindow.getTop();
pThis->m_rWindowManager.move( &pThis->m_rWindow, xNewLeft, yNewTop ); pThis->m_rWindowManager.move( pThis->m_rWindow, xNewLeft, yNewTop );
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* interpreter.cpp * interpreter.cpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: interpreter.cpp,v 1.5 2004/02/01 14:44:11 asmax Exp $ * $Id$
* *
* Authors: Cyril Deguet <asmax@via.ecp.fr> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr> * Olivier Teulire <ipkiss@via.ecp.fr>
...@@ -121,7 +121,8 @@ CmdGeneric *Interpreter::parseAction( const string &rAction, Theme *pTheme ) ...@@ -121,7 +121,8 @@ CmdGeneric *Interpreter::parseAction( const string &rAction, Theme *pTheme )
GenericWindow *pWin = pTheme->getWindowById( windowId ); GenericWindow *pWin = pTheme->getWindowById( windowId );
if( pWin ) if( pWin )
{ {
pCommand = new CmdShowWindow( getIntf(), *pWin ); pCommand = new CmdShowWindow( getIntf(), pTheme->getWindowManager(),
*pWin );
} }
else else
{ {
...@@ -135,7 +136,8 @@ CmdGeneric *Interpreter::parseAction( const string &rAction, Theme *pTheme ) ...@@ -135,7 +136,8 @@ CmdGeneric *Interpreter::parseAction( const string &rAction, Theme *pTheme )
GenericWindow *pWin = pTheme->getWindowById( windowId ); GenericWindow *pWin = pTheme->getWindowById( windowId );
if( pWin ) if( pWin )
{ {
pCommand = new CmdHideWindow( getIntf(), *pWin ); pCommand = new CmdHideWindow( getIntf(), pTheme->getWindowManager(),
*pWin );
} }
else else
{ {
......
...@@ -59,7 +59,7 @@ GenericWindow::GenericWindow( intf_thread_t *pIntf, int left, int top, ...@@ -59,7 +59,7 @@ GenericWindow::GenericWindow( intf_thread_t *pIntf, int left, int top,
m_pCapturingControl( NULL ), m_pFocusControl( NULL ), m_varVisible( pIntf ) m_pCapturingControl( NULL ), m_pFocusControl( NULL ), m_varVisible( pIntf )
{ {
// Register as a moving window // Register as a moving window
m_rWindowManager.registerWindow( this ); m_rWindowManager.registerWindow( *this );
// Get the OSFactory // Get the OSFactory
OSFactory *pOsFactory = OSFactory::instance( getIntf() ); OSFactory *pOsFactory = OSFactory::instance( getIntf() );
...@@ -79,7 +79,7 @@ GenericWindow::~GenericWindow() ...@@ -79,7 +79,7 @@ GenericWindow::~GenericWindow()
{ {
m_varVisible.delObserver( this ); m_varVisible.delObserver( this );
// Unregister from the window manager // Unregister from the window manager
m_rWindowManager.unregisterWindow( this ); m_rWindowManager.unregisterWindow( *this );
if( m_pTooltip ) if( m_pTooltip )
{ {
...@@ -156,7 +156,7 @@ void GenericWindow::processEvent( EvtMouse &rEvtMouse ) ...@@ -156,7 +156,7 @@ void GenericWindow::processEvent( EvtMouse &rEvtMouse )
if( rEvtMouse.getAction() == EvtMouse::kDown ) if( rEvtMouse.getAction() == EvtMouse::kDown )
{ {
// Raise all the windows // Raise all the windows
m_rWindowManager.raiseAll( this ); m_rWindowManager.raiseAll( *this );
if( pNewHitControl && pNewHitControl->isFocusable() ) if( pNewHitControl && pNewHitControl->isFocusable() )
{ {
......
...@@ -29,33 +29,27 @@ ...@@ -29,33 +29,27 @@
#include "../utils/position.hpp" #include "../utils/position.hpp"
void WindowManager::registerWindow( GenericWindow *pWindow ) void WindowManager::registerWindow( GenericWindow &rWindow )
{ {
if( pWindow == NULL )
{
msg_Dbg( getIntf(), "WM: registering a NULL window" );
return;
}
// Add the window to the set // Add the window to the set
m_allWindows.insert( pWindow ); m_allWindows.insert( &rWindow );
} }
void WindowManager::unregisterWindow( GenericWindow *pWindow ) void WindowManager::unregisterWindow( GenericWindow &rWindow )
{ {
// Erase every possible reference to the window // Erase every possible reference to the window
m_allWindows.erase( pWindow ); m_allWindows.erase( &rWindow );
m_movingWindows.erase( pWindow ); m_movingWindows.erase( &rWindow );
m_dependencies.erase( pWindow ); m_dependencies.erase( &rWindow );
} }
void WindowManager::startMove( GenericWindow *pWindow ) void WindowManager::startMove( GenericWindow &rWindow )
{ {
// Rebuild the set of moving windows // Rebuild the set of moving windows
m_movingWindows.clear(); m_movingWindows.clear();
buildDependSet( m_movingWindows, pWindow ); buildDependSet( m_movingWindows, &rWindow );
// Change the opacity of the moving windows // Change the opacity of the moving windows
WinSet_t::const_iterator it; WinSet_t::const_iterator it;
...@@ -119,14 +113,14 @@ void WindowManager::stopMove() ...@@ -119,14 +113,14 @@ void WindowManager::stopMove()
} }
void WindowManager::move( GenericWindow *pWindow, int left, int top ) const void WindowManager::move( GenericWindow &rWindow, int left, int top ) const
{ {
// Compute the real move offset // Compute the real move offset
int xOffset = left - pWindow->getLeft(); int xOffset = left - rWindow.getLeft();
int yOffset = top - pWindow->getTop(); int yOffset = top - rWindow.getTop();
// Check anchoring; this can change the values of xOffset and yOffset // Check anchoring; this can change the values of xOffset and yOffset
checkAnchors( pWindow, xOffset, yOffset ); checkAnchors( &rWindow, xOffset, yOffset );
// Move all the windows // Move all the windows
WinSet_t::const_iterator it; WinSet_t::const_iterator it;
...@@ -137,19 +131,19 @@ void WindowManager::move( GenericWindow *pWindow, int left, int top ) const ...@@ -137,19 +131,19 @@ void WindowManager::move( GenericWindow *pWindow, int left, int top ) const
} }
void WindowManager::raiseAll( GenericWindow *pWindow ) const void WindowManager::raiseAll( GenericWindow &rWindow ) const
{ {
// Raise all the windows // Raise all the windows
WinSet_t::const_iterator it; WinSet_t::const_iterator it;
for( it = m_allWindows.begin(); it != m_allWindows.end(); it++ ) for( it = m_allWindows.begin(); it != m_allWindows.end(); it++ )
{ {
if( *it != pWindow ) if( *it != &rWindow )
{ {
(*it)->raise(); (*it)->raise();
} }
} }
// Make sure to raise the given window at the end, so that it is above // Make sure to raise the given window at the end, so that it is above
pWindow->raise(); rWindow.raise();
} }
......
...@@ -26,13 +26,13 @@ ...@@ -26,13 +26,13 @@
#define WINDOW_MANAGER_HPP #define WINDOW_MANAGER_HPP
#include "skin_common.hpp" #include "skin_common.hpp"
#include "generic_window.hpp"
#include <list> #include <list>
#include <map> #include <map>
#include <set> #include <set>
#include <utility> #include <utility>
class GenericWindow;
class Anchor; class Anchor;
...@@ -46,13 +46,13 @@ class WindowManager: public SkinObject ...@@ -46,13 +46,13 @@ class WindowManager: public SkinObject
/// Add a window to the list of known windows. Necessary if you want /// Add a window to the list of known windows. Necessary if you want
/// your window to be movable... /// your window to be movable...
void registerWindow( GenericWindow *pWindow ); void registerWindow( GenericWindow &rWindow );
/// Remove a previously registered window /// Remove a previously registered window
void unregisterWindow( GenericWindow *pWindow ); void unregisterWindow( GenericWindow &rWindow );
/// Tell the window manager that a move is initiated for pWindow. /// Tell the window manager that a move is initiated for pWindow.
void startMove( GenericWindow *pWindow ); void startMove( GenericWindow &rWindow );
/// Tell the window manager that the current move ended. /// Tell the window manager that the current move ended.
void stopMove(); void stopMove();
...@@ -60,10 +60,10 @@ class WindowManager: public SkinObject ...@@ -60,10 +60,10 @@ class WindowManager: public SkinObject
/// Move the pWindow window to (left, top), and move all its /// Move the pWindow window to (left, top), and move all its
/// anchored windows. /// anchored windows.
/// If a new anchoring is detected, the windows will move accordingly. /// If a new anchoring is detected, the windows will move accordingly.
void move( GenericWindow *pWindow, int left, int top ) const; void move( GenericWindow &rWindow, int left, int top ) const;
/// Raise all the windows, pWindow being above the others /// Raise all the windows, rWindow being above the others
void raiseAll( GenericWindow *pWindow ) const; void raiseAll( GenericWindow &rWindow ) const;
/// Show all the registered windows /// Show all the registered windows
void showAll() const; void showAll() const;
...@@ -71,6 +71,12 @@ class WindowManager: public SkinObject ...@@ -71,6 +71,12 @@ class WindowManager: public SkinObject
/// Hide all the registered windows /// Hide all the registered windows
void hideAll() const; void hideAll() const;
/// Show the given window
void show( GenericWindow &rWindow ) { rWindow.show(); }
/// Hide the given window
void hide( GenericWindow &rWindow ) { rWindow.hide(); }
/// Toggle all the windows on top /// Toggle all the windows on top
void toggleOnTop(); void toggleOnTop();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment