![]() |
Gorgon Game Engine
|
UI window allows programmers to create an OS window that will accept widgets and has the ability to run by its own. More...
Public Member Functions | |
Window () | |
Window (Window &&other) | |
~Window () | |
bool | Add (Widget &widget) |
Adds the given widget to this container. More... | |
bool | EnsureVisible (const UI::Widget &) override |
Window does not do any scrolling, thus cannot ensure visibility. More... | |
virtual Geometry::Size | GetInteriorSize () const override |
Should return the interior (usable) size of the container. More... | |
virtual bool | IsVisible () const override |
Returns whether this layer is effectively visible. More... | |
Window & | operator= (Window &&other) |
virtual void | Quit () override |
Closes the window, returning the execution to the point where Run function is called. More... | |
virtual ExtenderRequestResponse | RequestExtender (const Gorgon::Layer &self) override |
This function will return a container that will act as an extender. More... | |
virtual void | Run () override |
Takes the control of the execution until Quit is called. More... | |
virtual void | Step () override |
Runs a single frame. More... | |
![]() | |
Window () | |
Empty constructor creates a non-initialized window. More... | |
Window (const FullscreenTag &, const WindowManager::Monitor &monitor, const std::string &name, const std::string &title="") | |
Creates a fullscreen window. More... | |
Window (const FullscreenTag &tag, const std::string &name, const std::string &title="") | |
Creates a fullscreen window. More... | |
Window (const Geometry::Size &size, const char *name, bool allowresize=false, bool visible=true) | |
Creates a new window at the center of the screen. More... | |
Window (const Geometry::Size &size, const char *name, const char *title, bool allowresize=false, bool visible=true) | |
Creates a new window at the center of the screen. More... | |
Window (const Geometry::Size &size, const std::string &name, bool allowresize=false, bool visible=true) | |
Creates a new window at the center of the screen. More... | |
Window (const Geometry::Size &size, const std::string &name, const std::string &title, bool allowresize=false, bool visible=true) | |
Creates a new window at the center of the screen. More... | |
Window (const Window &)=delete | |
Copy constructor is not allowed. More... | |
Window (const WindowManager::Monitor &monitor, const Geometry::Size &size, const char *name, bool allowresize=false, bool visible=true) | |
Creates a new window at the center of the screen. More... | |
Window (const WindowManager::Monitor &monitor, const Geometry::Size &size, const std::string &name, bool allowresize=false, bool visible=true) | |
Creates a new window at the center of the screen. More... | |
Window (Geometry::Rectangle rect, const char *name, bool allowresize=false, bool visible=true) | |
Creates a new window. More... | |
Window (Geometry::Rectangle rect, const std::string &name, bool allowresize=false, bool visible=true) | |
Creates a new window. More... | |
Window (Window &&other) | |
Move constructor. More... | |
~Window () | |
Destroys this window. More... | |
void | activatecontext () |
Activates the GL context of the window. More... | |
void | AllowResize () |
Allows window to be resized by the user. More... | |
void | Center () |
Centers the window to the default monitor. More... | |
void | Center (const WindowManager::Monitor &monitor) |
Centers the window to the given monitor. More... | |
void | Close () |
Closes the window. After this function, any use of this object might fail. More... | |
void | Destroy () |
Destroys this window. More... | |
void | Focus () |
Focuses this window. More... | |
Geometry::Bounds | GetExteriorBounds () const |
Returns the exterior bounding box of the window. More... | |
const WindowManager::Monitor & | GetMonitor () const |
Returns the monitor that the window is currently on. More... | |
Geometry::Point | GetMouseLocation () const |
Returns the mouse location on the window. More... | |
std::string | GetName () const |
Returns the name of the window that is set at creation time. More... | |
Geometry::Point | GetPosition () const |
Returns the current position of the window. More... | |
std::string | GetTitle () const |
Returns the current title of the window. More... | |
virtual void | Hide () override |
Hides this window, may generate Deactivated event. More... | |
void | HidePointer () |
Hides the pointer. More... | |
bool | IsClosed () const |
Whether the window is currently closed and cannot be acted on. More... | |
bool | IsFocused () const |
Returns if this window has the focus. More... | |
bool | IsLeftButtonPressed () const |
Query whether the left mouse button is pressed. More... | |
bool | IsLocalPointer () const |
Returns whether the current pointer is a local pointer. More... | |
bool | IsMaximized () const |
Returns if the window is maximized. More... | |
bool | IsMiddleButtonPressed () const |
Query whether the middle mouse button is pressed. More... | |
bool | IsMinimized () const |
Returns if the window is minimized. More... | |
bool | IsPointerVisible () const |
Returns whether the pointer is visible. More... | |
bool | IsRightButtonPressed () const |
Query whether the right mouse button is pressed. More... | |
bool | IsX1ButtonPressed () const |
Query whether the X1 mouse button is pressed. More... | |
bool | IsX2ButtonPressed () const |
Query whether the X2 mouse button is pressed. More... | |
void | Maximize () |
Maximizes the window to cover the usable area of the screen. More... | |
void | Minimize () |
Minimizes the window. More... | |
void | mouse_down (Geometry::Point location, Input::Mouse::Button button) |
These functions are used internally. More... | |
void | mouse_event (Input::Mouse::EventType event, Geometry::Point location, Input::Mouse::Button button, float amount) |
These functions are used internally. More... | |
void | mouse_location () |
These functions are used internally. More... | |
void | mouse_up (Geometry::Point location, Input::Mouse::Button button) |
These functions are used internally. More... | |
virtual void | Move (const Geometry::Point &position) override |
Moves the window to the given position. More... | |
virtual void | Move (int x, int y) override |
Moves the window to the given position. More... | |
Window & | operator= (Window &&other) |
Moves another window into this one. More... | |
Input::Mouse::Button | PressedButtons () const |
Returns currently pressed buttons. More... | |
void | PreventResize () |
Prevents window to be resized by the user. More... | |
void | processmessages () |
This method is automatically called by the system.Unless its necessary, do not use it. More... | |
virtual void | Render () override |
Renders the contents of the window. More... | |
virtual void | Resize (const Geometry::Size &size) override |
Resizes the window to the given size. More... | |
virtual void | Resize (int width, int height) override |
Resizes the window to the given size. More... | |
void | Restore () |
Restores a minimized or maximized window. More... | |
void | SetIcon (const WindowManager::Icon &icon) |
Changes the icon of the window. More... | |
void | SetTitle (const std::string &title) |
Changes the title of the window to the specified string. More... | |
virtual void | Show () override |
Displays this window, may generate Activated event. More... | |
void | ShowPointer () |
Displays the pointer. More... | |
void | Swap (Window &other) |
Used for move semantics. More... | |
void | SwitchToLocalPointers () |
Removes the operating system pointer and starts using Locally defined pointers. More... | |
void | SwitchToWMPointers () |
Stops showing local pointers and makes window manager pointer visible. More... | |
![]() | |
Layer () | |
Constructor that sets the layer to cover entire parent, no matter how big it is. More... | |
Layer (const Geometry::Bounds &bounds) | |
Initializing constructor. More... | |
Layer (const Geometry::Point &location) | |
Constructor that places the layer to the given location. More... | |
Layer (const Layer &)=delete | |
Copy constructor is disabled. More... | |
Layer (Layer &&other) | |
Move constructor. More... | |
virtual | ~Layer () |
Destructor. More... | |
Layer & | operator= (const Layer &)=delete |
Copy assignment is deleted. More... | |
Layer & | operator= (Layer &&other) |
Move assignment. More... | |
virtual bool | propagate_mouseevent (Input::Mouse::EventType evet, Geometry::Point location, Input::Mouse::Button button, float amount, MouseHandler &handlers) |
Propagates a mouse event. More... | |
void | Swap (Layer &other) |
Swaps two layers, mostly used for move semantics. More... | |
void | Add (Layer &layer) |
Adds the given layer as a child. More... | |
void | Add (Layer *layer) |
Adds the given layer as a child. More... | |
void | setname (std::string value) |
For debugging. More... | |
void | Insert (Layer &layer, long under) |
Inserts the given layer before the given index. More... | |
void | Insert (Layer *layer, long under) |
Inserts the given layer before the given index. More... | |
void | Remove (Layer &layer) |
Removes the given layer. More... | |
void | Remove (Layer *layer) |
Removes the given layer. More... | |
bool | HasParent () const |
Returns whether this layer has a parent. More... | |
virtual Layer & | GetParent () const |
Returns the parent of this layer. More... | |
Layer & | GetTopLevel () const |
Returns the top level layer that contains this layer. More... | |
virtual Geometry::Point | TranslateToTopLevel (Geometry::Point location={0, 0}) const |
Translates the given location to the top level. More... | |
Layer & | GetTopLevel () |
Containers::Collection< Layer >::ConstIterator | begin () const |
An iterator pointing to the start of the children. More... | |
Containers::Collection< Layer >::ConstIterator | end () const |
An iterator pointing to the end of the children. More... | |
Containers::Collection< Layer >::ConstIterator | First () const |
An iterator pointing to the start of the children. More... | |
Containers::Collection< Layer >::ConstIterator | Last () const |
An iterator pointing to the last item of the children. More... | |
void | PlaceBefore (int before) |
Places this layer before the given index. More... | |
void | PlaceToTop () |
Places this layer to the top of the layer stack its in. More... | |
void | PlaceToBottom () |
Places this layer to the bottom of the layer stack. More... | |
int | GetOrder () const |
Gets the current order of the stack. More... | |
void | SetWidth (int width) |
Resizes the layer to the given size. More... | |
void | SetHeight (int height) |
Resizes the layer to the given size. More... | |
void | SetBounds (const Geometry::Bounds &bounds) |
Sets the boundaries of this layer. More... | |
Geometry::Size | GetSize () const |
Returns the size of the layer. More... | |
Geometry::Size | GetCalculatedSize () const |
Returns the size of the layer. More... | |
int | GetWidth () const |
Returns the width of the layer. More... | |
int | GetHeight () const |
Returns the height of the layer. More... | |
Geometry::Point | GetLocation () const |
Returns the current location of the layer. More... | |
int | GetLeft () const |
Returns the current location of the layer. More... | |
int | GetTop () const |
Returns the current location of the layer. More... | |
Geometry::Bounds | GetBounds () const |
Returns the boundaries of the layer. More... | |
Geometry::Bounds | GetEffectiveBounds () const |
Returns the effective boundaries of the layer. More... | |
![]() | |
WidgetContainer ()=default | |
WidgetContainer (WidgetContainer &&)=default | |
virtual | ~WidgetContainer () |
Virtual destructor. More... | |
bool | Add (Widget &widget) |
Adds the given widget to this container. More... | |
void | AttachOrganizer (Organizers::Base &organizer) |
Attaches an organizer to this container. More... | |
auto | begin () |
Returns the begin iterator for the contained widgets. More... | |
auto | begin () const |
Returns the begin iterator for the contained widgets. More... | |
void | ChangeFocusOrder (Widget &widget, int order) |
Changes the focus order of the given widget. More... | |
void | ChangeZorder (Widget &widget, int order) |
Changes the z-order of the widget. More... | |
virtual bool | CharacterEvent (Char c) |
This function should be called whenever a character is received from operating system. More... | |
template<class O_ , class ... Args_> | |
O_ & | CreateOrganizer (Args_ &&... args) |
Creates a new organizer that lives with this container. More... | |
FocusStrategy | CurrentFocusStrategy () const |
Returns the active focus strategy. This function will not return Inherit. More... | |
void | Disable () |
Disables the container, disallowing interactions of all widgets in it. More... | |
void | DisableTabSwitch () |
Disable tab switching. More... | |
void | Displaced () |
Call this function if the container or widgets in it is moved without move function is called. More... | |
void | Enable () |
Enables the container, allowing interaction with the widgets in it. More... | |
void | EnableTabSwitch () |
Enable tab switching. More... | |
auto | end () |
Returns the end iterator for the contained widgets. More... | |
auto | end () const |
Returns the end iterator for the contained widgets. More... | |
bool | FocusFirst () |
Focuses the first widget that accepts focus. More... | |
bool | FocusLast () |
Focuses the last widget in the container. More... | |
bool | FocusNext () |
Focuses the next widget that accepts focus. More... | |
bool | FocusNext (const Widget &widget) |
Focuses the next widget that accepts focus starting from the given focus index. More... | |
bool | FocusNext (int after) |
Focuses the next widget that accepts focus starting from the given focus index. More... | |
bool | FocusPrevious () |
Focuses the previous widget that accepts focus. More... | |
bool | FocusPrevious (const Widget &widget) |
Focuses the previous widget that accepts focus. More... | |
bool | FocusPrevious (int before) |
Focuses the previous widget that accepts focus. More... | |
void | ForceRemove (Widget &widget) |
Forcefully removes the given widget from this container. More... | |
void | ForceRemoveFocus () |
Forcefully removes the focus from the focused widget. More... | |
virtual Widget & | GetCancel () const |
Returns the cancel element of the container which is called when the use presses escape key. More... | |
int | GetCount () const |
Returns the number of widgets in this container. More... | |
virtual Widget & | GetDefault () const |
Returns the default element of the container. More... | |
Widget & | GetFocus () const |
Returns the focused widget. More... | |
int | GetFocusOrder (const Widget &widget) const |
FocusStrategy | GetFocusStrategy () const |
Returns the focus strategy set to this container. More... | |
Organizers::Base & | GetOrganizer () const |
Returns the organizer controlling this container. More... | |
virtual bool | HasCancel () const |
Returns if this container has a cancel widget. More... | |
virtual bool | HasDefault () const |
Returns if this container has a default object. More... | |
bool | HasFocusedWidget () const |
Returns if this container has a focused widget. More... | |
bool | HasOrganizer () const |
Returns if this container has an organizer. More... | |
bool | Insert (Widget &widget, int index) |
Add the given widget to this container. More... | |
virtual bool | IsEnabled () const |
Returns whether container is enabled. More... | |
virtual bool | IsTabSwitchEnabled () const |
Check if tab switch is enabled. More... | |
virtual bool | KeyEvent (Input::Key key, float state) |
This function should be called whenever a key is pressed or released. More... | |
WidgetContainer & | operator= (WidgetContainer &&)=default |
Widget & | operator[] (int ind) |
Returns the widget at the given index. More... | |
const Widget & | operator[] (int ind) const |
Returns the widget at the given index. More... | |
bool | Remove (Widget &widget) |
Removes the given widget from this container. More... | |
virtual void | RemoveCancel () |
Removes the cancel widget of this container. More... | |
virtual void | RemoveDefault () |
Removes the default widget of this container. More... | |
bool | RemoveFocus () |
Removes the focus from the focused widget. More... | |
void | RemoveOrganizer () |
Removes the organizer from this container. More... | |
virtual void | SetCancel (Widget &widget) |
Sets the cancel widget of the container. More... | |
virtual void | SetDefault (Widget &widget) |
Sets the default object of the container. More... | |
virtual void | SetEnabled (bool value) |
Sets the enabled state of this container. More... | |
void | SetFocusStrategy (FocusStrategy value) |
Sets the focus strategy, see FocusStrategy. More... | |
bool | SetFocusTo (Widget &widget) |
Sets the focus to the given widget. More... | |
virtual void | SetTabSwitchEnabledState (bool state) |
Sets the state of tab switching. More... | |
void | ToggleEnabled () |
Toggles the enabled state of this container. More... | |
void | ToggleTabSwitchEnabledState () |
Toggles the state of tab switching. More... | |
Protected Member Functions | |
void | added (Layer &l) override |
Will be called when a layer is added. More... | |
decltype(CharacterEvent) ::Token | charinit () |
virtual Gorgon::Layer & | getlayer () override |
Returns the layer that will be used to place the contained widgets. More... | |
decltype(KeyEvent) ::Token | keyinit () |
Graphics::Layer * | layerinit () |
virtual bool | ResizeInterior (Geometry::Size size) override |
Should resize the interior (usable) size of the container. More... | |
![]() | |
Window (const WindowManager::Monitor &monitor, Geometry::Rectangle rect, const std::string &name, const std::string &title, bool allowresize, bool visible) | |
void | deleting (Layer *layer) |
virtual void | located (Layer *) override |
A window cannot be placed in another layer. This function always fails. More... | |
![]() | |
void | dotransformandclip (bool inverse=false) |
Performs transformation and clipping. Use inverse for reverse mapping for mouse events. More... | |
virtual void | removed (Layer &layer) |
Will be called when a layer is removed. More... | |
void | reverttransformandclip () |
Reverts previously done transformation. More... | |
![]() | |
virtual bool | addingwidget (Widget &) |
This function can return false to prevent the given widget from getting added to the container. More... | |
virtual void | childboundschanged (Widget *source) |
The boundary of any of the children is changed. Source could be nullptr. More... | |
bool | distributecharevent (Char c) |
Distributes a pressed character to the focused widget. More... | |
bool | distributekeyevent (Input::Key key, float state, bool handlestandard) |
Distributes the pressed key to the focused widget. More... | |
void | distributeparentenabled (bool state) |
Distributes a enabled state to children. More... | |
virtual void | focuschanged () |
This function is called when the focus is changed. More... | |
virtual FocusStrategy | getparentfocusstrategy () const |
If this widget is not top level, return the current strategy used by the parent. More... | |
bool | handlestandardkey (Input::Key key) |
Performs the standard operations (tab/enter/escape) More... | |
virtual bool | removingwidget (Widget &) |
This function is called before removing a widget. More... | |
virtual void | widgetadded (Widget &) |
This function is called after a widget is added. More... | |
virtual void | widgetremoved (Widget &) |
This function is called after a widget is removed. More... | |
Additional Inherited Members | |
![]() | |
enum | FocusStrategy { Inherit, AllowAll, Selective, Strict, Deny } |
Defines focus strategy for the container. Default is Inherit. More... | |
![]() | |
static Geometry::Size | GetMinimumRequiredSize () |
Returns the minimum size required to fit any window inside. More... | |
![]() | |
Graphics::PointerStack | Pointers |
Pointer system to be used within the window. More... | |
Event< Window > | FocusedEvent |
Called when this window is focused. More... | |
Event< Window > | LostFocusEvent |
Called when this window is deactivated. More... | |
Event< Window > | DestroyedEvent |
Called when this window is destroyed. More... | |
Event< Window, bool & > | ClosingEvent |
Called when user tries to close the window. More... | |
Event< Window > | MovedEvent |
Called after the window is moved, either by the user or programmatically. More... | |
Event< Window > | ResizedEvent |
Called after the window is resized, either by the user or programmatically. More... | |
Event< Window > | MinimizedEvent |
Called after the window is minimized, either by the user or programmatically. More... | |
Event< Window > | RestoredEvent |
Called after the window is restored from minimized state, either by the user or programmatically. More... | |
ConsumableEvent< Window, Input::Key, float > | KeyEvent |
Called when a key is pressed or released. More... | |
ConsumableEvent< Window, Input::Keyboard::Char > | CharacterEvent |
Called when a character is received. More... | |
![]() | |
const Containers::Collection< Layer > & | Children |
Sub-layers that this layer holds, all the sub-layers are considered to be above current layer. More... | |
![]() | |
static const struct Gorgon::Window::FullscreenTag | Fullscreen |
static const Containers::Collection< Window > & | Windows |
List of currently created windows. More... | |
![]() | |
static const Geometry::Bounds | EntireRegion |
When used as layer bounds, represents the entire region its placed in. More... | |
![]() | |
Geometry::Bounds | bounds |
Bounds of this layer. More... | |
Containers::Collection< Layer > | children |
Child layers that this layer holds, all child layers are considered to be above current layer. More... | |
bool | isvisible |
Whether this layer is visible, invisible layers will not be drawn or receive any events. More... | |
std::string | name |
For debugging. More... | |
Layer * | parent |
Parent layer, could be nullptr. More... | |
![]() | |
Containers::Collection< Widget > | widgets |
This container is sorted by the focus order. More... | |
UI window allows programmers to create an OS window that will accept widgets and has the ability to run by its own.
Window | ( | ) |
~Window | ( | ) |
References Window::CharacterEvent, and Window::KeyEvent.
References Window::Add(), Window::CharacterEvent, Window::charinit(), Window::KeyEvent, and Window::keyinit().
bool Add |
Adds the given widget to this container.
Widget will be placed to the top of the z-order, to the end of the focus order. If the given widget cannot be added, this function will return false.
|
overrideprotectedvirtual |
Will be called when a layer is added.
This function will even be called when the given layer was already in the children.
Reimplemented from Window.
References Window::added(), and Layer::children.
|
protected |
References WidgetContainer::CharacterEvent(), Window::CharacterEvent, and Gorgon::RegisterOnce().
|
overridevirtual |
Window does not do any scrolling, thus cannot ensure visibility.
Implements WidgetContainer.
|
overridevirtual |
Should return the interior (usable) size of the container.
Implements WidgetContainer.
References Layer::GetSize().
|
overrideprotectedvirtual |
Returns the layer that will be used to place the contained widgets.
Implements WidgetContainer.
|
overridevirtual |
Returns whether this layer is effectively visible.
Reimplemented from Window.
References Window::IsVisible().
|
protected |
References WidgetContainer::KeyEvent(), Window::KeyEvent, and Gorgon::RegisterOnce().
|
protected |
References Window::Add(), and LayerAdapter::SetLayer().
|
overridevirtual |
Closes the window, returning the execution to the point where Run function is called.
It allows current frame to be completed before quiting.
Implements Runner.
|
overridevirtual |
This function will return a container that will act as an extender.
Implements WidgetContainer.
References Layer::GetSize().
|
overrideprotectedvirtual |
Should resize the interior (usable) size of the container.
If resize operation cannot set the size exactly to the requested size, this function returns false.
Implements WidgetContainer.
References Layer::GetSize(), and Window::Resize().
|
overridevirtual |
Takes the control of the execution until Quit is called.
Implements Runner.
References Window::Close(), and Gorgon::NextFrame().
|
overridevirtual |