Gorgon Game Engine
LayerAdapter.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "WidgetContainer.h"
4 
5 namespace Gorgon { namespace UI {
6 
12  class LayerAdapter : public WidgetContainer {
13  public:
14 
18  }
19 
23  }
24 
25  virtual bool EnsureVisible(const Gorgon::UI::Widget &widget) override {
26  return false;
27  }
28 
29  virtual Geometry::Size GetInteriorSize() const override {
30  return base->GetCalculatedSize();
31  }
32 
33  virtual bool ResizeInterior(Geometry::Size size) override {
34  base->Resize(size);
35 
36  return true;
37  }
38 
39  virtual bool IsVisible() const override {
40  return base->IsVisible();
41  }
42 
43  bool IsReady() const {
44  return base != nullptr;
45  }
46 
47  void SetLayer(Gorgon::Layer &value) {
48  base = &value;
49  }
50 
52  return *base;
53  }
54 
55  virtual ExtenderRequestResponse RequestExtender(const Gorgon::Layer &self) override;
56 
57  protected:
58  virtual Gorgon::Layer &getlayer() override {
59  return *base;
60  }
61 
62  Layer *base = nullptr;
63  };
64 
65 } }
Gorgon::Layer::Resize
virtual void Resize(const Geometry::Size &size)
Resizes the layer to the given size.
Definition: Layer.h:337
Gorgon::UI::LayerAdapter::LayerAdapter
LayerAdapter(Layer &base)
Constructor requires the base layer.
Definition: LayerAdapter.h:21
Window.h
Gorgon::UI::LayerAdapter::GetInteriorSize
virtual Geometry::Size GetInteriorSize() const override
Should return the interior (usable) size of the container.
Definition: LayerAdapter.h:29
Gorgon::UI::WidgetContainer::SetFocusStrategy
void SetFocusStrategy(FocusStrategy value)
Sets the focus strategy, see FocusStrategy.
Definition: WidgetContainer.h:329
Gorgon::Layer::IsVisible
virtual bool IsVisible() const
Returns whether this layer is effectively visible.
Definition: Layer.h:459
Gorgon::UI::LayerAdapter::getlayer
virtual Gorgon::Layer & getlayer() override
Returns the layer that will be used to place the contained widgets.
Definition: LayerAdapter.h:58
Gorgon::Layer::GetCalculatedSize
Geometry::Size GetCalculatedSize() const
Returns the size of the layer.
Definition: Layer.h:369
Gorgon::UI::LayerAdapter::SetLayer
void SetLayer(Gorgon::Layer &value)
Definition: LayerAdapter.h:47
Gorgon
Root namespace for Gorgon Game Engine.
Definition: Any.h:19
Gorgon::Geometry::basic_Size
This class represents a 2D geometric size.
Definition: Size.h:23
Gorgon::UI::LayerAdapter
This class turns a layer into a widget container.
Definition: LayerAdapter.h:12
Gorgon::UI::ExtenderRequestResponse
This structure is used to transfer extender request response.
Definition: WidgetContainer.h:15
Gorgon::Layer
This class is the base class for all layer types.
Definition: Layer.h:79
LayerAdapter.h
Gorgon::UI::LayerAdapter::GetLayer
Gorgon::Layer & GetLayer() const
Definition: LayerAdapter.h:51
Gorgon::UI::LayerAdapter::ResizeInterior
virtual bool ResizeInterior(Geometry::Size size) override
Should resize the interior (usable) size of the container.
Definition: LayerAdapter.h:33
Gorgon::UI::LayerAdapter::RequestExtender
virtual ExtenderRequestResponse RequestExtender(const Gorgon::Layer &self) override
This function will return a container that will act as an extender.
Definition: LayerAdapter.cpp:7
Gorgon::UI::WidgetContainer::Deny
@ Deny
No widget is allowed focus and this container will not handle any keys.
Definition: WidgetContainer.h:63
Gorgon::UI::WidgetContainer
This class is the base class for all widget containers.
Definition: WidgetContainer.h:37
WidgetContainer.h
Gorgon::UI::Window
UI window allows programmers to create an OS window that will accept widgets and has the ability to r...
Definition: Window.h:24
Gorgon::UI::LayerAdapter::IsReady
bool IsReady() const
Definition: LayerAdapter.h:43
Gorgon::UI::Window::RequestExtender
virtual ExtenderRequestResponse RequestExtender(const Gorgon::Layer &self) override
This function will return a container that will act as an extender.
Definition: Window.h:107
Gorgon::UI::LayerAdapter::base
Layer * base
Definition: LayerAdapter.h:62
Gorgon::UI::LayerAdapter::LayerAdapter
LayerAdapter()
This constructor will leave the LayerAdapter in an invalid state.
Definition: LayerAdapter.h:17
Gorgon::UI::LayerAdapter::EnsureVisible
virtual bool EnsureVisible(const Gorgon::UI::Widget &widget) override
Ensures the widget is visible.
Definition: LayerAdapter.h:25
Gorgon::UI::LayerAdapter::IsVisible
virtual bool IsVisible() const override
Should return whether the container is visible.
Definition: LayerAdapter.h:39
Gorgon::UI::Widget
This class is the base for all widgets.
Definition: Widget.h:16