 |
Gorgon Game Engine
|
Go to the documentation of this file.
3 #include "../Utils/Assert.h"
7 #include "../Input/Layer.h"
8 #include "../Input/Keyboard.h"
9 #include "../Graphics/Layer.h"
10 #include "../Window.h"
18 namespace Gorgon {
namespace UI {
45 extenderlayer = other.extenderlayer;
47 other.extenderlayer = other.layerinit();
51 other.
KeyEvent.Unregister(other.inputtoken);
52 other.CharacterEvent.Unregister(other.chartoken);
65 extenderlayer = other.extenderlayer;
68 other.extenderlayer = other.layerinit();
69 other.Add(other.extenderlayer);
70 other.adapter.SetLayer(*other.extenderlayer);
86 virtual void Quit()
override {
90 virtual void Run()
override {
98 virtual void Step()
override {
108 return {
true, &adapter,
self.TranslateToTopLevel(),
GetSize()};
134 this->
KeyEvent.MoveToTop(this->inputtoken);
163 long ind =
children.FindLocation(extenderlayer);
172 bool quiting =
false;
decltype(CharacterEvent) ::Token charinit()
Definition: Window.h:141
~Window()
Definition: Window.h:31
This class represents a window.
Definition: Window.h:31
virtual void Run() override
Takes the control of the execution until Quit is called.
Definition: Window.h:90
virtual bool IsVisible() const override
Returns whether this layer is effectively visible.
Definition: Window.h:229
void Add(Layer &layer)
Adds the given layer as a child.
Definition: Layer.cpp:23
Window()
Empty constructor creates a non-initialized window.
Definition: Window.h:45
bool EnsureVisible(const UI::Widget &) override
Window does not do any scrolling, thus cannot ensure visibility.
Definition: Window.h:103
ConsumableEvent< Window, Input::Keyboard::Char > CharacterEvent
Called when a character is received.
Definition: Window.h:397
Window & operator=(Window &&other)
Definition: Window.h:50
virtual bool IsVisible() const override
Returns whether this layer is effectively visible.
Definition: Window.h:79
void NextFrame()
This function marks the end of current frame and starts the next one.
Definition: Main.cpp:115
bool Add(Widget &widget)
Adds the given widget to this container.
Definition: WidgetContainer.cpp:5
Window & operator=(Window &&other)
Moves another window into this one.
Definition: Window.h:141
virtual Geometry::Size GetInteriorSize() const override
Should return the interior (usable) size of the container.
Definition: Window.h:75
This layer allows drawing texture images on.
Definition: Layer.h:169
Defines the abstract class of Runner.
Definition: Main.h:21
void SetLayer(Gorgon::Layer &value)
Definition: LayerAdapter.h:47
Root namespace for Gorgon Game Engine.
Definition: Any.h:19
This class represents a 2D geometric size.
Definition: Size.h:23
uint32_t Char
Definition: Types.h:46
This class turns a layer into a widget container.
Definition: LayerAdapter.h:12
Graphics::Layer * layerinit()
Definition: Window.h:155
Window(Window &&other)
Definition: Window.h:37
virtual void Resize(const Geometry::Size &size) override
Resizes the window to the given size.
Definition: Window.cpp:323
virtual Gorgon::Layer & getlayer() override
Returns the layer that will be used to place the contained widgets.
Definition: Window.h:117
decltype(KeyEvent) ::Token keyinit()
Definition: Window.h:127
This structure is used to transfer extender request response.
Definition: WidgetContainer.h:15
virtual void Quit() override
Closes the window, returning the execution to the point where Run function is called.
Definition: Window.h:86
virtual bool ResizeInterior(Geometry::Size size) override
Should resize the interior (usable) size of the container.
Definition: Window.h:121
This class is the base class for all layer types.
Definition: Layer.h:79
void added(Layer &l) override
Will be called when a layer is added.
Definition: Window.h:162
virtual void Step() override
Runs a single frame.
Definition: Window.h:98
virtual void added(Layer &layer) override
Will be called when a layer is added.
Definition: Window.cpp:216
UI window allows programmers to create an OS window that will accept widgets and has the ability to r...
Definition: Window.h:24
void RegisterOnce(std::function< void()> fn)
Registers a function to be run at the start of the next frame.
Definition: Main.cpp:142
virtual ExtenderRequestResponse RequestExtender(const Gorgon::Layer &self) override
This function will return a container that will act as an extender.
Definition: Window.h:107
Window()
Definition: Window.h:28
Containers::Collection< Layer > children
Child layers that this layer holds, all child layers are considered to be above current layer.
Definition: Layer.h:501
void Close()
Closes the window. After this function, any use of this object might fail.
Definition: Window.cpp:340
ConsumableEvent< Window, Input::Key, float > KeyEvent
Called when a key is pressed or released.
Definition: Window.h:392
Geometry::Size GetSize() const
Returns the size of the layer.
Definition: Layer.h:362