/*****************************************************************************
* generic_window.cpp
*****************************************************************************
- * Copyright (C) 2003 VideoLAN (Centrale Réseaux) and its contributors
+ * 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 "generic_window.hpp"
#include "os_window.hpp"
#include "os_factory.hpp"
+#include "var_manager.hpp"
#include "../events/evt_refresh.hpp"
bool dragDrop, bool playOnDrop,
GenericWindow *pParent ):
SkinObject( pIntf ), m_left( left ), m_top( top ), m_width( 0 ),
- m_height( 0 ), m_varVisible( pIntf )
+ m_height( 0 ), m_pVarVisible( NULL )
{
- // Get the OSFactory
+ // Get the OSFactory
OSFactory *pOsFactory = OSFactory::instance( getIntf() );
// Get the parent OSWindow, if any
m_pOsWindow = pOsFactory->createOSWindow( *this, dragDrop, playOnDrop,
pOSParent );
+ // Create the visibility variable and register it in the manager
+ m_pVarVisible = new VarBoolImpl( pIntf );
+ VarManager::instance( pIntf )->registerVar( VariablePtr( m_pVarVisible ) );
+
// Observe the visibility variable
- m_varVisible.addObserver( this );
+ m_pVarVisible->addObserver( this );
}
GenericWindow::~GenericWindow()
{
- m_varVisible.delObserver( this );
+ m_pVarVisible->delObserver( this );
if( m_pOsWindow )
{
void GenericWindow::show() const
{
- m_varVisible.set( true );
+ m_pVarVisible->set( true );
}
void GenericWindow::hide() const
{
- m_varVisible.set( false );
+ m_pVarVisible->set( false );
}
}
-void GenericWindow::onUpdate( Subject<VarBool> &rVariable )
+void GenericWindow::onUpdate( Subject<VarBool> &rVariable, void*arg )
{
- if( m_varVisible.get() )
- {
- innerShow();
- }
- else
+ if (&rVariable == m_pVarVisible )
{
- innerHide();
+ if( m_pVarVisible->get() )
+ {
+ innerShow();
+ }
+ else
+ {
+ innerHide();
+ }
}
}