Gateware Libraries  R6.5A
Beta Build
GW::SYSTEM::GWindow Class Referenceabstract

A thread-safe window creation and management library. More...

#include <GWindow.h>

Inheritance diagram for GW::SYSTEM::GWindow:
Collaboration diagram for GW::SYSTEM::GWindow:

Public Member Functions

virtual GReturn OpenWindow ()=0
 Initializes a window handle and displays a window. More...
 
virtual GReturn ProcessWindowEvents ()=0
 Flushes and processes all messages from the window's event queue. More...
 
virtual GReturn ReconfigureWindow (int _x, int _y, int _width, int _height, GWindowStyle _style)=0
 Gives the currently opened window the specified size, position and style. More...
 
virtual GReturn SetWindowName (const char *_newName)=0
 Changes de text displayed at the top bar of the window. More...
 
virtual GReturn MoveWindow (int _x, int _y)=0
 Repositions the currently opened window to the specified x and y pixels on screen. More...
 
virtual GReturn ResizeWindow (int _width, int _height)=0
 Resizes the currently opened window to the specified width and height. More...
 
virtual GReturn Maximize ()=0
 Resizes the currently opened window to the native maximum resolution. More...
 
virtual GReturn Minimize ()=0
 Minimizes the currently opened window. More...
 
virtual GReturn ChangeWindowStyle (GWindowStyle _style)=0
 Sets the currently opened window's style to the specified style. More...
 
virtual GReturn GetWidth (unsigned int &_outWidth)=0
 Returns the width in pixels of the currently opened window. More...
 
virtual GReturn GetHeight (unsigned int &_outHeight)=0
 Returns the height in pixels of the currently opened window. More...
 
virtual GReturn GetClientWidth (unsigned int &_outClientWidth)=0
 Returns the client width in pixels of the currently opened window. More...
 
virtual GReturn GetClientHeight (unsigned int &_outClientHeight)=0
 Returns the client height in pixels of the currently opened window. More...
 
virtual GReturn GetX (unsigned int &_outX)=0
 Returns the X position in pixels of the currently opened window. More...
 
virtual GReturn GetY (unsigned int &_outY)=0
 Returns the Y position in pixels of the currently opened window. More...
 
virtual GReturn GetClientTopLeft (unsigned int &_outX, unsigned int &_outY)=0
 Gets the location of the top-left pixel of the opened window's client area. More...
 
virtual GReturn GetWindowHandle (unsigned int _handleSize, void **_outWindowHandle)=0
 Returns the platform specific window handle to the currently opened window. More...
 
virtual GReturn IsFullscreen (bool &_outIsFullscreen)=0
 Returns a bool specifying whether or not the currently opened window is fullscreen. More...
 
virtual GReturn GetLastEvent (GWindowInputEvents &_LastEvent)=0
 Returns the last input event that has happened to the window. More...
 
- Public Member Functions inherited from GW::CORE::GBroadcasting
virtual GReturn RegisterListener (GListener *_addListener, unsigned long long _eventMask)=0
 Any listener added to this class must receive all events unless otherwise specified by the _eventMask (optional). More...
 
virtual GReturn DeregisterListener (GListener *_removeListener)=0
 A successfully deregistered listener will no longer receive events and have its reference count decremented by one. More...
 
- Public Member Functions inherited from GW::CORE::GInterface
virtual GReturn GetCount (unsigned int &_outCount)=0
 Return the total number of active references to this object. More...
 
virtual GReturn IncrementCount ()=0
 Increase the total number of active references to this object. More...
 
virtual GReturn DecrementCount ()=0
 Decrease the total number of active references to this object. More...
 
virtual GReturn RequestInterface (const GUUIID &_interfaceID, void **_outputInterface)=0
 Requests an interface that may or may not be supported by this object. More...
 

Detailed Description

A thread-safe window creation and management library.

This library is used to create, move, resize, and destroy a window. Methods exist to query information from the window as well. The window is also a broadcaster, meaning a GListener can be written to receive events from it.

Member Function Documentation

◆ ChangeWindowStyle()

virtual GReturn GW::SYSTEM::GWindow::ChangeWindowStyle ( GWindowStyle  _style)
pure virtual

Sets the currently opened window's style to the specified style.

GWindowStyle will be overwritten and the window resized or moved accordingly.

Parameters
[in]_styleThe GWindowStyle to change the window to.
Return values
SUCCESSThe window style was successfully changed.
REDUNDANT_OPERATIONNo window exists to change.

◆ GetClientHeight()

virtual GReturn GW::SYSTEM::GWindow::GetClientHeight ( unsigned int &  _outClientHeight)
pure virtual

Returns the client height in pixels of the currently opened window.

Return values
0The window is minimized.
-1No window exists to query size from.
elseHeight was successfully queried and returned.

◆ GetClientTopLeft()

virtual GReturn GW::SYSTEM::GWindow::GetClientTopLeft ( unsigned int &  _outX,
unsigned int &  _outY 
)
pure virtual

Gets the location of the top-left pixel of the opened window's client area.

Parameters
[out]_outXWill contain the X location of the top-left pixel.
[out]_outYWill contain the Y location of the top-left pixel.
Return values
-1No window exists to query position from.
elsePosition was successfully queried and returned.

◆ GetClientWidth()

virtual GReturn GW::SYSTEM::GWindow::GetClientWidth ( unsigned int &  _outClientWidth)
pure virtual

Returns the client width in pixels of the currently opened window.

Client height is the height of the window's drawable area.

Return values
0The window is minimized.
-1No window exists to query size from.
elseWidth was successfully queried and returned.

◆ GetHeight()

virtual GReturn GW::SYSTEM::GWindow::GetHeight ( unsigned int &  _outHeight)
pure virtual

Returns the height in pixels of the currently opened window.

Client width is the width of the window's drawable area.

Return values
0The window is minimized.
-1No window exists to query size from.
elseHeight was successfully queried and returned.

◆ GetLastEvent()

virtual GReturn GW::SYSTEM::GWindow::GetLastEvent ( GWindowInputEvents _LastEvent)
pure virtual

Returns the last input event that has happened to the window.

Parameters
[out]GWindowInputEventyou pass-in will be updated to the lastest event that was called.
Return values
FAILUREThe Gateware's internal event tracker wasn't a valid event.
SUCCESSThe function run successfully and out-param is filled out.

◆ GetWidth()

virtual GReturn GW::SYSTEM::GWindow::GetWidth ( unsigned int &  _outWidth)
pure virtual

Returns the width in pixels of the currently opened window.

Return values
0The window is minimized.
-1No window exists to query size from.
elseWidth was successfully queried and returned.

◆ GetWindowHandle()

virtual GReturn GW::SYSTEM::GWindow::GetWindowHandle ( unsigned int  _handleSize,
void **  _outWindowHandle 
)
pure virtual

Returns the platform specific window handle to the currently opened window.

On Windows the void* is an HWND, on Linux a LINUX_WINDOW, and on Mac an NSWindow. Methods exist to query window information right from these handles.

Return values
void*The void* data to the window handle.

◆ GetX()

virtual GReturn GW::SYSTEM::GWindow::GetX ( unsigned int &  _outX)
pure virtual

Returns the X position in pixels of the currently opened window.

Return values
-1No window exists to query position from.
elseX position was successfully queried and returned.

◆ GetY()

virtual GReturn GW::SYSTEM::GWindow::GetY ( unsigned int &  _outY)
pure virtual

Returns the Y position in pixels of the currently opened window.

Return values
-1No window exists to query position from.
elseY position was successfully queried and returned.

◆ IsFullscreen()

virtual GReturn GW::SYSTEM::GWindow::IsFullscreen ( bool &  _outIsFullscreen)
pure virtual

Returns a bool specifying whether or not the currently opened window is fullscreen.

Return values
trueThe window is fullscreen.
falseThe window is not fullscreen.

◆ Maximize()

virtual GReturn GW::SYSTEM::GWindow::Maximize ( )
pure virtual

Resizes the currently opened window to the native maximum resolution.

GWindowStyle will be overwritten to be the fullscreen version if it is not already.

Return values
SUCCESSThe window was successfully maximized.
REDUNDANT_OPERATIONNo window exists to maximize.

◆ Minimize()

virtual GReturn GW::SYSTEM::GWindow::Minimize ( )
pure virtual

Minimizes the currently opened window.

GWindowStyle will be overwritten to be the minimized style if it is not already.

Return values
SUCCESSThe window was successfully minimized.
REDUNDANT_OPERATIONNo window exists to minimize or window is already maximized.

◆ MoveWindow()

virtual GReturn GW::SYSTEM::GWindow::MoveWindow ( int  _x,
int  _y 
)
pure virtual

Repositions the currently opened window to the specified x and y pixels on screen.

If position parameters are less than 0 then 0 will be used. If position parameters are greater than native resoultion, maximum native resolution parameters will be used.

Parameters
[in]_xThe x position on screen to move the window to.
[in]_yThe y position on screen to move the window to.
Return values
SUCCESSThe window was successfully moved.
INVALID_ARGUMENTThe style passed in is invalid
REDUNDANT_OPERATIONNo window exists to move.

◆ OpenWindow()

virtual GReturn GW::SYSTEM::GWindow::OpenWindow ( )
pure virtual

Initializes a window handle and displays a window.

The window is opened with the size, position and style specified in the parameters passed into the CreateGWindow function. Parameters were checked for invalid values during the initialization of the window after creation, so it is assumed the window has valid parameters before this function is called.

Return values
SUCCESSThe window was successfully created and displayed.
REDUNDANT_OPERATIONThe GWindow object already has a window open
FAILUREThe window could not be created.

◆ ProcessWindowEvents()

virtual GReturn GW::SYSTEM::GWindow::ProcessWindowEvents ( )
pure virtual

Flushes and processes all messages from the window's event queue.

This function is meant to be called once a frame in an application's main loop. This function will break when all waiting messages have been processed and the event queue is empty.

Return values
SUCCESSThe messages were successfully processed and removed.
REDUNDANT_OPERATIONNo window exists process.

◆ ReconfigureWindow()

virtual GReturn GW::SYSTEM::GWindow::ReconfigureWindow ( int  _x,
int  _y,
int  _width,
int  _height,
GWindowStyle  _style 
)
pure virtual

Gives the currently opened window the specified size, position and style.

If width and height are equal to or greater than the native resolution, the passed in GWindowStyle will be overwritten to be the fullscreen version if it is not already. If position parameters are less than 0 then 0 will be used. If position parameters are greater than native resoultion, maximum native resolution parameters will be used.

Parameters
[in]_xThe x position on screen to move the window to.
[in]_yThe y position on screen to move the window to.
[in]_widthThe width to give the window.
[in]_heightThe height to give the window.
[in]_styleThe style to give to the window. (see GWindowStyle for style options)
Return values
SUCCESSThe window successfully had its attributes changed.
INVALID_ARGUMENTOne of the size parameters are outside the limits of the hardware.
REDUNDANT_OPERATIONNo window exists to edit.

◆ ResizeWindow()

virtual GReturn GW::SYSTEM::GWindow::ResizeWindow ( int  _width,
int  _height 
)
pure virtual

Resizes the currently opened window to the specified width and height.

If width and height are greater than the native resolution, the GWindowStyle will be overwritten to be the fullscreen version if it is not already. If position parameters are less than 0 then 0 will be used. If position parameters are greater than native resoultion, maximum native resolution parameters will be used.

Parameters
[in]_xThe width to resize the window to.
[in]_yThe height to resize the window to.
Return values
SUCCESSThe window was successfully resized.
INVALID_ARGUMENTOne of the size parameters are less than or equal to 0.
REDUNDANT_OPERATIONNo window exists to resize.

◆ SetWindowName()

virtual GReturn GW::SYSTEM::GWindow::SetWindowName ( const char *  _newName)
pure virtual

Changes de text displayed at the top bar of the window.

Parameters
[in]_styleThe style to give to the window. (see GWindowStyle for style options)
Return values
SUCCESSThe window successfully had its text changed.
INVALID_ARGUMENTThe string passed in contains invalid characters or is null.
REDUNDANT_OPERATIONNo window exists to edit.

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