Commit 1e34cf51 authored by Cyril Deguet's avatar Cyril Deguet

* all: split GenericWindow into GenericWindow (general interface for

  windows) and TopWindow (implementation for top-level windows)
parent a5ca00dc
......@@ -112,6 +112,8 @@ SOURCES_skins2 = \
src/theme_loader.hpp \
src/tooltip.cpp \
src/tooltip.hpp \
src/top_window.cpp \
src/top_window.hpp \
src/var_manager.cpp \
src/var_manager.hpp \
src/vlcproc.cpp \
......
......@@ -2,7 +2,7 @@
* cmd_layout.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: cmd_layout.cpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
* $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -23,7 +23,7 @@
*****************************************************************************/
#include "cmd_layout.hpp"
#include "../src/generic_window.hpp"
#include "../src/top_window.hpp"
#include "../src/generic_layout.hpp"
#include "../src/theme.hpp"
......@@ -42,7 +42,7 @@ void CmdLayout::execute()
{
return;
}
GenericWindow *pWindow =
TopWindow *pWindow =
getIntf()->p_sys->p_theme->getWindowById( m_windowId );
GenericLayout *pLayout =
getIntf()->p_sys->p_theme->getLayoutById( m_layoutId );
......
......@@ -26,7 +26,7 @@
#define CMD_SHOW_WINDOW_HPP
#include "cmd_generic.hpp"
#include "../src/generic_window.hpp"
#include "../src/top_window.hpp"
#include "../src/window_manager.hpp"
......@@ -35,7 +35,7 @@ class CmdShowWindow: public CmdGeneric
{
public:
CmdShowWindow( intf_thread_t *pIntf, WindowManager &rWinManager,
GenericWindow &rWin ):
TopWindow &rWin ):
CmdGeneric( pIntf ), m_rWinManager( rWinManager ), m_rWin( rWin ) {}
virtual ~CmdShowWindow() {}
......@@ -49,7 +49,7 @@ class CmdShowWindow: public CmdGeneric
/// Reference to the window manager
WindowManager &m_rWinManager;
/// Reference to the window
GenericWindow &m_rWin;
TopWindow &m_rWin;
};
......@@ -58,7 +58,7 @@ class CmdHideWindow: public CmdGeneric
{
public:
CmdHideWindow( intf_thread_t *pIntf, WindowManager &rWinManager,
GenericWindow &rWin ):
TopWindow &rWin ):
CmdGeneric( pIntf ), m_rWinManager( rWinManager ), m_rWin( rWin ) {}
virtual ~CmdHideWindow() {}
......@@ -72,7 +72,7 @@ class CmdHideWindow: public CmdGeneric
/// Reference to the window manager
WindowManager &m_rWinManager;
/// Reference to the window
GenericWindow &m_rWin;
TopWindow &m_rWin;
};
......
......@@ -2,7 +2,7 @@
* ctrl_generic.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ctrl_generic.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>
......@@ -24,7 +24,7 @@
#include "ctrl_generic.hpp"
#include "../src/generic_layout.hpp"
#include "../src/generic_window.hpp"
#include "../src/top_window.hpp"
#include "../src/os_graphics.hpp"
#include "../utils/position.hpp"
#include "../utils/var_bool.hpp"
......@@ -101,7 +101,7 @@ void CtrlGeneric::releaseMouse() const
void CtrlGeneric::notifyTooltipChange() const
{
GenericWindow *pWin = getWindow();
TopWindow *pWin = getWindow();
if( pWin )
{
// Notify the window
......@@ -110,7 +110,7 @@ void CtrlGeneric::notifyTooltipChange() const
}
GenericWindow *CtrlGeneric::getWindow() const
TopWindow *CtrlGeneric::getWindow() const
{
if( m_pLayout )
{
......
......@@ -2,7 +2,7 @@
* ctrl_generic.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ctrl_generic.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>
......@@ -35,7 +35,7 @@ class EvtGeneric;
class OSGraphics;
class GenericLayout;
class Position;
class GenericWindow;
class TopWindow;
class VarBool;
......@@ -96,7 +96,7 @@ class CtrlGeneric: public SkinObject, public Observer<VarBool>
virtual void notifyTooltipChange() const;
/// Get the associated window, if any
virtual GenericWindow *getWindow() const;
virtual TopWindow *getWindow() const;
/// Overload this method if you want to do something special when
/// the Position object is set
......
......@@ -26,13 +26,13 @@
#include "../events/evt_generic.hpp"
#include "../events/evt_mouse.hpp"
#include "../events/evt_motion.hpp"
#include "../src/generic_window.hpp"
#include "../src/top_window.hpp"
#include "../src/window_manager.hpp"
#include "../utils/position.hpp"
CtrlMove::CtrlMove( intf_thread_t *pIntf, WindowManager &rWindowManager,
CtrlFlat &rCtrl, GenericWindow &rWindow,
CtrlFlat &rCtrl, TopWindow &rWindow,
const UString &rHelp, VarBool *pVisible ):
CtrlFlat( pIntf, rHelp, pVisible ), m_fsm( pIntf ),
m_rWindowManager( rWindowManager ),
......
......@@ -2,7 +2,7 @@
* ctrl_move.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ctrl_move.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>
......@@ -29,7 +29,7 @@
#include "../utils/fsm.hpp"
#include "ctrl_flat.hpp"
class GenericWindow;
class TopWindow;
class WindowManager;
......@@ -38,7 +38,7 @@ class CtrlMove: public CtrlFlat
{
public:
CtrlMove( intf_thread_t *pIntf, WindowManager &rWindowManager,
CtrlFlat &rCtrl, GenericWindow &rWindow,
CtrlFlat &rCtrl, TopWindow &rWindow,
const UString &rHelp, VarBool *pVisible );
virtual ~CtrlMove() {}
......@@ -69,7 +69,7 @@ class CtrlMove: public CtrlFlat
/// Decorated CtrlFlat
CtrlFlat &m_rCtrl;
/// The window moved by this control
GenericWindow &m_rWindow;
TopWindow &m_rWindow;
/// The last received event
EvtGeneric *m_pEvt;
/// Position of the click that started the move
......
......@@ -2,7 +2,7 @@
* ctrl_slider.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ctrl_slider.cpp,v 1.5 2004/03/02 21:45:15 ipkiss Exp $
* $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -27,7 +27,7 @@
#include "../events/evt_mouse.hpp"
#include "../events/evt_scroll.hpp"
#include "../src/generic_bitmap.hpp"
#include "../src/generic_window.hpp"
#include "../src/top_window.hpp"
#include "../src/os_factory.hpp"
#include "../src/os_graphics.hpp"
#include "../utils/position.hpp"
......@@ -342,7 +342,7 @@ void CtrlSliderBg::handleEvent( EvtGeneric &rEvent )
// Forward the clic to the cursor
EvtMouse evt( getIntf(), x, y, EvtMouse::kLeft, EvtMouse::kDown );
GenericWindow *pWin = getWindow();
TopWindow *pWin = getWindow();
if( pWin )
{
EvtEnter evtEnter( getIntf() );
......
......@@ -27,10 +27,9 @@
#include "../src/os_graphics.hpp"
CtrlVideo::CtrlVideo( intf_thread_t *pIntf, WindowManager &rWindowManager,
const UString &rHelp, VarBool *pVisible ):
CtrlGeneric( pIntf, rHelp, pVisible ), m_rWindowManager( rWindowManager ),
m_pVout( NULL )
CtrlVideo::CtrlVideo( intf_thread_t *pIntf, const UString &rHelp,
VarBool *pVisible ):
CtrlGeneric( pIntf, rHelp, pVisible ), m_pVout( NULL )
{
}
......@@ -80,8 +79,7 @@ void CtrlVideo::draw( OSGraphics &rImage, int xDest, int yDest )
if (!m_pVout)
{
m_pVout = new VoutWindow( getIntf(), pPos->getLeft(),
pPos->getTop(), m_rWindowManager, false,
false, *pParent );
pPos->getTop(), false, false, *pParent );
m_pVout->resize( pPos->getWidth(), pPos->getHeight() );
m_pVout->show();
}
......
......@@ -27,14 +27,13 @@
#include "ctrl_generic.hpp"
class VoutWindow;
class WindowManager;
/// Control video
class CtrlVideo: public CtrlGeneric
{
public:
CtrlVideo( intf_thread_t *pIntf, WindowManager &rWindowManager,
const UString &rHelp, VarBool *pVisible );
CtrlVideo( intf_thread_t *pIntf, const UString &rHelp,
VarBool *pVisible );
virtual ~CtrlVideo();
/// Handle an event on the control
......@@ -50,8 +49,6 @@ class CtrlVideo: public CtrlGeneric
virtual void draw( OSGraphics &rImage, int xDest, int yDest );
private:
/// Window manager
WindowManager &m_rWindowManager;
/// Vout window
VoutWindow *m_pVout;
};
......
......@@ -29,8 +29,7 @@
#include "../src/png_bitmap.hpp"
#include "../src/os_factory.hpp"
#include "../src/generic_bitmap.hpp"
#include "../src/generic_window.hpp"
#include "../src/vout_window.hpp"
#include "../src/top_window.hpp"
#include "../src/anchor.hpp"
#include "../src/ft2_font.hpp"
#include "../src/theme.hpp"
......@@ -149,18 +148,18 @@ void Builder::addFont( const BuilderData::Font &rData )
void Builder::addWindow( const BuilderData::Window &rData )
{
GenericWindow *pWin =
new GenericWindow( getIntf(), rData.m_xPos, rData.m_yPos,
TopWindow *pWin =
new TopWindow( getIntf(), rData.m_xPos, rData.m_yPos,
m_pTheme->getWindowManager(),
rData.m_dragDrop, rData.m_playOnDrop );
m_pTheme->m_windows[rData.m_id] = GenericWindowPtr( pWin );
m_pTheme->m_windows[rData.m_id] = TopWindowPtr( pWin );
}
void Builder::addLayout( const BuilderData::Layout &rData )
{
GenericWindow *pWin = m_pTheme->m_windows[rData.m_windowId].get();
TopWindow *pWin = m_pTheme->m_windows[rData.m_windowId].get();
if( pWin == NULL )
{
msg_Err( getIntf(), "unknown window id: %s", rData.m_windowId.c_str() );
......@@ -186,7 +185,7 @@ void Builder::addLayout( const BuilderData::Layout &rData )
void Builder::addAnchor( const BuilderData::Anchor &rData )
{
GenericWindow *pWin = m_pTheme->m_windows[rData.m_windowId].get();
TopWindow *pWin = m_pTheme->m_windows[rData.m_windowId].get();
if( pWin == NULL )
{
msg_Err( getIntf(), "unknown window id: %s", rData.m_windowId.c_str() );
......@@ -335,7 +334,7 @@ void Builder::addImage( const BuilderData::Image &rData )
return;
}
GenericWindow *pWindow = m_pTheme->m_windows[rData.m_windowId].get();
TopWindow *pWindow = m_pTheme->m_windows[rData.m_windowId].get();
if( pWindow == NULL )
{
msg_Err( getIntf(), "unknown window id: %s", rData.m_windowId.c_str() );
......@@ -570,8 +569,7 @@ void Builder::addVideo( const BuilderData::Video &rData )
return;
}
CtrlVideo *pVideo =
new CtrlVideo( getIntf(), m_pTheme->getWindowManager(),
CtrlVideo *pVideo = new CtrlVideo( getIntf(),
UString( getIntf(), rData.m_help.c_str() ), NULL);
// Compute the position of the control
......
......@@ -118,7 +118,7 @@ CmdGeneric *Interpreter::parseAction( const string &rAction, Theme *pTheme )
{
int leftPos = rAction.find( ".show()" );
string windowId = rAction.substr( 0, leftPos );
GenericWindow *pWin = pTheme->getWindowById( windowId );
TopWindow *pWin = pTheme->getWindowById( windowId );
if( pWin )
{
pCommand = new CmdShowWindow( getIntf(), pTheme->getWindowManager(),
......@@ -133,7 +133,7 @@ CmdGeneric *Interpreter::parseAction( const string &rAction, Theme *pTheme )
{
int leftPos = rAction.find( ".hide()" );
string windowId = rAction.substr( 0, leftPos );
GenericWindow *pWin = pTheme->getWindowById( windowId );
TopWindow *pWin = pTheme->getWindowById( windowId );
if( pWin )
{
pCommand = new CmdHideWindow( getIntf(), pTheme->getWindowManager(),
......@@ -210,7 +210,7 @@ VarBool *Interpreter::getVarBool( const string &rName, Theme *pTheme )
{
int leftPos = rName.find( ".isVisible" );
string windowId = rName.substr( 0, leftPos );
GenericWindow *pWin = pTheme->getWindowById( windowId );
TopWindow *pWin = pTheme->getWindowById( windowId );
if( pWin )
{
return &pWin->getVisibleVar();
......
......@@ -2,7 +2,7 @@
* generic_layout.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: generic_layout.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>
......@@ -23,7 +23,7 @@
*****************************************************************************/
#include "generic_layout.hpp"
#include "generic_window.hpp"
#include "top_window.hpp"
#include "os_factory.hpp"
#include "os_graphics.hpp"
#include "../controls/ctrl_generic.hpp"
......@@ -52,7 +52,7 @@ GenericLayout::~GenericLayout()
}
void GenericLayout::setWindow( GenericWindow *pWindow )
void GenericLayout::setWindow( TopWindow *pWindow )
{
m_pWindow = pWindow;
}
......@@ -61,7 +61,7 @@ void GenericLayout::setWindow( GenericWindow *pWindow )
void GenericLayout::onControlCapture( const CtrlGeneric &rCtrl )
{
// Just forward the request to the window
GenericWindow *pWindow = getWindow();
TopWindow *pWindow = getWindow();
if( pWindow )
{
pWindow->onControlCapture( rCtrl );
......@@ -72,7 +72,7 @@ void GenericLayout::onControlCapture( const CtrlGeneric &rCtrl )
void GenericLayout::onControlRelease( const CtrlGeneric &rCtrl )
{
// Just forward the request to the window
GenericWindow *pWindow = getWindow();
TopWindow *pWindow = getWindow();
if( pWindow )
{
pWindow->onControlRelease( rCtrl );
......@@ -161,7 +161,7 @@ void GenericLayout::resize( int width, int height )
}
// Resize and refresh the associated window
GenericWindow *pWindow = getWindow();
TopWindow *pWindow = getWindow();
if( pWindow )
{
// Resize the window
......@@ -191,7 +191,7 @@ void GenericLayout::refreshAll()
}
// Refresh the associated window
GenericWindow *pWindow = getWindow();
TopWindow *pWindow = getWindow();
if( pWindow )
{
pWindow->refresh( 0, 0, m_width, m_height );
......
......@@ -2,7 +2,7 @@
* generic_layout.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: generic_layout.hpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
* $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -31,7 +31,7 @@
#include <list>
class GenericWindow;
class TopWindow;
class OSGraphics;
class CtrlGeneric;
......@@ -60,10 +60,10 @@ class GenericLayout: public SkinObject, public Box
virtual ~GenericLayout();
/// Attach the layout to a window
virtual void setWindow( GenericWindow *pWindow );
virtual void setWindow( TopWindow *pWindow );
/// Get the associated window, if any
virtual GenericWindow *getWindow() const { return m_pWindow; }
virtual TopWindow *getWindow() const { return m_pWindow; }
/// Called by a control which wants to capture the mouse
virtual void onControlCapture( const CtrlGeneric &rCtrl );
......@@ -104,7 +104,7 @@ class GenericLayout: public SkinObject, public Box
private:
/// Parent window of the layout
GenericWindow *m_pWindow;
TopWindow *m_pWindow;
/// Layout size
int m_width, m_height;
int m_minWidth, m_maxWidth;
......
This diff is collapsed.
......@@ -26,15 +26,9 @@
#define GENERIC_WINDOW_HPP
#include "skin_common.hpp"
#include "../utils/pointer.hpp"
#include "../utils/var_bool.hpp"
#include <list>
class Anchor;
class OSWindow;
class OSGraphics;
class GenericLayout;
class CtrlGeneric;
class EvtGeneric;
class EvtFocus;
class EvtLeave;
......@@ -43,7 +37,6 @@ class EvtMouse;
class EvtKey;
class EvtRefresh;
class EvtScroll;
class WindowManager;
/// Generic window class
......@@ -51,22 +44,18 @@ class GenericWindow: public SkinObject, public Observer<VarBool>
{
public:
GenericWindow( intf_thread_t *pIntf, int xPos, int yPos,
WindowManager &rWindowManager,
bool dragDrop, bool playOnDrop,
GenericWindow *pParent = NULL );
virtual ~GenericWindow();
/// Methods to process OS events.
virtual void processEvent( EvtFocus &rEvtFocus );
virtual void processEvent( EvtMotion &rEvtMotion );
virtual void processEvent( EvtMouse &rEvtMouse );
virtual void processEvent( EvtLeave &rEvtLeave );
virtual void processEvent( EvtKey &rEvtKey );
virtual void processEvent( EvtRefresh &rEvtRefresh );
virtual void processEvent( EvtScroll &rEvtScroll );
/// Forward an event to a control
virtual void forwardEvent( EvtGeneric &rEvt, CtrlGeneric &rCtrl );
virtual void processEvent( EvtFocus &rEvtFocus ) {}
virtual void processEvent( EvtMotion &rEvtMotion ) {}
virtual void processEvent( EvtMouse &rEvtMouse ) {}
virtual void processEvent( EvtLeave &rEvtLeave ) {}
virtual void processEvent( EvtKey &rEvtKey ) {}
virtual void processEvent( EvtRefresh &rEvtRefresh ) {}
virtual void processEvent( EvtScroll &rEvtScroll ) {}
// Show the window
virtual void show();
......@@ -75,7 +64,7 @@ class GenericWindow: public SkinObject, public Observer<VarBool>
virtual void hide();
// Refresh an area of the window
virtual void refresh( int left, int top, int width, int height );
virtual void refresh( int left, int top, int width, int height ) {}
/// Move the window
virtual void move( int left, int top );
......@@ -92,21 +81,6 @@ class GenericWindow: public SkinObject, public Observer<VarBool>
/// Toggle the window on top
virtual void toggleOnTop( bool onTop ) const;
/// Change the active layout
virtual void setActiveLayout( GenericLayout *pLayout );
/// Update the shape of the window from the active layout
virtual void updateShape();
/// Called by a control that wants to capture the mouse
virtual void onControlCapture( const CtrlGeneric &rCtrl );
/// Called by a control that wants to release the mouse
virtual void onControlRelease( const CtrlGeneric &rCtrl );
/// Called by a control when its tooltip changed
virtual void onTooltipChange( const CtrlGeneric &rCtrl );
/// Get the coordinates of the window
virtual int getLeft() const { return m_left; }
virtual int getTop() const { return m_top; }
......@@ -116,55 +90,27 @@ class GenericWindow: public SkinObject, public Observer<VarBool>
/// Give access to the visibility variable
VarBool &getVisibleVar() { return m_varVisible; }
/// Get the list of the anchors of this window
virtual const list<Anchor*> getAnchorList() const;
protected:
/// Actually show the window
virtual void innerShow();
/// Actually hide the window
virtual void innerHide();
/// Add an anchor to this window
virtual void addAnchor( Anchor *pAnchor );
/// Get the OS window
OSWindow *getOSWindow() const { return m_pOsWindow; }
private:
/// Window manager
WindowManager &m_rWindowManager;
/// Window position and size
int m_left, m_top, m_width, m_height;
/// Flag set if the window has a parent
bool m_isChild;
/// OS specific implementation
OSWindow *m_pOsWindow;
/// Current active layout of the window
GenericLayout *m_pActiveLayout;
/// Last control on which the mouse was over
CtrlGeneric *m_pLastHitControl;
/// Control that has captured the mouse
CtrlGeneric *m_pCapturingControl;
/// Control that has the focus
CtrlGeneric *m_pFocusControl;
/// List of the anchors of this window
list<Anchor*> m_anchorList;
/// Variable for the visibility of the window
VarBoolImpl m_varVisible;
/// Current key modifier (also used for mouse)
int m_currModifier;
/// Method called when the observed variable is modified
virtual void onUpdate( Subject<VarBool> &rVariable );
// Actually show the window
virtual void innerShow();
// Actually hide the window
virtual void innerHide();
/// Find the uppest control in the layout hit by the mouse, and send
/// it an enter event if needed
CtrlGeneric *findHitControl( int xPos, int yPos );
/// Update the lastHitControl pointer and send a leave event to the
/// right control
void setLastHit( CtrlGeneric *pNewHitControl );
};
typedef CountedPtr<GenericWindow> GenericWindowPtr;
#endif
......@@ -51,14 +51,14 @@ void Theme::loadConfig()
return;
// Initialization
map<string, GenericWindowPtr>::const_iterator it;
map<string, TopWindowPtr>::const_iterator it;
int i = 0;
int x, y, v, scan;
// Get config for each window
for( it = m_windows.begin(); it != m_windows.end(); it++ )
{
GenericWindow *pWin = (*it).second.get();
TopWindow *pWin = (*it).second.get();
// Get config
scan = sscanf( &save[i * 13], "(%4d,%4d,%1d)", &x, &y, &v );
......@@ -81,14 +81,14 @@ void Theme::saveConfig()
// Initialize char where config is stored
char *save = new char[400];
map<string, GenericWindowPtr>::const_iterator it;
map<string, TopWindowPtr>::const_iterator it;
int i = 0;
int x, y;
// Save config of every window
for( it = m_windows.begin(); it != m_windows.end(); it++ )
{
GenericWindow *pWin = (*it).second.get();
TopWindow *pWin = (*it).second.get();
// Print config
x = pWin->getLeft();
y = pWin->getTop();
......@@ -126,9 +126,9 @@ GenericFont *Theme::getFontById( const string &id )
FIND_OBJECT( GenericFontPtr, m_fonts );
}
GenericWindow *Theme::getWindowById( const string &id )
TopWindow *Theme::getWindowById( const string &id )
{
FIND_OBJECT( GenericWindowPtr, m_windows );
FIND_OBJECT( TopWindowPtr, m_windows );
}
GenericLayout *Theme::getLayoutById( const string &id )
......
......@@ -51,7 +51,7 @@ class Theme: public SkinObject
GenericBitmap *getBitmapById( const string &id );
GenericFont *getFontById( const string &id );
GenericWindow *getWindowById( const string &id );
TopWindow *getWindowById( const string &id );
GenericLayout *getLayoutById( const string &id );
CtrlGeneric *getControlById( const string &id );
......@@ -65,7 +65,7 @@ class Theme: public SkinObject
/// Store the fonts by ID
map<string, GenericFontPtr> m_fonts;
/// Store the windows by ID
map<string, GenericWindowPtr> m_windows;
map<string, TopWindowPtr> m_windows;
/// Store the layouts by ID
map<string, GenericLayoutPtr> m_layouts;
/// Store the controls by ID
......
This diff is collapsed.
/*****************************************************************************
* top_window.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id$
*
* Authors: Cyril Deguet <asmax@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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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.
*****************************************************************************/
#ifndef TOP_WINDOW_HPP
#define TOP_WINDOW_HPP
#include "generic_window.hpp"
#include "../utils/pointer.hpp"
#include <list>
class Anchor;
class OSWindow;
class OSGraphics;
class GenericLayout;
class CtrlGeneric;
class WindowManager;
/// Class to handle top-level windows
class TopWindow: public GenericWindow
{
public:
TopWindow( intf_thread_t *pIntf, int xPos, int yPos,
WindowManager &rWindowManager,
bool dragDrop, bool playOnDrop );
virtual ~TopWindow();
/// Methods to process OS events.
virtual void processEvent( EvtFocus &rEvtFocus );
virtual void processEvent( EvtMotion &rEvtMotion );
virtual void processEvent( EvtMouse &rEvtMouse );
virtual void processEvent( EvtLeave &rEvtLeave );
virtual void processEvent( EvtKey &rEvtKey );
virtual void processEvent( EvtRefresh &rEvtRefresh );
virtual void processEvent( EvtScroll &rEvtScroll );
/// Forward an event to a control
virtual void forwardEvent( EvtGeneric &rEvt, CtrlGeneric &rCtrl );
// Refresh an area of the window
virtual void refresh( int left, int top, int width, int height );
/// Change the active layout
virtual void setActiveLayout( GenericLayout *pLayout );
/// Update the shape of the window from the active layout
virtual void updateShape();
/// Called by a control that wants to capture the mouse
virtual void onControlCapture( const CtrlGeneric &rCtrl );
/// Called by a control that wants to release the mouse
virtual void onControlRelease( const CtrlGeneric &rCtrl );
/// Called by a control when its tooltip changed
virtual void onTooltipChange( const CtrlGeneric &rCtrl );
/// Get the list of the anchors of this window
virtual const list<Anchor*> getAnchorList() const;
/// Add an anchor to this window
virtual void addAnchor( Anchor *pAnchor );
protected:
/// Actually show the window
virtual void innerShow();
private:
/// Window manager
WindowManager &m_rWindowManager;
/// Current active layout of the window
GenericLayout *m_pActiveLayout;
/// Last control on which the mouse was over
CtrlGeneric *m_pLastHitControl;
/// Control that has captured the mouse
CtrlGeneric *m_pCapturingControl;
/// Control that has the focus
CtrlGeneric *m_pFocusControl;
/// List of the anchors of this window
list<Anchor*> m_anchorList;
/// Current key modifier (also used for mouse)
int m_currModifier;
/// Find the uppest control in the layout hit by the mouse, and send
/// it an enter event if needed
CtrlGeneric *findHitControl( int xPos, int yPos );
/// Update the lastHitControl pointer and send a leave event to the
/// right control
void setLastHit( CtrlGeneric *pNewHitControl );
};
typedef CountedPtr<TopWindow> TopWindowPtr;
#endif
......@@ -27,9 +27,8 @@
VoutWindow::VoutWindow( intf_thread_t *pIntf, int left, int top,
WindowManager &rWindowManager,
bool dragDrop, bool playOnDrop, GenericWindow &rParent ):
GenericWindow( pIntf, left, top, rWindowManager, dragDrop, playOnDrop,
GenericWindow( pIntf, left, top, dragDrop, playOnDrop,
&rParent )
{
}
......
......@@ -32,7 +32,6 @@ class VoutWindow: public GenericWindow
{
public:
VoutWindow( intf_thread_t *pIntf, int xPos, int yPos,
WindowManager &rWindowManager,
bool dragDrop, bool playOnDrop, GenericWindow &rParent );
virtual ~VoutWindow();
};
......
......@@ -42,14 +42,14 @@ WindowManager::~WindowManager()
}
void WindowManager::registerWindow( GenericWindow &rWindow )
void WindowManager::registerWindow( TopWindow &rWindow )
{
// Add the window to the set
m_allWindows.insert( &rWindow );
}
void WindowManager::unregisterWindow( GenericWindow &rWindow )
void WindowManager::unregisterWindow( TopWindow &rWindow )
{
// Erase every possible reference to the window
m_allWindows.erase( &rWindow );
......@@ -58,7 +58,7 @@ void WindowManager::unregisterWindow( GenericWindow &rWindow )
}
void WindowManager::startMove( GenericWindow &rWindow )
void WindowManager::startMove( TopWindow &rWindow )
{
// Rebuild the set of moving windows
m_movingWindows.clear();
......@@ -126,7 +126,7 @@ void WindowManager::stopMove()
}
void WindowManager::move( GenericWindow &rWindow, int left, int top ) const
void WindowManager::move( TopWindow &rWindow, int left, int top ) const
{
// Compute the real move offset
int xOffset = left - rWindow.getLeft();
......@@ -144,7 +144,7 @@ void WindowManager::move( GenericWindow &rWindow, int left, int top ) const
}
void WindowManager::raiseAll( GenericWindow &rWindow ) const
void WindowManager::raiseAll( TopWindow &rWindow ) const
{
// Raise all the windows
WinSet_t::const_iterator it;
......@@ -194,7 +194,7 @@ void WindowManager::toggleOnTop()
void WindowManager::buildDependSet( WinSet_t &rWinSet,
GenericWindow *pWindow )
TopWindow *pWindow )
{
// pWindow is in the set
rWinSet.insert( pWindow );
......@@ -213,7 +213,7 @@ void WindowManager::buildDependSet( WinSet_t &rWinSet,
}
void WindowManager::checkAnchors( GenericWindow *pWindow,
void WindowManager::checkAnchors( TopWindow *pWindow,
int &xOffset, int &yOffset ) const
{
WinSet_t::const_iterator itMov, itSta;
......
......@@ -26,7 +26,7 @@
#define WINDOW_MANAGER_HPP
#include "skin_common.hpp"
#include "generic_window.hpp"
#include "top_window.hpp"
#include <list>
#include <map>
#include <set>
......@@ -50,13 +50,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 &rWindow );
void registerWindow( TopWindow &rWindow );
/// Remove a previously registered window
void unregisterWindow( GenericWindow &rWindow );
void unregisterWindow( TopWindow &rWindow );
/// Tell the window manager that a move is initiated for pWindow.
void startMove( GenericWindow &rWindow );
void startMove( TopWindow &rWindow );
/// Tell the window manager that the current move ended.
void stopMove();
......@@ -64,10 +64,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 &rWindow, int left, int top ) const;
void move( TopWindow &rWindow, int left, int top ) const;
/// Raise all the windows, rWindow being above the others
void raiseAll( GenericWindow &rWindow ) const;
void raiseAll( TopWindow &rWindow ) const;
/// Show all the registered windows
void showAll() const;
......@@ -76,10 +76,10 @@ class WindowManager: public SkinObject
void hideAll() const;
/// Show the given window
void show( GenericWindow &rWindow ) { rWindow.show(); }
void show( TopWindow &rWindow ) { rWindow.show(); }
/// Hide the given window
void hide( GenericWindow &rWindow ) { rWindow.hide(); }
void hide( TopWindow &rWindow ) { rWindow.hide(); }
/// Toggle all the windows on top
void toggleOnTop();
......@@ -104,7 +104,7 @@ class WindowManager: public SkinObject
private:
/// Some useful typedefs for lazy people like me
typedef set<GenericWindow*> WinSet_t;
typedef set<TopWindow*> WinSet_t;
typedef list<Anchor*> AncList_t;
/// This map represents the graph of anchored windows: it associates
......@@ -112,7 +112,7 @@ class WindowManager: public SkinObject
/// This is not transitive, i.e. if a is in m_dep[b] and if b is in
/// m_dep[c], it doesn't mean that a is in m_dep[c] (in fact, it
/// would be extremely rare...)
map<GenericWindow*, WinSet_t> m_dependencies;
map<TopWindow*, WinSet_t> m_dependencies;
/// Store all the windows
WinSet_t m_allWindows;
/// Store the moving windows; this set is updated at every start of
......@@ -130,11 +130,11 @@ class WindowManager: public SkinObject
Tooltip *m_pTooltip;
/// Recursively build a set of windows anchored to the one given.
void buildDependSet( WinSet_t &rWinSet, GenericWindow *pWindow );
void buildDependSet( WinSet_t &rWinSet, TopWindow *pWindow );
/// Check anchoring: this function updates xOffset and yOffset,
/// to take care of a new anchoring (if any)
void checkAnchors( GenericWindow *pWindow,
void checkAnchors( TopWindow *pWindow,
int &xOffset, int &yOffset ) const;
};
......
......@@ -61,7 +61,6 @@
<Bitmap id="stop_disabled" file="stop_disabled.png" alphacolor="#FF0000"/>
<Bitmap id="stop_onclick" file="stop_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="volume_radial" file="volume.png" alphacolor="#FF0000"/>
<Bitmap id="vout" file="vout.png" alphacolor="#FF0000"/>
<Font id="default_font" font="FreeSansBold.ttf" size="15"/>
<Font id="playlist_font" font="FreeSansBold.ttf" size="12"/>
......
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