diff options
author | kobewi <kobewi4e@gmail.com> | 2022-08-22 13:08:57 +0200 |
---|---|---|
committer | kobewi <kobewi4e@gmail.com> | 2022-09-01 22:13:46 +0200 |
commit | 73929bef735c1bcf38b8db71426461ea00f61852 (patch) | |
tree | 67a1dfb441d40c373011a3beda23f56cd3491e2f /scene/gui/flow_container.cpp | |
parent | 8c7be63588bf3e4ef4b780ff57936c68db5939c7 (diff) |
Rework oriented containers
Diffstat (limited to 'scene/gui/flow_container.cpp')
-rw-r--r-- | scene/gui/flow_container.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/scene/gui/flow_container.cpp b/scene/gui/flow_container.cpp index ca230b8e81..b0d15aa7f4 100644 --- a/scene/gui/flow_container.cpp +++ b/scene/gui/flow_container.cpp @@ -272,14 +272,36 @@ void FlowContainer::_notification(int p_what) { } } +void FlowContainer::_validate_property(PropertyInfo &p_property) const { + if (is_fixed && p_property.name == "vertical") { + p_property.usage = PROPERTY_USAGE_NONE; + } +} + int FlowContainer::get_line_count() const { return cached_line_count; } +void FlowContainer::set_vertical(bool p_vertical) { + ERR_FAIL_COND_MSG(is_fixed, "Can't change orientation of " + get_class() + "."); + vertical = p_vertical; + update_minimum_size(); + _resort(); +} + +bool FlowContainer::is_vertical() const { + return vertical; +} + FlowContainer::FlowContainer(bool p_vertical) { vertical = p_vertical; } void FlowContainer::_bind_methods() { ClassDB::bind_method(D_METHOD("get_line_count"), &FlowContainer::get_line_count); + + ClassDB::bind_method(D_METHOD("set_vertical", "vertical"), &FlowContainer::set_vertical); + ClassDB::bind_method(D_METHOD("is_vertical"), &FlowContainer::is_vertical); + + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "vertical"), "set_vertical", "is_vertical"); } |