lxgui
|
The base class of all elements in the GUI. More...
#include <gui_region.hpp>
Public Member Functions | |
region (utils::control_block &block, manager &mgr, const region_core_attributes &attr) | |
Contructor. | |
~region () override | |
Destructor. | |
region (const region &)=delete | |
Non-copiable. | |
region (region &&)=delete | |
Non-movable. | |
region & | operator= (const region &)=delete |
Non-copiable. | |
region & | operator= (region &&)=delete |
Non-movable. | |
virtual void | render () const |
Renders this region on the current render target. | |
virtual void | update (float delta) |
Updates this region's logic. | |
virtual std::string | serialize (const std::string &tab) const |
Prints all relevant information about this region in a string. | |
virtual void | copy_from (const region &obj) |
Copies a region's parameters into this region (inheritance). | |
virtual void | notify_borders_need_update () |
Tells this region that its borders need updating. | |
virtual void | notify_scaling_factor_updated () |
Tells this region that the global interface scaling factor has changed. | |
const std::string & | get_name () const |
Returns this region's name. | |
const std::string & | get_raw_name () const |
Returns this region's raw name. | |
utils::observer_ptr< const frame > | get_parent () const |
Returns this region's parent. | |
const utils::observer_ptr< frame > & | get_parent () |
Returns this region's parent. | |
virtual utils::owner_ptr< region > | release_from_parent () |
Removes this region from its parent and return an owning pointer. | |
void | destroy () |
Forcefully removes this region from the GUI. | |
void | set_alpha (float alpha) |
Changes this region's alpha (opacity). | |
float | get_alpha () const |
Returns this region's alpha (opacity). | |
float | get_effective_alpha () const |
Returns this region's effective alpha (opacity). | |
void | show () |
shows this region. | |
void | hide () |
hides this region. | |
void | set_shown (bool is_shown) |
shows/hides this region. | |
bool | is_shown () const |
Checks if this region is shown. | |
bool | is_visible () const |
Checks if this region can be seen on the screen. | |
bool | is_valid () const |
Checks if this region has all its borders correctly defined. | |
virtual void | set_dimensions (const vector2f &dimensions) |
Changes this region's absolute dimensions (in pixels). | |
virtual void | set_width (float abs_width) |
Changes this region's absolute width (in pixels). | |
virtual void | set_height (float abs_height) |
Changes this region's absolute height (in pixels). | |
void | set_relative_dimensions (const vector2f &dimensions) |
Changes this region's dimensions (relative to its parent). | |
void | set_relative_width (float rel_width) |
Changes this region's width (relative to its parent). | |
void | set_relative_height (float rel_height) |
Changes this region's height (relative to its parent). | |
const vector2f & | get_dimensions () const |
Returns this region's explicitly-defined width and height (in pixels). | |
vector2f | get_apparent_dimensions () const |
Returns this region's apparent width and height (in pixels). | |
bool | is_apparent_width_defined () const |
Checks if this region's apparent width is defined. | |
bool | is_apparent_height_defined () const |
Checks if this region's apparent height is defined. | |
virtual bool | is_in_region (const vector2f &position) const |
Checks if the provided coordinates are inside this region. | |
const std::string & | get_region_type () const |
Returns the type of this region. | |
bool | is_region_type (const std::string &type_name) const |
Checks if this region is of the provided type. | |
template<typename ObjectType > | |
bool | is_region_type () const |
Checks if this region is of the provided type. | |
bool | is_region_type (const region &obj) const |
Checks if this region is of a type equal or derived from the supplied region. | |
float | get_bottom () const |
Returns the vertical position of this region's bottom border. | |
vector2f | get_center () const |
Returns the position of this region's center. | |
float | get_left () const |
Returns the horizontal position of this region's left border. | |
float | get_right () const |
Returns the horizontal position of this region's right border. | |
float | get_top () const |
Returns the vertical position of this region's top border. | |
const bounds2f & | get_borders () const |
Returns this region's borders. | |
void | clear_all_anchors () |
Removes all anchors. | |
void | set_all_anchors (const utils::observer_ptr< region > &obj) |
Adjusts this regions anchors to fit the provided region. | |
void | set_all_anchors (const std::string &obj_name) |
Adjusts this regions anchors to fit the provided region. | |
void | set_anchor (const anchor_data &a) |
Adds/replaces an anchor. | |
template<typename... Args> | |
void | set_anchor (Args &&... args) |
Adds/replaces an anchor. | |
bool | depends_on (const region &obj) const |
Checks if this region depends on another. | |
std::size_t | get_anchor_count () const |
Returns the number of defined anchors. | |
anchor & | modify_anchor (point p) |
Returns one of this region's anchor to modify it. | |
const anchor & | get_anchor (point p) const |
Returns one of this region's anchor. | |
const std::array< std::optional< anchor >, 9 > & | get_anchors () const |
Returns all of this region's anchors. | |
float | round_to_pixel (float value, utils::rounding_method method=utils::rounding_method::nearest) const |
Round an absolute position on screen to the nearest physical pixel. | |
vector2f | round_to_pixel (const vector2f &position, utils::rounding_method method=utils::rounding_method::nearest) const |
Round an absolute position on screen to the nearest physical pixel. | |
void | add_anchored_object (region &obj) |
Notifies this region that another one is anchored to it. | |
void | remove_anchored_object (region &obj) |
Notifies this region that another one is no longer anchored to it. | |
bool | is_virtual () const |
Checks if this region is virtual. | |
void | set_manually_inherited (bool manually_inherited) |
Flags this region as manually inherited or not. | |
bool | is_manually_inherited () const |
Checks if this object is manually inherited. | |
virtual utils::observer_ptr< const frame_renderer > | get_effective_frame_renderer () const |
Returns the renderer of this object or its parents. | |
utils::observer_ptr< frame_renderer > | get_effective_frame_renderer () |
Returns the renderer of this object or its parents, nullptr if none. | |
virtual void | notify_renderer_need_redraw () |
Notifies the renderer of this region that it needs to be redrawn. | |
const std::vector< utils::observer_ptr< region > > & | get_anchored_objects () const |
Returns the list of all objects that are anchored to this one. | |
virtual void | notify_loaded () |
Notifies this region that it has been fully loaded. | |
bool | is_loaded () const |
Checks if this region has been fully loaded. | |
virtual void | notify_visible () |
Notifies this region that it is now visible on screen. | |
virtual void | notify_invisible () |
Notifies this region that it is no longer visible on screen. | |
void | set_addon (const addon *a) |
Sets the addon this frame belongs to. | |
const addon * | get_addon () const |
Returns this frame's addon. | |
std::string | parse_file_name (const std::string &file_name) const |
Convert an addon-relative file path to a application-relative path. | |
manager & | get_manager () |
Returns this region's manager. | |
const manager & | get_manager () const |
Returns this region's manager. | |
registry & | get_registry () |
Returns the UI object registry, which keeps track of all objects in the UI. | |
const registry & | get_registry () const |
Returns the UI object registry, which keeps track of all objects in the UI. | |
void | remove_glue () |
Removes the Lua glue. | |
virtual void | parse_layout (const layout_node &node) |
Parses data from a layout_node. | |
Static Public Member Functions | |
static void | register_on_lua (sol::state &lua) |
Registers this region class to the provided Lua state. | |
Static Public Attributes | |
static constexpr const char * | class_name = "Region" |
Protected Member Functions | |
virtual void | parse_attributes_ (const layout_node &node) |
virtual void | parse_size_node_ (const layout_node &node) |
virtual void | parse_anchor_node_ (const layout_node &node) |
color | parse_color_node_ (const layout_node &node) |
vector2< std::optional< float > > | parse_offset_node_ (const layout_node &node) |
vector2< float > | parse_offset_node_or_ (const layout_node &node, float fallback) |
std::pair< anchor_type, vector2< std::optional< float > > > | parse_dimension_node_ (const layout_node &node) |
void | read_anchors_ (float &left, float &right, float &top, float &bottom, float &x_center, float &y_center) const |
bool | make_borders_ (float &min, float &max, float center, float size) const |
virtual void | update_borders_ () |
sol::state & | get_lua_ () |
const sol::state & | get_lua_ () const |
template<typename T > | |
void | create_glue_ (T &self) |
virtual const std::vector< std::string > & | get_type_list_ () const |
void | set_lua_member_ (std::string key, sol::stack_object value) |
sol::object | get_lua_member_ (const std::string &key) const |
void | set_virtual_ () |
Makes this region virtual. | |
void | set_name_ (const std::string &name) |
Sets this region's name. | |
virtual void | set_parent_ (utils::observer_ptr< frame > parent) |
Changes this region's parent. | |
template<typename T > | |
void | initialize_ (T &self, const region_core_attributes &attr) |
Set up function to call in all derived class constructors. | |
Static Protected Member Functions | |
template<typename T > | |
static const std::vector< std::string > & | get_type_list_impl_ () |
Protected Attributes | |
manager & | manager_ |
const addon * | addon_ = nullptr |
std::string | name_ |
std::string | raw_name_ |
utils::observer_ptr< frame > | parent_ = nullptr |
bool | is_manually_inherited_ = false |
bool | is_virtual_ = false |
bool | is_loaded_ = false |
bool | is_valid_ = true |
std::array< std::optional< anchor >, 9 > | anchor_list_ |
bounds2< bool > | defined_borders_ |
bounds2f | borders_ |
float | alpha_ = 1.0f |
bool | is_shown_ = true |
bool | is_visible_ = true |
vector2f | dimensions_ |
std::vector< utils::observer_ptr< region > > | anchored_object_list_ |
Friends | |
template<typename ObjectType > | |
const ObjectType * | down_cast (const region *self) |
Obtain a pointer to a derived class. | |
template<typename ObjectType > | |
ObjectType * | down_cast (region *self) |
Obtain a pointer to a derived class. | |
The base class of all elements in the GUI.
Objects of this class offers core functionalities needed by every element of the interface. They have a name, and a corresponding variable created in Lua to access them. They can have a parent lxgui::gui::frame. They can be placed on the screen at an absolute position, or relative to other regions. They can be shown or hidden.
Apart form this, a region does not contain anything, nor can it display anything on the screen. Any functionality beyond the list above is implemented in specialized subclasses (see the full list below).
Interaction between C++, Lua, and layout files. When a region is created, it must be given a name, for example "PlayerHealthBar"
. For as long as the object lives, this name will be used to refer to it. In particular, as soon as the object is created, regardless of whether this was done in C++, layout files, or Lua, a new variable will be created in the Lua state with the exact same name, PlayerHealthBar
. This variable is a reference to the region, and can be used to interact with it dynamically. Because of this, each object must have a unique name, otherwise it could not be accessible from Lua.
Note: Although you can destroy this Lua variable by setting it to nil, this is not recommended: the object will not be destroyed (nor garbage-collected) because it still exists in the C++ memory space. The only way to truly destroy an object from Lua is to call delete_frame
(for frames only). Destroying and creating objects has a cost however. If the object is likely to reappear later with the same content, simply hide it and show it again later on. If the content may change, you can also recycle the object, i.e., keep it alive and simply change its content when it later reappears.
Deleting an object from C++ is done using region::destroy. This will automatically delete all references to this object in Lua as well.
Finally, note that objects do not need to be explicitly destroyed: they will automatically be destroyed when their parent is itself destroyed (see below). Only use explicit destruction when absolutely necessary.
Parent-child relationship. Parents of regions are frames. See the lxgui::gui::frame class documentation for more information. One important aspect of the parent-child relationship is related to the object name. If a region has a parent, it can be given a name starting with "$parent"
. The name of the parent will automatically replace the "$parent"
string. For example, if an object is named "$parentButton"
and its parent is named "ErrorMessage"
, the final name of the object will be "ErrorMessageButton"
. It can be accessed from the Lua state as ErrorMessageButton
, or as ErrorMessage.Button
. This is particularly important when using inheritance, as the final name of an inherited child region then naturally depends on the name of its parent.
A child will inherit some properties from its parent: transparency, scaling, visibility (show/hide), strata (if not explicitly specified), level (incremented from its parent's), and renderer (if not explicitly specified). Note in particular that the parent-child relationship does not impose any link between the child and its parent's position and size: this must be done explicitly with anchors, as required.
Lastly, a child is owned by its parent: if the parent is destroyed, the child will be destroyed as well.
Positioning. regions have a position on the screen, but this is not parameterized as a simple pair of X and Y coordinates. Instead, objects are positioned based on a list of "anchors". Anchors are links between objects, which force one edge or one corner of a given object to match with the edge or corner of another object. For example, given two objects A and B, you can create an anchor that links the top-left corner of A to the top-left corner of B. The position of A will automatically be linked to the position of B, hence if B moves, A will follow. To further refine this positioning, you can specify anchor offsets: for example, you may want A's top-left corner to be shifted from B's top-left corner by two pixels in the X direction, and five in the Y direction. This offset can be defined either as an absolute number of pixels, or as a relative fraction of the size of the object being anchored to. For example, you can specify that A's top-left corner links to B's top-left corner, with an horizontal offset equal to 30% of B's width. Read the "Anchors" section below for more information.
An object which has no anchor will be considered "invalid" and will not be displayed.
Sizing. There are two ways to specify the size of a region. The first and most straightforward approach is to directly set its width and/or height. This must be specified as an absolute number of pixels. The second and more versatile method is to use more than one anchor for opposite sides of the object, for example an anchor for the "left" and another for the "right" edge. This will implicitly give a width to the object, depending on the position of the other objects to which it is anchored. Anchors will always override the absolute width and height of an object if they provide any constraint on the extents of the object in a given dimension.
An object which has neither a fixed absolute size, nor has it size implicitly constrained by anchors, is considered "invalid" and will not be displayed.
Anchors. There are nine available anchor points:
TOP_LEFT
: constrains the max Y and min X.TOP_RIGHT
: constrains the max Y and max X.BOTTOM_LEFT
: constrains the min Y and min X.BOTTOM_RIGHT
: constrains the min Y and max X.LEFT
: constrains the min X and the midpoint in Y.RIGHT
: constrains the max X and the midpoint in Y.TOP
: constrains the max Y and the midpoint in X.BOTTOM
: constrains the min Y and the midpoint in X.CENTER
: constrains the midpoint in X and Y.If you specify two constraints on the same point (for example: TOP_LEFT
and BOTTOM_LEFT
both constrain the min X coordinate), the most stringent constraint always wins. Constraints on the midpoints are more subtle however, as they will always be discarded when both the min and max are constrained. For example, consider an object A
of fixed size 30x30 and some other object B
of fixed size 40x40. If we anchor the RIGHT
of A
to the LEFT
of B
, A
's vertical center will be automatically aligned with B
's vertical center. This is the effect of the midpoint constraint. Now, if we further anchor the TOP
of A
to the TOP
of B
, we have more than one anchor constraining the vertical extents of A
(see "Sizing" above), therefore A
's fixed height of 30 pixels will be ignored from now on. It will shrink to a height of 20 pixels, i.e., the distance between B
's top edge and its vertical center. Finally, if we further anchor the BOTTOM
of A
to the BOTTOM
of B
, the constraint on A
's midpoint will be ignored: A
will be enlarged to a height of 40 pixels, i.e., the distance between B
's top and bottom edges.
Definition at line 161 of file gui_region.hpp.
|
explicit |
Contructor.
Definition at line 21 of file gui_region.cpp.
|
override |
Destructor.
Definition at line 35 of file gui_region.cpp.
|
delete |
Non-copiable.
|
delete |
Non-movable.
void lxgui::gui::region::add_anchored_object | ( | region & | obj | ) |
Notifies this region that another one is anchored to it.
obj | The anchored region |
Definition at line 561 of file gui_region.cpp.
void lxgui::gui::region::clear_all_anchors | ( | ) |
Removes all anchors.
Definition at line 365 of file gui_region.cpp.
|
virtual |
Copies a region's parameters into this region (inheritance).
obj | The region to copy |
Reimplemented in lxgui::gui::animated_texture, lxgui::gui::button, lxgui::gui::check_button, lxgui::gui::edit_box, lxgui::gui::font_string, lxgui::gui::frame, lxgui::gui::scroll_frame, lxgui::gui::slider, lxgui::gui::status_bar, and lxgui::gui::texture.
Definition at line 128 of file gui_region.cpp.
|
protected |
Definition at line 136 of file gui_region_tpl.hpp.
bool lxgui::gui::region::depends_on | ( | const region & | obj | ) | const |
Checks if this region depends on another.
obj | The region to test |
Definition at line 503 of file gui_region.cpp.
void lxgui::gui::region::destroy | ( | ) |
Forcefully removes this region from the GUI.
Definition at line 333 of file gui_region.cpp.
const addon * lxgui::gui::region::get_addon | ( | ) | const |
Returns this frame's addon.
Definition at line 843 of file gui_region.cpp.
float lxgui::gui::region::get_alpha | ( | ) | const |
Returns this region's alpha (opacity).
Definition at line 157 of file gui_region.cpp.
Returns one of this region's anchor.
p | The anchor point |
Definition at line 539 of file gui_region.cpp.
std::size_t lxgui::gui::region::get_anchor_count | ( | ) | const |
Returns the number of defined anchors.
Definition at line 519 of file gui_region.cpp.
const std::vector< utils::observer_ptr< region > > & lxgui::gui::region::get_anchored_objects | ( | ) | const |
Returns the list of all objects that are anchored to this one.
Definition at line 790 of file gui_region.cpp.
const std::array< std::optional< anchor >, 9 > & lxgui::gui::region::get_anchors | ( | ) | const |
Returns all of this region's anchors.
Definition at line 549 of file gui_region.cpp.
vector2f lxgui::gui::region::get_apparent_dimensions | ( | ) | const |
Returns this region's apparent width and height (in pixels).
Definition at line 276 of file gui_region.cpp.
const bounds2f & lxgui::gui::region::get_borders | ( | ) | const |
Returns this region's borders.
Definition at line 361 of file gui_region.cpp.
float lxgui::gui::region::get_bottom | ( | ) | const |
Returns the vertical position of this region's bottom border.
Definition at line 357 of file gui_region.cpp.
vector2f lxgui::gui::region::get_center | ( | ) | const |
Returns the position of this region's center.
Definition at line 341 of file gui_region.cpp.
const vector2f & lxgui::gui::region::get_dimensions | ( | ) | const |
Returns this region's explicitly-defined width and height (in pixels).
Definition at line 272 of file gui_region.cpp.
float lxgui::gui::region::get_effective_alpha | ( | ) | const |
Returns this region's effective alpha (opacity).
Definition at line 161 of file gui_region.cpp.
|
inline |
Returns the renderer of this object or its parents, nullptr if none.
Definition at line 615 of file gui_region.hpp.
|
virtual |
Returns the renderer of this object or its parents.
Reimplemented in lxgui::gui::frame.
Definition at line 802 of file gui_region.cpp.
float lxgui::gui::region::get_left | ( | ) | const |
Returns the horizontal position of this region's left border.
Definition at line 345 of file gui_region.cpp.
|
protected |
Definition at line 767 of file gui_region.cpp.
|
protected |
Definition at line 771 of file gui_region.cpp.
|
protected |
|
inline |
Returns this region's manager.
Definition at line 693 of file gui_region.hpp.
|
inline |
Returns this region's manager.
Definition at line 701 of file gui_region.hpp.
const std::string & lxgui::gui::region::get_name | ( | ) | const |
Returns this region's name.
Definition at line 140 of file gui_region.cpp.
|
inline |
Returns this region's parent.
Definition at line 237 of file gui_region.hpp.
|
inline |
Returns this region's parent.
Definition at line 229 of file gui_region.hpp.
const std::string & lxgui::gui::region::get_raw_name | ( | ) | const |
Returns this region's raw name.
Definition at line 144 of file gui_region.cpp.
const std::string & lxgui::gui::region::get_region_type | ( | ) | const |
Returns the type of this region.
Definition at line 148 of file gui_region.cpp.
registry & lxgui::gui::region::get_registry | ( | ) |
Returns the UI object registry, which keeps track of all objects in the UI.
Definition at line 850 of file gui_region.cpp.
const registry & lxgui::gui::region::get_registry | ( | ) | const |
Returns the UI object registry, which keeps track of all objects in the UI.
Definition at line 855 of file gui_region.cpp.
float lxgui::gui::region::get_right | ( | ) | const |
Returns the horizontal position of this region's right border.
Definition at line 349 of file gui_region.cpp.
float lxgui::gui::region::get_top | ( | ) | const |
Returns the vertical position of this region's top border.
Definition at line 353 of file gui_region.cpp.
|
protectedvirtual |
Reimplemented in lxgui::gui::button, lxgui::gui::check_button, lxgui::gui::edit_box, lxgui::gui::frame, lxgui::gui::layered_region, lxgui::gui::scroll_frame, lxgui::gui::slider, and lxgui::gui::status_bar.
Definition at line 860 of file gui_region.cpp.
|
staticprotected |
Definition at line 147 of file gui_region_tpl.hpp.
void lxgui::gui::region::hide | ( | ) |
hides this region.
Definition at line 186 of file gui_region.cpp.
|
protected |
Set up function to call in all derived class constructors.
self | A pointer to the derived this |
attr | The region attributes provided to the constructor |
Definition at line 141 of file gui_region_tpl.hpp.
bool lxgui::gui::region::is_apparent_height_defined | ( | ) | const |
Checks if this region's apparent height is defined.
Definition at line 284 of file gui_region.cpp.
bool lxgui::gui::region::is_apparent_width_defined | ( | ) | const |
Checks if this region's apparent width is defined.
Definition at line 280 of file gui_region.cpp.
|
virtual |
Checks if the provided coordinates are inside this region.
position | The coordinates to test |
Reimplemented in lxgui::gui::frame, and lxgui::gui::slider.
Definition at line 288 of file gui_region.cpp.
bool lxgui::gui::region::is_loaded | ( | ) | const |
Checks if this region has been fully loaded.
Definition at line 798 of file gui_region.cpp.
bool lxgui::gui::region::is_manually_inherited | ( | ) | const |
Checks if this object is manually inherited.
Definition at line 784 of file gui_region.cpp.
|
inline |
Checks if this region is of the provided type.
Definition at line 423 of file gui_region.hpp.
|
inline |
Checks if this region is of a type equal or derived from the supplied region.
Definition at line 431 of file gui_region.hpp.
bool lxgui::gui::region::is_region_type | ( | const std::string & | type_name | ) | const |
Checks if this region is of the provided type.
type_name | The type to test |
Definition at line 152 of file gui_region.cpp.
bool lxgui::gui::region::is_shown | ( | ) | const |
Checks if this region is shown.
Definition at line 203 of file gui_region.cpp.
bool lxgui::gui::region::is_valid | ( | ) | const |
Checks if this region has all its borders correctly defined.
Definition at line 211 of file gui_region.cpp.
bool lxgui::gui::region::is_virtual | ( | ) | const |
Checks if this region is virtual.
Definition at line 553 of file gui_region.cpp.
bool lxgui::gui::region::is_visible | ( | ) | const |
Checks if this region can be seen on the screen.
Definition at line 207 of file gui_region.cpp.
|
protected |
Definition at line 585 of file gui_region.cpp.
Returns one of this region's anchor to modify it.
p | The anchor point |
Definition at line 529 of file gui_region.cpp.
|
virtual |
Tells this region that its borders need updating.
Reimplemented in lxgui::gui::slider.
Definition at line 744 of file gui_region.cpp.
|
virtual |
Notifies this region that it is no longer visible on screen.
Reimplemented in lxgui::gui::frame.
Definition at line 813 of file gui_region.cpp.
|
virtual |
Notifies this region that it has been fully loaded.
Reimplemented in lxgui::gui::frame.
Definition at line 794 of file gui_region.cpp.
|
virtual |
Notifies the renderer of this region that it needs to be redrawn.
Reimplemented in lxgui::gui::frame, and lxgui::gui::layered_region.
Definition at line 788 of file gui_region.cpp.
|
virtual |
Tells this region that the global interface scaling factor has changed.
Reimplemented in lxgui::gui::edit_box, lxgui::gui::font_string, lxgui::gui::frame, and lxgui::gui::scroll_frame.
Definition at line 759 of file gui_region.cpp.
|
virtual |
Notifies this region that it is now visible on screen.
Reimplemented in lxgui::gui::frame.
Definition at line 808 of file gui_region.cpp.
|
protectedvirtual |
Definition at line 89 of file gui_region_parser.cpp.
|
protectedvirtual |
Reimplemented in lxgui::gui::button, lxgui::gui::edit_box, lxgui::gui::frame, lxgui::gui::layered_region, lxgui::gui::slider, and lxgui::gui::status_bar.
Definition at line 133 of file gui_region_parser.cpp.
|
protected |
Definition at line 10 of file gui_region_parser.cpp.
|
protected |
Definition at line 35 of file gui_region_parser.cpp.
std::string lxgui::gui::region::parse_file_name | ( | const std::string & | file_name | ) | const |
Convert an addon-relative file path to a application-relative path.
file_name | The raw file name |
Definition at line 818 of file gui_region.cpp.
|
virtual |
Parses data from a layout_node.
node | The layout node |
Reimplemented in lxgui::gui::frame, lxgui::gui::animated_texture, lxgui::gui::font_string, lxgui::gui::layered_region, and lxgui::gui::texture.
Definition at line 127 of file gui_region_parser.cpp.
|
protected |
Definition at line 24 of file gui_region_parser.cpp.
|
protected |
Definition at line 28 of file gui_region_parser.cpp.
|
protectedvirtual |
Definition at line 65 of file gui_region_parser.cpp.
|
protected |
Definition at line 614 of file gui_region.cpp.
|
static |
Registers this region class to the provided Lua state.
|
virtual |
Removes this region from its parent and return an owning pointer.
Reimplemented in lxgui::gui::frame, and lxgui::gui::layered_region.
Definition at line 329 of file gui_region.cpp.
void lxgui::gui::region::remove_anchored_object | ( | region & | obj | ) |
Notifies this region that another one is no longer anchored to it.
obj | The region no longer anchored |
Definition at line 565 of file gui_region.cpp.
void lxgui::gui::region::remove_glue | ( | ) |
Removes the Lua glue.
Definition at line 775 of file gui_region.cpp.
|
virtual |
Renders this region on the current render target.
Reimplemented in lxgui::gui::animated_texture, lxgui::gui::font_string, lxgui::gui::frame, and lxgui::gui::texture.
Definition at line 765 of file gui_region.cpp.
vector2f lxgui::gui::region::round_to_pixel | ( | const vector2f & | position, |
utils::rounding_method | method = utils::rounding_method::nearest |
||
) | const |
Round an absolute position on screen to the nearest physical pixel.
position | The input absolute position (can be fractional) |
method | The rounding method |
Definition at line 578 of file gui_region.cpp.
float lxgui::gui::region::round_to_pixel | ( | float | value, |
utils::rounding_method | method = utils::rounding_method::nearest |
||
) | const |
Round an absolute position on screen to the nearest physical pixel.
value | The input absolute position (can be fractional) |
method | The rounding method |
Definition at line 573 of file gui_region.cpp.
|
virtual |
Prints all relevant information about this region in a string.
tab | The offset to give to all lines |
Reimplemented in lxgui::gui::animated_texture, lxgui::gui::button, lxgui::gui::check_button, lxgui::gui::font_string, lxgui::gui::frame, lxgui::gui::layered_region, lxgui::gui::slider, lxgui::gui::status_bar, and lxgui::gui::texture.
Definition at line 91 of file gui_region.cpp.
void lxgui::gui::region::set_addon | ( | const addon * | a | ) |
Sets the addon this frame belongs to.
a | The addon this frame belongs to |
Definition at line 833 of file gui_region.cpp.
void lxgui::gui::region::set_all_anchors | ( | const std::string & | obj_name | ) |
Adjusts this regions anchors to fit the provided region.
obj_name | The name of the object to fit to |
Definition at line 404 of file gui_region.cpp.
void lxgui::gui::region::set_all_anchors | ( | const utils::observer_ptr< region > & | obj | ) |
Adjusts this regions anchors to fit the provided region.
obj | A pointer to the object you want to wrap |
Definition at line 437 of file gui_region.cpp.
void lxgui::gui::region::set_alpha | ( | float | alpha | ) |
Changes this region's alpha (opacity).
alpha | The new alpha value |
Definition at line 169 of file gui_region.cpp.
|
inline |
Adds/replaces an anchor.
args | Argument to construct a new anchor_data |
Definition at line 503 of file gui_region.hpp.
void lxgui::gui::region::set_anchor | ( | const anchor_data & | a | ) |
Adds/replaces an anchor.
a | The anchor to add |
Definition at line 473 of file gui_region.cpp.
|
virtual |
Changes this region's absolute dimensions (in pixels).
dimensions | The new dimensions |
Reimplemented in lxgui::gui::frame.
Definition at line 215 of file gui_region.cpp.
|
virtual |
Changes this region's absolute height (in pixels).
abs_height | The new height |
Reimplemented in lxgui::gui::frame.
Definition at line 239 of file gui_region.cpp.
|
protected |
void lxgui::gui::region::set_manually_inherited | ( | bool | manually_inherited | ) |
Flags this region as manually inherited or not.
Definition at line 780 of file gui_region.cpp.
|
protected |
Sets this region's name.
name | This region's name |
Definition at line 294 of file gui_region.cpp.
|
protectedvirtual |
Changes this region's parent.
parent | The new parent |
Reimplemented in lxgui::gui::frame.
Definition at line 312 of file gui_region.cpp.
void lxgui::gui::region::set_relative_dimensions | ( | const vector2f & | dimensions | ) |
Changes this region's dimensions (relative to its parent).
dimensions | The new dimensions (relative) |
Definition at line 251 of file gui_region.cpp.
void lxgui::gui::region::set_relative_height | ( | float | rel_height | ) |
Changes this region's height (relative to its parent).
rel_height | The new height |
Definition at line 265 of file gui_region.cpp.
void lxgui::gui::region::set_relative_width | ( | float | rel_width | ) |
Changes this region's width (relative to its parent).
rel_width | The new width |
Definition at line 258 of file gui_region.cpp.
void lxgui::gui::region::set_shown | ( | bool | is_shown | ) |
shows/hides this region.
is_shown | 'true' if you want to show this region |
Definition at line 196 of file gui_region.cpp.
|
protected |
|
virtual |
Changes this region's absolute width (in pixels).
abs_width | The new width |
Reimplemented in lxgui::gui::frame.
Definition at line 227 of file gui_region.cpp.
void lxgui::gui::region::show | ( | ) |
shows this region.
Definition at line 176 of file gui_region.cpp.
|
virtual |
Updates this region's logic.
delta | Time spent since last update |
Reimplemented in lxgui::gui::frame, and lxgui::gui::animated_texture.
Definition at line 763 of file gui_region.cpp.
|
protectedvirtual |
Reimplemented in lxgui::gui::frame.
Definition at line 669 of file gui_region.cpp.
|
friend |
Obtain a pointer to a derived class.
self | The pointer to down cast |
Definition at line 837 of file gui_region.hpp.
|
friend |
Obtain a pointer to a derived class.
self | The pointer to down cast |
Definition at line 886 of file gui_region.hpp.
|
protected |
Definition at line 802 of file gui_region.hpp.
|
protected |
Definition at line 818 of file gui_region.hpp.
|
protected |
Definition at line 814 of file gui_region.hpp.
|
protected |
Definition at line 824 of file gui_region.hpp.
|
protected |
Definition at line 816 of file gui_region.hpp.
|
staticconstexpr |
Definition at line 735 of file gui_region.hpp.
|
protected |
Definition at line 815 of file gui_region.hpp.
|
protected |
Definition at line 822 of file gui_region.hpp.
|
protected |
Definition at line 811 of file gui_region.hpp.
|
protected |
Definition at line 809 of file gui_region.hpp.
|
protected |
Definition at line 819 of file gui_region.hpp.
|
protected |
Definition at line 812 of file gui_region.hpp.
|
protected |
Definition at line 810 of file gui_region.hpp.
|
protected |
Definition at line 820 of file gui_region.hpp.
|
protected |
Definition at line 800 of file gui_region.hpp.
|
protected |
Definition at line 804 of file gui_region.hpp.
|
protected |
Definition at line 807 of file gui_region.hpp.
|
protected |
Definition at line 805 of file gui_region.hpp.