LLGL 0.05 Beta
Loading...
Searching...
No Matches
LLGL::Window Class Referenceabstract

Window interface for desktop platforms. More...

#include <Window.h>

Inheritance diagram for LLGL::Window:
LLGL::Surface LLGL::Interface LLGL::NonCopyable

Classes

class  EventListener
 Interface for all window event listeners. More...

Public Member Functions

 ~Window ()
 Releases the internal data.
virtual void SetPosition (const Offset2D &position)=0
 Sets the window position relative to its parent.
virtual Offset2D GetPosition () const =0
 Returns the window position relative to its parent (which can also be the display).
virtual void SetSize (const Extent2D &size, bool useClientArea=true)=0
 Sets the either the overall window size or the client area size. By default the client area size is set.
virtual Extent2D GetSize (bool useClientArea=true) const =0
 Returns either the window size (including frame and title bar) or the client area size (both in window coordinates). By default the client area size is returned.
virtual void SetTitle (const UTF8String &title)=0
 Sets the window title as UTF8 string.
virtual UTF8String GetTitle () const =0
 Returns the window title as UTF8 string.
virtual void Show (bool show=true)=0
 Shows or hides the window.
virtual bool IsShown () const =0
 Returns true if this window is visible.
virtual void SetDesc (const WindowDescriptor &desc)=0
 Sets the window attributes according to the specified window descriptor.
virtual WindowDescriptor GetDesc () const =0
 Queries a window descriptor, which describes the attributes of this window.
bool AdaptForVideoMode (Extent2D *resolution, bool *fullscreen) override
 Adapts the window for the specified video mode.
Display * FindResidentDisplay () const override final
 Searches the entire list of displays until a display is found where more than the half of this window's client area is visible.
bool HasFocus () const
 Returns true if this window has the keyboard focus.
bool HasQuit () const
 Returns true if this window is in the 'Quit' state.
void SetUserData (void *userData)
 Sets a raw pointer to some user defined data. The initial value is null.
void * GetUserData () const
 Returns the raw pointer that was previously set with SetUserData. The initial value is null.
void AddEventListener (const std::shared_ptr< EventListener > &eventListener)
 Adds the specified event listener to this window.
void RemoveEventListener (const EventListener *eventListener)
 Removes the specified event listener from this window.
void PostQuit ()
 Posts a 'Quit' event to all event listeners if the window is not yet in the 'Quit' state.
void PostKeyDown (Key keyCode)
 Posts a 'KeyDown' event to all event listeners.
void PostKeyUp (Key keyCode)
void PostDoubleClick (Key keyCode)
void PostChar (wchar_t chr)
void PostWheelMotion (int motion)
void PostLocalMotion (const Offset2D &position)
void PostGlobalMotion (const Offset2D &motion)
void PostResize (const Extent2D &clientAreaSize)
void PostUpdate ()
 Posts an 'Update' timer event with to all event listeners.
void PostGetFocus ()
 Posts a 'GetFocus' event to all event listeners.
void PostLostFocus ()
 Posts a 'LostFocus' event to all event listeners.
Public Member Functions inherited from LLGL::Surface
virtual bool GetNativeHandle (void *nativeHandle, std::size_t nativeHandleSize)=0
 Returns the native surface handle.
virtual Extent2D GetContentSize () const =0
 Returns the size (in pixels) of the surface content, i.e. the drawable area.
Public Member Functions inherited from LLGL::Interface
virtual bool IsInstanceOf (int id) const
 Returns true if this object is an instance of the specified interface.
Public Member Functions inherited from LLGL::NonCopyable
 NonCopyable (const NonCopyable &)=delete
NonCopyable & operator= (const NonCopyable &)=delete
virtual ~NonCopyable ()=default

Static Public Member Functions

static std::unique_ptr< Window > Create (const WindowDescriptor &desc)
 Creates a platform specific instance of the Window interface.
Static Public Member Functions inherited from LLGL::Surface
static bool ProcessEvents ()
 Processes all windowing system events, i.e. input-, movement-, resize-, and other events for all surfaces associated with the host process.

Protected Member Functions

 Window ()
 Allocates the internal data.
Protected Member Functions inherited from LLGL::NonCopyable
 NonCopyable ()=default

Detailed Description

Window interface for desktop platforms.

Remarks
This is the main interface for the windowing system in LLGL. To implement a custom window (and use GLFW for instance) you have to derive from this class and implement all pure virtual functions. The counterpart is the Canvas interface for mobile platforms.
See also
Canvas

Constructor & Destructor Documentation

◆ ~Window()

LLGL::Window::~Window ( )

Releases the internal data.

◆ Window()

LLGL::Window::Window ( )
protected

Allocates the internal data.

Member Function Documentation

◆ AdaptForVideoMode()

bool LLGL::Window::AdaptForVideoMode ( Extent2D * resolution,
bool * fullscreen )
overridevirtual

Adapts the window for the specified video mode.

Remarks
This is a default implementation of the base class function and makes use of "GetDesc" and "SetDesc".
See also
GetDesc
SetDesc

Implements LLGL::Surface.

◆ AddEventListener()

void LLGL::Window::AddEventListener ( const std::shared_ptr< EventListener > & eventListener)

Adds the specified event listener to this window.

◆ Create()

std::unique_ptr< Window > LLGL::Window::Create ( const WindowDescriptor & desc)
static

Creates a platform specific instance of the Window interface.

Returns
Unique pointer to a new instance of the platform specific Window interface or null if the platform does not support windows (such as Android and iOS).
Remarks
For mobile platforms the interface Canvas can be used.
See also
Canvas

◆ FindResidentDisplay()

Display * LLGL::Window::FindResidentDisplay ( ) const
finaloverridevirtual

Searches the entire list of displays until a display is found where more than the half of this window's client area is visible.

Implements LLGL::Surface.

◆ GetDesc()

virtual WindowDescriptor LLGL::Window::GetDesc ( ) const
pure virtual

Queries a window descriptor, which describes the attributes of this window.

◆ GetPosition()

virtual Offset2D LLGL::Window::GetPosition ( ) const
pure virtual

Returns the window position relative to its parent (which can also be the display).

◆ GetSize()

virtual Extent2D LLGL::Window::GetSize ( bool useClientArea = true) const
pure virtual

Returns either the window size (including frame and title bar) or the client area size (both in window coordinates). By default the client area size is returned.

◆ GetTitle()

virtual UTF8String LLGL::Window::GetTitle ( ) const
pure virtual

Returns the window title as UTF8 string.

◆ GetUserData()

void * LLGL::Window::GetUserData ( ) const

Returns the raw pointer that was previously set with SetUserData. The initial value is null.

See also
SetUserData

◆ HasFocus()

bool LLGL::Window::HasFocus ( ) const

Returns true if this window has the keyboard focus.

◆ HasQuit()

bool LLGL::Window::HasQuit ( ) const

Returns true if this window is in the 'Quit' state.

See also
PostQuit

◆ IsShown()

virtual bool LLGL::Window::IsShown ( ) const
pure virtual

Returns true if this window is visible.

◆ PostChar()

void LLGL::Window::PostChar ( wchar_t chr)
See also
PostKeyDown

◆ PostDoubleClick()

void LLGL::Window::PostDoubleClick ( Key keyCode)
See also
PostKeyDown

◆ PostGetFocus()

void LLGL::Window::PostGetFocus ( )

Posts a 'GetFocus' event to all event listeners.

◆ PostGlobalMotion()

void LLGL::Window::PostGlobalMotion ( const Offset2D & motion)
See also
PostKeyDown

◆ PostKeyDown()

void LLGL::Window::PostKeyDown ( Key keyCode)

Posts a 'KeyDown' event to all event listeners.

See also
EventListener::OnKeyDown

◆ PostKeyUp()

void LLGL::Window::PostKeyUp ( Key keyCode)
See also
PostKeyDown

◆ PostLocalMotion()

void LLGL::Window::PostLocalMotion ( const Offset2D & position)
See also
PostKeyDown

◆ PostLostFocus()

void LLGL::Window::PostLostFocus ( )

Posts a 'LostFocus' event to all event listeners.

◆ PostQuit()

void LLGL::Window::PostQuit ( )

Posts a 'Quit' event to all event listeners if the window is not yet in the 'Quit' state.

Remarks
If any of the event listener sets the veto flag to false within the OnQuit callback, the window will not be put into 'Quit' state.
See also
EventListener::OnQuit
HasQuit

◆ PostResize()

void LLGL::Window::PostResize ( const Extent2D & clientAreaSize)
See also
PostKeyDown

◆ PostUpdate()

void LLGL::Window::PostUpdate ( )

Posts an 'Update' timer event with to all event listeners.

◆ PostWheelMotion()

void LLGL::Window::PostWheelMotion ( int motion)
See also
PostKeyDown

◆ RemoveEventListener()

void LLGL::Window::RemoveEventListener ( const EventListener * eventListener)

Removes the specified event listener from this window.

◆ SetDesc()

virtual void LLGL::Window::SetDesc ( const WindowDescriptor & desc)
pure virtual

Sets the window attributes according to the specified window descriptor.

◆ SetPosition()

virtual void LLGL::Window::SetPosition ( const Offset2D & position)
pure virtual

Sets the window position relative to its parent.

◆ SetSize()

virtual void LLGL::Window::SetSize ( const Extent2D & size,
bool useClientArea = true )
pure virtual

Sets the either the overall window size or the client area size. By default the client area size is set.

◆ SetTitle()

virtual void LLGL::Window::SetTitle ( const UTF8String & title)
pure virtual

Sets the window title as UTF8 string.

◆ SetUserData()

void LLGL::Window::SetUserData ( void * userData)

Sets a raw pointer to some user defined data. The initial value is null.

Remarks
This can be used to quickly associate an instance of this class with custom data, especially during event handling.

◆ Show()

virtual void LLGL::Window::Show ( bool show = true)
pure virtual

Shows or hides the window.


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