summaryrefslogtreecommitdiff
path: root/scene/gui/tab_container.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui/tab_container.cpp')
-rw-r--r--scene/gui/tab_container.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index ff53d91ea3..fd5df5c93b 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -406,14 +406,14 @@ void TabContainer::_notification(int p_what) {
}
// Find the offset at which to draw tabs, according to the alignment.
- switch (align) {
- case ALIGN_LEFT:
+ switch (alignment) {
+ case ALIGNMENT_LEFT:
tabs_ofs_cache = header_x;
break;
- case ALIGN_CENTER:
+ case ALIGNMENT_CENTER:
tabs_ofs_cache = header_x + (header_width / 2) - (all_tabs_width / 2);
break;
- case ALIGN_RIGHT:
+ case ALIGNMENT_RIGHT:
tabs_ofs_cache = header_x + header_width - all_tabs_width;
break;
}
@@ -561,7 +561,7 @@ void TabContainer::_draw_tab(Ref<StyleBox> &p_tab_style, Color &p_font_color, in
if (icon.is_valid()) {
int y = y_center - (icon->get_height() / 2);
icon->draw(canvas, Point2i(x_content, y));
- if (text != "") {
+ if (!text.is_empty()) {
x_content += icon->get_width() + icon_text_distance;
}
}
@@ -600,7 +600,7 @@ void TabContainer::_on_theme_changed() {
_refresh_texts();
- minimum_size_changed();
+ update_minimum_size();
if (get_tab_count() > 0) {
_repaint();
update();
@@ -656,7 +656,7 @@ int TabContainer::_get_tab_width(int p_index) const {
Ref<Texture2D> icon = control->get_meta("_tab_icon");
if (icon.is_valid()) {
width += icon->get_width();
- if (text != "") {
+ if (!text.is_empty()) {
width += get_theme_constant(SNAME("icon_separation"));
}
}
@@ -967,14 +967,14 @@ int TabContainer::get_tab_idx_at_point(const Point2 &p_point) const {
return -1;
}
-void TabContainer::set_tab_align(TabAlign p_align) {
- ERR_FAIL_INDEX(p_align, 3);
- align = p_align;
+void TabContainer::set_tab_alignment(AlignmentMode p_alignment) {
+ ERR_FAIL_INDEX(p_alignment, 3);
+ alignment = p_alignment;
update();
}
-TabContainer::TabAlign TabContainer::get_tab_align() const {
- return align;
+TabContainer::AlignmentMode TabContainer::get_tab_alignment() const {
+ return alignment;
}
void TabContainer::set_tabs_visible(bool p_visible) {
@@ -995,7 +995,7 @@ void TabContainer::set_tabs_visible(bool p_visible) {
}
update();
- minimum_size_changed();
+ update_minimum_size();
}
bool TabContainer::are_tabs_visible() const {
@@ -1108,7 +1108,7 @@ void TabContainer::get_translatable_strings(List<String> *p_strings) const {
String name = c->get_meta("_tab_name");
- if (name != "") {
+ if (!name.is_empty()) {
p_strings->push_back(name);
}
}
@@ -1198,8 +1198,8 @@ void TabContainer::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_previous_tab"), &TabContainer::get_previous_tab);
ClassDB::bind_method(D_METHOD("get_current_tab_control"), &TabContainer::get_current_tab_control);
ClassDB::bind_method(D_METHOD("get_tab_control", "tab_idx"), &TabContainer::get_tab_control);
- ClassDB::bind_method(D_METHOD("set_tab_align", "align"), &TabContainer::set_tab_align);
- ClassDB::bind_method(D_METHOD("get_tab_align"), &TabContainer::get_tab_align);
+ ClassDB::bind_method(D_METHOD("set_tab_alignment", "alignment"), &TabContainer::set_tab_alignment);
+ ClassDB::bind_method(D_METHOD("get_tab_alignment"), &TabContainer::get_tab_alignment);
ClassDB::bind_method(D_METHOD("set_tabs_visible", "visible"), &TabContainer::set_tabs_visible);
ClassDB::bind_method(D_METHOD("are_tabs_visible"), &TabContainer::are_tabs_visible);
ClassDB::bind_method(D_METHOD("set_all_tabs_in_front", "is_front"), &TabContainer::set_all_tabs_in_front);
@@ -1230,16 +1230,16 @@ void TabContainer::_bind_methods() {
ADD_SIGNAL(MethodInfo("tab_selected", PropertyInfo(Variant::INT, "tab")));
ADD_SIGNAL(MethodInfo("pre_popup_pressed"));
- ADD_PROPERTY(PropertyInfo(Variant::INT, "tab_align", PROPERTY_HINT_ENUM, "Left,Center,Right"), "set_tab_align", "get_tab_align");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "tab_alignment", PROPERTY_HINT_ENUM, "Left,Center,Right"), "set_tab_alignment", "get_tab_alignment");
ADD_PROPERTY(PropertyInfo(Variant::INT, "current_tab", PROPERTY_HINT_RANGE, "-1,4096,1", PROPERTY_USAGE_EDITOR), "set_current_tab", "get_current_tab");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "tabs_visible"), "set_tabs_visible", "are_tabs_visible");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "all_tabs_in_front"), "set_all_tabs_in_front", "is_all_tabs_in_front");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "drag_to_rearrange_enabled"), "set_drag_to_rearrange_enabled", "get_drag_to_rearrange_enabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_hidden_tabs_for_min_size"), "set_use_hidden_tabs_for_min_size", "get_use_hidden_tabs_for_min_size");
- BIND_ENUM_CONSTANT(ALIGN_LEFT);
- BIND_ENUM_CONSTANT(ALIGN_CENTER);
- BIND_ENUM_CONSTANT(ALIGN_RIGHT);
+ BIND_ENUM_CONSTANT(ALIGNMENT_LEFT);
+ BIND_ENUM_CONSTANT(ALIGNMENT_CENTER);
+ BIND_ENUM_CONSTANT(ALIGNMENT_RIGHT);
}
TabContainer::TabContainer() {