1 #include "lxgui/gui_scroll_frame.hpp"
3 #include "lxgui/gui_alive_checker.hpp"
4 #include "lxgui/gui_frame.hpp"
5 #include "lxgui/gui_manager.hpp"
6 #include "lxgui/gui_out.hpp"
7 #include "lxgui/gui_region_tpl.hpp"
8 #include "lxgui/gui_render_target.hpp"
9 #include "lxgui/gui_renderer.hpp"
10 #include "lxgui/gui_texture.hpp"
16 frame(block, mgr, attr) {
33 script_name ==
"OnScrollRangeChanged" || script_name ==
"OnVerticalScroll";
45 if (script_name ==
"OnSizeChanged") {
57 const scroll_frame* scroll_obj = down_cast<scroll_frame>(&obj);
67 attr.
name = other_child->get_raw_name();
70 utils::observer_ptr<frame> scroll_child =
create_child(std::move(attr));
73 scroll_child->set_manually_inherited(
true);
74 scroll_child->notify_loaded();
87 create_layered_region<texture>(
layer::artwork,
"$parentScrollTexture");
92 scroll_texture->set_manually_inherited(
true);
98 scroll_texture->notify_loaded();
223 if (apparent_size.
x <= 0 || apparent_size.
y <= 0)
228 vector2ui(std::round(apparent_size.
x * factor), std::round(apparent_size.
y * factor));
232 scroll_texture_->set_tex_rect(std::array<float, 4>{0.0f, 0.0f, 1.0f, 1.0f});
270 utils::observer_ptr<const frame>
274 return hovered_frame;
292 return get_type_list_impl_<scroll_frame>();
Utility class for safe checking of region validity.
bool is_alive() const
Check if the wrapped region is still alive.
Stores a variable number of arguments for an event.
virtual void notify_strata_needs_redraw(strata strata_id)
Tells this renderer that one of its region requires redraw.
void render_strata_(const strata_data &strata_obj) const
std::array< strata_data, num_strata > strata_list_
utils::observer_ptr< const frame > find_topmost_frame(const std::function< bool(const frame &)> &predicate) const
Find the top-most frame matching the provided predicate.
void clear_strata_list_()
A region that can contain other regions and react to events.
utils::observer_ptr< frame > add_child(utils::owner_ptr< frame > child)
Adds a frame to this frame's children.
void copy_from(const region &obj) override
Copies a region's parameters into this frame (inheritance).
virtual void fire_script(const std::string &script_name, const event_data &data=event_data{})
Calls a script.
virtual void update_(float delta)
void notify_renderer_need_redraw() override
Notifies the renderer of this region that it needs to be redrawn.
virtual bool can_use_script(const std::string &script_name) const
Returns 'true' if this frame can use a script.
utils::owner_ptr< frame > remove_child(const utils::observer_ptr< frame > &child)
Removes a frame from this frame's children.
utils::observer_ptr< frame > create_child(frame_core_attributes attr)
Creates a new frame as child of this frame.
virtual utils::observer_ptr< const frame > find_topmost_frame(const std::function< bool(const frame &)> &predicate) const
Find the topmost frame matching the provided predicate.
void notify_scaling_factor_updated() override
Tells this region that the global interface scaling factor has changed.
Manages the user interface.
float get_interface_scaling_factor() const
Returns the current UI scaling factor.
const renderer & get_renderer() const
Returns the renderer implementation.
The base class of all elements in the GUI.
const bounds2f & get_borders() const
Returns this region's borders.
void initialize_(T &self, const region_core_attributes &attr)
Set up function to call in all derived class constructors.
bool is_virtual() const
Checks if this region is virtual.
bool is_visible() const
Checks if this region can be seen on the screen.
manager & get_manager()
Returns this region's manager.
vector2f get_apparent_dimensions() const
Returns this region's apparent width and height (in pixels).
const std::string & get_name() const
Returns this region's name.
bool is_loaded() const
Checks if this region has been fully loaded.
Abstract type for implementation specific management.
void set_view(const matrix4f &view_matrix)
Sets the view matrix to use when rendering (viewport).
void end()
Ends rendering.
virtual std::shared_ptr< render_target > create_render_target(const vector2ui &dimensions, material::filter filt=material::filter::none)=0
Creates a new render target.
void begin(std::shared_ptr< render_target > target=nullptr)
Begins rendering on a particular render target.
void disconnect() noexcept
Disconnect the slot.
vector2< float > vector2f
Holds 2D coordinates (as floats)
utils::observer_ptr< ObjectType > observer_from(ObjectType *self)
Obtain an observer pointer from a raw pointer (typically 'this')
vector2< std::size_t > vector2ui
Holds 2D coordinates (as unsigned integers)
oup::observable_sealed_ptr< T > owner_ptr
Struct holding all the core information about a frame necessary for its creation.
static matrix4f translation(const vector2f &dx) noexcept
static matrix4f view(const vector2f &window) noexcept
std::vector< utils::observer_ptr< const region > > inheritance