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 @@
* cmd_show_window.hpp
*****************************************************************************
* 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>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -27,23 +27,27 @@
#include "cmd_generic.hpp"
#include "../src/generic_window.hpp"
#include "../src/window_manager.hpp"
/// Command to show a window
class CmdShowWindow: public CmdGeneric
{
public:
CmdShowWindow( intf_thread_t *pIntf, GenericWindow &rWin ):
CmdGeneric( pIntf ), m_rWin( rWin ) {}
CmdShowWindow( intf_thread_t *pIntf, WindowManager &rWinManager,
GenericWindow &rWin ):
CmdGeneric( pIntf ), m_rWinManager( rWinManager ), m_rWin( rWin ) {}
virtual ~CmdShowWindow() {}
/// 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
virtual string getType() const { return "show window"; }
private:
/// Reference to the window manager
WindowManager &m_rWinManager;
/// Reference to the window
GenericWindow &m_rWin;
};
......@@ -53,17 +57,20 @@ class CmdShowWindow: public CmdGeneric
class CmdHideWindow: public CmdGeneric
{
public:
CmdHideWindow( intf_thread_t *pIntf, GenericWindow &rWin ):
CmdGeneric( pIntf ), m_rWin( rWin ) {}
CmdHideWindow( intf_thread_t *pIntf, WindowManager &rWinManager,
GenericWindow &rWin ):
CmdGeneric( pIntf ), m_rWinManager( rWinManager ), m_rWin( rWin ) {}
virtual ~CmdHideWindow() {}
/// 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
virtual string getType() const { return "hide window"; }
private:
/// Reference to the window manager
WindowManager &m_rWinManager;
/// Reference to the window
GenericWindow &m_rWin;
};
......
......@@ -2,7 +2,7 @@
* ctrl_move.cpp
*****************************************************************************
* 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>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -106,7 +106,7 @@ void CtrlMove::transStillMoving( SkinObject *pCtrl )
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 )
int yNewTop = pEvtMotion->getYPos() - pThis->m_yPos +
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 @@
* interpreter.cpp
*****************************************************************************
* 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>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -121,7 +121,8 @@ CmdGeneric *Interpreter::parseAction( const string &rAction, Theme *pTheme )
GenericWindow *pWin = pTheme->getWindowById( windowId );
if( pWin )
{
pCommand = new CmdShowWindow( getIntf(), *pWin );
pCommand = new CmdShowWindow( getIntf(), pTheme->getWindowManager(),
*pWin );
}
else
{
......@@ -135,7 +136,8 @@ CmdGeneric *Interpreter::parseAction( const string &rAction, Theme *pTheme )
GenericWindow *pWin = pTheme->getWindowById( windowId );
if( pWin )
{
pCommand = new CmdHideWindow( getIntf(), *pWin );
pCommand = new CmdHideWindow( getIntf(), pTheme->getWindowManager(),
*pWin );
}
else
{
......
......@@ -59,7 +59,7 @@ GenericWindow::GenericWindow( intf_thread_t *pIntf, int left, int top,
m_pCapturingControl( NULL ), m_pFocusControl( NULL ), m_varVisible( pIntf )
{
// Register as a moving window
m_rWindowManager.registerWindow( this );
m_rWindowManager.registerWindow( *this );
// Get the OSFactory
OSFactory *pOsFactory = OSFactory::instance( getIntf() );
......@@ -79,7 +79,7 @@ GenericWindow::~GenericWindow()
{
m_varVisible.delObserver( this );
// Unregister from the window manager
m_rWindowManager.unregisterWindow( this );
m_rWindowManager.unregisterWindow( *this );
if( m_pTooltip )
{
......@@ -156,7 +156,7 @@ void GenericWindow::processEvent( EvtMouse &rEvtMouse )
if( rEvtMouse.getAction() == EvtMouse::kDown )
{
// Raise all the windows
m_rWindowManager.raiseAll( this );
m_rWindowManager.raiseAll( *this );
if( pNewHitControl && pNewHitControl->isFocusable() )
{
......
......@@ -29,33 +29,27 @@
#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
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
m_allWindows.erase( pWindow );
m_movingWindows.erase( pWindow );
m_dependencies.erase( pWindow );
m_allWindows.erase( &rWindow );
m_movingWindows.erase( &rWindow );
m_dependencies.erase( &rWindow );
}
void WindowManager::startMove( GenericWindow *pWindow )
void WindowManager::startMove( GenericWindow &rWindow )
{
// Rebuild the set of moving windows
m_movingWindows.clear();
buildDependSet( m_movingWindows, pWindow );
buildDependSet( m_movingWindows, &rWindow );
// Change the opacity of the moving windows
WinSet_t::const_iterator it;
......@@ -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
int xOffset = left - pWindow->getLeft();
int yOffset = top - pWindow->getTop();
int xOffset = left - rWindow.getLeft();
int yOffset = top - rWindow.getTop();
// Check anchoring; this can change the values of xOffset and yOffset
checkAnchors( pWindow, xOffset, yOffset );
checkAnchors( &rWindow, xOffset, yOffset );
// Move all the windows
WinSet_t::const_iterator it;
......@@ -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
WinSet_t::const_iterator it;
for( it = m_allWindows.begin(); it != m_allWindows.end(); it++ )
{
if( *it != pWindow )
if( *it != &rWindow )
{
(*it)->raise();
}
}
// Make sure to raise the given window at the end, so that it is above
pWindow->raise();
rWindow.raise();
}
......
......@@ -26,13 +26,13 @@
#define WINDOW_MANAGER_HPP
#include "skin_common.hpp"
#include "generic_window.hpp"
#include <list>
#include <map>
#include <set>
#include <utility>
class GenericWindow;
class Anchor;
......@@ -46,13 +46,13 @@ class WindowManager: public SkinObject
/// Add a window to the list of known windows. Necessary if you want
/// your window to be movable...
void registerWindow( GenericWindow *pWindow );
void registerWindow( GenericWindow &rWindow );
/// Remove a previously registered window
void unregisterWindow( GenericWindow *pWindow );
void unregisterWindow( GenericWindow &rWindow );
/// 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.
void stopMove();
......@@ -60,10 +60,10 @@ class WindowManager: public SkinObject
/// Move the pWindow window to (left, top), and move all its
/// anchored windows.
/// 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
void raiseAll( GenericWindow *pWindow ) const;
/// Raise all the windows, rWindow being above the others
void raiseAll( GenericWindow &rWindow ) const;
/// Show all the registered windows
void showAll() const;
......@@ -71,6 +71,12 @@ class WindowManager: public SkinObject
/// Hide all the registered windows
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
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