lxgui
Loading...
Searching...
No Matches
gui_layered_region.cpp
1#include "lxgui/gui_layered_region.hpp"
2
3#include "lxgui/gui_frame.hpp"
4#include "lxgui/gui_manager.hpp"
5#include "lxgui/gui_out.hpp"
6#include "lxgui/gui_region.hpp"
7#include "lxgui/gui_region_tpl.hpp"
8
9#include <sstream>
10
11namespace lxgui::gui {
12
14 utils::control_block& block, manager& mgr, const region_core_attributes& attr) :
15 base(block, mgr, attr) {
16
17 initialize_(*this, attr);
18}
19
20std::string layered_region::serialize(const std::string& tab) const {
21 std::ostringstream str;
22 str << base::serialize(tab);
23 str << tab << " # Layer : " << utils::to_string(layer_) << "\n";
24
25 return str.str();
26}
27
29 if (!parent_)
30 return nullptr;
31
32 return parent_->remove_region(utils::static_pointer_cast<layered_region>(observer_from_this()));
33}
34
38
40 if (layer_ == layer_id)
41 return;
42
43 layer_ = layer_id;
44 if (parent_)
45 parent_->notify_layers_need_update();
46}
47
51
52void layered_region::set_region_level(int region_level) {
53 if (region_level_ == region_level)
54 return;
55
56 region_level = region_level_;
57 if (parent_)
58 parent_->notify_layers_need_update();
59}
60
62 if (is_virtual_)
63 return;
64
65 if (parent_)
66 parent_->notify_renderer_need_redraw();
67}
68
69const std::vector<std::string>& layered_region::get_type_list_() const {
70 return get_type_list_impl_<layered_region>();
71}
72
73} // namespace lxgui::gui
void notify_renderer_need_redraw() override
Notifies the renderer of this region that it needs to be redrawn.
void set_region_level(int region_level)
Sets this layered_region's region level.
layered_region(utils::control_block &block, manager &mgr, const region_core_attributes &attr)
Constructor.
std::string serialize(const std::string &tab) const override
Prints all relevant information about this region in a string.
layer get_draw_layer() const
Returns this layered_region's draw layer.
utils::owner_ptr< region > release_from_parent() override
Removes this region from its parent and return an owning pointer.
int get_region_level() const
Sets the region level.
void set_draw_layer(layer layer_id)
Sets this layered_region's draw layer.
const std::vector< std::string > & get_type_list_() const override
Manages the user interface.
The base class of all elements in the GUI.
void initialize_(T &self, const region_core_attributes &attr)
Set up function to call in all derived class constructors.
utils::observer_ptr< frame > parent_
virtual std::string serialize(const std::string &tab) const
Prints all relevant information about this region in a string.
layer
ID of a layer for rendering inside a frame.
oup::observable_sealed_ptr< T > owner_ptr
Struct holding all the core information about a region necessary for its creation.