TGUI  0.9.5
Loading...
Searching...
No Matches
tgui::DefaultBackendWindow Class Referenceabstract

This class abstracts the backend-specific window and gui creation code. More...

#include <TGUI/DefaultBackendWindow.hpp>

Public Member Functions

virtual GuiBasegetGui () const =0
 Returns the gui object that is created and destroyed by this class.
 
virtual bool isOpen () const =0
 Returns whether the window is still open.
 
virtual void close ()=0
 Closes the window.
 
virtual bool pollEvent (Event &event)=0
 Retrieves an event from the window if there is one.
 
virtual void draw ()=0
 Draws the gui to the window.
 
virtual void mainLoop ()=0
 Pass control of the main loop to TGUI, if the backend supports it.
 
virtual void setIcon (const String &filename)=0
 Changes the icon of the window.
 

Static Public Member Functions

static std::shared_ptr< DefaultBackendWindowcreate (unsigned int width, unsigned int height, const String &title)
 Creates the backend window and the gui.
 

Detailed Description

This class abstracts the backend-specific window and gui creation code.

Normally you don't need this class as you know what the backend is and can write backend-specific code. This class is required by e.g. the Gui Builder to work independently from the backend.

Member Function Documentation

◆ close()

virtual void tgui::DefaultBackendWindow::close ( )
pure virtual

Closes the window.

See also
isOpen

◆ create()

static std::shared_ptr< DefaultBackendWindow > tgui::DefaultBackendWindow::create ( unsigned int  width,
unsigned int  height,
const String title 
)
static

Creates the backend window and the gui.

Parameters
widthWidth of the window
heightHeight of the window
titleTitle of the window
Warning
If TGUI contains multiple backends, an arbitrary one will be used
This function will assert when TGUI was built without a backend

◆ getGui()

virtual GuiBase * tgui::DefaultBackendWindow::getGui ( ) const
pure virtual

Returns the gui object that is created and destroyed by this class.

Returns
Pointer to the gui that is owned by this class
Warning
You can't access the gui after this backend window is destroyed

◆ isOpen()

virtual bool tgui::DefaultBackendWindow::isOpen ( ) const
pure virtual

Returns whether the window is still open.

Returns
Is the window still open?
Warning
You must call close() on this object to close the window, it does NOT happen automatically when the user presses the close button of the window (in which case you receive an event of type Event::Type::Closed from pollEvent).

◆ pollEvent()

virtual bool tgui::DefaultBackendWindow::pollEvent ( Event event)
pure virtual

Retrieves an event from the window if there is one.

Parameters
eventReference to event structure that will filled in by this function if there is an event
Returns
True if the window had an unprocessed event. If false is returned, the event parameter is untouched.

◆ setIcon()

virtual void tgui::DefaultBackendWindow::setIcon ( const String filename)
pure virtual

Changes the icon of the window.

Parameters
filenameFilename of the icon to load

The documentation for this class was generated from the following file: