lxgui
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
lxgui::gui::button Class Reference

A frame with a button that can be clicked. More...

#include <gui_button.hpp>

Inheritance diagram for lxgui::gui::button:
lxgui::gui::frame lxgui::gui::region lxgui::gui::check_button

Public Types

enum class  state { up , down , disabled }
 
using base = frame
 
using child_list = std::list< utils::owner_ptr< frame > >
 Type of the frame child list (internal). More...
 
using child_list_view = utils::view::adaptor< child_list, utils::view::smart_ptr_dereferencer, utils::view::non_null_filter >
 
using const_child_list_view = utils::view::adaptor< const child_list, utils::view::smart_ptr_dereferencer, utils::view::non_null_filter >
 
using region_list = std::list< utils::owner_ptr< layered_region > >
 Type of the region list (internal). More...
 
using region_list_view = utils::view::adaptor< region_list, utils::view::smart_ptr_dereferencer, utils::view::non_null_filter >
 
using const_region_list_view = utils::view::adaptor< const region_list, utils::view::smart_ptr_dereferencer, utils::view::non_null_filter >
 

Public Member Functions

 button (utils::control_block &block, manager &mgr, const frame_core_attributes &attr)
 Constructor. More...
 
std::string serialize (const std::string &tab) const override
 Prints all relevant information about this region in a string. More...
 
bool can_use_script (const std::string &script_name) const override
 Returns 'true' if this button can use a script. More...
 
void fire_script (const std::string &script_name, const event_data &data=event_data{}) override
 Calls a script. More...
 
void copy_from (const region &obj) override
 Copies a region's parameters into this button (inheritance). More...
 
void set_text (const utils::ustring &content)
 Sets this button's text. More...
 
const utils::ustring & get_text () const
 Returns this button's text. More...
 
const utils::observer_ptr< texture > & get_normal_texture ()
 Returns this button's normal texture. More...
 
utils::observer_ptr< const textureget_normal_texture () const
 Returns this button's normal texture. More...
 
const utils::observer_ptr< texture > & get_pushed_texture ()
 Returns this button's pushed texture. More...
 
utils::observer_ptr< const textureget_pushed_texture () const
 Returns this button's pushed texture. More...
 
const utils::observer_ptr< texture > & get_disabled_texture ()
 Returns this button's disabled texture. More...
 
utils::observer_ptr< const textureget_disabled_texture () const
 Returns this button's disabled texture. More...
 
const utils::observer_ptr< texture > & get_highlight_texture ()
 Returns this button's highlight texture. More...
 
utils::observer_ptr< const textureget_highlight_texture () const
 Returns this button's highlight texture. More...
 
const utils::observer_ptr< font_string > & get_normal_text ()
 Returns this button's normal text. More...
 
utils::observer_ptr< const font_stringget_normal_text () const
 Returns this button's normal text. More...
 
const utils::observer_ptr< font_string > & get_highlight_text ()
 Returns this button's highlight text. More...
 
utils::observer_ptr< const font_stringget_highlight_text () const
 Returns this button's highlight text. More...
 
const utils::observer_ptr< font_string > & get_disabled_text ()
 Returns this button's disabled text. More...
 
utils::observer_ptr< const font_stringget_disabled_text () const
 Returns this button's disabled text. More...
 
const utils::observer_ptr< font_string > & get_current_font_string ()
 Returns the currently displayed text object. More...
 
utils::observer_ptr< const font_stringget_current_font_string () const
 Returns the currently displayed text object. More...
 
void set_normal_texture (utils::observer_ptr< texture > tex)
 Sets this button's normal texture. More...
 
void set_pushed_texture (utils::observer_ptr< texture > tex)
 Sets this button's pushed texture. More...
 
void set_disabled_texture (utils::observer_ptr< texture > tex)
 Sets this button's disabled texture. More...
 
void set_highlight_texture (utils::observer_ptr< texture > tex)
 Sets this button's highlight texture. More...
 
void set_normal_text (utils::observer_ptr< font_string > fstr)
 Sets this button's normal text. More...
 
void set_highlight_text (utils::observer_ptr< font_string > fstr)
 Sets this button's highlight text. More...
 
void set_disabled_text (utils::observer_ptr< font_string > fstr)
 Sets this button's disabled text. More...
 
void set_enabled (bool enabled)
 Enables or disables this button. More...
 
virtual void disable ()
 Disables this button. More...
 
virtual void enable ()
 Enables this button. More...
 
bool is_enabled () const
 Checks if this button is enabled. More...
 
virtual void push ()
 Pushed this button. More...
 
virtual void release ()
 Releases this button. More...
 
void click (const std::string &mouse_event)
 Handle a mouse click over this button. More...
 
void click (input::mouse_button button_id, input::mouse_button_event button_event)
 Handle a mouse click over this button. More...
 
virtual void highlight ()
 Highlights this button. More...
 
virtual void unlight ()
 Unlights this button. More...
 
state get_button_state () const
 Returns this button's state. More...
 
void lock_highlight ()
 Locks this button's highlighting. More...
 
void unlock_highlight ()
 Unlocks this button's highlighting. More...
 
void set_pushed_text_offset (const vector2f &offset)
 Sets this button's pushed text offset. More...
 
const vector2fget_pushed_text_offset () const
 Returns this button's pushed text offset. More...
 
void set_button_clicks_enabled (const std::string &mouse_event, bool enable)
 Make this button generate OnClick events when a specific mouse event occurs over the button. More...
 
void set_button_clicks_enabled (input::mouse_button button_id, input::mouse_button_event button_event, bool enable)
 Make this button generate OnClick events when a specific mouse event occurs over the button. More...
 
void enable_button_clicks (const std::string &mouse_event)
 Make this button generate OnClick events when a specific mouse event occurs over the button. More...
 
void enable_button_clicks (input::mouse_button button_id, input::mouse_button_event button_event)
 Make this button generate OnClick events when a specific mouse event occurs over the button. More...
 
void disable_button_clicks (const std::string &mouse_event)
 Stop this button from generating OnClick events when a specific mouse event occurs over the button. More...
 
void disable_button_clicks (input::mouse_button button_id, input::mouse_button_event button_event)
 Stop this button from generating OnClick events when a specific mouse event occurs over the button. More...
 
void disable_button_clicks ()
 Stop this button from generating OnClick events. More...
 
bool is_button_clicks_enabled (const std::string &mouse_event) const
 Checks if this button can generate OnClick events when a specific mouse event occurs over the button. More...
 
bool is_button_clicks_enabled (input::mouse_button button_id, input::mouse_button_event button_event) const
 Checks if this button can generate OnClick events when a specific mouse event occurs over the button. More...
 
void render () const override
 Renders this region on the current render target. More...
 
void update (float delta) final
 Updates this region's logic. More...
 
void create_title_region ()
 Creates a new title region for this frame. More...
 
void set_draw_layer_enabled (layer layer_id, bool enable)
 Enables or disables a layer. More...
 
void disable_draw_layer (layer layer_id)
 Disables a layer. More...
 
void enable_draw_layer (layer layer_id)
 Enables a layer. More...
 
void set_mouse_enabled (bool is_mouse_enabled)
 Sets if this frame can receive mouse input (click & move). More...
 
void enable_mouse ()
 Marks this frame as able to receive mouse input (click & move). More...
 
void disable_mouse ()
 Marks this frame as unable to receive mouse input (click & move). More...
 
void set_mouse_click_enabled (bool is_mouse_enabled)
 Sets if this frame can receive mouse click input. More...
 
void enable_mouse_click ()
 Marks this frame as able to receive mouse click input. More...
 
void disable_mouse_click ()
 Marks this frame as unable to receive mouse click input. More...
 
void set_mouse_move_enabled (bool is_mouse_enabled)
 Sets if this frame can receive mouse move input. More...
 
void enable_mouse_move ()
 Marks this frame as able to receive mouse move input. More...
 
void disable_mouse_move ()
 Marks this frame as unable to receive mouse move input. More...
 
void set_mouse_wheel_enabled (bool is_mouse_wheel_enabled)
 Sets if this frame can receive mouse wheel input. More...
 
void enable_mouse_wheel ()
 Marks this frame as able to receive mouse wheel input. More...
 
void disable_mouse_wheel ()
 Marks this frame as unable to receive mouse wheel input. More...
 
void set_keyboard_enabled (bool is_keyboard_enabled)
 Sets if this frame can receive any keyboard input. More...
 
void enable_keyboard ()
 Marks this frame as able to receive any keyboard input. More...
 
void disable_keyboard ()
 Marks this frame as unable to receive any keyboard input. More...
 
void set_key_capture_enabled (const std::string &key_name, bool enable)
 Marks this frame as able to receive keyboard input from a specific key. More...
 
void set_key_capture_enabled (input::key key_id, bool enable)
 Marks this frame as able to receive keyboard input from a specific key. More...
 
void enable_key_capture (const std::string &key_name)
 Marks this frame as able to receive keyboard input from a specific key. More...
 
void enable_key_capture (input::key key_id)
 Marks this frame as able to receive keyboard input from a specific key. More...
 
void disable_key_capture (const std::string &key_name)
 Marks this frame as unable to receive keyboard input from a specific key. More...
 
void disable_key_capture (input::key key_id)
 Marks this frame as unable to receive keyboard input from a specific key. More...
 
void disable_key_capture ()
 Marks this frame as unable to receive keyboard input from any key. More...
 
bool has_script (const std::string &script_name) const
 Checks if this frame has a script defined. More...
 
utils::observer_ptr< layered_regionadd_region (utils::owner_ptr< layered_region > reg)
 Adds a layered_region to this frame's children. More...
 
template<typename RegionType , typename Enable = typename std::enable_if<std::is_base_of<gui::layered_region, RegionType>::value>::type>
utils::observer_ptr< RegionType > add_region (utils::owner_ptr< RegionType > reg)
 Adds a layered_region to this frame's children. More...
 
utils::owner_ptr< layered_regionremove_region (const utils::observer_ptr< layered_region > &reg)
 Removes a layered_region from this frame's children. More...
 
utils::observer_ptr< layered_regioncreate_layered_region (layer layer_id, region_core_attributes attr)
 Creates a new region as child of this frame. More...
 
template<typename RegionType , typename Enable = typename std::enable_if<std::is_base_of<gui::layered_region, RegionType>::value>::type>
utils::observer_ptr< RegionType > create_layered_region (layer layer_id, region_core_attributes attr)
 Creates a new region as child of this frame. More...
 
template<typename RegionType , typename Enable = typename std::enable_if<std::is_base_of<gui::layered_region, RegionType>::value>::type>
utils::observer_ptr< RegionType > create_layered_region (layer layer_id, const std::string &name)
 Creates a new region as child of this frame. More...
 
utils::observer_ptr< framecreate_child (frame_core_attributes attr)
 Creates a new frame as child of this frame. More...
 
template<typename FrameType , typename Enable = typename std::enable_if<std::is_base_of<gui::frame, FrameType>::value>::type>
utils::observer_ptr< FrameType > create_child (frame_core_attributes attr)
 Creates a new frame as child of this frame. More...
 
template<typename FrameType , typename Enable = typename std::enable_if<std::is_base_of<gui::frame, FrameType>::value>::type>
utils::observer_ptr< FrameType > create_child (const std::string &name)
 Creates a new frame as child of this frame. More...
 
utils::observer_ptr< frameadd_child (utils::owner_ptr< frame > child)
 Adds a frame to this frame's children. More...
 
template<typename FrameType , typename Enable = typename std::enable_if<std::is_base_of<gui::frame, FrameType>::value>::type>
utils::observer_ptr< FrameType > add_child (utils::owner_ptr< FrameType > child)
 Adds a frame to this frame's children. More...
 
utils::owner_ptr< frameremove_child (const utils::observer_ptr< frame > &child)
 Removes a frame from this frame's children. More...
 
child_list_view get_children ()
 Returns the child list. More...
 
const_child_list_view get_children () const
 Returns the child list. More...
 
utils::observer_ptr< const frameget_child (const std::string &name) const
 Returns one of this frame's children. More...
 
utils::observer_ptr< frameget_child (const std::string &name)
 Returns one of this frame's children. More...
 
template<typename FrameType , typename Enable = typename std::enable_if<std::is_base_of<gui::frame, FrameType>::value>::type>
utils::observer_ptr< const FrameType > get_child (const std::string &name) const
 Returns one of this frame's children. More...
 
template<typename FrameType , typename Enable = typename std::enable_if<std::is_base_of<gui::frame, FrameType>::value>::type>
utils::observer_ptr< FrameType > get_child (const std::string &name)
 Returns one of this frame's children. More...
 
region_list_view get_regions ()
 Returns the region list. More...
 
const_region_list_view get_regions () const
 Returns the region list. More...
 
utils::observer_ptr< const layered_regionget_region (const std::string &name) const
 Returns one of this frame's region. More...
 
utils::observer_ptr< layered_regionget_region (const std::string &name)
 Returns one of this frame's region. More...
 
template<typename RegionType , typename Enable = typename std::enable_if<std::is_base_of<gui::layered_region, RegionType>::value>::type>
utils::observer_ptr< RegionType > get_region (const std::string &name)
 Returns one of this frame's region. More...
 
float get_effective_scale () const
 Calculates effective scale. More...
 
int get_level () const
 Returns this frame's level. More...
 
std::optional< strataget_strata () const
 Returns this frame's strata. More...
 
strata get_effective_strata () const
 Returns this frame's effective strata. More...
 
utils::observer_ptr< const frameget_top_level_parent () const
 Returns this frame's top-level parent. More...
 
utils::observer_ptr< frameget_top_level_parent ()
 Returns this frame's top-level parent. More...
 
const backdropget_backdrop () const
 Returns this frame's backdrop. More...
 
backdropget_backdrop ()
 Returns this frame's backdrop. More...
 
backdropget_or_create_backdrop ()
 Returns this frame's backdrop, creating it if needed. More...
 
const bounds2fget_abs_hit_rect_insets () const
 Returns this frame's absolute hit rect insets. More...
 
const bounds2fget_rel_hit_rect_insets () const
 Returns this frame's relative hit rect insets. More...
 
vector2f get_max_dimensions () const
 Returns this frame's max dimensions. More...
 
vector2f get_min_dimensions () const
 Returns this frame's min dimensions. More...
 
std::size_t get_child_count () const
 Returns the number of children of this frame. More...
 
std::size_t get_child_count_upper_bound () const
 Returns the approximate number of children of this frame. More...
 
std::size_t get_layered_region_count () const
 Returns the number of layered regions of this frame. More...
 
std::size_t get_layered_region_count_upper_bound () const
 Returns the approximate number of regions of this frame. More...
 
float get_scale () const
 Returns this frame's scale. More...
 
utils::observer_ptr< const regionget_title_region () const
 Returns this frame's title region. More...
 
utils::observer_ptr< regionget_title_region ()
 Returns this frame's title region. More...
 
bool is_clamped_to_screen () const
 Checks if this frame is clamped to screen. More...
 
bool is_in_region (const vector2f &position) const override
 Checks if the provided coordinates are inside this frame. More...
 
virtual utils::observer_ptr< const framefind_topmost_frame (const std::function< bool(const frame &)> &predicate) const
 Find the topmost frame matching the provided predicate. More...
 
utils::observer_ptr< framefind_topmost_frame (const std::function< bool(const frame &)> &predicate)
 Find the topmost frame matching the provided predicate. More...
 
bool is_mouse_move_enabled () const
 Checks if this frame can receive mouse movement input. More...
 
bool is_mouse_click_enabled () const
 Checks if this frame can receive mouse click input. More...
 
bool is_mouse_wheel_enabled () const
 Checks if this frame can receive mouse wheel input. More...
 
bool is_drag_enabled (const std::string &button_name) const
 Checks if this frame is registered for drag events with the provided mouse button. More...
 
bool is_key_capture_enabled (const std::string &key_name) const
 Checks if this frame can receive keyboard input from a specific key. More...
 
bool is_keyboard_enabled () const
 Checks if this frame can receive any keyboard input. More...
 
bool is_movable () const
 Checks if this frame can be moved. More...
 
bool is_resizable () const
 Checks if this frame can be resized. More...
 
bool is_top_level () const
 Checks if this frame is at top level. More...
 
bool is_user_placed () const
 Checks if this frame has been moved by the user. More...
 
utils::connection add_script (const std::string &script_name, std::string content, script_info info=script_info{})
 Adds an additional handler script to this frame (executed after existing scripts). More...
 
utils::connection add_script (const std::string &script_name, sol::protected_function handler, script_info info=script_info{})
 Adds an additional handler script to this frame (executed after existing scripts). More...
 
utils::connection add_script (const std::string &script_name, script_function handler, script_info info=script_info{})
 Adds an additional handler script to this frame (executed after existing scripts). More...
 
template<typename DerivedType = void, typename Function >
utils::connection add_script (const std::string &script_name, Function &&handler, script_info info=script_info{})
 Adds an additional handler script to this frame (executed after existing scripts). More...
 
utils::connection set_script (const std::string &script_name, std::string content, script_info info=script_info{})
 Sets a new handler script for this frame (replacing existing scripts). More...
 
utils::connection set_script (const std::string &script_name, sol::protected_function handler, script_info info=script_info{})
 Sets a new handler script for this frame (replacing existing scripts). More...
 
utils::connection set_script (const std::string &script_name, script_function handler, script_info info=script_info{})
 Sets a new handler script for this frame (replacing existing scripts). More...
 
template<typename DerivedType = void, typename Function >
utils::connection set_script (const std::string &script_name, Function &&handler, script_info info=script_info{})
 Sets a new handler script for this frame (replacing existing scripts). More...
 
script_list_view get_script (const std::string &script_name) const
 Return a view into this frame's handler scripts, registered for the given event. More...
 
void remove_script (const std::string &script_name)
 Removes a script from this frame. More...
 
void set_update_rate (float rate)
 Sets a maximum update rate (in updates per seconds). More...
 
float get_update_rate () const
 Gets the maximum update rate (in upates per seconds). More...
 
void register_event (const std::string &event_name)
 Tells this frame to react to a certain event. More...
 
void unregister_event (const std::string &event_name)
 Tells the frame not to react to a certain event. More...
 
void set_drag_enabled (const std::string &button_name, bool enable)
 Tells this frame whether to react to mouse drag or not. More...
 
void set_drag_enabled (input::mouse_button button_id, bool enable)
 Tells this frame whether to react to mouse drag or not. More...
 
void enable_drag (const std::string &button_name)
 Tells this frame to react to mouse drag. More...
 
void enable_drag (input::mouse_button button_id)
 Tells this frame to react to mouse drag. More...
 
void disable_drag (const std::string &button_name)
 Tells this frame to not react to mouse drag. More...
 
void disable_drag (input::mouse_button button_id)
 Tells this frame to not react to mouse drag. More...
 
void disable_drag ()
 Tells this frame to not react to mouse drag from any mouse button. More...
 
void set_clamped_to_screen (bool is_clamped_to_screen)
 Sets if this frame is clamped to screen. More...
 
void set_strata (std::optional< strata > strata_id)
 Sets this frame's strata. More...
 
void set_backdrop (std::unique_ptr< backdrop > bdrop)
 Sets this frames' backdrop. More...
 
void set_abs_hit_rect_insets (const bounds2f &insets)
 Sets this frame's absolute hit rect insets. More...
 
void set_rel_hit_rect_insets (const bounds2f &insets)
 Sets this frame's relative hit rect insets. More...
 
void set_level (int level_id)
 Sets this frame's level. More...
 
void set_max_dimensions (const vector2f &max)
 Sets this frame's maximum size. More...
 
void set_min_dimensions (const vector2f &min)
 Sets this frame's minimum size. More...
 
void set_max_height (float max_height)
 Sets this frame's maximum height. More...
 
void set_max_width (float max_width)
 Sets this frame's maximum width. More...
 
void set_min_height (float min_height)
 Sets this frame's minimum height. More...
 
void set_min_width (float min_width)
 Sets this frame's minimum width. More...
 
void set_movable (bool is_movable)
 Sets if this frame can be moved by the user. More...
 
utils::owner_ptr< regionrelease_from_parent () override
 Removes this region from its parent and return an owning pointer. More...
 
void set_resizable (bool is_resizable)
 Sets if this frame can be resized by the user. More...
 
void set_scale (float scale)
 Sets this frame's scale. More...
 
void set_top_level (bool is_top_level)
 Sets if this frame is at top level. More...
 
void raise ()
 Increases this frame's level so it's the highest of the strata. More...
 
void set_user_placed (bool is_user_placed)
 Sets if this frame has been moved by the user. More...
 
void start_moving ()
 Starts moving this frame with the mouse. More...
 
void stop_moving ()
 ends moving this frame. More...
 
void start_sizing (const point &p)
 Starts resizing this frame with the mouse. More...
 
void stop_sizing ()
 ends resizing this frame. More...
 
void enable_auto_focus (bool enable)
 Enables automatic focus when this frame is shown or raised. More...
 
bool is_auto_focus_enabled () const
 Checks if automatic focus is enabled. More...
 
void set_focus (bool focus)
 Asks for focus for this frame. More...
 
bool has_focus () const
 Check if this frame currently has focus. More...
 
void set_frame_renderer (utils::observer_ptr< frame_renderer > rdr)
 Flags this object as rendered by another object. More...
 
utils::observer_ptr< const frame_rendererget_frame_renderer () const
 Returns the renderer of this object, nullptr if none. More...
 
const utils::observer_ptr< frame_renderer > & get_frame_renderer ()
 Returns the renderer of this object, nullptr if none. More...
 
utils::observer_ptr< const frame_rendererget_effective_frame_renderer () const final
 Returns the renderer of this object or its parents, nullptr if none. More...
 
utils::observer_ptr< frame_rendererget_effective_frame_renderer ()
 Returns the renderer of this object or its parents, nullptr if none. More...
 
void notify_renderer_need_redraw () override
 Notifies the renderer of this region that it needs to be redrawn. More...
 
void set_dimensions (const vector2f &dimensions) override
 Changes this region's absolute dimensions (in pixels). More...
 
void set_width (float abs_width) override
 Changes this region's absolute width (in pixels). More...
 
void set_height (float abs_height) override
 Changes this region's absolute height (in pixels). More...
 
virtual void notify_mouse_in_frame (bool mouse_in_frame, const vector2f &mouse_pos)
 Tells this frame it is being hovered by the mouse. More...
 
void notify_visible () override
 Notifies this region that it is now visible on screen. More...
 
void notify_invisible () override
 Notifies this region that it is no longer visible on screen. More...
 
virtual void notify_focus (bool focus)
 Notifies this frame that it has received or lost focus. More...
 
void notify_loaded () override
 Notifies this region that it has been fully loaded. More...
 
void notify_layers_need_update ()
 Tells this frame to rebuild its layer list. More...
 
void notify_scaling_factor_updated () override
 Tells this region that the global interface scaling factor has changed. More...
 
void parse_layout (const layout_node &node) final
 Parses data from a layout_node. More...
 
virtual void notify_borders_need_update ()
 Tells this region that its borders need updating. More...
 
const std::string & get_name () const
 Returns this region's name. More...
 
const std::string & get_raw_name () const
 Returns this region's raw name. More...
 
utils::observer_ptr< const frameget_parent () const
 Returns this region's parent. More...
 
const utils::observer_ptr< frame > & get_parent ()
 Returns this region's parent. More...
 
void destroy ()
 Forcefully removes this region from the GUI. More...
 
void set_alpha (float alpha)
 Changes this region's alpha (opacity). More...
 
float get_alpha () const
 Returns this region's alpha (opacity). More...
 
float get_effective_alpha () const
 Returns this region's effective alpha (opacity). More...
 
void show ()
 shows this region. More...
 
void hide ()
 hides this region. More...
 
void set_shown (bool is_shown)
 shows/hides this region. More...
 
bool is_shown () const
 Checks if this region is shown. More...
 
bool is_visible () const
 Checks if this region can be seen on the screen. More...
 
bool is_valid () const
 Checks if this region has all its borders correctly defined. More...
 
void set_relative_dimensions (const vector2f &dimensions)
 Changes this region's dimensions (relative to its parent). More...
 
void set_relative_width (float rel_width)
 Changes this region's width (relative to its parent). More...
 
void set_relative_height (float rel_height)
 Changes this region's height (relative to its parent). More...
 
const vector2fget_dimensions () const
 Returns this region's explicitly-defined width and height (in pixels). More...
 
vector2f get_apparent_dimensions () const
 Returns this region's apparent width and height (in pixels). More...
 
bool is_apparent_width_defined () const
 Checks if this region's apparent width is defined. More...
 
bool is_apparent_height_defined () const
 Checks if this region's apparent height is defined. More...
 
const std::string & get_region_type () const
 Returns the type of this region. More...
 
bool is_region_type (const std::string &type_name) const
 Checks if this region is of the provided type. More...
 
template<typename ObjectType >
bool is_region_type () const
 Checks if this region is of the provided type. More...
 
bool is_region_type (const region &obj) const
 Checks if this region is of a type equal or derived from the supplied region. More...
 
float get_bottom () const
 Returns the vertical position of this region's bottom border. More...
 
vector2f get_center () const
 Returns the position of this region's center. More...
 
float get_left () const
 Returns the horizontal position of this region's left border. More...
 
float get_right () const
 Returns the horizontal position of this region's right border. More...
 
float get_top () const
 Returns the vertical position of this region's top border. More...
 
const bounds2fget_borders () const
 Returns this region's borders. More...
 
void clear_all_anchors ()
 Removes all anchors. More...
 
void set_all_anchors (const utils::observer_ptr< region > &obj)
 Adjusts this regions anchors to fit the provided region. More...
 
void set_all_anchors (const std::string &obj_name)
 Adjusts this regions anchors to fit the provided region. More...
 
void set_anchor (const anchor_data &a)
 Adds/replaces an anchor. More...
 
template<typename... Args>
void set_anchor (Args &&... args)
 Adds/replaces an anchor. More...
 
bool depends_on (const region &obj) const
 Checks if this region depends on another. More...
 
std::size_t get_anchor_count () const
 Returns the number of defined anchors. More...
 
anchormodify_anchor (point p)
 Returns one of this region's anchor to modify it. More...
 
const anchorget_anchor (point p) const
 Returns one of this region's anchor. More...
 
const std::array< std::optional< anchor >, 9 > & get_anchors () const
 Returns all of this region's anchors. More...
 
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. More...
 
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. More...
 
void add_anchored_object (region &obj)
 Notifies this region that another one is anchored to it. More...
 
void remove_anchored_object (region &obj)
 Notifies this region that another one is no longer anchored to it. More...
 
bool is_virtual () const
 Checks if this region is virtual. More...
 
void set_manually_inherited (bool manually_inherited)
 Flags this region as manually inherited or not. More...
 
bool is_manually_inherited () const
 Checks if this object is manually inherited. More...
 
const std::vector< utils::observer_ptr< region > > & get_anchored_objects () const
 Returns the list of all objects that are anchored to this one. More...
 
bool is_loaded () const
 Checks if this region has been fully loaded. More...
 
void set_addon (const addon *a)
 Sets the addon this frame belongs to. More...
 
const addonget_addon () const
 Returns this frame's addon. More...
 
std::string parse_file_name (const std::string &file_name) const
 Convert an addon-relative file path to a application-relative path. More...
 
managerget_manager ()
 Returns this region's manager. More...
 
const managerget_manager () const
 Returns this region's manager. More...
 
registryget_registry ()
 Returns the UI object registry, which keeps track of all objects in the UI. More...
 
const registryget_registry () const
 Returns the UI object registry, which keeps track of all objects in the UI. More...
 
void remove_glue ()
 Removes the Lua glue. More...
 

Static Public Member Functions

static void register_on_lua (sol::state &lua)
 Registers this region class to the provided Lua state. More...
 
static std::string get_adjusted_script_name (const std::string &script_name)
 Returns the "adjusted" script name: "OnEvent" becomes "on_event". More...
 

Static Public Attributes

static constexpr const char * class_name = "Button"
 

Protected Member Functions

void parse_attributes_ (const layout_node &node) override
 
void parse_all_nodes_before_children_ (const layout_node &node) override
 
bool is_button_clicks_enabled_ (input::mouse_button button_id) const
 
virtual void click_ (input::mouse_button button_id, input::mouse_button_event button_event, float mx, float my)
 
const std::vector< std::string > & get_type_list_ () const override
 
virtual void parse_resize_bounds_node_ (const layout_node &node)
 
virtual void parse_title_region_node_ (const layout_node &node)
 
virtual void parse_backdrop_node_ (const layout_node &node)
 
virtual void parse_hit_rect_insets_node_ (const layout_node &node)
 
virtual void parse_layers_node_ (const layout_node &node)
 
virtual void parse_frames_node_ (const layout_node &node)
 
virtual void parse_scripts_node_ (const layout_node &node)
 
utils::observer_ptr< layered_regionparse_region_ (const layout_node &node, const std::string &layer_name, const std::string &type)
 
utils::observer_ptr< frameparse_child_ (const layout_node &node, const std::string &type)
 
virtual void update_ (float delta)
 
void check_position_ ()
 
void add_level_ (int amount)
 
utils::observer_ptr< const frame_renderercompute_top_level_frame_renderer_ () const
 
utils::observer_ptr< frame_renderercompute_top_level_frame_renderer_ ()
 
strata compute_effective_strata_ () const
 
void notify_strata_changed_ (strata new_strata_id)
 
void notify_frame_renderer_changed_ (const utils::observer_ptr< frame_renderer > &new_renderer)
 
void update_borders_ () override
 
void set_parent_ (utils::observer_ptr< frame > parent) override
 Changes this region's parent. More...
 
bool check_script_ (const std::string &script_name) const
 
utils::connection define_script_ (const std::string &script_name, const std::string &content, bool append, const script_info &info)
 
utils::connection define_script_ (const std::string &script_name, sol::protected_function handler, bool append, const script_info &info)
 
utils::connection define_script_ (const std::string &script_name, script_function handler, bool append, const script_info &info)
 
void on_event_ (std::string_view event_name, const event_data &event)
 
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
 
sol::state & get_lua_ ()
 
const sol::state & get_lua_ () const
 
template<typename T >
void create_glue_ (T &self)
 
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. More...
 
void set_name_ (const std::string &name)
 Sets this region's name. More...
 
template<typename T >
void initialize_ (T &self, const region_core_attributes &attr)
 Set up function to call in all derived class constructors. More...
 

Static Protected Member Functions

template<typename T >
static const std::vector< std::string > & get_type_list_impl_ ()
 

Protected Attributes

state state_ = state::up
 
bool is_highlighted_ = false
 
bool is_highlight_locked_ = false
 
utils::ustring content_
 
utils::observer_ptr< texturenormal_texture_ = nullptr
 
utils::observer_ptr< texturepushed_texture_ = nullptr
 
utils::observer_ptr< texturedisabled_texture_ = nullptr
 
utils::observer_ptr< texturehighlight_texture_ = nullptr
 
utils::observer_ptr< font_stringnormal_text_ = nullptr
 
utils::observer_ptr< font_stringhighlight_text_ = nullptr
 
utils::observer_ptr< font_stringdisabled_text_ = nullptr
 
utils::observer_ptr< font_stringcurrent_font_string_ = nullptr
 
vector2f pushed_text_offset_ = vector2f::zero
 
std::set< std::string > reg_click_list_
 
child_list child_list_
 
region_list region_list_
 
std::array< layer_container, num_layerslayer_list_
 
std::unordered_map< std::string, script_signalsignal_list_
 
event_receiver event_receiver_
 
std::set< std::string > reg_drag_list_
 
std::set< std::string > reg_key_list_
 
int level_ = 0
 
std::optional< stratastrata_
 
strata effective_strata_ = strata::medium
 
bool is_top_level_ = false
 
utils::observer_ptr< frame_rendererframe_renderer_ = nullptr
 
utils::observer_ptr< frame_renderereffective_frame_renderer_ = nullptr
 
std::unique_ptr< backdropbackdrop_
 
bool is_mouse_click_enabled_ = false
 
bool is_mouse_move_enabled_ = false
 
bool is_mouse_wheel_enabled_ = false
 
bool is_keyboard_enabled_ = false
 
bool is_movable_ = false
 
bool is_clamped_to_screen_ = false
 
bool is_resizable_ = false
 
bool is_user_placed_ = false
 
bounds2f abs_hit_rect_inset_list_ = bounds2f::zero
 
bounds2f rel_hit_rect_inset_list_ = bounds2f::zero
 
float min_width_ = 0.0f
 
float max_width_ = std::numeric_limits<float>::infinity()
 
float min_height_ = 0.0f
 
float max_height_ = std::numeric_limits<float>::infinity()
 
float scale_ = 1.0f
 
float update_rate_ = 0.0f
 
float time_since_last_update_ = std::numeric_limits<float>::infinity()
 
bool is_mouse_in_frame_ = false
 
utils::owner_ptr< regiontitle_region_ = nullptr
 
bool is_focused_ = false
 
bool is_auto_focus_ = false
 
managermanager_
 
const addonaddon_ = nullptr
 
std::string name_
 
std::string raw_name_
 
utils::observer_ptr< frameparent_ = 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_
 

Static Protected Attributes

static constexpr std::size_t num_layers = magic_enum::enum_count<layer>()
 

Detailed Description

A frame with a button that can be clicked.

This class can handle three different states: "normal", "pushed" and "disabled". You can provide a different texture for each of these states, and two different fontstrings for "normal" and "disabled".

In addition, you can provide another texture/fontstring for the "highlight" state (when the mouse is over the button region).

Note that there is no fontstring for the "pushed" state: in this case, the "normal" font is rendered with a slight offset that you are free to define.

The button "click" event will be triggered by all registered combinations of mouse events configured with button::enable_button_clicks.

Note that a button has frame::enable_mouse set to true and button::enable_button_clicks set to true for "LeftMouseUp" by default.

Events. Hard-coded events available to all buttons, in addition to those from frame:

Definition at line 52 of file gui_button.hpp.

Member Typedef Documentation

◆ base

Definition at line 54 of file gui_button.hpp.

◆ child_list

using lxgui::gui::frame::child_list = std::list<utils::owner_ptr<frame> >
inherited

Type of the frame child list (internal).

Note
Constraints on the choice container type:
  • must not invalidate iterators on back insertion
  • must allow forward iteration
  • iterators can be invalidated on removal
  • most common use is iteration, not addition or removal
  • ordering of elements is irrelevant

Definition at line 268 of file gui_frame.hpp.

◆ child_list_view

Definition at line 269 of file gui_frame.hpp.

◆ const_child_list_view

Definition at line 271 of file gui_frame.hpp.

◆ const_region_list_view

Definition at line 288 of file gui_frame.hpp.

◆ region_list

Type of the region list (internal).

Note
Constraints on the choice container type:
  • must not invalidate iterators on back insertion
  • must allow forward iteration
  • iterators can be invalidated on removal
  • most common use is iteration, not addition or removal
  • ordering of elements is irrelevant

Definition at line 285 of file gui_frame.hpp.

◆ region_list_view

Definition at line 286 of file gui_frame.hpp.

Member Enumeration Documentation

◆ state

Enumerator
up 
down 
disabled 

Definition at line 56 of file gui_button.hpp.

Constructor & Destructor Documentation

◆ button()

lxgui::gui::button::button ( utils::control_block &  block,
manager mgr,
const frame_core_attributes attr 
)
explicit

Constructor.

Definition at line 13 of file gui_button.cpp.

Member Function Documentation

◆ add_anchored_object()

void lxgui::gui::region::add_anchored_object ( region obj)
inherited

Notifies this region that another one is anchored to it.

Parameters
objThe anchored region
Note
Anchored objects get their borders automatically updated whenever this object's borders are updated.

Definition at line 561 of file gui_region.cpp.

◆ add_child() [1/2]

utils::observer_ptr< frame > lxgui::gui::frame::add_child ( utils::owner_ptr< frame child)
inherited

Adds a frame to this frame's children.

Parameters
childThe frame to add

Definition at line 678 of file gui_frame.cpp.

◆ add_child() [2/2]

template<typename FrameType , typename Enable = typename std::enable_if<std::is_base_of<gui::frame, FrameType>::value>::type>
utils::observer_ptr<FrameType> lxgui::gui::frame::add_child ( utils::owner_ptr< FrameType >  child)
inlineinherited

Adds a frame to this frame's children.

Parameters
childThe frame to add

Definition at line 731 of file gui_frame.hpp.

◆ add_level_()

void lxgui::gui::frame::add_level_ ( int  amount)
protectedinherited

Definition at line 1342 of file gui_frame.cpp.

◆ add_region() [1/2]

utils::observer_ptr< layered_region > lxgui::gui::frame::add_region ( utils::owner_ptr< layered_region reg)
inherited

Adds a layered_region to this frame's children.

Parameters
regThe layered_region to add

Definition at line 592 of file gui_frame.cpp.

◆ add_region() [2/2]

template<typename RegionType , typename Enable = typename std::enable_if<std::is_base_of<gui::layered_region, RegionType>::value>::type>
utils::observer_ptr<RegionType> lxgui::gui::frame::add_region ( utils::owner_ptr< RegionType >  reg)
inlineinherited

Adds a layered_region to this frame's children.

Parameters
regThe layered_region to add

Definition at line 590 of file gui_frame.hpp.

◆ add_script() [1/4]

template<typename DerivedType = void, typename Function >
utils::connection lxgui::gui::frame::add_script ( const std::string &  script_name,
Function &&  handler,
script_info  info = script_info{} 
)
inlineinherited

Adds an additional handler script to this frame (executed after existing scripts).

Parameters
script_nameThe name of the script (e.g., "OnEvent")
handlerThe handler of the script, as a C++ function (see below for expected signature)
infoThe location where this script has been defined
Returns
A connection object, to disable the script if needed.
Note
This defines a C++ function to be called for the event specified in script_name. This provides the best performance, but lacks direct access to the Lua environment. If this is required, prefer the other overload taking a Lua function instead.
This overload enables taking handler scripts with a self parameter of type other than frame, for example:
add_script([](button& self, const event_data& data) { ... });
button(utils::control_block &block, manager &mgr, const frame_core_attributes &attr)
Constructor.
Definition: gui_button.cpp:13
utils::connection add_script(const std::string &script_name, std::string content, script_info info=script_info{})
Adds an additional handler script to this frame (executed after existing scripts).
Definition: gui_frame.hpp:1125
For maximum safety, by default this is done using a dynamic_cast, so that incorrect types will be reported. However this has a cost; if you are sure of the type and want to bypass this cost, just supply the self type as the first template argument to this function:
add_script<button>([](button& self, const event_data& data) { ... });

Definition at line 1197 of file gui_frame.hpp.

◆ add_script() [2/4]

utils::connection lxgui::gui::frame::add_script ( const std::string &  script_name,
script_function  handler,
script_info  info = script_info{} 
)
inlineinherited

Adds an additional handler script to this frame (executed after existing scripts).

Parameters
script_nameThe name of the script (e.g., "OnEvent")
handlerThe handler of the script, as a C++ function of signature script_signature
infoThe location where this script has been defined
Returns
A connection object, to disable the script if needed.
Note
This defines a C++ function to be called for the event specified in script_name. This provides the best performance, but lacks direct access to the Lua environment. If this is required, prefer the other overload taking a Lua function instead.

Definition at line 1165 of file gui_frame.hpp.

◆ add_script() [3/4]

utils::connection lxgui::gui::frame::add_script ( const std::string &  script_name,
sol::protected_function  handler,
script_info  info = script_info{} 
)
inlineinherited

Adds an additional handler script to this frame (executed after existing scripts).

Parameters
script_nameThe name of the script (e.g., "OnEvent")
handlerThe handler of the script, as a Lua function
infoThe location where this script has been defined
Returns
A connection object, to disable the script if needed.
Note
This defines a Lua function to be called for the event specified in script_name. This provides more flexibility compared to using C++ function, but also has a larger overhead. If performance is a concern, prefer the other overload taking a C++ function instead.

Definition at line 1144 of file gui_frame.hpp.

◆ add_script() [4/4]

utils::connection lxgui::gui::frame::add_script ( const std::string &  script_name,
std::string  content,
script_info  info = script_info{} 
)
inlineinherited

Adds an additional handler script to this frame (executed after existing scripts).

Parameters
script_nameThe name of the script (e.g., "OnEvent")
contentThe content of the script, as Lua code
infoThe location where this script has been defined
Returns
A connection object, to disable the script if needed.
Note
The script_info parameter is used only for displaying error messages. This function is meant to be used by the layout file parser. If you want to manually define your own script handlers, prefer the other overloads.

Definition at line 1125 of file gui_frame.hpp.

◆ can_use_script()

bool lxgui::gui::button::can_use_script ( const std::string &  script_name) const
overridevirtual

Returns 'true' if this button can use a script.

Parameters
script_nameThe name of the script
Note
This method can be overridden if needed.

Reimplemented from lxgui::gui::frame.

Definition at line 26 of file gui_button.cpp.

◆ check_position_()

void lxgui::gui::frame::check_position_ ( )
protectedinherited

Definition at line 359 of file gui_frame.cpp.

◆ check_script_()

bool lxgui::gui::frame::check_script_ ( const std::string &  script_name) const
protectedinherited

Definition at line 946 of file gui_frame.cpp.

◆ clear_all_anchors()

void lxgui::gui::region::clear_all_anchors ( )
inherited

Removes all anchors.

Note
This region and its children won't be visible until you define at least one anchor.

Definition at line 365 of file gui_region.cpp.

◆ click() [1/2]

void lxgui::gui::button::click ( const std::string &  mouse_event)

Handle a mouse click over this button.

Parameters
mouse_eventThe mouse event with which to generate a click
Note
This calls the OnClick() handler only if the event is registered for clicks.

Definition at line 398 of file gui_button.cpp.

◆ click() [2/2]

void lxgui::gui::button::click ( input::mouse_button  button_id,
input::mouse_button_event  button_event 
)

Handle a mouse click over this button.

Parameters
button_idThe mouse button with which to generate a click
button_eventThe mouse button event with which to generate a click
Note
This calls the OnClick() handler only if the event is registered for clicks.

Definition at line 407 of file gui_button.cpp.

◆ click_()

void lxgui::gui::button::click_ ( input::mouse_button  button_id,
input::mouse_button_event  button_event,
float  mx,
float  my 
)
protectedvirtual

Definition at line 412 of file gui_button.cpp.

◆ compute_effective_strata_()

strata lxgui::gui::frame::compute_effective_strata_ ( ) const
protectedinherited

Definition at line 739 of file gui_frame.cpp.

◆ compute_top_level_frame_renderer_() [1/2]

utils::observer_ptr<frame_renderer> lxgui::gui::frame::compute_top_level_frame_renderer_ ( )
inlineprotectedinherited

Definition at line 1759 of file gui_frame.hpp.

◆ compute_top_level_frame_renderer_() [2/2]

utils::observer_ptr< const frame_renderer > lxgui::gui::frame::compute_top_level_frame_renderer_ ( ) const
protectedinherited

Definition at line 1414 of file gui_frame.cpp.

◆ copy_from()

void lxgui::gui::button::copy_from ( const region obj)
overridevirtual

Copies a region's parameters into this button (inheritance).

Parameters
objThe region to copy

Reimplemented from lxgui::gui::region.

Reimplemented in lxgui::gui::check_button.

Definition at line 86 of file gui_button.cpp.

◆ create_child() [1/3]

template<typename FrameType , typename Enable = typename std::enable_if<std::is_base_of<gui::frame, FrameType>::value>::type>
utils::observer_ptr<FrameType> lxgui::gui::frame::create_child ( const std::string &  name)
inlineinherited

Creates a new frame as child of this frame.

Parameters
nameThe name of the frame
Returns
The created frame.
Note
You don't have the responsibility to delete this frame. It will be done automatically when its parent is deleted.
This function takes care of the basic initializing: you can directly use the created frame. However, you still need to call notify_loaded() when you are done with any extra initialization you require on this frame. If you do not, the frame's OnLoad callback will not fire.

Definition at line 709 of file gui_frame.hpp.

◆ create_child() [2/3]

utils::observer_ptr< frame > lxgui::gui::frame::create_child ( frame_core_attributes  attr)
inherited

Creates a new frame as child of this frame.

Parameters
attrThe core attributes of the frame (parent will be ignored)
Returns
The created frame.
Note
You don't have the responsibility to delete this frame. It will be done automatically when its parent is deleted.
This function takes care of the basic initializing: you can directly use the created frame. However, you still need to call notify_loaded() when you are done with any extra initialization you require on this frame. If you do not, the frame's OnLoad callback will not fire.

Definition at line 666 of file gui_frame.cpp.

◆ create_child() [3/3]

template<typename FrameType , typename Enable = typename std::enable_if<std::is_base_of<gui::frame, FrameType>::value>::type>
utils::observer_ptr<FrameType> lxgui::gui::frame::create_child ( frame_core_attributes  attr)
inlineinherited

Creates a new frame as child of this frame.

Parameters
attrThe core attributes of the frame (object_type and parent will be ignored)
Returns
The created frame.
Note
You don't have the responsibility to delete this frame. It will be done automatically when its parent is deleted.
This function takes care of the basic initializing: you can directly use the created frame. However, you still need to call notify_loaded() when you are done with any extra initialization you require on this frame. If you do not, the frame's OnLoad callback will not fire.

Definition at line 688 of file gui_frame.hpp.

◆ create_glue_()

template<typename T >
void lxgui::gui::region::create_glue_ ( T &  self)
protectedinherited

Definition at line 136 of file gui_region_tpl.hpp.

◆ create_layered_region() [1/3]

template<typename RegionType , typename Enable = typename std::enable_if<std::is_base_of<gui::layered_region, RegionType>::value>::type>
utils::observer_ptr<RegionType> lxgui::gui::frame::create_layered_region ( layer  layer_id,
const std::string &  name 
)
inlineinherited

Creates a new region as child of this frame.

Parameters
layer_idThe layer on which to create the region
nameThe name of the region
Returns
The created region.
Note
You don't have the responsibility to delete this region. It will be done automatically when its parent is deleted.
This function takes care of the basic initializing: you can directly use the created region.

Definition at line 651 of file gui_frame.hpp.

◆ create_layered_region() [2/3]

utils::observer_ptr< layered_region > lxgui::gui::frame::create_layered_region ( layer  layer_id,
region_core_attributes  attr 
)
inherited

Creates a new region as child of this frame.

Parameters
layer_idThe layer on which to create the region
attrThe core attributes of the region (parent will be ignored)
Returns
The created region.
Note
You don't have the responsibility to delete this region. It will be done automatically when its parent is deleted.
This function takes care of the basic initializing: you can directly use the created region.

Definition at line 652 of file gui_frame.cpp.

◆ create_layered_region() [3/3]

template<typename RegionType , typename Enable = typename std::enable_if<std::is_base_of<gui::layered_region, RegionType>::value>::type>
utils::observer_ptr<RegionType> lxgui::gui::frame::create_layered_region ( layer  layer_id,
region_core_attributes  attr 
)
inlineinherited

Creates a new region as child of this frame.

Parameters
layer_idThe layer on which to create the region
attrThe core attributes of the region (object_type and parent will be ignored)
Returns
The created region.
Note
You don't have the responsibility to delete this region. It will be done automatically when its parent is deleted.
This function takes care of the basic initializing: you can directly use the created region.

Definition at line 630 of file gui_frame.hpp.

◆ create_title_region()

void lxgui::gui::frame::create_title_region ( )
inherited

Creates a new title region for this frame.

Note
You can get it by calling get_title_region().

Definition at line 275 of file gui_frame.cpp.

◆ define_script_() [1/3]

utils::connection lxgui::gui::frame::define_script_ ( const std::string &  script_name,
const std::string &  content,
bool  append,
const script_info info 
)
protectedinherited

Definition at line 957 of file gui_frame.cpp.

◆ define_script_() [2/3]

utils::connection lxgui::gui::frame::define_script_ ( const std::string &  script_name,
script_function  handler,
bool  append,
const script_info info 
)
protectedinherited

Definition at line 1034 of file gui_frame.cpp.

◆ define_script_() [3/3]

utils::connection lxgui::gui::frame::define_script_ ( const std::string &  script_name,
sol::protected_function  handler,
bool  append,
const script_info info 
)
protectedinherited

Definition at line 992 of file gui_frame.cpp.

◆ depends_on()

bool lxgui::gui::region::depends_on ( const region obj) const
inherited

Checks if this region depends on another.

Parameters
objThe region to test
Note
Useful to detect circular references.

Definition at line 503 of file gui_region.cpp.

◆ destroy()

void lxgui::gui::region::destroy ( )
inherited

Forcefully removes this region from the GUI.

Warning
After calling this function, any pointer to the object is invalidated! Only call this function if you need the object to be destroyed early, before its parent (if any) would itself be destroyed.

Definition at line 333 of file gui_region.cpp.

◆ disable()

void lxgui::gui::button::disable ( )
virtual

Disables this button.

Note
A disabled button doesn't receive any input.

Reimplemented in lxgui::gui::check_button.

Definition at line 291 of file gui_button.cpp.

◆ disable_button_clicks() [1/3]

void lxgui::gui::button::disable_button_clicks ( )

Stop this button from generating OnClick events.

See also
enable_button_clicks()
is_button_clicks_enabled()

Definition at line 519 of file gui_button.cpp.

◆ disable_button_clicks() [2/3]

void lxgui::gui::button::disable_button_clicks ( const std::string &  mouse_event)

Stop this button from generating OnClick events when a specific mouse event occurs over the button.

Parameters
mouse_eventThe mouse event for which to stop generating OnClick events
See also
enable_button_clicks()

Definition at line 509 of file gui_button.cpp.

◆ disable_button_clicks() [3/3]

void lxgui::gui::button::disable_button_clicks ( input::mouse_button  button_id,
input::mouse_button_event  button_event 
)

Stop this button from generating OnClick events when a specific mouse event occurs over the button.

Parameters
button_idThe mouse button for which to stop generating OnClick events
button_eventThe state of the button for which to stop generating OnClick events
Note
See disable_button_clicks(const std::string&) for more information.
See also
enable_button_clicks()

Definition at line 513 of file gui_button.cpp.

◆ disable_drag() [1/3]

void lxgui::gui::frame::disable_drag ( )
inherited

Tells this frame to not react to mouse drag from any mouse button.

Definition at line 1170 of file gui_frame.cpp.

◆ disable_drag() [2/3]

void lxgui::gui::frame::disable_drag ( const std::string &  button_name)
inherited

Tells this frame to not react to mouse drag.

Parameters
button_nameThe mouse button to not react to

Definition at line 1162 of file gui_frame.cpp.

◆ disable_drag() [3/3]

void lxgui::gui::frame::disable_drag ( input::mouse_button  button_id)
inherited

Tells this frame to not react to mouse drag.

Parameters
button_idThe mouse button to not react to

Definition at line 1166 of file gui_frame.cpp.

◆ disable_draw_layer()

void lxgui::gui::frame::disable_draw_layer ( layer  layer_id)
inherited

Disables a layer.

Parameters
layer_idThe id of the layer to disable

Definition at line 421 of file gui_frame.cpp.

◆ disable_key_capture() [1/3]

void lxgui::gui::frame::disable_key_capture ( )
inherited

Marks this frame as unable to receive keyboard input from any key.

See also
enable_key_capture()
is_key_capture_enabled()
set_keyboard_enabled()
is_keyboard_enabled()

Definition at line 474 of file gui_frame.cpp.

◆ disable_key_capture() [2/3]

void lxgui::gui::frame::disable_key_capture ( const std::string &  key_name)
inherited

Marks this frame as unable to receive keyboard input from a specific key.

Parameters
key_nameThe key for which to disable capture
See also
enable_key_capture()
is_key_capture_enabled()
set_keyboard_enabled()
is_keyboard_enabled()

Definition at line 466 of file gui_frame.cpp.

◆ disable_key_capture() [3/3]

void lxgui::gui::frame::disable_key_capture ( input::key  key_id)
inherited

Marks this frame as unable to receive keyboard input from a specific key.

Parameters
key_idThe key for which to disable capture
Note
See disable_key_capture(const std::string&) for more information. This overload only allows capturing a single key; for key combinations, please use the overload taking a string.
See also
enable_key_capture()
is_key_capture_enabled()
set_keyboard_enabled()
is_keyboard_enabled()

Definition at line 470 of file gui_frame.cpp.

◆ disable_keyboard()

void lxgui::gui::frame::disable_keyboard ( )
inlineinherited

Marks this frame as unable to receive any keyboard input.

See also
set_keyboard_enabled()

Definition at line 475 of file gui_frame.hpp.

◆ disable_mouse()

void lxgui::gui::frame::disable_mouse ( )
inlineinherited

Marks this frame as unable to receive mouse input (click & move).

See also
set_mouse_enabled()

Definition at line 380 of file gui_frame.hpp.

◆ disable_mouse_click()

void lxgui::gui::frame::disable_mouse_click ( )
inlineinherited

Marks this frame as unable to receive mouse click input.

See also
set_mouse_click_enabled()

Definition at line 402 of file gui_frame.hpp.

◆ disable_mouse_move()

void lxgui::gui::frame::disable_mouse_move ( )
inlineinherited

Marks this frame as unable to receive mouse move input.

See also
set_mouse_move_enabled()

Definition at line 424 of file gui_frame.hpp.

◆ disable_mouse_wheel()

void lxgui::gui::frame::disable_mouse_wheel ( )
inlineinherited

Marks this frame as unable to receive mouse wheel input.

See also
set_mouse_wheel_enabled()

Definition at line 446 of file gui_frame.hpp.

◆ enable()

void lxgui::gui::button::enable ( )
virtual

Enables this button.

Reimplemented in lxgui::gui::check_button.

Definition at line 328 of file gui_button.cpp.

◆ enable_auto_focus()

void lxgui::gui::frame::enable_auto_focus ( bool  enable)
inherited

Enables automatic focus when this frame is shown or raised.

Parameters
enable'true' to enable auto focus

Definition at line 1310 of file gui_frame.cpp.

◆ enable_button_clicks() [1/2]

void lxgui::gui::button::enable_button_clicks ( const std::string &  mouse_event)

Make this button generate OnClick events when a specific mouse event occurs over the button.

Parameters
mouse_eventThe mouse event for which to enable OnClick events
Note
The mouse event string must be of the form "<button>Up" or "<button>Down". For example, "LeftButtonUp".
See also
disable_button_clicks()

Definition at line 499 of file gui_button.cpp.

◆ enable_button_clicks() [2/2]

void lxgui::gui::button::enable_button_clicks ( input::mouse_button  button_id,
input::mouse_button_event  button_event 
)

Make this button generate OnClick events when a specific mouse event occurs over the button.

Parameters
button_idThe mouse button for which to enable OnClick events
button_eventThe mouse button event for which to enable OnClick events
Note
See enable_button_clicks(const std::string&) for more information.
See also
disable_button_clicks()

Definition at line 503 of file gui_button.cpp.

◆ enable_drag() [1/2]

void lxgui::gui::frame::enable_drag ( const std::string &  button_name)
inherited

Tells this frame to react to mouse drag.

Parameters
button_nameThe mouse button to react to

Definition at line 1154 of file gui_frame.cpp.

◆ enable_drag() [2/2]

void lxgui::gui::frame::enable_drag ( input::mouse_button  button_id)
inherited

Tells this frame to react to mouse drag.

Parameters
button_idThe mouse button to react to

Definition at line 1158 of file gui_frame.cpp.

◆ enable_draw_layer()

void lxgui::gui::frame::enable_draw_layer ( layer  layer_id)
inherited

Enables a layer.

Parameters
layer_idThe id of the layer to enable

Definition at line 429 of file gui_frame.cpp.

◆ enable_key_capture() [1/2]

void lxgui::gui::frame::enable_key_capture ( const std::string &  key_name)
inherited

Marks this frame as able to receive keyboard input from a specific key.

Parameters
key_nameThe key to capture
Note
If the frame captures the key, other frames below it will not be able to receive the input from this key. The format of the input key name is standard English, with modifiers for the "Control" (Ctrl), "Shift", and "Alt" keys. For example, "Ctrl-Shift-C" corresponds to the Ctrl, Shift, and C keys being pressed simultaneously. Keyboard input must be enabled for capture to take place.
See also
disable_key_capture()
is_key_capture_enabled()
set_keyboard_enabled()
is_keyboard_enabled()

Definition at line 458 of file gui_frame.cpp.

◆ enable_key_capture() [2/2]

void lxgui::gui::frame::enable_key_capture ( input::key  key_id)
inherited

Marks this frame as able to receive keyboard input from a specific key.

Parameters
key_idThe key to capture
Note
See enable_key_capture(const std::string&) for more information. This overload only allows capturing a single key; for key combinations, please use the overload taking a string.
See also
disable_key_capture()
is_key_capture_enabled()
set_keyboard_enabled()
is_keyboard_enabled()

Definition at line 462 of file gui_frame.cpp.

◆ enable_keyboard()

void lxgui::gui::frame::enable_keyboard ( )
inlineinherited

Marks this frame as able to receive any keyboard input.

See also
set_keyboard_enabled()

Definition at line 467 of file gui_frame.hpp.

◆ enable_mouse()

void lxgui::gui::frame::enable_mouse ( )
inlineinherited

Marks this frame as able to receive mouse input (click & move).

See also
set_mouse_enabled()

Definition at line 372 of file gui_frame.hpp.

◆ enable_mouse_click()

void lxgui::gui::frame::enable_mouse_click ( )
inlineinherited

Marks this frame as able to receive mouse click input.

See also
set_mouse_click_enabled()

Definition at line 394 of file gui_frame.hpp.

◆ enable_mouse_move()

void lxgui::gui::frame::enable_mouse_move ( )
inlineinherited

Marks this frame as able to receive mouse move input.

See also
set_mouse_move_enabled()

Definition at line 416 of file gui_frame.hpp.

◆ enable_mouse_wheel()

void lxgui::gui::frame::enable_mouse_wheel ( )
inlineinherited

Marks this frame as able to receive mouse wheel input.

See also
set_mouse_wheel_enabled()

Definition at line 438 of file gui_frame.hpp.

◆ find_topmost_frame() [1/2]

utils::observer_ptr<frame> lxgui::gui::frame::find_topmost_frame ( const std::function< bool(const frame &)> &  predicate)
inlineinherited

Find the topmost frame matching the provided predicate.

Parameters
predicateA function returning 'true' if the frame can be selected
Returns
The topmost frame, if any, and nullptr otherwise.
Note
For most frames, this can either return 'this' or 'nullptr'. For frames responsible for rendering other frames (such as scroll_frame), this can return other frames.

Definition at line 1034 of file gui_frame.hpp.

◆ find_topmost_frame() [2/2]

utils::observer_ptr< const frame > lxgui::gui::frame::find_topmost_frame ( const std::function< bool(const frame &)> &  predicate) const
virtualinherited

Find the topmost frame matching the provided predicate.

Parameters
predicateA function returning 'true' if the frame can be selected
Returns
The topmost frame, if any, and nullptr otherwise.
Note
For most frames, this can either return 'this' or 'nullptr'. For frames responsible for rendering other frames (such as scroll_frame), this can return other frames.

Reimplemented in lxgui::gui::scroll_frame.

Definition at line 832 of file gui_frame.cpp.

◆ fire_script()

void lxgui::gui::button::fire_script ( const std::string &  script_name,
const event_data data = event_data{} 
)
overridevirtual

Calls a script.

Parameters
script_nameThe name of the script
dataStores scripts arguments
Note
Triggered callbacks could destroy the frame. If you need to use the frame again after calling this function, use the helper class alive_checker.

Reimplemented from lxgui::gui::frame.

Definition at line 31 of file gui_button.cpp.

◆ get_abs_hit_rect_insets()

const bounds2f & lxgui::gui::frame::get_abs_hit_rect_insets ( ) const
inherited

Returns this frame's absolute hit rect insets.

Returns
This frame's absolute hit rect insets

Definition at line 777 of file gui_frame.cpp.

◆ get_addon()

const addon * lxgui::gui::region::get_addon ( ) const
inherited

Returns this frame's addon.

Returns
This frame's addon
Note
Returns "nullptr" if the frame has been created by Lua code and wasn't assigned a parent.

Definition at line 843 of file gui_region.cpp.

◆ get_adjusted_script_name()

std::string lxgui::gui::frame::get_adjusted_script_name ( const std::string &  script_name)
staticinherited

Returns the "adjusted" script name: "OnEvent" becomes "on_event".

Parameters
script_nameThe CamelCase name of the script
Returns
the snake_case name of the script

Definition at line 879 of file gui_frame.cpp.

◆ get_alpha()

float lxgui::gui::region::get_alpha ( ) const
inherited

Returns this region's alpha (opacity).

Returns
This region's alpha (opacity).

Definition at line 157 of file gui_region.cpp.

◆ get_anchor()

const anchor & lxgui::gui::region::get_anchor ( point  p) const
inherited

Returns one of this region's anchor.

Parameters
pThe anchor point
Returns
A pointer to the anchor, nullptr if none

Definition at line 539 of file gui_region.cpp.

◆ get_anchor_count()

std::size_t lxgui::gui::region::get_anchor_count ( ) const
inherited

Returns the number of defined anchors.

Returns
The number of defined anchors

Definition at line 519 of file gui_region.cpp.

◆ get_anchored_objects()

const std::vector< utils::observer_ptr< region > > & lxgui::gui::region::get_anchored_objects ( ) const
inherited

Returns the list of all objects that are anchored to this one.

Returns
The list of all objects that are anchored to this one

Definition at line 790 of file gui_region.cpp.

◆ get_anchors()

const std::array< std::optional< anchor >, 9 > & lxgui::gui::region::get_anchors ( ) const
inherited

Returns all of this region's anchors.

Returns
All of this region's anchors

Definition at line 549 of file gui_region.cpp.

◆ get_apparent_dimensions()

vector2f lxgui::gui::region::get_apparent_dimensions ( ) const
inherited

Returns this region's apparent width and height (in pixels).

Returns
This region's apparent width and height (in pixels)
Note
If you need to get the actual size of a region on the screen, use this function instead of get_dimensions(), as some regions may not have their dimensions explicitly defined, and instead get their extents from anchors.

Definition at line 276 of file gui_region.cpp.

◆ get_backdrop() [1/2]

backdrop * lxgui::gui::frame::get_backdrop ( )
inherited

Returns this frame's backdrop.

Returns
This frame's backdrop

Definition at line 766 of file gui_frame.cpp.

◆ get_backdrop() [2/2]

const backdrop * lxgui::gui::frame::get_backdrop ( ) const
inherited

Returns this frame's backdrop.

Returns
This frame's backdrop

Definition at line 762 of file gui_frame.cpp.

◆ get_borders()

const bounds2f & lxgui::gui::region::get_borders ( ) const
inherited

Returns this region's borders.

Returns
This region's borders

Definition at line 361 of file gui_region.cpp.

◆ get_bottom()

float lxgui::gui::region::get_bottom ( ) const
inherited

Returns the vertical position of this region's bottom border.

Returns
The vertical position of this region's bottom border

Definition at line 357 of file gui_region.cpp.

◆ get_button_state()

button::state lxgui::gui::button::get_button_state ( ) const

Returns this button's state.

Returns
This button's state (see ButtonState)

Definition at line 474 of file gui_button.cpp.

◆ get_center()

vector2f lxgui::gui::region::get_center ( ) const
inherited

Returns the position of this region's center.

Returns
The position of this region's center

Definition at line 341 of file gui_region.cpp.

◆ get_child() [1/4]

utils::observer_ptr<frame> lxgui::gui::frame::get_child ( const std::string &  name)
inlineinherited

Returns one of this frame's children.

Parameters
nameThe name of the child
Returns
One of this frame's children
Note
The provided name can either be the full name or the relative name (i.e. without the "$parent" in front). This function first looks for matches on the full name, then if no child is found, on the relative name.

Definition at line 775 of file gui_frame.hpp.

◆ get_child() [2/4]

template<typename FrameType , typename Enable = typename std::enable_if<std::is_base_of<gui::frame, FrameType>::value>::type>
utils::observer_ptr<FrameType> lxgui::gui::frame::get_child ( const std::string &  name)
inlineinherited

Returns one of this frame's children.

Parameters
nameThe name of the child
Returns
One of this frame's children
Note
The provided name can either be the full name or the relative name (i.e. without the "$parent" in front). This function first looks for matches on the full name, then if no child is found, on the relative name.

Definition at line 809 of file gui_frame.hpp.

◆ get_child() [3/4]

utils::observer_ptr< const frame > lxgui::gui::frame::get_child ( const std::string &  name) const
inherited

Returns one of this frame's children.

Parameters
nameThe name of the child
Returns
One of this frame's children
Note
The provided name can either be the full name or the relative name (i.e. without the "$parent" in front). This function first looks for matches on the full name, then if no child is found, on the relative name.

Definition at line 305 of file gui_frame.cpp.

◆ get_child() [4/4]

template<typename FrameType , typename Enable = typename std::enable_if<std::is_base_of<gui::frame, FrameType>::value>::type>
utils::observer_ptr<const FrameType> lxgui::gui::frame::get_child ( const std::string &  name) const
inlineinherited

Returns one of this frame's children.

Parameters
nameThe name of the child
Returns
One of this frame's children
Note
The provided name can either be the full name or the relative name (i.e. without the "$parent" in front). This function first looks for matches on the full name, then if no child is found, on the relative name.

Definition at line 792 of file gui_frame.hpp.

◆ get_child_count()

std::size_t lxgui::gui::frame::get_child_count ( ) const
inherited

Returns the number of children of this frame.

Returns
The number of children of this frame
Note
If only an approximate number is acceptable, use get_child_count_upper_bound(), which is faster.

Definition at line 793 of file gui_frame.cpp.

◆ get_child_count_upper_bound()

std::size_t lxgui::gui::frame::get_child_count_upper_bound ( ) const
inherited

Returns the approximate number of children of this frame.

Returns
The approximate number of children of this frame
Note
The returned number is an upper bound on the actual number of children. This can be used to reserve enough space for memory allocations. If the exact number of children is required, use get_child_count().

Definition at line 798 of file gui_frame.cpp.

◆ get_children() [1/2]

frame::child_list_view lxgui::gui::frame::get_children ( )
inherited

Returns the child list.

Returns
The child list

Definition at line 712 of file gui_frame.cpp.

◆ get_children() [2/2]

frame::const_child_list_view lxgui::gui::frame::get_children ( ) const
inherited

Returns the child list.

Returns
The child list

Definition at line 716 of file gui_frame.cpp.

◆ get_current_font_string() [1/2]

const utils::observer_ptr<font_string>& lxgui::gui::button::get_current_font_string ( )
inline

Returns the currently displayed text object.

Returns
The currently displayed text object

Definition at line 220 of file gui_button.hpp.

◆ get_current_font_string() [2/2]

utils::observer_ptr<const font_string> lxgui::gui::button::get_current_font_string ( ) const
inline

Returns the currently displayed text object.

Returns
The currently displayed text object

Definition at line 228 of file gui_button.hpp.

◆ get_dimensions()

const vector2f & lxgui::gui::region::get_dimensions ( ) const
inherited

Returns this region's explicitly-defined width and height (in pixels).

Returns
This region's explicitly-defined width and height (in pixels)
Note
If you need to get the actual size of a region on the screen, use get_apparent_dimensions(), as some regions may not have their dimensions explicitly defined, and instead get their extents from anchors. If a dimension is not explicitly defined, it will be returned as zero.

Definition at line 272 of file gui_region.cpp.

◆ get_disabled_text() [1/2]

const utils::observer_ptr<font_string>& lxgui::gui::button::get_disabled_text ( )
inline

Returns this button's disabled text.

Returns
This button's disabled text

Definition at line 204 of file gui_button.hpp.

◆ get_disabled_text() [2/2]

utils::observer_ptr<const font_string> lxgui::gui::button::get_disabled_text ( ) const
inline

Returns this button's disabled text.

Returns
This button's disabled text

Definition at line 212 of file gui_button.hpp.

◆ get_disabled_texture() [1/2]

const utils::observer_ptr<texture>& lxgui::gui::button::get_disabled_texture ( )
inline

Returns this button's disabled texture.

Returns
This button's disabled texture

Definition at line 140 of file gui_button.hpp.

◆ get_disabled_texture() [2/2]

utils::observer_ptr<const texture> lxgui::gui::button::get_disabled_texture ( ) const
inline

Returns this button's disabled texture.

Returns
This button's disabled texture

Definition at line 148 of file gui_button.hpp.

◆ get_effective_alpha()

float lxgui::gui::region::get_effective_alpha ( ) const
inherited

Returns this region's effective alpha (opacity).

Returns
This region's effective alpha (opacity).
Note
This includes the region's parent alpha.

Definition at line 161 of file gui_region.cpp.

◆ get_effective_frame_renderer() [1/2]

utils::observer_ptr<frame_renderer> lxgui::gui::frame::get_effective_frame_renderer ( )
inlineinherited

Returns the renderer of this object or its parents, nullptr if none.

Returns
The renderer of this object or its parents, nullptr if none
Note
For more information, see set_frame_renderer().

Definition at line 1645 of file gui_frame.hpp.

◆ get_effective_frame_renderer() [2/2]

utils::observer_ptr< const frame_renderer > lxgui::gui::frame::get_effective_frame_renderer ( ) const
finalvirtualinherited

Returns the renderer of this object or its parents, nullptr if none.

Returns
The renderer of this object or its parents, nullptr if none
Note
For more information, see set_frame_renderer().

Reimplemented from lxgui::gui::region.

Definition at line 1410 of file gui_frame.cpp.

◆ get_effective_scale()

float lxgui::gui::frame::get_effective_scale ( ) const
inherited

Calculates effective scale.

Returns
Effective scale (scale*parent->scale)

Definition at line 720 of file gui_frame.cpp.

◆ get_effective_strata()

strata lxgui::gui::frame::get_effective_strata ( ) const
inherited

Returns this frame's effective strata.

Returns
This frame's strata, or its parent's effective strata if strata::parent.

Definition at line 735 of file gui_frame.cpp.

◆ get_frame_renderer() [1/2]

const utils::observer_ptr<frame_renderer>& lxgui::gui::frame::get_frame_renderer ( )
inlineinherited

Returns the renderer of this object, nullptr if none.

Returns
The renderer of this object, nullptr if none
Note
For more information, see set_frame_renderer().

Definition at line 1629 of file gui_frame.hpp.

◆ get_frame_renderer() [2/2]

utils::observer_ptr<const frame_renderer> lxgui::gui::frame::get_frame_renderer ( ) const
inlineinherited

Returns the renderer of this object, nullptr if none.

Returns
The renderer of this object, nullptr if none
Note
For more information, see set_frame_renderer().

Definition at line 1620 of file gui_frame.hpp.

◆ get_highlight_text() [1/2]

const utils::observer_ptr<font_string>& lxgui::gui::button::get_highlight_text ( )
inline

Returns this button's highlight text.

Returns
This button's highlight text

Definition at line 188 of file gui_button.hpp.

◆ get_highlight_text() [2/2]

utils::observer_ptr<const font_string> lxgui::gui::button::get_highlight_text ( ) const
inline

Returns this button's highlight text.

Returns
This button's highlight text

Definition at line 196 of file gui_button.hpp.

◆ get_highlight_texture() [1/2]

const utils::observer_ptr<texture>& lxgui::gui::button::get_highlight_texture ( )
inline

Returns this button's highlight texture.

Returns
This button's highlight texture

Definition at line 156 of file gui_button.hpp.

◆ get_highlight_texture() [2/2]

utils::observer_ptr<const texture> lxgui::gui::button::get_highlight_texture ( ) const
inline

Returns this button's highlight texture.

Returns
This button's highlight texture

Definition at line 164 of file gui_button.hpp.

◆ get_layered_region_count()

std::size_t lxgui::gui::frame::get_layered_region_count ( ) const
inherited

Returns the number of layered regions of this frame.

Returns
The number of layered regions of this frame
Note
If only an approximate number is acceptable, use get_layered_region_count_upper_bound(), which is faster.

Definition at line 802 of file gui_frame.cpp.

◆ get_layered_region_count_upper_bound()

std::size_t lxgui::gui::frame::get_layered_region_count_upper_bound ( ) const
inherited

Returns the approximate number of regions of this frame.

Returns
The approximate number of regions of this frame
Note
The returned number is an upper bound on the actual number of regions. This can be used to reserve enough space for memory allocations. If the exact number of regions is required, use get_layered_region_count().

Definition at line 807 of file gui_frame.cpp.

◆ get_left()

float lxgui::gui::region::get_left ( ) const
inherited

Returns the horizontal position of this region's left border.

Returns
The horizontal position of this region's left border

Definition at line 345 of file gui_region.cpp.

◆ get_level()

int lxgui::gui::frame::get_level ( ) const
inherited

Returns this frame's level.

Returns
This frame's level

Definition at line 727 of file gui_frame.cpp.

◆ get_lua_() [1/2]

sol::state & lxgui::gui::region::get_lua_ ( )
protectedinherited

Definition at line 767 of file gui_region.cpp.

◆ get_lua_() [2/2]

const sol::state & lxgui::gui::region::get_lua_ ( ) const
protectedinherited

Definition at line 771 of file gui_region.cpp.

◆ get_lua_member_()

sol::object lxgui::gui::region::get_lua_member_ ( const std::string &  key) const
protectedinherited

◆ get_manager() [1/2]

manager& lxgui::gui::region::get_manager ( )
inlineinherited

Returns this region's manager.

Returns
This region's manager

Definition at line 693 of file gui_region.hpp.

◆ get_manager() [2/2]

const manager& lxgui::gui::region::get_manager ( ) const
inlineinherited

Returns this region's manager.

Returns
This region's manager

Definition at line 701 of file gui_region.hpp.

◆ get_max_dimensions()

vector2f lxgui::gui::frame::get_max_dimensions ( ) const
inherited

Returns this frame's max dimensions.

Returns
This frame's max dimensions

Definition at line 785 of file gui_frame.cpp.

◆ get_min_dimensions()

vector2f lxgui::gui::frame::get_min_dimensions ( ) const
inherited

Returns this frame's min dimensions.

Returns
This frame's min dimensions

Definition at line 789 of file gui_frame.cpp.

◆ get_name()

const std::string & lxgui::gui::region::get_name ( ) const
inherited

Returns this region's name.

Returns
This region's name

Definition at line 140 of file gui_region.cpp.

◆ get_normal_text() [1/2]

const utils::observer_ptr<font_string>& lxgui::gui::button::get_normal_text ( )
inline

Returns this button's normal text.

Returns
This button's normal text

Definition at line 172 of file gui_button.hpp.

◆ get_normal_text() [2/2]

utils::observer_ptr<const font_string> lxgui::gui::button::get_normal_text ( ) const
inline

Returns this button's normal text.

Returns
This button's normal text

Definition at line 180 of file gui_button.hpp.

◆ get_normal_texture() [1/2]

const utils::observer_ptr<texture>& lxgui::gui::button::get_normal_texture ( )
inline

Returns this button's normal texture.

Returns
This button's normal texture

Definition at line 108 of file gui_button.hpp.

◆ get_normal_texture() [2/2]

utils::observer_ptr<const texture> lxgui::gui::button::get_normal_texture ( ) const
inline

Returns this button's normal texture.

Returns
This button's normal texture

Definition at line 116 of file gui_button.hpp.

◆ get_or_create_backdrop()

backdrop & lxgui::gui::frame::get_or_create_backdrop ( )
inherited

Returns this frame's backdrop, creating it if needed.

Returns
This frame's backdrop

Definition at line 770 of file gui_frame.cpp.

◆ get_parent() [1/2]

const utils::observer_ptr<frame>& lxgui::gui::region::get_parent ( )
inlineinherited

Returns this region's parent.

Returns
This region's parent

Definition at line 237 of file gui_region.hpp.

◆ get_parent() [2/2]

utils::observer_ptr<const frame> lxgui::gui::region::get_parent ( ) const
inlineinherited

Returns this region's parent.

Returns
This region's parent

Definition at line 229 of file gui_region.hpp.

◆ get_pushed_text_offset()

const vector2f & lxgui::gui::button::get_pushed_text_offset ( ) const

Returns this button's pushed text offset.

Returns
This button's pushed text offset

Definition at line 495 of file gui_button.cpp.

◆ get_pushed_texture() [1/2]

const utils::observer_ptr<texture>& lxgui::gui::button::get_pushed_texture ( )
inline

Returns this button's pushed texture.

Returns
This button's pushed texture

Definition at line 124 of file gui_button.hpp.

◆ get_pushed_texture() [2/2]

utils::observer_ptr<const texture> lxgui::gui::button::get_pushed_texture ( ) const
inline

Returns this button's pushed texture.

Returns
This button's pushed texture

Definition at line 132 of file gui_button.hpp.

◆ get_raw_name()

const std::string & lxgui::gui::region::get_raw_name ( ) const
inherited

Returns this region's raw name.

Returns
This region's raw name
Note
This is the name of the region before "$parent" has been replaced by its parent's name.

Definition at line 144 of file gui_region.cpp.

◆ get_region() [1/3]

utils::observer_ptr<layered_region> lxgui::gui::frame::get_region ( const std::string &  name)
inlineinherited

Returns one of this frame's region.

Parameters
nameThe name of the region
Returns
One of this frame's region
Note
The provided name can either be the full name or the relative name (i.e. without the "$parent" in front). This function first looks for matches on the full name, then if no region is found, on the relative name.

Definition at line 845 of file gui_frame.hpp.

◆ get_region() [2/3]

template<typename RegionType , typename Enable = typename std::enable_if<std::is_base_of<gui::layered_region, RegionType>::value>::type>
utils::observer_ptr<RegionType> lxgui::gui::frame::get_region ( const std::string &  name)
inlineinherited

Returns one of this frame's region.

Parameters
nameThe name of the region
Returns
One of this frame's region
Note
The provided name can either be the full name or the relative name (i.e. without the "$parent" in front). This function first looks for matches on the full name, then if no region is found, on the relative name.

Definition at line 863 of file gui_frame.hpp.

◆ get_region() [3/3]

utils::observer_ptr< const layered_region > lxgui::gui::frame::get_region ( const std::string &  name) const
inherited

Returns one of this frame's region.

Parameters
nameThe name of the region
Returns
One of this frame's region
Note
The provided name can either be the full name or the relative name (i.e. without the "$parent" in front). This function first looks for matches on the full name, then if no region is found, on the relative name.

Definition at line 329 of file gui_frame.cpp.

◆ get_region_type()

const std::string & lxgui::gui::region::get_region_type ( ) const
inherited

Returns the type of this region.

Returns
The type of this region

Definition at line 148 of file gui_region.cpp.

◆ get_regions() [1/2]

frame::region_list_view lxgui::gui::frame::get_regions ( )
inherited

Returns the region list.

Returns
The region list

Definition at line 321 of file gui_frame.cpp.

◆ get_regions() [2/2]

frame::const_region_list_view lxgui::gui::frame::get_regions ( ) const
inherited

Returns the region list.

Returns
The region list

Definition at line 325 of file gui_frame.cpp.

◆ get_registry() [1/2]

registry & lxgui::gui::region::get_registry ( )
inherited

Returns the UI object registry, which keeps track of all objects in the UI.

Returns
The registry object

Definition at line 850 of file gui_region.cpp.

◆ get_registry() [2/2]

const registry & lxgui::gui::region::get_registry ( ) const
inherited

Returns the UI object registry, which keeps track of all objects in the UI.

Returns
The registry object

Definition at line 855 of file gui_region.cpp.

◆ get_rel_hit_rect_insets()

const bounds2f & lxgui::gui::frame::get_rel_hit_rect_insets ( ) const
inherited

Returns this frame's relative hit rect insets.

Returns
This frame's relative hit rect insets

Definition at line 781 of file gui_frame.cpp.

◆ get_right()

float lxgui::gui::region::get_right ( ) const
inherited

Returns the horizontal position of this region's right border.

Returns
The horizontal position of this region's right border

Definition at line 349 of file gui_region.cpp.

◆ get_scale()

float lxgui::gui::frame::get_scale ( ) const
inherited

Returns this frame's scale.

Returns
This frame's scale
Note
If you want it's true scale on the screen, use get_effective_scale().

Definition at line 811 of file gui_frame.cpp.

◆ get_script()

script_list_view lxgui::gui::frame::get_script ( const std::string &  script_name) const
inherited

Return a view into this frame's handler scripts, registered for the given event.

Parameters
script_nameThe name of the script (e.g., "OnEvent")
Returns
An iterable view into the frame's handlers.

Definition at line 1072 of file gui_frame.cpp.

◆ get_strata()

std::optional< strata > lxgui::gui::frame::get_strata ( ) const
inherited

Returns this frame's strata.

Returns
This frame's strata, or nullopt if the strata is inherited from the parent.
Note
See get_effective_strata() to obtain the actual strata of this frame.

Definition at line 731 of file gui_frame.cpp.

◆ get_text()

const utils::ustring & lxgui::gui::button::get_text ( ) const

Returns this button's text.

Returns
This button's text

Definition at line 219 of file gui_button.cpp.

◆ get_title_region() [1/2]

utils::observer_ptr<region> lxgui::gui::frame::get_title_region ( )
inlineinherited

Returns this frame's title region.

Definition at line 997 of file gui_frame.hpp.

◆ get_title_region() [2/2]

utils::observer_ptr<const region> lxgui::gui::frame::get_title_region ( ) const
inlineinherited

Returns this frame's title region.

Definition at line 992 of file gui_frame.hpp.

◆ get_top()

float lxgui::gui::region::get_top ( ) const
inherited

Returns the vertical position of this region's top border.

Returns
The vertical position of this region's top border

Definition at line 353 of file gui_region.cpp.

◆ get_top_level_parent() [1/2]

utils::observer_ptr<frame> lxgui::gui::frame::get_top_level_parent ( )
inlineinherited

Returns this frame's top-level parent.

Returns
This frame's top-level parent

Definition at line 902 of file gui_frame.hpp.

◆ get_top_level_parent() [2/2]

utils::observer_ptr< const frame > lxgui::gui::frame::get_top_level_parent ( ) const
inherited

Returns this frame's top-level parent.

Returns
This frame's top-level parent

Definition at line 750 of file gui_frame.cpp.

◆ get_type_list_()

const std::vector< std::string > & lxgui::gui::button::get_type_list_ ( ) const
overrideprotectedvirtual

Reimplemented from lxgui::gui::region.

Reimplemented in lxgui::gui::check_button.

Definition at line 544 of file gui_button.cpp.

◆ get_type_list_impl_()

template<typename T >
const std::vector< std::string > & lxgui::gui::region::get_type_list_impl_
staticprotectedinherited

Definition at line 147 of file gui_region_tpl.hpp.

◆ get_update_rate()

float lxgui::gui::frame::get_update_rate ( ) const
inherited

Gets the maximum update rate (in upates per seconds).

Returns
The maximum update rate (in upates per seconds)

Definition at line 1150 of file gui_frame.cpp.

◆ has_focus()

bool lxgui::gui::frame::has_focus ( ) const
inherited

Check if this frame currently has focus.

Returns
'true' if the frame has focus, 'false' otherwise

Definition at line 1326 of file gui_frame.cpp.

◆ has_script()

bool lxgui::gui::frame::has_script ( const std::string &  script_name) const
inherited

Checks if this frame has a script defined.

Parameters
script_nameThe name of the script to check
Returns
'true' if this script is defined

Definition at line 584 of file gui_frame.cpp.

◆ hide()

void lxgui::gui::region::hide ( )
inherited

hides this region.

Note
All its children won't be visible on the screen anymore, even if they are still marked as shown.

Definition at line 186 of file gui_region.cpp.

◆ highlight()

void lxgui::gui::button::highlight ( )
virtual

Highlights this button.

Note
The button will be highlighted even if the mouse is not over it. It will stop when the mouse leaves it.

Definition at line 431 of file gui_button.cpp.

◆ initialize_()

template<typename T >
void lxgui::gui::region::initialize_ ( T &  self,
const region_core_attributes attr 
)
protectedinherited

Set up function to call in all derived class constructors.

Parameters
selfA pointer to the derived this
attrThe region attributes provided to the constructor

Definition at line 141 of file gui_region_tpl.hpp.

◆ is_apparent_height_defined()

bool lxgui::gui::region::is_apparent_height_defined ( ) const
inherited

Checks if this region's apparent height is defined.

Returns
'true' if defined, 'false' otherwise
Note
The apparent height is defined if either the region's absolute or relative height is explicitly specified (from set_height(), set_relative_height(), set_dimensions(), or set_relative_dimensions()), or if its left and right borders are anchored. A region with an undefined apparent height will not be rendered on the screen until its height is defined.

Definition at line 284 of file gui_region.cpp.

◆ is_apparent_width_defined()

bool lxgui::gui::region::is_apparent_width_defined ( ) const
inherited

Checks if this region's apparent width is defined.

Returns
'true' if defined, 'false' otherwise
Note
The apparent width is defined if either the region's absolute or relative width is explicitly specified (from set_width(), set_relative_width(), set_dimensions(), or set_relative_dimensions()), or if its left and right borders are anchored. A region with an undefined apparent width will not be rendered on the screen until its width is defined.

Definition at line 280 of file gui_region.cpp.

◆ is_auto_focus_enabled()

bool lxgui::gui::frame::is_auto_focus_enabled ( ) const
inherited

Checks if automatic focus is enabled.

Returns
'true' if automatic focus is enabled

Definition at line 1314 of file gui_frame.cpp.

◆ is_button_clicks_enabled() [1/2]

bool lxgui::gui::button::is_button_clicks_enabled ( const std::string &  mouse_event) const

Checks if this button can generate OnClick events when a specific mouse event occurs over the button.

Parameters
mouse_eventThe mouse event to check
Returns
'true' if this button can generate OnClick events from this mouse event
See also
enable_button_clicks()

Definition at line 523 of file gui_button.cpp.

◆ is_button_clicks_enabled() [2/2]

bool lxgui::gui::button::is_button_clicks_enabled ( input::mouse_button  button_id,
input::mouse_button_event  button_event 
) const

Checks if this button can generate OnClick events when a specific mouse event occurs over the button.

Parameters
button_idThe mouse button for which to check
button_eventThe mouse button event for which to check
Returns
'true' if this button can generate OnClick events from this mouse event
See also
enable_button_clicks()

Definition at line 527 of file gui_button.cpp.

◆ is_button_clicks_enabled_()

bool lxgui::gui::button::is_button_clicks_enabled_ ( input::mouse_button  button_id) const
protected

Definition at line 533 of file gui_button.cpp.

◆ is_clamped_to_screen()

bool lxgui::gui::frame::is_clamped_to_screen ( ) const
inherited

Checks if this frame is clamped to screen.

Returns
'true' if this frame is clamped to screen

Definition at line 815 of file gui_frame.cpp.

◆ is_drag_enabled()

bool lxgui::gui::frame::is_drag_enabled ( const std::string &  button_name) const
inherited

Checks if this frame is registered for drag events with the provided mouse button.

Parameters
button_nameThe name of the mouse button to check
Returns
'true' if this frame is registered for drag events with the provided mouse button

Definition at line 851 of file gui_frame.cpp.

◆ is_enabled()

bool lxgui::gui::button::is_enabled ( ) const

Checks if this button is enabled.

Returns
'true' if this button is enabled

Definition at line 358 of file gui_button.cpp.

◆ is_in_region()

bool lxgui::gui::frame::is_in_region ( const vector2f position) const
overridevirtualinherited

Checks if the provided coordinates are inside this frame.

Parameters
positionThe coordinates to test
Returns
'true' if the provided coordinates are inside this frame or its title region

Reimplemented from lxgui::gui::region.

Reimplemented in lxgui::gui::slider.

Definition at line 819 of file gui_frame.cpp.

◆ is_key_capture_enabled()

bool lxgui::gui::frame::is_key_capture_enabled ( const std::string &  key_name) const
inherited

Checks if this frame can receive keyboard input from a specific key.

Parameters
key_nameThe key to check
Returns
'true' if this frame can receive keyboard input from this key
See also
enable_key_capture()
enable_keyboard()
is_keyboard_enabled()

Definition at line 859 of file gui_frame.cpp.

◆ is_keyboard_enabled()

bool lxgui::gui::frame::is_keyboard_enabled ( ) const
inherited

Checks if this frame can receive any keyboard input.

Returns
'true' if this frame can receive any keyboard input
See also
enable_key_capture()
is_key_capture_enabled()
enable_keyboard()

Definition at line 855 of file gui_frame.cpp.

◆ is_loaded()

bool lxgui::gui::region::is_loaded ( ) const
inherited

Checks if this region has been fully loaded.

Note
A region that is not fully loaded still has all its core attributes set, hence can be considered as "fully constructed" from a C++ point of view. However, semantically, the object may need further steps to be complete, as designed by the UI designer. Therefore, form the UI's point of view, a region is considered "complete" only if is_loaded() returns 'true' (see notifu_loaded()). Only then can the region, e.g., react to or generate events.

Definition at line 798 of file gui_region.cpp.

◆ is_manually_inherited()

bool lxgui::gui::region::is_manually_inherited ( ) const
inherited

Checks if this object is manually inherited.

Returns
'true' if this object is manually inherited
Note
For more information, see set_manually_inherited().

Definition at line 784 of file gui_region.cpp.

◆ is_mouse_click_enabled()

bool lxgui::gui::frame::is_mouse_click_enabled ( ) const
inherited

Checks if this frame can receive mouse click input.

Returns
'true' if this frame can receive mouse click input

Definition at line 839 of file gui_frame.cpp.

◆ is_mouse_move_enabled()

bool lxgui::gui::frame::is_mouse_move_enabled ( ) const
inherited

Checks if this frame can receive mouse movement input.

Returns
'true' if this frame can receive mouse movement input

Definition at line 843 of file gui_frame.cpp.

◆ is_mouse_wheel_enabled()

bool lxgui::gui::frame::is_mouse_wheel_enabled ( ) const
inherited

Checks if this frame can receive mouse wheel input.

Returns
'true' if this frame can receive mouse wheel input

Definition at line 847 of file gui_frame.cpp.

◆ is_movable()

bool lxgui::gui::frame::is_movable ( ) const
inherited

Checks if this frame can be moved.

Returns
'true' if this frame can be moved

Definition at line 863 of file gui_frame.cpp.

◆ is_region_type() [1/3]

template<typename ObjectType >
bool lxgui::gui::region::is_region_type ( ) const
inlineinherited

Checks if this region is of the provided type.

Returns
'true' if this region is of the provided type

Definition at line 423 of file gui_region.hpp.

◆ is_region_type() [2/3]

bool lxgui::gui::region::is_region_type ( const region obj) const
inlineinherited

Checks if this region is of a type equal or derived from the supplied region.

Returns
'true' if this region is of a type equal or derived from the supplied region

Definition at line 431 of file gui_region.hpp.

◆ is_region_type() [3/3]

bool lxgui::gui::region::is_region_type ( const std::string &  type_name) const
inherited

Checks if this region is of the provided type.

Parameters
type_nameThe type to test
Returns
'true' if this region is of the provided type

Definition at line 152 of file gui_region.cpp.

◆ is_resizable()

bool lxgui::gui::frame::is_resizable ( ) const
inherited

Checks if this frame can be resized.

Returns
'true' if this frame can be resized

Definition at line 867 of file gui_frame.cpp.

◆ is_shown()

bool lxgui::gui::region::is_shown ( ) const
inherited

Checks if this region is shown.

Returns
'true' if this region is shown

Definition at line 203 of file gui_region.cpp.

◆ is_top_level()

bool lxgui::gui::frame::is_top_level ( ) const
inherited

Checks if this frame is at top level.

Returns
'true' if this frame is at top level

Definition at line 871 of file gui_frame.cpp.

◆ is_user_placed()

bool lxgui::gui::frame::is_user_placed ( ) const
inherited

Checks if this frame has been moved by the user.

Returns
'true' if this frame has been moved by the user

Definition at line 875 of file gui_frame.cpp.

◆ is_valid()

bool lxgui::gui::region::is_valid ( ) const
inherited

Checks if this region has all its borders correctly defined.

Returns
'true' if this region has all its borders correctly defined
Note
To be valid, a region needs to have a defined position and size along both the X and Y dimensions. This means either one anchor and a set size, or two opposite anchors. For example, any anchor plus a call to set_dimensions(). Or a top_left plus a bottom_right anchors. Or a left plus a right anchors plus a call to set_height().

Definition at line 211 of file gui_region.cpp.

◆ is_virtual()

bool lxgui::gui::region::is_virtual ( ) const
inherited

Checks if this region is virtual.

Returns
'true' if this region is virtual
Note
A virtual region will not be displayed on the screen, but can serve as a template to create new GUI elements (it is then "inherited", although note that this has no connection to C++ inheritance).

Definition at line 553 of file gui_region.cpp.

◆ is_visible()

bool lxgui::gui::region::is_visible ( ) const
inherited

Checks if this region can be seen on the screen.

Returns
'true' if this region can be seen on the screen

Definition at line 207 of file gui_region.cpp.

◆ lock_highlight()

void lxgui::gui::button::lock_highlight ( )

Locks this button's highlighting.

Note
The button will always be highlighted until you call unlock_highlight().

Definition at line 478 of file gui_button.cpp.

◆ make_borders_()

bool lxgui::gui::region::make_borders_ ( float &  min,
float &  max,
float  center,
float  size 
) const
protectedinherited

Definition at line 585 of file gui_region.cpp.

◆ modify_anchor()

anchor & lxgui::gui::region::modify_anchor ( point  p)
inherited

Returns one of this region's anchor to modify it.

Parameters
pThe anchor point
Returns
A reference to the anchor, will throw if this point has no anchor.
Note
After you have modified the anchor, you must call notify_borders_need_update() to ensure that the object's borders are properly updated.

Definition at line 529 of file gui_region.cpp.

◆ notify_borders_need_update()

void lxgui::gui::region::notify_borders_need_update ( )
virtualinherited

Tells this region that its borders need updating.

Reimplemented in lxgui::gui::slider.

Definition at line 744 of file gui_region.cpp.

◆ notify_focus()

void lxgui::gui::frame::notify_focus ( bool  focus)
virtualinherited

Notifies this frame that it has received or lost focus.

Parameters
focus'true' if focus is received, 'false' if lost

Reimplemented in lxgui::gui::edit_box.

Definition at line 1330 of file gui_frame.cpp.

◆ notify_frame_renderer_changed_()

void lxgui::gui::frame::notify_frame_renderer_changed_ ( const utils::observer_ptr< frame_renderer > &  new_renderer)
protectedinherited

Definition at line 1385 of file gui_frame.cpp.

◆ notify_invisible()

void lxgui::gui::frame::notify_invisible ( )
overridevirtualinherited

Notifies this region that it is no longer visible on screen.

Note
Automatically called by show()/hide().

Reimplemented from lxgui::gui::region.

Definition at line 1457 of file gui_frame.cpp.

◆ notify_layers_need_update()

void lxgui::gui::frame::notify_layers_need_update ( )
inherited

Tells this frame to rebuild its layer list.

Note
Automatically called by add_region(), remove_region(), and layered_region::set_draw_layer().

Definition at line 489 of file gui_frame.cpp.

◆ notify_loaded()

void lxgui::gui::frame::notify_loaded ( )
overridevirtualinherited

Notifies this region that it has been fully loaded.

Note
Calls the "OnLoad" script.

Reimplemented from lxgui::gui::region.

Definition at line 478 of file gui_frame.cpp.

◆ notify_mouse_in_frame()

void lxgui::gui::frame::notify_mouse_in_frame ( bool  mouse_in_frame,
const vector2f mouse_pos 
)
virtualinherited

Tells this frame it is being hovered by the mouse.

Parameters
mouse_in_frame'true' if the mouse is above this frame
mouse_posThe mouse coordinates in pixels
Note
Always use the mouse position set by this function and not the one returned by the input_manager, because there can be an offset applied (for example with scroll_frame).

Definition at line 1501 of file gui_frame.cpp.

◆ notify_renderer_need_redraw()

void lxgui::gui::frame::notify_renderer_need_redraw ( )
overridevirtualinherited

Notifies the renderer of this region that it needs to be redrawn.

Note
Automatically called by any shape changing function.

Reimplemented from lxgui::gui::region.

Definition at line 1481 of file gui_frame.cpp.

◆ notify_scaling_factor_updated()

void lxgui::gui::frame::notify_scaling_factor_updated ( )
overridevirtualinherited

Tells this region that the global interface scaling factor has changed.

Reimplemented from lxgui::gui::region.

Reimplemented in lxgui::gui::scroll_frame.

Definition at line 1488 of file gui_frame.cpp.

◆ notify_strata_changed_()

void lxgui::gui::frame::notify_strata_changed_ ( strata  new_strata_id)
protectedinherited

Definition at line 567 of file gui_frame.cpp.

◆ notify_visible()

void lxgui::gui::frame::notify_visible ( )
overridevirtualinherited

Notifies this region that it is now visible on screen.

Note
Automatically called by show()/hide().

Reimplemented from lxgui::gui::region.

Definition at line 1423 of file gui_frame.cpp.

◆ on_event_()

void lxgui::gui::frame::on_event_ ( std::string_view  event_name,
const event_data event 
)
protectedinherited

Definition at line 1096 of file gui_frame.cpp.

◆ parse_all_nodes_before_children_()

void lxgui::gui::button::parse_all_nodes_before_children_ ( const layout_node node)
overrideprotectedvirtual

Reimplemented from lxgui::gui::frame.

Reimplemented in lxgui::gui::check_button.

Definition at line 18 of file gui_button_parser.cpp.

◆ parse_anchor_node_()

void lxgui::gui::region::parse_anchor_node_ ( const layout_node node)
protectedvirtualinherited

Definition at line 89 of file gui_region_parser.cpp.

◆ parse_attributes_()

void lxgui::gui::button::parse_attributes_ ( const layout_node node)
overrideprotectedvirtual

Reimplemented from lxgui::gui::region.

Definition at line 11 of file gui_button_parser.cpp.

◆ parse_backdrop_node_()

void lxgui::gui::frame::parse_backdrop_node_ ( const layout_node node)
protectedvirtualinherited

Definition at line 133 of file gui_frame_parser.cpp.

◆ parse_child_()

utils::observer_ptr< frame > lxgui::gui::frame::parse_child_ ( const layout_node node,
const std::string &  type 
)
protectedinherited

Definition at line 360 of file gui_frame_parser.cpp.

◆ parse_color_node_()

color lxgui::gui::region::parse_color_node_ ( const layout_node node)
protectedinherited

Definition at line 10 of file gui_region_parser.cpp.

◆ parse_dimension_node_()

std::pair< anchor_type, vector2< std::optional< float > > > lxgui::gui::region::parse_dimension_node_ ( const layout_node node)
protectedinherited

Definition at line 35 of file gui_region_parser.cpp.

◆ parse_file_name()

std::string lxgui::gui::region::parse_file_name ( const std::string &  file_name) const
inherited

Convert an addon-relative file path to a application-relative path.

Parameters
file_nameThe raw file name
Returns
The modified file name
Note
All file names must be relative to the current working directory (typically, the application's executable path), but sometimes it is more convenient and maintainable to specify a path that is relative to the addon directory. This can be achieved by simply putting "|" in front of a file name, which will then be interpreted as relative to the addon directory. This function takes care of this transformation.

Definition at line 818 of file gui_region.cpp.

◆ parse_frames_node_()

void lxgui::gui::frame::parse_frames_node_ ( const layout_node node)
protectedvirtualinherited

Definition at line 389 of file gui_frame_parser.cpp.

◆ parse_hit_rect_insets_node_()

void lxgui::gui::frame::parse_hit_rect_insets_node_ ( const layout_node node)
protectedvirtualinherited

Definition at line 271 of file gui_frame_parser.cpp.

◆ parse_layers_node_()

void lxgui::gui::frame::parse_layers_node_ ( const layout_node node)
protectedvirtualinherited

Definition at line 342 of file gui_frame_parser.cpp.

◆ parse_layout()

void lxgui::gui::frame::parse_layout ( const layout_node node)
finalvirtualinherited

Parses data from a layout_node.

Parameters
nodeThe layout node
Note
Derived classes must override parse_all_nodes_before_children_() if they need to parse additional blocks, and parse_attributes_() if they need to parse additional attributes.

Reimplemented from lxgui::gui::region.

Definition at line 27 of file gui_frame_parser.cpp.

◆ parse_offset_node_()

vector2< std::optional< float > > lxgui::gui::region::parse_offset_node_ ( const layout_node node)
protectedinherited

Definition at line 24 of file gui_region_parser.cpp.

◆ parse_offset_node_or_()

vector2< float > lxgui::gui::region::parse_offset_node_or_ ( const layout_node node,
float  fallback 
)
protectedinherited

Definition at line 28 of file gui_region_parser.cpp.

◆ parse_region_()

utils::observer_ptr< layered_region > lxgui::gui::frame::parse_region_ ( const layout_node node,
const std::string &  layer_name,
const std::string &  type 
)
protectedinherited

Definition at line 306 of file gui_frame_parser.cpp.

◆ parse_resize_bounds_node_()

void lxgui::gui::frame::parse_resize_bounds_node_ ( const layout_node node)
protectedvirtualinherited

Definition at line 82 of file gui_frame_parser.cpp.

◆ parse_scripts_node_()

void lxgui::gui::frame::parse_scripts_node_ ( const layout_node node)
protectedvirtualinherited

Definition at line 397 of file gui_frame_parser.cpp.

◆ parse_size_node_()

void lxgui::gui::region::parse_size_node_ ( const layout_node node)
protectedvirtualinherited

Definition at line 65 of file gui_region_parser.cpp.

◆ parse_title_region_node_()

void lxgui::gui::frame::parse_title_region_node_ ( const layout_node node)
protectedvirtualinherited

Definition at line 124 of file gui_frame_parser.cpp.

◆ push()

void lxgui::gui::button::push ( )
virtual

Pushed this button.

Note
This function only has a visual impact: the OnClick() handler is not called.

Definition at line 362 of file gui_button.cpp.

◆ raise()

void lxgui::gui::frame::raise ( )
inherited

Increases this frame's level so it's the highest of the strata.

Note
All its children are raised of the same amount.
Only works for top level frames.

Definition at line 1286 of file gui_frame.cpp.

◆ read_anchors_()

void lxgui::gui::region::read_anchors_ ( float &  left,
float &  right,
float &  top,
float &  bottom,
float &  x_center,
float &  y_center 
) const
protectedinherited

Definition at line 614 of file gui_region.cpp.

◆ register_event()

void lxgui::gui::frame::register_event ( const std::string &  event_name)
inherited

Tells this frame to react to a certain event.

Parameters
event_nameThe name of the event

Definition at line 1131 of file gui_frame.cpp.

◆ register_on_lua()

static void lxgui::gui::button::register_on_lua ( sol::state &  lua)
static

Registers this region class to the provided Lua state.

◆ release()

void lxgui::gui::button::release ( )
virtual

Releases this button.

Note
This function only has a visual impact: the OnClick() handler is not called.

Reimplemented in lxgui::gui::check_button.

Definition at line 380 of file gui_button.cpp.

◆ release_from_parent()

utils::owner_ptr< region > lxgui::gui::frame::release_from_parent ( )
overridevirtualinherited

Removes this region from its parent and return an owning pointer.

Returns
An owning pointer to this region

Reimplemented from lxgui::gui::region.

Definition at line 1264 of file gui_frame.cpp.

◆ remove_anchored_object()

void lxgui::gui::region::remove_anchored_object ( region obj)
inherited

Notifies this region that another one is no longer anchored to it.

Parameters
objThe region no longer anchored
See also
add_anchored_object()

Definition at line 565 of file gui_region.cpp.

◆ remove_child()

utils::owner_ptr< frame > lxgui::gui::frame::remove_child ( const utils::observer_ptr< frame > &  child)
inherited

Removes a frame from this frame's children.

Parameters
childThe frame to remove
Returns
A unique_ptr to the child, ignore it to destroy the child.

Definition at line 690 of file gui_frame.cpp.

◆ remove_glue()

void lxgui::gui::region::remove_glue ( )
inherited

Removes the Lua glue.

Definition at line 775 of file gui_region.cpp.

◆ remove_region()

utils::owner_ptr< layered_region > lxgui::gui::frame::remove_region ( const utils::observer_ptr< layered_region > &  reg)
inherited

Removes a layered_region from this frame's children.

Parameters
regThe layered_region to remove
Returns
A unique_ptr to the region, ignore it to destroy the region.

Definition at line 617 of file gui_frame.cpp.

◆ remove_script()

void lxgui::gui::frame::remove_script ( const std::string &  script_name)
inherited

Removes a script from this frame.

Parameters
script_nameThe name of the script (e.g., "OnEvent")
Note
This removes all handler scripts registered to this event, including the ones inherited from templates.

Definition at line 1080 of file gui_frame.cpp.

◆ render()

void lxgui::gui::frame::render ( ) const
overridevirtualinherited

Renders this region on the current render target.

Reimplemented from lxgui::gui::region.

Definition at line 62 of file gui_frame.cpp.

◆ round_to_pixel() [1/2]

vector2f lxgui::gui::region::round_to_pixel ( const vector2f position,
utils::rounding_method  method = utils::rounding_method::nearest 
) const
inherited

Round an absolute position on screen to the nearest physical pixel.

Parameters
positionThe input absolute position (can be fractional)
methodThe rounding method
Returns
The position of the nearest physical pixel

Definition at line 578 of file gui_region.cpp.

◆ round_to_pixel() [2/2]

float lxgui::gui::region::round_to_pixel ( float  value,
utils::rounding_method  method = utils::rounding_method::nearest 
) const
inherited

Round an absolute position on screen to the nearest physical pixel.

Parameters
valueThe input absolute position (can be fractional)
methodThe rounding method
Returns
The position of the nearest physical pixel

Definition at line 573 of file gui_region.cpp.

◆ serialize()

std::string lxgui::gui::button::serialize ( const std::string &  tab) const
overridevirtual

Prints all relevant information about this region in a string.

Parameters
tabThe offset to give to all lines
Returns
All relevant information about this region

Reimplemented from lxgui::gui::region.

Reimplemented in lxgui::gui::check_button.

Definition at line 22 of file gui_button.cpp.

◆ set_abs_hit_rect_insets()

void lxgui::gui::frame::set_abs_hit_rect_insets ( const bounds2f insets)
inherited

Sets this frame's absolute hit rect insets.

Parameters
insetsOffsets
Note
This is the zone on which you can click.

Definition at line 1193 of file gui_frame.cpp.

◆ set_addon()

void lxgui::gui::region::set_addon ( const addon a)
inherited

Sets the addon this frame belongs to.

Parameters
aThe addon this frame belongs to

Definition at line 833 of file gui_region.cpp.

◆ set_all_anchors() [1/2]

void lxgui::gui::region::set_all_anchors ( const std::string &  obj_name)
inherited

Adjusts this regions anchors to fit the provided region.

Parameters
obj_nameThe name of the object to fit to
Note
Removes all anchors and defines two new ones.

Definition at line 404 of file gui_region.cpp.

◆ set_all_anchors() [2/2]

void lxgui::gui::region::set_all_anchors ( const utils::observer_ptr< region > &  obj)
inherited

Adjusts this regions anchors to fit the provided region.

Parameters
objA pointer to the object you want to wrap
Note
Removes all anchors and defines two new ones.

Definition at line 437 of file gui_region.cpp.

◆ set_alpha()

void lxgui::gui::region::set_alpha ( float  alpha)
inherited

Changes this region's alpha (opacity).

Parameters
alphaThe new alpha value
Note
Default is 1.0f.

Definition at line 169 of file gui_region.cpp.

◆ set_anchor() [1/2]

template<typename... Args>
void lxgui::gui::region::set_anchor ( Args &&...  args)
inlineinherited

Adds/replaces an anchor.

Parameters
argsArgument to construct a new anchor_data

Definition at line 503 of file gui_region.hpp.

◆ set_anchor() [2/2]

void lxgui::gui::region::set_anchor ( const anchor_data a)
inherited

Adds/replaces an anchor.

Parameters
aThe anchor to add

Definition at line 473 of file gui_region.cpp.

◆ set_backdrop()

void lxgui::gui::frame::set_backdrop ( std::unique_ptr< backdrop bdrop)
inherited

Sets this frames' backdrop.

Parameters
bdropThe new backdrop

Definition at line 1188 of file gui_frame.cpp.

◆ set_button_clicks_enabled() [1/2]

void lxgui::gui::button::set_button_clicks_enabled ( const std::string &  mouse_event,
bool  enable 
)
inline

Make this button generate OnClick events when a specific mouse event occurs over the button.

Parameters
mouse_eventThe mouse event for which to enable or disable OnClick events
enable'true' to enable, 'false' to disable
See also
enable_button_clicks()
disable_button_clicks()

Definition at line 379 of file gui_button.hpp.

◆ set_button_clicks_enabled() [2/2]

void lxgui::gui::button::set_button_clicks_enabled ( input::mouse_button  button_id,
input::mouse_button_event  button_event,
bool  enable 
)
inline

Make this button generate OnClick events when a specific mouse event occurs over the button.

Parameters
button_idThe mouse button for which to enable or disable OnClick events
button_eventThe mouse button event for which to enable or disable OnClick events
enable'true' to enable, 'false' to disable
See also
enable_button_clicks()
disable_button_clicks()

Definition at line 395 of file gui_button.hpp.

◆ set_clamped_to_screen()

void lxgui::gui::frame::set_clamped_to_screen ( bool  is_clamped_to_screen)
inherited

Sets if this frame is clamped to screen.

Parameters
is_clamped_to_screen'true' if this frame is clamped to screen
Note
If 'true', the frame can't go out of the screen.

Definition at line 1174 of file gui_frame.cpp.

◆ set_dimensions()

void lxgui::gui::frame::set_dimensions ( const vector2f dimensions)
overridevirtualinherited

Changes this region's absolute dimensions (in pixels).

Parameters
dimensionsThe new dimensions

Reimplemented from lxgui::gui::region.

Definition at line 345 of file gui_frame.cpp.

◆ set_disabled_text()

void lxgui::gui::button::set_disabled_text ( utils::observer_ptr< font_string fstr)

Sets this button's disabled text.

Parameters
fstrThe new text object

Definition at line 279 of file gui_button.cpp.

◆ set_disabled_texture()

void lxgui::gui::button::set_disabled_texture ( utils::observer_ptr< texture tex)

Sets this button's disabled texture.

Parameters
texThe new texture

Definition at line 239 of file gui_button.cpp.

◆ set_drag_enabled() [1/2]

void lxgui::gui::frame::set_drag_enabled ( const std::string &  button_name,
bool  enable 
)
inlineinherited

Tells this frame whether to react to mouse drag or not.

Parameters
button_nameThe mouse button to react to
enable'true' to enable, 'false' to disable

Definition at line 1391 of file gui_frame.hpp.

◆ set_drag_enabled() [2/2]

void lxgui::gui::frame::set_drag_enabled ( input::mouse_button  button_id,
bool  enable 
)
inlineinherited

Tells this frame whether to react to mouse drag or not.

Parameters
button_idThe mouse button to react to
enable'true' to enable, 'false' to disable

Definition at line 1404 of file gui_frame.hpp.

◆ set_draw_layer_enabled()

void lxgui::gui::frame::set_draw_layer_enabled ( layer  layer_id,
bool  enable 
)
inlineinherited

Enables or disables a layer.

Parameters
layer_idThe id of the layer to disable
enable'true' to enable, 'false' to disable

Definition at line 342 of file gui_frame.hpp.

◆ set_enabled()

void lxgui::gui::button::set_enabled ( bool  enabled)
inline

Enables or disables this button.

Parameters
enabled'true' to enable, 'false' to disable

Definition at line 278 of file gui_button.hpp.

◆ set_focus()

void lxgui::gui::frame::set_focus ( bool  focus)
inherited

Asks for focus for this frame.

Parameters
focus'true' to ask for focus, 'false' to release it
Note
Focus can be lost if another frame asks for focus later. The focus will be restored automatically when that other frame releases focus, or it can be requested again by calling set_focus(true).

Definition at line 1318 of file gui_frame.cpp.

◆ set_frame_renderer()

void lxgui::gui::frame::set_frame_renderer ( utils::observer_ptr< frame_renderer rdr)
inherited

Flags this object as rendered by another object.

Parameters
rdrThe object that will take care of rendering this region
Note
By default, objects are rendered by the gui::manager.
The renderer also takes care of providing inputs.
If the renderer is set to nullptr, the frame will inherit the renderer of its parent. If the frame has no parent, this will default to the gui::manager.

Definition at line 1398 of file gui_frame.cpp.

◆ set_height()

void lxgui::gui::frame::set_height ( float  abs_height)
overridevirtualinherited

Changes this region's absolute height (in pixels).

Parameters
abs_heightThe new height

Reimplemented from lxgui::gui::region.

Definition at line 355 of file gui_frame.cpp.

◆ set_highlight_text()

void lxgui::gui::button::set_highlight_text ( utils::observer_ptr< font_string fstr)

Sets this button's highlight text.

Parameters
fstrThe new text object

Definition at line 267 of file gui_button.cpp.

◆ set_highlight_texture()

void lxgui::gui::button::set_highlight_texture ( utils::observer_ptr< texture tex)

Sets this button's highlight texture.

Parameters
texThe new texture

Definition at line 247 of file gui_button.cpp.

◆ set_key_capture_enabled() [1/2]

void lxgui::gui::frame::set_key_capture_enabled ( const std::string &  key_name,
bool  enable 
)
inlineinherited

Marks this frame as able to receive keyboard input from a specific key.

Parameters
key_nameThe key to capture
enable'true' to enable, 'false' to disable
See also
enable_key_capture()
disable_key_capture()

Definition at line 486 of file gui_frame.hpp.

◆ set_key_capture_enabled() [2/2]

void lxgui::gui::frame::set_key_capture_enabled ( input::key  key_id,
bool  enable 
)
inlineinherited

Marks this frame as able to receive keyboard input from a specific key.

Parameters
key_idThe key to capture
enable'true' to enable, 'false' to disable
See also
enable_key_capture()
disable_key_capture()

Definition at line 501 of file gui_frame.hpp.

◆ set_keyboard_enabled()

void lxgui::gui::frame::set_keyboard_enabled ( bool  is_keyboard_enabled)
inherited

Sets if this frame can receive any keyboard input.

Parameters
is_keyboard_enabled'true' to enable
Note
If enabled, specific keys must be enabled for capture to actually receive keybaord events.
See also
is_keyboard_enabled()
enable_key_capture()
is_key_capture_enabled()
enable_keyboard()
disable_keyboard()

Definition at line 454 of file gui_frame.cpp.

◆ set_level()

void lxgui::gui::frame::set_level ( int  level_id)
inherited

Sets this frame's level.

Parameters
level_idThe new level

Definition at line 1201 of file gui_frame.cpp.

◆ set_lua_member_()

void lxgui::gui::region::set_lua_member_ ( std::string  key,
sol::stack_object  value 
)
protectedinherited

◆ set_manually_inherited()

void lxgui::gui::region::set_manually_inherited ( bool  manually_inherited)
inherited

Flags this region as manually inherited or not.

Note
By default, all regions are automatically inherited. This is generally the desired behavior for regions defined by the user, but it is less desirable for "special" or "internal" regions necessary for the proper operation of some region types (e.g., the texture used by a button), which need special treatment or registration.

Definition at line 780 of file gui_region.cpp.

◆ set_max_dimensions()

void lxgui::gui::frame::set_max_dimensions ( const vector2f max)
inherited

Sets this frame's maximum size.

Parameters
maxThe maximum dimensions of this frame

Definition at line 1212 of file gui_frame.cpp.

◆ set_max_height()

void lxgui::gui::frame::set_max_height ( float  max_height)
inherited

Sets this frame's maximum height.

Parameters
max_heightThe maximum height this frame can have

Definition at line 1222 of file gui_frame.cpp.

◆ set_max_width()

void lxgui::gui::frame::set_max_width ( float  max_width)
inherited

Sets this frame's maximum width.

Parameters
max_widthThe maximum width this frame can have

Definition at line 1233 of file gui_frame.cpp.

◆ set_min_dimensions()

void lxgui::gui::frame::set_min_dimensions ( const vector2f min)
inherited

Sets this frame's minimum size.

Parameters
minMinimum dimensions of this frame

Definition at line 1217 of file gui_frame.cpp.

◆ set_min_height()

void lxgui::gui::frame::set_min_height ( float  min_height)
inherited

Sets this frame's minimum height.

Parameters
min_heightThe minimum height this frame can have

Definition at line 1244 of file gui_frame.cpp.

◆ set_min_width()

void lxgui::gui::frame::set_min_width ( float  min_width)
inherited

Sets this frame's minimum width.

Parameters
min_widthThe minimum width this frame can have

Definition at line 1252 of file gui_frame.cpp.

◆ set_mouse_click_enabled()

void lxgui::gui::frame::set_mouse_click_enabled ( bool  is_mouse_enabled)
inherited

Sets if this frame can receive mouse click input.

Parameters
is_mouse_enabled'true' to enable

Definition at line 442 of file gui_frame.cpp.

◆ set_mouse_enabled()

void lxgui::gui::frame::set_mouse_enabled ( bool  is_mouse_enabled)
inherited

Sets if this frame can receive mouse input (click & move).

Parameters
is_mouse_enabled'true' to enable

Definition at line 437 of file gui_frame.cpp.

◆ set_mouse_move_enabled()

void lxgui::gui::frame::set_mouse_move_enabled ( bool  is_mouse_enabled)
inherited

Sets if this frame can receive mouse move input.

Parameters
is_mouse_enabled'true' to enable

Definition at line 446 of file gui_frame.cpp.

◆ set_mouse_wheel_enabled()

void lxgui::gui::frame::set_mouse_wheel_enabled ( bool  is_mouse_wheel_enabled)
inherited

Sets if this frame can receive mouse wheel input.

Parameters
is_mouse_wheel_enabled'true' to enable

Definition at line 450 of file gui_frame.cpp.

◆ set_movable()

void lxgui::gui::frame::set_movable ( bool  is_movable)
inherited

Sets if this frame can be moved by the user.

Parameters
is_movable'true' to allow the user to move this frame

Definition at line 1260 of file gui_frame.cpp.

◆ set_name_()

void lxgui::gui::region::set_name_ ( const std::string &  name)
protectedinherited

Sets this region's name.

Parameters
nameThis region's name
Note
Can only be called once. If you need to set both the name and the parent at the same time (typically, at creation), use set_name_and_parent_().

Definition at line 294 of file gui_region.cpp.

◆ set_normal_text()

void lxgui::gui::button::set_normal_text ( utils::observer_ptr< font_string fstr)

Sets this button's normal text.

Parameters
fstrThe new text object

Definition at line 255 of file gui_button.cpp.

◆ set_normal_texture()

void lxgui::gui::button::set_normal_texture ( utils::observer_ptr< texture tex)

Sets this button's normal texture.

Parameters
texThe new texture

Definition at line 223 of file gui_button.cpp.

◆ set_parent_()

void lxgui::gui::frame::set_parent_ ( utils::observer_ptr< frame parent)
overrideprotectedvirtualinherited

Changes this region's parent.

Parameters
parentThe new parent
Note
Default is nullptr.

Reimplemented from lxgui::gui::region.

Definition at line 513 of file gui_frame.cpp.

◆ set_pushed_text_offset()

void lxgui::gui::button::set_pushed_text_offset ( const vector2f offset)

Sets this button's pushed text offset.

Parameters
offsetThe pushed text offset

Definition at line 490 of file gui_button.cpp.

◆ set_pushed_texture()

void lxgui::gui::button::set_pushed_texture ( utils::observer_ptr< texture tex)

Sets this button's pushed texture.

Parameters
texThe new texture

Definition at line 231 of file gui_button.cpp.

◆ set_rel_hit_rect_insets()

void lxgui::gui::frame::set_rel_hit_rect_insets ( const bounds2f insets)
inherited

Sets this frame's relative hit rect insets.

Parameters
insetsOffsets
Note
This is the zone on which you can click.

Definition at line 1197 of file gui_frame.cpp.

◆ set_relative_dimensions()

void lxgui::gui::region::set_relative_dimensions ( const vector2f dimensions)
inherited

Changes this region's dimensions (relative to its parent).

Parameters
dimensionsThe new dimensions (relative)

Definition at line 251 of file gui_region.cpp.

◆ set_relative_height()

void lxgui::gui::region::set_relative_height ( float  rel_height)
inherited

Changes this region's height (relative to its parent).

Parameters
rel_heightThe new height

Definition at line 265 of file gui_region.cpp.

◆ set_relative_width()

void lxgui::gui::region::set_relative_width ( float  rel_width)
inherited

Changes this region's width (relative to its parent).

Parameters
rel_widthThe new width

Definition at line 258 of file gui_region.cpp.

◆ set_resizable()

void lxgui::gui::frame::set_resizable ( bool  is_resizable)
inherited

Sets if this frame can be resized by the user.

Parameters
is_resizable'true' to allow the user to resize this frame

Definition at line 1272 of file gui_frame.cpp.

◆ set_scale()

void lxgui::gui::frame::set_scale ( float  scale)
inherited

Sets this frame's scale.

Parameters
scaleThe new scale

Definition at line 1276 of file gui_frame.cpp.

◆ set_script() [1/4]

template<typename DerivedType = void, typename Function >
utils::connection lxgui::gui::frame::set_script ( const std::string &  script_name,
Function &&  handler,
script_info  info = script_info{} 
)
inlineinherited

Sets a new handler script for this frame (replacing existing scripts).

Parameters
script_nameThe name of the script (e.g., "OnEvent")
handlerThe handler of the script, as a C++ function of signature script_signature
infoThe location where this script has been defined
Returns
A connection object, to disable the script if needed.
Note
This defines a C++ function to be called for the event specified in script_name. This provides the best performance, but lacks direct access to the Lua environment. If this is required, prefer the other overload taking a Lua function instead.
This overload enables taking handler scripts with a self parameter of type other than frame, for example:
add_script([](button& self, const event_data& data) { ... });
For maximum safety, by default this is done using a dynamic_cast, so that incorrect types will be reported. However this has a cost; if you are sure of the type and want to bypass this cost, just supply the self type as the first template argument to this function:
add_script<button>([](button& self, const event_data& data) { ... });

Definition at line 1305 of file gui_frame.hpp.

◆ set_script() [2/4]

utils::connection lxgui::gui::frame::set_script ( const std::string &  script_name,
script_function  handler,
script_info  info = script_info{} 
)
inlineinherited

Sets a new handler script for this frame (replacing existing scripts).

Parameters
script_nameThe name of the script (e.g., "OnEvent")
handlerThe handler of the script, as a C++ function of signature script_signature
infoThe location where this script has been defined
Returns
A connection object, to disable the script if needed.
Note
This defines a C++ function to be called for the event specified in script_name. This provides the best performance, but lacks direct access to the Lua environment. If this is required, prefer the other overload taking a Lua function instead.

Definition at line 1273 of file gui_frame.hpp.

◆ set_script() [3/4]

utils::connection lxgui::gui::frame::set_script ( const std::string &  script_name,
sol::protected_function  handler,
script_info  info = script_info{} 
)
inlineinherited

Sets a new handler script for this frame (replacing existing scripts).

Parameters
script_nameThe name of the script (e.g., "OnEvent")
handlerThe handler of the script, as a Lua function
infoThe location where this script has been defined
Returns
A connection object, to disable the script if needed.
Note
This defines a Lua function to be called for the event specified in script_name. This provides more flexibility compared to using C++ function, but also has a larger overhead. If performance is a concern, prefer the other overload taking a C++ function instead.

Definition at line 1252 of file gui_frame.hpp.

◆ set_script() [4/4]

utils::connection lxgui::gui::frame::set_script ( const std::string &  script_name,
std::string  content,
script_info  info = script_info{} 
)
inlineinherited

Sets a new handler script for this frame (replacing existing scripts).

Parameters
script_nameThe name of the script (e.g., "OnEvent")
contentThe content of the script, as Lua code
infoThe location where this script has been defined
Returns
A connection object, to disable the script if needed.
Note
The script_info parameter is used only for displaying error messages. This function is meant to be used by the layout file parser. If you want to manually define your own script handlers, prefer the other overloads.

Definition at line 1233 of file gui_frame.hpp.

◆ set_shown()

void lxgui::gui::region::set_shown ( bool  is_shown)
inherited

shows/hides this region.

Parameters
is_shown'true' if you want to show this region
Note
See show() and hide() for more information.

Definition at line 196 of file gui_region.cpp.

◆ set_strata()

void lxgui::gui::frame::set_strata ( std::optional< strata strata_id)
inherited

Sets this frame's strata.

Parameters
strata_idThe new strata, or nullopt to inherit strata from parent

Definition at line 1178 of file gui_frame.cpp.

◆ set_text()

void lxgui::gui::button::set_text ( const utils::ustring &  content)

Sets this button's text.

Parameters
contentThe new text

Definition at line 206 of file gui_button.cpp.

◆ set_top_level()

void lxgui::gui::frame::set_top_level ( bool  is_top_level)
inherited

Sets if this frame is at top level.

Parameters
is_top_level'true' to put the frame at top level
Note
A top-level frame will be raised to the foreground if it or any of its children are clicked. This should typically be set to 'true' for any "dialog" or "window" frame, which can be moved around, and not for "element" frames (buttons, etc.).

Definition at line 1282 of file gui_frame.cpp.

◆ set_update_rate()

void lxgui::gui::frame::set_update_rate ( float  rate)
inherited

Sets a maximum update rate (in updates per seconds).

Parameters
rateThe new rate, or 0 to update as often as possible
Note
The default is 0, which means the frame will be updated on each frame. If set to a value of 10, then the frame will be updated a maximum of 10 times per second. This can be useful to avoid wasting time updating a frame constantly, when less frequent updates would be sufficient.
Warning
Because update is triggered from parent to child, a frame's update rate will never be greater than that of its parent, even if this function is used to set the rate to a larger value.

Definition at line 1146 of file gui_frame.cpp.

◆ set_user_placed()

void lxgui::gui::frame::set_user_placed ( bool  is_user_placed)
inherited

Sets if this frame has been moved by the user.

Parameters
is_user_placed'true' if this frame has been moved by the user

Definition at line 1355 of file gui_frame.cpp.

◆ set_virtual_()

void lxgui::gui::region::set_virtual_ ( )
protectedinherited

Makes this region virtual.

Note
See is_virtual().

Definition at line 557 of file gui_region.cpp.

◆ set_width()

void lxgui::gui::frame::set_width ( float  abs_width)
overridevirtualinherited

Changes this region's absolute width (in pixels).

Parameters
abs_widthThe new width

Reimplemented from lxgui::gui::region.

Definition at line 351 of file gui_frame.cpp.

◆ show()

void lxgui::gui::region::show ( )
inherited

shows this region.

Note
Its parent must be shown for it to appear on the screen.

Definition at line 176 of file gui_region.cpp.

◆ start_moving()

void lxgui::gui::frame::start_moving ( )
inherited

Starts moving this frame with the mouse.

Definition at line 1359 of file gui_frame.cpp.

◆ start_sizing()

void lxgui::gui::frame::start_sizing ( const point p)
inherited

Starts resizing this frame with the mouse.

Parameters
pThe corner to move

Definition at line 1372 of file gui_frame.cpp.

◆ stop_moving()

void lxgui::gui::frame::stop_moving ( )
inherited

ends moving this frame.

Definition at line 1367 of file gui_frame.cpp.

◆ stop_sizing()

void lxgui::gui::frame::stop_sizing ( )
inherited

ends resizing this frame.

Definition at line 1380 of file gui_frame.cpp.

◆ unlight()

void lxgui::gui::button::unlight ( )
virtual

Unlights this button.

Note
The button will be unlighted even if the mouse is over it. It will highlight again when the mouse leaves then enters its region.

Definition at line 449 of file gui_button.cpp.

◆ unlock_highlight()

void lxgui::gui::button::unlock_highlight ( )

Unlocks this button's highlighting.

Definition at line 483 of file gui_button.cpp.

◆ unregister_event()

void lxgui::gui::frame::unregister_event ( const std::string &  event_name)
inherited

Tells the frame not to react to a certain event.

Parameters
event_nameThe name of the event

Definition at line 1139 of file gui_frame.cpp.

◆ update()

void lxgui::gui::frame::update ( float  delta)
finalvirtualinherited

Updates this region's logic.

Parameters
deltaTime spent since last update
Note
Triggered callbacks could destroy the frame. If you need to use the frame again after calling this function, use the helper class alive_checker.

Reimplemented from lxgui::gui::region.

Definition at line 1543 of file gui_frame.cpp.

◆ update_()

void lxgui::gui::frame::update_ ( float  delta)
protectedvirtualinherited

Reimplemented in lxgui::gui::scroll_frame, and lxgui::gui::edit_box.

Definition at line 1561 of file gui_frame.cpp.

◆ update_borders_()

void lxgui::gui::frame::update_borders_ ( )
overrideprotectedvirtualinherited

Reimplemented from lxgui::gui::region.

Definition at line 1519 of file gui_frame.cpp.

Member Data Documentation

◆ abs_hit_rect_inset_list_

bounds2f lxgui::gui::frame::abs_hit_rect_inset_list_ = bounds2f::zero
protectedinherited

Definition at line 1833 of file gui_frame.hpp.

◆ addon_

const addon* lxgui::gui::region::addon_ = nullptr
protectedinherited

Definition at line 802 of file gui_region.hpp.

◆ alpha_

float lxgui::gui::region::alpha_ = 1.0f
protectedinherited

Definition at line 818 of file gui_region.hpp.

◆ anchor_list_

std::array<std::optional<anchor>, 9> lxgui::gui::region::anchor_list_
protectedinherited

Definition at line 814 of file gui_region.hpp.

◆ anchored_object_list_

std::vector<utils::observer_ptr<region> > lxgui::gui::region::anchored_object_list_
protectedinherited

Definition at line 824 of file gui_region.hpp.

◆ backdrop_

std::unique_ptr<backdrop> lxgui::gui::frame::backdrop_
protectedinherited

Definition at line 1822 of file gui_frame.hpp.

◆ borders_

bounds2f lxgui::gui::region::borders_
protectedinherited

Definition at line 816 of file gui_region.hpp.

◆ child_list_

child_list lxgui::gui::frame::child_list_
protectedinherited

Definition at line 1801 of file gui_frame.hpp.

◆ class_name

constexpr const char* lxgui::gui::button::class_name = "Button"
staticconstexpr

Definition at line 468 of file gui_button.hpp.

◆ content_

utils::ustring lxgui::gui::button::content_
protected

Definition at line 485 of file gui_button.hpp.

◆ current_font_string_

utils::observer_ptr<font_string> lxgui::gui::button::current_font_string_ = nullptr
protected

Definition at line 495 of file gui_button.hpp.

◆ defined_borders_

bounds2<bool> lxgui::gui::region::defined_borders_
protectedinherited

Definition at line 815 of file gui_region.hpp.

◆ dimensions_

vector2f lxgui::gui::region::dimensions_
protectedinherited

Definition at line 822 of file gui_region.hpp.

◆ disabled_text_

utils::observer_ptr<font_string> lxgui::gui::button::disabled_text_ = nullptr
protected

Definition at line 494 of file gui_button.hpp.

◆ disabled_texture_

utils::observer_ptr<texture> lxgui::gui::button::disabled_texture_ = nullptr
protected

Definition at line 489 of file gui_button.hpp.

◆ effective_frame_renderer_

utils::observer_ptr<frame_renderer> lxgui::gui::frame::effective_frame_renderer_ = nullptr
protectedinherited

Definition at line 1820 of file gui_frame.hpp.

◆ effective_strata_

strata lxgui::gui::frame::effective_strata_ = strata::medium
protectedinherited

Definition at line 1816 of file gui_frame.hpp.

◆ event_receiver_

event_receiver lxgui::gui::frame::event_receiver_
protectedinherited

Definition at line 1809 of file gui_frame.hpp.

◆ frame_renderer_

utils::observer_ptr<frame_renderer> lxgui::gui::frame::frame_renderer_ = nullptr
protectedinherited

Definition at line 1819 of file gui_frame.hpp.

◆ highlight_text_

utils::observer_ptr<font_string> lxgui::gui::button::highlight_text_ = nullptr
protected

Definition at line 493 of file gui_button.hpp.

◆ highlight_texture_

utils::observer_ptr<texture> lxgui::gui::button::highlight_texture_ = nullptr
protected

Definition at line 490 of file gui_button.hpp.

◆ is_auto_focus_

bool lxgui::gui::frame::is_auto_focus_ = false
protectedinherited

Definition at line 1851 of file gui_frame.hpp.

◆ is_clamped_to_screen_

bool lxgui::gui::frame::is_clamped_to_screen_ = false
protectedinherited

Definition at line 1829 of file gui_frame.hpp.

◆ is_focused_

bool lxgui::gui::frame::is_focused_ = false
protectedinherited

Definition at line 1850 of file gui_frame.hpp.

◆ is_highlight_locked_

bool lxgui::gui::button::is_highlight_locked_ = false
protected

Definition at line 483 of file gui_button.hpp.

◆ is_highlighted_

bool lxgui::gui::button::is_highlighted_ = false
protected

Definition at line 482 of file gui_button.hpp.

◆ is_keyboard_enabled_

bool lxgui::gui::frame::is_keyboard_enabled_ = false
protectedinherited

Definition at line 1827 of file gui_frame.hpp.

◆ is_loaded_

bool lxgui::gui::region::is_loaded_ = false
protectedinherited

Definition at line 811 of file gui_region.hpp.

◆ is_manually_inherited_

bool lxgui::gui::region::is_manually_inherited_ = false
protectedinherited

Definition at line 809 of file gui_region.hpp.

◆ is_mouse_click_enabled_

bool lxgui::gui::frame::is_mouse_click_enabled_ = false
protectedinherited

Definition at line 1824 of file gui_frame.hpp.

◆ is_mouse_in_frame_

bool lxgui::gui::frame::is_mouse_in_frame_ = false
protectedinherited

Definition at line 1846 of file gui_frame.hpp.

◆ is_mouse_move_enabled_

bool lxgui::gui::frame::is_mouse_move_enabled_ = false
protectedinherited

Definition at line 1825 of file gui_frame.hpp.

◆ is_mouse_wheel_enabled_

bool lxgui::gui::frame::is_mouse_wheel_enabled_ = false
protectedinherited

Definition at line 1826 of file gui_frame.hpp.

◆ is_movable_

bool lxgui::gui::frame::is_movable_ = false
protectedinherited

Definition at line 1828 of file gui_frame.hpp.

◆ is_resizable_

bool lxgui::gui::frame::is_resizable_ = false
protectedinherited

Definition at line 1830 of file gui_frame.hpp.

◆ is_shown_

bool lxgui::gui::region::is_shown_ = true
protectedinherited

Definition at line 819 of file gui_region.hpp.

◆ is_top_level_

bool lxgui::gui::frame::is_top_level_ = false
protectedinherited

Definition at line 1817 of file gui_frame.hpp.

◆ is_user_placed_

bool lxgui::gui::frame::is_user_placed_ = false
protectedinherited

Definition at line 1831 of file gui_frame.hpp.

◆ is_valid_

bool lxgui::gui::region::is_valid_ = true
protectedinherited

Definition at line 812 of file gui_region.hpp.

◆ is_virtual_

bool lxgui::gui::region::is_virtual_ = false
protectedinherited

Definition at line 810 of file gui_region.hpp.

◆ is_visible_

bool lxgui::gui::region::is_visible_ = true
protectedinherited

Definition at line 820 of file gui_region.hpp.

◆ layer_list_

std::array<layer_container, num_layers> lxgui::gui::frame::layer_list_
protectedinherited

Definition at line 1806 of file gui_frame.hpp.

◆ level_

int lxgui::gui::frame::level_ = 0
protectedinherited

Definition at line 1814 of file gui_frame.hpp.

◆ manager_

manager& lxgui::gui::region::manager_
protectedinherited

Definition at line 800 of file gui_region.hpp.

◆ max_height_

float lxgui::gui::frame::max_height_ = std::numeric_limits<float>::infinity()
protectedinherited

Definition at line 1839 of file gui_frame.hpp.

◆ max_width_

float lxgui::gui::frame::max_width_ = std::numeric_limits<float>::infinity()
protectedinherited

Definition at line 1837 of file gui_frame.hpp.

◆ min_height_

float lxgui::gui::frame::min_height_ = 0.0f
protectedinherited

Definition at line 1838 of file gui_frame.hpp.

◆ min_width_

float lxgui::gui::frame::min_width_ = 0.0f
protectedinherited

Definition at line 1836 of file gui_frame.hpp.

◆ name_

std::string lxgui::gui::region::name_
protectedinherited

Definition at line 804 of file gui_region.hpp.

◆ normal_text_

utils::observer_ptr<font_string> lxgui::gui::button::normal_text_ = nullptr
protected

Definition at line 492 of file gui_button.hpp.

◆ normal_texture_

utils::observer_ptr<texture> lxgui::gui::button::normal_texture_ = nullptr
protected

Definition at line 487 of file gui_button.hpp.

◆ num_layers

constexpr std::size_t lxgui::gui::frame::num_layers = magic_enum::enum_count<layer>()
staticconstexprprotectedinherited

Definition at line 1804 of file gui_frame.hpp.

◆ parent_

utils::observer_ptr<frame> lxgui::gui::region::parent_ = nullptr
protectedinherited

Definition at line 807 of file gui_region.hpp.

◆ pushed_text_offset_

vector2f lxgui::gui::button::pushed_text_offset_ = vector2f::zero
protected

Definition at line 497 of file gui_button.hpp.

◆ pushed_texture_

utils::observer_ptr<texture> lxgui::gui::button::pushed_texture_ = nullptr
protected

Definition at line 488 of file gui_button.hpp.

◆ raw_name_

std::string lxgui::gui::region::raw_name_
protectedinherited

Definition at line 805 of file gui_region.hpp.

◆ reg_click_list_

std::set<std::string> lxgui::gui::button::reg_click_list_
protected

Definition at line 499 of file gui_button.hpp.

◆ reg_drag_list_

std::set<std::string> lxgui::gui::frame::reg_drag_list_
protectedinherited

Definition at line 1811 of file gui_frame.hpp.

◆ reg_key_list_

std::set<std::string> lxgui::gui::frame::reg_key_list_
protectedinherited

Definition at line 1812 of file gui_frame.hpp.

◆ region_list_

region_list lxgui::gui::frame::region_list_
protectedinherited

Definition at line 1802 of file gui_frame.hpp.

◆ rel_hit_rect_inset_list_

bounds2f lxgui::gui::frame::rel_hit_rect_inset_list_ = bounds2f::zero
protectedinherited

Definition at line 1834 of file gui_frame.hpp.

◆ scale_

float lxgui::gui::frame::scale_ = 1.0f
protectedinherited

Definition at line 1841 of file gui_frame.hpp.

◆ signal_list_

std::unordered_map<std::string, script_signal> lxgui::gui::frame::signal_list_
protectedinherited

Definition at line 1808 of file gui_frame.hpp.

◆ state_

state lxgui::gui::button::state_ = state::up
protected

Definition at line 481 of file gui_button.hpp.

◆ strata_

std::optional<strata> lxgui::gui::frame::strata_
protectedinherited

Definition at line 1815 of file gui_frame.hpp.

◆ time_since_last_update_

float lxgui::gui::frame::time_since_last_update_ = std::numeric_limits<float>::infinity()
protectedinherited

Definition at line 1844 of file gui_frame.hpp.

◆ title_region_

utils::owner_ptr<region> lxgui::gui::frame::title_region_ = nullptr
protectedinherited

Definition at line 1848 of file gui_frame.hpp.

◆ update_rate_

float lxgui::gui::frame::update_rate_ = 0.0f
protectedinherited

Definition at line 1843 of file gui_frame.hpp.


The documentation for this class was generated from the following files: