Commit 9e041752 authored by Cyril Deguet's avatar Cyril Deguet

* all: the vout window now processes refresh events.

    It only displays a black rectangle at the moment but it could be
    any bitmap
parent 1e34cf51
......@@ -25,6 +25,7 @@
#include "generic_window.hpp"
#include "os_window.hpp"
#include "os_factory.hpp"
#include "../events/evt_refresh.hpp"
GenericWindow::GenericWindow( intf_thread_t *pIntf, int left, int top,
......@@ -63,6 +64,14 @@ GenericWindow::~GenericWindow()
}
void GenericWindow::processEvent( EvtRefresh &rEvtRefresh )
{
// Refresh the given area
refresh( rEvtRefresh.getXStart(), rEvtRefresh.getYStart(),
rEvtRefresh.getWidth(), rEvtRefresh.getHeight() );
}
void GenericWindow::show()
{
m_varVisible.set( true );
......
......@@ -54,9 +54,10 @@ class GenericWindow: public SkinObject, public Observer<VarBool>
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 ) {}
virtual void processEvent( EvtRefresh &rEvtRefresh );
// Show the window
virtual void show();
......
......@@ -38,7 +38,6 @@
#include "../events/evt_motion.hpp"
#include "../events/evt_mouse.hpp"
#include "../events/evt_key.hpp"
#include "../events/evt_refresh.hpp"
#include "../events/evt_special.hpp"
#include "../events/evt_scroll.hpp"
#include "../utils/position.hpp"
......@@ -232,14 +231,6 @@ void TopWindow::processEvent( EvtKey &rEvtKey )
}
void TopWindow::processEvent( EvtRefresh &rEvtRefresh )
{
// Refresh the given area
refresh( rEvtRefresh.getXStart(), rEvtRefresh.getYStart(),
rEvtRefresh.getWidth(), rEvtRefresh.getHeight() );
}
void TopWindow::processEvent( EvtScroll &rEvtScroll )
{
// Raise the windows
......
......@@ -52,7 +52,6 @@ class TopWindow: public GenericWindow
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
......
......@@ -23,19 +23,53 @@
#include "vout_window.hpp"
#include "os_factory.hpp"
#include "os_graphics.hpp"
#include "os_window.hpp"
VoutWindow::VoutWindow( intf_thread_t *pIntf, int left, int top,
bool dragDrop, bool playOnDrop, GenericWindow &rParent ):
bool dragDrop, bool playOnDrop,
GenericWindow &rParent ):
GenericWindow( pIntf, left, top, dragDrop, playOnDrop,
&rParent )
&rParent ), m_pImage( NULL )
{
}
VoutWindow::~VoutWindow()
{
if( m_pImage )
{
delete m_pImage;
}
// XXX we should stop the vout before destroying the window!
}
void VoutWindow::resize( int width, int height )
{
// Get the OSFactory
OSFactory *pOsFactory = OSFactory::instance( getIntf() );
// Recreate the image
if( m_pImage )
{
delete m_pImage;
}
m_pImage = pOsFactory->createOSGraphics( width, height );
// Draw a black rectangle
m_pImage->fillRect( 0, 0, width, height, 0 );
// Resize the window
GenericWindow::resize( width, height );
}
void VoutWindow::refresh( int left, int top, int width, int height )
{
if( m_pImage )
{
m_pImage->copyToWindow( *getOSWindow(), left, top, width, height, left,
top );
}
}
......@@ -26,6 +26,8 @@
#include "generic_window.hpp"
class OSGraphics;
/// Class to handle a video output window
class VoutWindow: public GenericWindow
......@@ -34,6 +36,16 @@ class VoutWindow: public GenericWindow
VoutWindow( intf_thread_t *pIntf, int xPos, int yPos,
bool dragDrop, bool playOnDrop, GenericWindow &rParent );
virtual ~VoutWindow();
/// Resize the window
virtual void resize( int width, int height );
/// Refresh an area of the window
virtual void refresh( int left, int top, int width, int height );
private:
/// Image when there is no video
OSGraphics *m_pImage;
};
typedef CountedPtr<VoutWindow> VoutWindowPtr;
......
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