#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,
}
+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 );
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();
#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"
}
-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
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
#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 );
+ }
+}
#include "generic_window.hpp"
+class OSGraphics;
+
/// Class to handle a video output window
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;