1
/*****************************************************************************
3
*****************************************************************************
4
* Copyright (C) 2003 VideoLAN
5
* $Id: generic_window.cpp 7267 2004-04-03 20:17:06Z ipkiss $
7
* Authors: Cyril Deguet <asmax@via.ecp.fr>
8
* Olivier Teuli�re <ipkiss@via.ecp.fr>
10
* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version.
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
20
* You should have received a copy of the GNU General Public License
21
* along with this program; if not, write to the Free Software
22
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
23
*****************************************************************************/
25
#include "generic_window.hpp"
26
#include "os_window.hpp"
27
#include "os_factory.hpp"
28
#include "../events/evt_refresh.hpp"
31
GenericWindow::GenericWindow( intf_thread_t *pIntf, int left, int top,
32
bool dragDrop, bool playOnDrop,
33
GenericWindow *pParent ):
34
SkinObject( pIntf ), m_left( left ), m_top( top ), m_width( 0 ),
35
m_height( 0 ), m_varVisible( pIntf )
38
OSFactory *pOsFactory = OSFactory::instance( getIntf() );
40
// Get the parent OSWindow, if any
41
OSWindow *pOSParent = NULL;
44
pOSParent = pParent->m_pOsWindow;
47
// Create an OSWindow to handle OS specific processing
48
m_pOsWindow = pOsFactory->createOSWindow( *this, dragDrop, playOnDrop,
51
// Observe the visibility variable
52
m_varVisible.addObserver( this );
56
GenericWindow::~GenericWindow()
58
m_varVisible.delObserver( this );
67
void GenericWindow::processEvent( EvtRefresh &rEvtRefresh )
69
// Refresh the given area
70
refresh( rEvtRefresh.getXStart(), rEvtRefresh.getYStart(),
71
rEvtRefresh.getWidth(), rEvtRefresh.getHeight() );
75
void GenericWindow::show() const
77
m_varVisible.set( true );
81
void GenericWindow::hide() const
83
m_varVisible.set( false );
87
void GenericWindow::move( int left, int top )
89
// Update the window coordinates
93
m_pOsWindow->moveResize( left, top, m_width, m_height );
97
void GenericWindow::resize( int width, int height )
99
// Update the window size
103
m_pOsWindow->moveResize( m_left, m_top, width, height );
107
void GenericWindow::raise() const
109
m_pOsWindow->raise();
113
void GenericWindow::setOpacity( uint8_t value )
115
m_pOsWindow->setOpacity( value );
119
void GenericWindow::toggleOnTop( bool onTop ) const
121
m_pOsWindow->toggleOnTop( onTop );
125
void GenericWindow::onUpdate( Subject<VarBool> &rVariable )
127
if( m_varVisible.get() )
138
void GenericWindow::innerShow()
142
m_pOsWindow->show( m_left, m_top );
147
void GenericWindow::innerHide()