summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/base_button.cpp12
-rw-r--r--scene/gui/box_container.cpp4
-rw-r--r--scene/gui/button.cpp114
-rw-r--r--scene/gui/check_box.cpp20
-rw-r--r--scene/gui/check_button.cpp8
-rw-r--r--scene/gui/code_edit.cpp54
-rw-r--r--scene/gui/color_picker.cpp82
-rw-r--r--scene/gui/dialogs.cpp18
-rw-r--r--scene/gui/file_dialog.cpp44
-rw-r--r--scene/gui/gradient_edit.cpp14
-rw-r--r--scene/gui/graph_edit.cpp108
-rw-r--r--scene/gui/graph_node.cpp76
-rw-r--r--scene/gui/grid_container.cpp8
-rw-r--r--scene/gui/item_list.cpp80
-rw-r--r--scene/gui/label.cpp44
-rw-r--r--scene/gui/line_edit.cpp70
-rw-r--r--scene/gui/link_button.cpp24
-rw-r--r--scene/gui/margin_container.cpp16
-rw-r--r--scene/gui/option_button.cpp44
-rw-r--r--scene/gui/panel.cpp2
-rw-r--r--scene/gui/panel_container.cpp18
-rw-r--r--scene/gui/popup.cpp6
-rw-r--r--scene/gui/popup_menu.cpp96
-rw-r--r--scene/gui/progress_bar.cpp22
-rw-r--r--scene/gui/range.cpp4
-rw-r--r--scene/gui/rich_text_label.cpp106
-rw-r--r--scene/gui/scroll_bar.cpp52
-rw-r--r--scene/gui/scroll_container.cpp14
-rw-r--r--scene/gui/separator.cpp6
-rw-r--r--scene/gui/slider.cpp10
-rw-r--r--scene/gui/spin_box.cpp8
-rw-r--r--scene/gui/split_container.cpp28
-rw-r--r--scene/gui/tab_container.cpp120
-rw-r--r--scene/gui/tabs.cpp126
-rw-r--r--scene/gui/text_edit.cpp76
-rw-r--r--scene/gui/tree.cpp196
36 files changed, 865 insertions, 865 deletions
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp
index 8414c4dc78..75a4464a40 100644
--- a/scene/gui/base_button.cpp
+++ b/scene/gui/base_button.cpp
@@ -125,7 +125,7 @@ void BaseButton::_pressed() {
get_script_instance()->call(SceneStringNames::get_singleton()->_pressed);
}
pressed();
- emit_signal("pressed");
+ emit_signal(SNAME("pressed"));
}
void BaseButton::_toggled(bool p_pressed) {
@@ -133,14 +133,14 @@ void BaseButton::_toggled(bool p_pressed) {
get_script_instance()->call(SceneStringNames::get_singleton()->_toggled, p_pressed);
}
toggled(p_pressed);
- emit_signal("toggled", p_pressed);
+ emit_signal(SNAME("toggled"), p_pressed);
}
void BaseButton::on_action_event(Ref<InputEvent> p_event) {
if (p_event->is_pressed()) {
status.press_attempt = true;
status.pressing_inside = true;
- emit_signal("button_down");
+ emit_signal(SNAME("button_down"));
}
if (status.press_attempt && status.pressing_inside) {
@@ -153,7 +153,7 @@ void BaseButton::on_action_event(Ref<InputEvent> p_event) {
status.pressed = !status.pressed;
_unpress_group();
if (button_group.is_valid()) {
- button_group->emit_signal("pressed", this);
+ button_group->emit_signal(SNAME("pressed"), this);
}
_toggled(status.pressed);
_pressed();
@@ -174,7 +174,7 @@ void BaseButton::on_action_event(Ref<InputEvent> p_event) {
}
status.press_attempt = false;
status.pressing_inside = false;
- emit_signal("button_up");
+ emit_signal(SNAME("button_up"));
}
update();
@@ -218,7 +218,7 @@ void BaseButton::set_pressed(bool p_pressed) {
if (p_pressed) {
_unpress_group();
if (button_group.is_valid()) {
- button_group->emit_signal("pressed", this);
+ button_group->emit_signal(SNAME("pressed"), this);
}
}
_toggled(status.pressed);
diff --git a/scene/gui/box_container.cpp b/scene/gui/box_container.cpp
index 40a49dbb58..a2f1d2b15a 100644
--- a/scene/gui/box_container.cpp
+++ b/scene/gui/box_container.cpp
@@ -43,7 +43,7 @@ void BoxContainer::_resort() {
Size2i new_size = get_size();
- int sep = get_theme_constant("separation"); //,vertical?"VBoxContainer":"HBoxContainer");
+ int sep = get_theme_constant(SNAME("separation")); //,vertical?"VBoxContainer":"HBoxContainer");
bool rtl = is_layout_rtl();
bool first = true;
@@ -247,7 +247,7 @@ Size2 BoxContainer::get_minimum_size() const {
/* Calculate MINIMUM SIZE */
Size2i minimum;
- int sep = get_theme_constant("separation"); //,vertical?"VBoxContainer":"HBoxContainer");
+ int sep = get_theme_constant(SNAME("separation")); //,vertical?"VBoxContainer":"HBoxContainer");
bool first = true;
diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp
index bcc273114b..4b6c0ef697 100644
--- a/scene/gui/button.cpp
+++ b/scene/gui/button.cpp
@@ -41,8 +41,8 @@ Size2 Button::get_minimum_size() const {
if (!expand_icon) {
Ref<Texture2D> _icon;
- if (icon.is_null() && has_theme_icon("icon")) {
- _icon = Control::get_theme_icon("icon");
+ if (icon.is_null() && has_theme_icon(SNAME("icon"))) {
+ _icon = Control::get_theme_icon(SNAME("icon"));
} else {
_icon = icon;
}
@@ -53,7 +53,7 @@ Size2 Button::get_minimum_size() const {
if (icon_align != ALIGN_CENTER) {
minsize.width += _icon->get_width();
if (xl_text != "") {
- minsize.width += get_theme_constant("hseparation");
+ minsize.width += get_theme_constant(SNAME("hseparation"));
}
} else {
minsize.width = MAX(minsize.width, _icon->get_width());
@@ -61,12 +61,12 @@ Size2 Button::get_minimum_size() const {
}
}
- Ref<Font> font = get_theme_font("font");
- float font_height = font->get_height(get_theme_font_size("font_size"));
+ Ref<Font> font = get_theme_font(SNAME("font"));
+ float font_height = font->get_height(get_theme_font_size(SNAME("font_size")));
minsize.height = MAX(font_height, minsize.height);
- return get_theme_stylebox("normal")->get_minimum_size() + minsize;
+ return get_theme_stylebox(SNAME("normal"))->get_minimum_size() + minsize;
}
void Button::_set_internal_margin(Side p_side, float p_value) {
@@ -97,43 +97,43 @@ void Button::_notification(int p_what) {
Color color;
Color color_icon(1, 1, 1, 1);
- Ref<StyleBox> style = get_theme_stylebox("normal");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("normal"));
bool rtl = is_layout_rtl();
switch (get_draw_mode()) {
case DRAW_NORMAL: {
- if (rtl && has_theme_stylebox("normal_mirrored")) {
- style = get_theme_stylebox("normal_mirrored");
+ if (rtl && has_theme_stylebox(SNAME("normal_mirrored"))) {
+ style = get_theme_stylebox(SNAME("normal_mirrored"));
} else {
- style = get_theme_stylebox("normal");
+ style = get_theme_stylebox(SNAME("normal"));
}
if (!flat) {
style->draw(ci, Rect2(Point2(0, 0), size));
}
- color = get_theme_color("font_color");
- if (has_theme_color("icon_normal_color")) {
- color_icon = get_theme_color("icon_normal_color");
+ color = get_theme_color(SNAME("font_color"));
+ if (has_theme_color(SNAME("icon_normal_color"))) {
+ color_icon = get_theme_color(SNAME("icon_normal_color"));
}
} break;
case DRAW_HOVER_PRESSED: {
- if (has_theme_stylebox("hover_pressed") && has_theme_stylebox_override("hover_pressed")) {
- if (rtl && has_theme_stylebox("hover_pressed_mirrored")) {
- style = get_theme_stylebox("hover_pressed_mirrored");
+ if (has_theme_stylebox(SNAME("hover_pressed")) && has_theme_stylebox_override("hover_pressed")) {
+ if (rtl && has_theme_stylebox(SNAME("hover_pressed_mirrored"))) {
+ style = get_theme_stylebox(SNAME("hover_pressed_mirrored"));
} else {
- style = get_theme_stylebox("hover_pressed");
+ style = get_theme_stylebox(SNAME("hover_pressed"));
}
if (!flat) {
style->draw(ci, Rect2(Point2(0, 0), size));
}
- if (has_theme_color("font_hover_pressed_color")) {
- color = get_theme_color("font_hover_pressed_color");
+ if (has_theme_color(SNAME("font_hover_pressed_color"))) {
+ color = get_theme_color(SNAME("font_hover_pressed_color"));
} else {
- color = get_theme_color("font_color");
+ color = get_theme_color(SNAME("font_color"));
}
- if (has_theme_color("icon_hover_pressed_color")) {
- color_icon = get_theme_color("icon_hover_pressed_color");
+ if (has_theme_color(SNAME("icon_hover_pressed_color"))) {
+ color_icon = get_theme_color(SNAME("icon_hover_pressed_color"));
}
break;
@@ -141,67 +141,67 @@ void Button::_notification(int p_what) {
[[fallthrough]];
}
case DRAW_PRESSED: {
- if (rtl && has_theme_stylebox("pressed_mirrored")) {
- style = get_theme_stylebox("pressed_mirrored");
+ if (rtl && has_theme_stylebox(SNAME("pressed_mirrored"))) {
+ style = get_theme_stylebox(SNAME("pressed_mirrored"));
} else {
- style = get_theme_stylebox("pressed");
+ style = get_theme_stylebox(SNAME("pressed"));
}
if (!flat) {
style->draw(ci, Rect2(Point2(0, 0), size));
}
- if (has_theme_color("font_pressed_color")) {
- color = get_theme_color("font_pressed_color");
+ if (has_theme_color(SNAME("font_pressed_color"))) {
+ color = get_theme_color(SNAME("font_pressed_color"));
} else {
- color = get_theme_color("font_color");
+ color = get_theme_color(SNAME("font_color"));
}
- if (has_theme_color("icon_pressed_color")) {
- color_icon = get_theme_color("icon_pressed_color");
+ if (has_theme_color(SNAME("icon_pressed_color"))) {
+ color_icon = get_theme_color(SNAME("icon_pressed_color"));
}
} break;
case DRAW_HOVER: {
- if (rtl && has_theme_stylebox("hover_mirrored")) {
- style = get_theme_stylebox("hover_mirrored");
+ if (rtl && has_theme_stylebox(SNAME("hover_mirrored"))) {
+ style = get_theme_stylebox(SNAME("hover_mirrored"));
} else {
- style = get_theme_stylebox("hover");
+ style = get_theme_stylebox(SNAME("hover"));
}
if (!flat) {
style->draw(ci, Rect2(Point2(0, 0), size));
}
- color = get_theme_color("font_hover_color");
- if (has_theme_color("icon_hover_color")) {
- color_icon = get_theme_color("icon_hover_color");
+ color = get_theme_color(SNAME("font_hover_color"));
+ if (has_theme_color(SNAME("icon_hover_color"))) {
+ color_icon = get_theme_color(SNAME("icon_hover_color"));
}
} break;
case DRAW_DISABLED: {
- if (rtl && has_theme_stylebox("disabled_mirrored")) {
- style = get_theme_stylebox("disabled_mirrored");
+ if (rtl && has_theme_stylebox(SNAME("disabled_mirrored"))) {
+ style = get_theme_stylebox(SNAME("disabled_mirrored"));
} else {
- style = get_theme_stylebox("disabled");
+ style = get_theme_stylebox(SNAME("disabled"));
}
if (!flat) {
style->draw(ci, Rect2(Point2(0, 0), size));
}
- color = get_theme_color("font_disabled_color");
- if (has_theme_color("icon_disabled_color")) {
- color_icon = get_theme_color("icon_disabled_color");
+ color = get_theme_color(SNAME("font_disabled_color"));
+ if (has_theme_color(SNAME("icon_disabled_color"))) {
+ color_icon = get_theme_color(SNAME("icon_disabled_color"));
}
} break;
}
if (has_focus()) {
- Ref<StyleBox> style2 = get_theme_stylebox("focus");
+ Ref<StyleBox> style2 = get_theme_stylebox(SNAME("focus"));
style2->draw(ci, Rect2(Point2(), size));
}
Ref<Texture2D> _icon;
- if (icon.is_null() && has_theme_icon("icon")) {
- _icon = Control::get_theme_icon("icon");
+ if (icon.is_null() && has_theme_icon(SNAME("icon"))) {
+ _icon = Control::get_theme_icon(SNAME("icon"));
} else {
_icon = icon;
}
@@ -234,21 +234,21 @@ void Button::_notification(int p_what) {
if (icon_align_rtl_checked == ALIGN_LEFT) {
style_offset.x = style->get_margin(SIDE_LEFT);
if (_internal_margin[SIDE_LEFT] > 0) {
- icon_ofs_region = _internal_margin[SIDE_LEFT] + get_theme_constant("hseparation");
+ icon_ofs_region = _internal_margin[SIDE_LEFT] + get_theme_constant(SNAME("hseparation"));
}
} else if (icon_align_rtl_checked == ALIGN_CENTER) {
style_offset.x = 0.0;
} else if (icon_align_rtl_checked == ALIGN_RIGHT) {
style_offset.x = -style->get_margin(SIDE_RIGHT);
if (_internal_margin[SIDE_RIGHT] > 0) {
- icon_ofs_region = -_internal_margin[SIDE_RIGHT] - get_theme_constant("hseparation");
+ icon_ofs_region = -_internal_margin[SIDE_RIGHT] - get_theme_constant(SNAME("hseparation"));
}
}
style_offset.y = style->get_margin(SIDE_TOP);
if (expand_icon) {
Size2 _size = get_size() - style->get_offset() * 2;
- _size.width -= get_theme_constant("hseparation") + icon_ofs_region;
+ _size.width -= get_theme_constant(SNAME("hseparation")) + icon_ofs_region;
if (!clip_text && icon_align_rtl_checked != ALIGN_CENTER) {
_size.width -= text_buf->get_size().width;
}
@@ -276,7 +276,7 @@ void Button::_notification(int p_what) {
}
}
- Point2 icon_ofs = !_icon.is_null() ? Point2(icon_region.size.width + get_theme_constant("hseparation"), 0) : Point2();
+ Point2 icon_ofs = !_icon.is_null() ? Point2(icon_region.size.width + get_theme_constant(SNAME("hseparation")), 0) : Point2();
if (align_rtl_checked == ALIGN_CENTER && icon_align_rtl_checked == ALIGN_CENTER) {
icon_ofs.x = 0.0;
}
@@ -286,10 +286,10 @@ void Button::_notification(int p_what) {
int text_width = clip_text ? MIN(text_clip, text_buf->get_size().x) : text_buf->get_size().x;
if (_internal_margin[SIDE_LEFT] > 0) {
- text_clip -= _internal_margin[SIDE_LEFT] + get_theme_constant("hseparation");
+ text_clip -= _internal_margin[SIDE_LEFT] + get_theme_constant(SNAME("hseparation"));
}
if (_internal_margin[SIDE_RIGHT] > 0) {
- text_clip -= _internal_margin[SIDE_RIGHT] + get_theme_constant("hseparation");
+ text_clip -= _internal_margin[SIDE_RIGHT] + get_theme_constant(SNAME("hseparation"));
}
Point2 text_ofs = (size - style->get_minimum_size() - icon_ofs - text_buf->get_size() - Point2(_internal_margin[SIDE_RIGHT] - _internal_margin[SIDE_LEFT], 0)) / 2.0;
@@ -300,7 +300,7 @@ void Button::_notification(int p_what) {
icon_ofs.x = 0.0;
}
if (_internal_margin[SIDE_LEFT] > 0) {
- text_ofs.x = style->get_margin(SIDE_LEFT) + icon_ofs.x + _internal_margin[SIDE_LEFT] + get_theme_constant("hseparation");
+ text_ofs.x = style->get_margin(SIDE_LEFT) + icon_ofs.x + _internal_margin[SIDE_LEFT] + get_theme_constant(SNAME("hseparation"));
} else {
text_ofs.x = style->get_margin(SIDE_LEFT) + icon_ofs.x;
}
@@ -317,7 +317,7 @@ void Button::_notification(int p_what) {
} break;
case ALIGN_RIGHT: {
if (_internal_margin[SIDE_RIGHT] > 0) {
- text_ofs.x = size.x - style->get_margin(SIDE_RIGHT) - text_width - _internal_margin[SIDE_RIGHT] - get_theme_constant("hseparation");
+ text_ofs.x = size.x - style->get_margin(SIDE_RIGHT) - text_width - _internal_margin[SIDE_RIGHT] - get_theme_constant(SNAME("hseparation"));
} else {
text_ofs.x = size.x - style->get_margin(SIDE_RIGHT) - text_width;
}
@@ -328,8 +328,8 @@ void Button::_notification(int p_what) {
} break;
}
- Color font_outline_color = get_theme_color("font_outline_color");
- int outline_size = get_theme_constant("outline_size");
+ Color font_outline_color = get_theme_color(SNAME("font_outline_color"));
+ int outline_size = get_theme_constant(SNAME("outline_size"));
if (outline_size > 0 && font_outline_color.a > 0) {
text_buf->draw_outline(ci, text_ofs, outline_size, font_outline_color);
}
@@ -340,8 +340,8 @@ void Button::_notification(int p_what) {
}
void Button::_shape() {
- Ref<Font> font = get_theme_font("font");
- int font_size = get_theme_font_size("font_size");
+ Ref<Font> font = get_theme_font(SNAME("font"));
+ int font_size = get_theme_font_size(SNAME("font_size"));
text_buf->clear();
if (text_direction == Control::TEXT_DIRECTION_INHERITED) {
diff --git a/scene/gui/check_box.cpp b/scene/gui/check_box.cpp
index c0650a8f3f..d93107df2d 100644
--- a/scene/gui/check_box.cpp
+++ b/scene/gui/check_box.cpp
@@ -33,12 +33,12 @@
#include "servers/rendering_server.h"
Size2 CheckBox::get_icon_size() const {
- Ref<Texture2D> checked = Control::get_theme_icon("checked");
- Ref<Texture2D> checked_disabled = Control::get_theme_icon("checked_disabled");
- Ref<Texture2D> unchecked = Control::get_theme_icon("unchecked");
- Ref<Texture2D> unchecked_disabled = Control::get_theme_icon("unchecked_disabled");
- Ref<Texture2D> radio_checked = Control::get_theme_icon("radio_checked");
- Ref<Texture2D> radio_unchecked = Control::get_theme_icon("radio_unchecked");
+ Ref<Texture2D> checked = Control::get_theme_icon(SNAME("checked"));
+ Ref<Texture2D> checked_disabled = Control::get_theme_icon(SNAME("checked_disabled"));
+ Ref<Texture2D> unchecked = Control::get_theme_icon(SNAME("unchecked"));
+ Ref<Texture2D> unchecked_disabled = Control::get_theme_icon(SNAME("unchecked_disabled"));
+ Ref<Texture2D> radio_checked = Control::get_theme_icon(SNAME("radio_checked"));
+ Ref<Texture2D> radio_unchecked = Control::get_theme_icon(SNAME("radio_unchecked"));
Size2 tex_size = Size2(0, 0);
if (!checked.is_null()) {
@@ -61,9 +61,9 @@ Size2 CheckBox::get_minimum_size() const {
Size2 tex_size = get_icon_size();
minsize.width += tex_size.width;
if (get_text().length() > 0) {
- minsize.width += get_theme_constant("hseparation");
+ minsize.width += get_theme_constant(SNAME("hseparation"));
}
- Ref<StyleBox> sb = get_theme_stylebox("normal");
+ Ref<StyleBox> sb = get_theme_stylebox(SNAME("normal"));
minsize.height = MAX(minsize.height, tex_size.height + sb->get_margin(SIDE_TOP) + sb->get_margin(SIDE_BOTTOM));
return minsize;
@@ -83,7 +83,7 @@ void CheckBox::_notification(int p_what) {
Ref<Texture2D> on = Control::get_theme_icon(vformat("%s%s", is_radio() ? "radio_checked" : "checked", is_disabled() ? "_disabled" : ""));
Ref<Texture2D> off = Control::get_theme_icon(vformat("%s%s", is_radio() ? "radio_unchecked" : "unchecked", is_disabled() ? "_disabled" : ""));
- Ref<StyleBox> sb = get_theme_stylebox("normal");
+ Ref<StyleBox> sb = get_theme_stylebox(SNAME("normal"));
Vector2 ofs;
if (is_layout_rtl()) {
@@ -91,7 +91,7 @@ void CheckBox::_notification(int p_what) {
} else {
ofs.x = sb->get_margin(SIDE_LEFT);
}
- ofs.y = int((get_size().height - get_icon_size().height) / 2) + get_theme_constant("check_vadjust");
+ ofs.y = int((get_size().height - get_icon_size().height) / 2) + get_theme_constant(SNAME("check_vadjust"));
if (is_pressed()) {
on->draw(ci, ofs);
diff --git a/scene/gui/check_button.cpp b/scene/gui/check_button.cpp
index a8bf449355..162a256d23 100644
--- a/scene/gui/check_button.cpp
+++ b/scene/gui/check_button.cpp
@@ -52,9 +52,9 @@ Size2 CheckButton::get_minimum_size() const {
Size2 tex_size = get_icon_size();
minsize.width += tex_size.width;
if (get_text().length() > 0) {
- minsize.width += get_theme_constant("hseparation");
+ minsize.width += get_theme_constant(SNAME("hseparation"));
}
- Ref<StyleBox> sb = get_theme_stylebox("normal");
+ Ref<StyleBox> sb = get_theme_stylebox(SNAME("normal"));
minsize.height = MAX(minsize.height, tex_size.height + sb->get_margin(SIDE_TOP) + sb->get_margin(SIDE_BOTTOM));
return minsize;
@@ -86,7 +86,7 @@ void CheckButton::_notification(int p_what) {
off = Control::get_theme_icon(is_disabled() ? "off_disabled" : "off");
}
- Ref<StyleBox> sb = get_theme_stylebox("normal");
+ Ref<StyleBox> sb = get_theme_stylebox(SNAME("normal"));
Vector2 ofs;
Size2 tex_size = get_icon_size();
@@ -95,7 +95,7 @@ void CheckButton::_notification(int p_what) {
} else {
ofs.x = get_size().width - (tex_size.width + sb->get_margin(SIDE_RIGHT));
}
- ofs.y = (get_size().height - tex_size.height) / 2 + get_theme_constant("check_vadjust");
+ ofs.y = (get_size().height - tex_size.height) / 2 + get_theme_constant(SNAME("check_vadjust"));
if (is_pressed()) {
on->draw(ci, ofs);
diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp
index ba1534ed5c..2e6befb706 100644
--- a/scene/gui/code_edit.cpp
+++ b/scene/gui/code_edit.cpp
@@ -50,28 +50,28 @@ void CodeEdit::_notification(int p_what) {
set_gutter_width(line_number_gutter, (line_number_digits + 1) * cache.font->get_char_size('0', 0, cache.font_size).width);
set_gutter_width(fold_gutter, get_row_height() / 1.2);
- breakpoint_color = get_theme_color("breakpoint_color");
- breakpoint_icon = get_theme_icon("breakpoint");
+ breakpoint_color = get_theme_color(SNAME("breakpoint_color"));
+ breakpoint_icon = get_theme_icon(SNAME("breakpoint"));
- bookmark_color = get_theme_color("bookmark_color");
- bookmark_icon = get_theme_icon("bookmark");
+ bookmark_color = get_theme_color(SNAME("bookmark_color"));
+ bookmark_icon = get_theme_icon(SNAME("bookmark"));
- executing_line_color = get_theme_color("executing_line_color");
- executing_line_icon = get_theme_icon("executing_line");
+ executing_line_color = get_theme_color(SNAME("executing_line_color"));
+ executing_line_icon = get_theme_icon(SNAME("executing_line"));
- line_number_color = get_theme_color("line_number_color");
+ line_number_color = get_theme_color(SNAME("line_number_color"));
- folding_color = get_theme_color("code_folding_color");
- can_fold_icon = get_theme_icon("can_fold");
- folded_icon = get_theme_icon("folded");
+ folding_color = get_theme_color(SNAME("code_folding_color"));
+ can_fold_icon = get_theme_icon(SNAME("can_fold"));
+ folded_icon = get_theme_icon(SNAME("folded"));
- code_completion_max_width = get_theme_constant("completion_max_width") * cache.font->get_char_size('x').x;
- code_completion_max_lines = get_theme_constant("completion_lines");
- code_completion_scroll_width = get_theme_constant("completion_scroll_width");
- code_completion_scroll_color = get_theme_color("completion_scroll_color");
- code_completion_background_color = get_theme_color("completion_background_color");
- code_completion_selected_color = get_theme_color("completion_selected_color");
- code_completion_existing_color = get_theme_color("completion_existing_color");
+ code_completion_max_width = get_theme_constant(SNAME("completion_max_width")) * cache.font->get_char_size('x').x;
+ code_completion_max_lines = get_theme_constant(SNAME("completion_lines"));
+ code_completion_scroll_width = get_theme_constant(SNAME("completion_scroll_width"));
+ code_completion_scroll_color = get_theme_color(SNAME("completion_scroll_color"));
+ code_completion_background_color = get_theme_color(SNAME("completion_background_color"));
+ code_completion_selected_color = get_theme_color(SNAME("completion_selected_color"));
+ code_completion_existing_color = get_theme_color(SNAME("completion_existing_color"));
} break;
case NOTIFICATION_DRAW: {
RID ci = get_canvas_item();
@@ -81,11 +81,11 @@ void CodeEdit::_notification(int p_what) {
bool code_completion_below = false;
if (caret_visible && code_completion_active && code_completion_options.size() > 0) {
- Ref<StyleBox> csb = get_theme_stylebox("completion");
+ Ref<StyleBox> csb = get_theme_stylebox(SNAME("completion"));
const int code_completion_options_count = code_completion_options.size();
const int lines = MIN(code_completion_options_count, code_completion_max_lines);
- const int icon_hsep = get_theme_constant("hseparation", "ItemList");
+ const int icon_hsep = get_theme_constant(SNAME("hseparation"), SNAME("ItemList"));
const Size2 icon_area_size(row_height, row_height);
code_completion_rect.size.width = code_completion_longest_line + icon_hsep + icon_area_size.width + 2;
@@ -164,8 +164,8 @@ void CodeEdit::_notification(int p_what) {
if (caret_visible && code_hint != "" && (!code_completion_active || (code_completion_below != code_hint_draw_below))) {
const Ref<Font> font = cache.font;
const int font_height = font->get_height(cache.font_size);
- Ref<StyleBox> sb = get_theme_stylebox("panel", "TooltipPanel");
- Color font_color = get_theme_color("font_color", "TooltipLabel");
+ Ref<StyleBox> sb = get_theme_stylebox(SNAME("panel"), SNAME("TooltipPanel"));
+ Color font_color = get_theme_color(SNAME("font_color"), SNAME("TooltipLabel"));
Vector<String> code_hint_lines = code_hint.split("\n");
int line_count = code_hint_lines.size();
@@ -969,7 +969,7 @@ void CodeEdit::set_line_as_breakpoint(int p_line, bool p_breakpointed) {
} else if (breakpointed_lines.has(p_line)) {
breakpointed_lines.erase(p_line);
}
- emit_signal("breakpoint_toggled", p_line);
+ emit_signal(SNAME("breakpoint_toggled"), p_line);
update();
}
@@ -1551,7 +1551,7 @@ void CodeEdit::request_code_completion(bool p_force) {
}
if (p_force) {
- emit_signal("request_code_completion");
+ emit_signal(SNAME("request_code_completion"));
return;
}
@@ -1559,9 +1559,9 @@ void CodeEdit::request_code_completion(bool p_force) {
int ofs = CLAMP(cursor_get_column(), 0, line.length());
if (ofs > 0 && (is_in_string(cursor_get_line(), ofs) != -1 || _is_char(line[ofs - 1]) || code_completion_prefixes.has(String::chr(line[ofs - 1])))) {
- emit_signal("request_code_completion");
+ emit_signal(SNAME("request_code_completion"));
} else if (ofs > 1 && line[ofs - 1] == ' ' && code_completion_prefixes.has(String::chr(line[ofs - 2]))) {
- emit_signal("request_code_completion");
+ emit_signal(SNAME("request_code_completion"));
}
}
@@ -2534,9 +2534,9 @@ void CodeEdit::_lines_edited_from(int p_from_line, int p_to_line) {
}
breakpointed_lines.erase(line);
- emit_signal("breakpoint_toggled", line);
+ emit_signal(SNAME("breakpoint_toggled"), line);
if (line_count > 0 || line >= p_from_line) {
- emit_signal("breakpoint_toggled", line + line_count);
+ emit_signal(SNAME("breakpoint_toggled"), line + line_count);
breakpointed_lines[line + line_count] = true;
continue;
}
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index 842cef3b83..eaad887032 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -45,14 +45,14 @@ List<Color> ColorPicker::preset_cache;
void ColorPicker::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_THEME_CHANGED: {
- btn_pick->set_icon(get_theme_icon("screen_picker", "ColorPicker"));
- bt_add_preset->set_icon(get_theme_icon("add_preset"));
+ btn_pick->set_icon(get_theme_icon(SNAME("screen_picker"), SNAME("ColorPicker")));
+ bt_add_preset->set_icon(get_theme_icon(SNAME("add_preset")));
_update_controls();
} break;
case NOTIFICATION_ENTER_TREE: {
- btn_pick->set_icon(get_theme_icon("screen_picker", "ColorPicker"));
- bt_add_preset->set_icon(get_theme_icon("add_preset"));
+ btn_pick->set_icon(get_theme_icon(SNAME("screen_picker"), SNAME("ColorPicker")));
+ bt_add_preset->set_icon(get_theme_icon(SNAME("add_preset")));
_update_controls();
_update_color();
@@ -75,13 +75,13 @@ void ColorPicker::_notification(int p_what) {
} break;
case NOTIFICATION_PARENTED: {
for (int i = 0; i < 4; i++) {
- set_offset((Side)i, get_offset((Side)i) + get_theme_constant("margin"));
+ set_offset((Side)i, get_offset((Side)i) + get_theme_constant(SNAME("margin")));
}
} break;
case NOTIFICATION_VISIBILITY_CHANGED: {
Popup *p = Object::cast_to<Popup>(get_parent());
if (p) {
- p->set_size(Size2(get_combined_minimum_size().width + get_theme_constant("margin") * 2, get_combined_minimum_size().height + get_theme_constant("margin") * 2));
+ p->set_size(Size2(get_combined_minimum_size().width + get_theme_constant(SNAME("margin")) * 2, get_combined_minimum_size().height + get_theme_constant(SNAME("margin")) * 2));
}
} break;
case NOTIFICATION_WM_CLOSE_REQUEST: {
@@ -142,7 +142,7 @@ void ColorPicker::finish_shaders() {
}
void ColorPicker::set_focus_on_line_edit() {
- c_text->call_deferred("grab_focus");
+ c_text->call_deferred(SNAME("grab_focus"));
}
void ColorPicker::_update_controls() {
@@ -180,7 +180,7 @@ void ColorPicker::_update_controls() {
}
} else {
Ref<StyleBoxEmpty> style_box_empty(memnew(StyleBoxEmpty));
- Ref<Texture2D> bar_arrow = get_theme_icon("bar_arrow");
+ Ref<Texture2D> bar_arrow = get_theme_icon(SNAME("bar_arrow"));
for (int i = 0; i < 4; i++) {
scroll[i]->add_theme_icon_override("grabber", bar_arrow);
@@ -294,7 +294,7 @@ void ColorPicker::_value_changed(double) {
}
_set_pick_color(color, false);
- emit_signal("color_changed", color);
+ emit_signal(SNAME("color_changed"), color);
}
void ColorPicker::_html_submitted(const String &p_html) {
@@ -313,7 +313,7 @@ void ColorPicker::_html_submitted(const String &p_html) {
}
set_pick_color(color);
- emit_signal("color_changed", color);
+ emit_signal(SNAME("color_changed"), color);
}
void ColorPicker::_update_color(bool p_update_sliders) {
@@ -388,7 +388,7 @@ void ColorPicker::_text_type_toggled() {
text_is_constructor = !text_is_constructor;
if (text_is_constructor) {
text_type->set_text("");
- text_type->set_icon(get_theme_icon("Script", "EditorIcons"));
+ text_type->set_icon(get_theme_icon(SNAME("Script"), SNAME("EditorIcons")));
c_text->set_editable(false);
} else {
@@ -537,7 +537,7 @@ void ColorPicker::_sample_input(const Ref<InputEvent> &p_event) {
// Revert to the old color when left-clicking the old color sample.
color = old_color;
_update_color();
- emit_signal("color_changed", color);
+ emit_signal(SNAME("color_changed"), color);
}
}
}
@@ -554,28 +554,28 @@ void ColorPicker::_sample_draw() {
const Rect2 rect_old = Rect2(Point2(), Size2(sample->get_size().width * 0.5, sample->get_size().height * 0.95));
if (display_old_color && old_color.a < 1.0) {
- sample->draw_texture_rect(get_theme_icon("preset_bg", "ColorPicker"), rect_old, true);
+ sample->draw_texture_rect(get_theme_icon(SNAME("preset_bg"), SNAME("ColorPicker")), rect_old, true);
}
sample->draw_rect(rect_old, old_color);
if (old_color.r > 1 || old_color.g > 1 || old_color.b > 1) {
// Draw an indicator to denote that the old color is "overbright" and can't be displayed accurately in the preview.
- sample->draw_texture(get_theme_icon("overbright_indicator", "ColorPicker"), Point2());
+ sample->draw_texture(get_theme_icon(SNAME("overbright_indicator"), SNAME("ColorPicker")), Point2());
}
} else {
rect_new = Rect2(Point2(), Size2(sample->get_size().width, sample->get_size().height * 0.95));
}
if (color.a < 1.0) {
- sample->draw_texture_rect(get_theme_icon("preset_bg", "ColorPicker"), rect_new, true);
+ sample->draw_texture_rect(get_theme_icon(SNAME("preset_bg"), SNAME("ColorPicker")), rect_new, true);
}
sample->draw_rect(rect_new, color);
if (color.r > 1 || color.g > 1 || color.b > 1) {
// Draw an indicator to denote that the new color is "overbright" and can't be displayed accurately in the preview.
- sample->draw_texture(get_theme_icon("overbright_indicator", "ColorPicker"), Point2(uv_edit->get_size().width * 0.5, 0));
+ sample->draw_texture(get_theme_icon(SNAME("overbright_indicator"), SNAME("ColorPicker")), Point2(uv_edit->get_size().width * 0.5, 0));
}
}
@@ -649,7 +649,7 @@ void ColorPicker::_hsv_draw(int p_which, Control *c) {
default: {
}
}
- Ref<Texture2D> cursor = get_theme_icon("picker_cursor", "ColorPicker");
+ Ref<Texture2D> cursor = get_theme_icon(SNAME("picker_cursor"), SNAME("ColorPicker"));
int x;
int y;
if (picker_type == SHAPE_VHS_CIRCLE) {
@@ -679,7 +679,7 @@ void ColorPicker::_hsv_draw(int p_which, Control *c) {
} else if (p_which == 1) {
if (picker_type == SHAPE_HSV_RECTANGLE) {
- Ref<Texture2D> hue = get_theme_icon("color_hue", "ColorPicker");
+ Ref<Texture2D> hue = get_theme_icon(SNAME("color_hue"), SNAME("ColorPicker"));
c->draw_texture_rect(hue, Rect2(Point2(), c->get_size()));
int y = c->get_size().y - c->get_size().y * (1.0 - h);
Color col;
@@ -728,7 +728,7 @@ void ColorPicker::_slider_draw(int p_which) {
#endif
if (p_which == 3) {
- scroll[p_which]->draw_texture_rect(get_theme_icon("preset_bg", "ColorPicker"), Rect2(Point2(0, margin), Size2(size.x, margin)), true);
+ scroll[p_which]->draw_texture_rect(get_theme_icon(SNAME("preset_bg"), SNAME("ColorPicker")), Rect2(Point2(0, margin), Size2(size.x, margin)), true);
left_color = color;
left_color.a = 0;
@@ -740,7 +740,7 @@ void ColorPicker::_slider_draw(int p_which) {
}
if (hsv_mode_enabled) {
if (p_which == 0) {
- Ref<Texture2D> hue = get_theme_icon("color_hue", "ColorPicker");
+ Ref<Texture2D> hue = get_theme_icon(SNAME("color_hue"), SNAME("ColorPicker"));
scroll[p_which]->draw_set_transform(Point2(), -Math_PI / 2, Size2(1.0, 1.0));
scroll[p_which]->draw_texture_rect(hue, Rect2(Vector2(margin * -2, 0), Vector2(scroll[p_which]->get_size().x, margin)), false, Color(1, 1, 1), true);
return;
@@ -826,10 +826,10 @@ void ColorPicker::_uv_input(const Ref<InputEvent> &p_event, Control *c) {
set_pick_color(color);
_update_color();
if (!deferred_mode_enabled) {
- emit_signal("color_changed", color);
+ emit_signal(SNAME("color_changed"), color);
}
} else if (deferred_mode_enabled && !bev->is_pressed() && bev->get_button_index() == MOUSE_BUTTON_LEFT) {
- emit_signal("color_changed", color);
+ emit_signal(SNAME("color_changed"), color);
changing_color = false;
spinning = false;
} else {
@@ -873,7 +873,7 @@ void ColorPicker::_uv_input(const Ref<InputEvent> &p_event, Control *c) {
set_pick_color(color);
_update_color();
if (!deferred_mode_enabled) {
- emit_signal("color_changed", color);
+ emit_signal(SNAME("color_changed"), color);
}
}
}
@@ -898,9 +898,9 @@ void ColorPicker::_w_input(const Ref<InputEvent> &p_event) {
set_pick_color(color);
_update_color();
if (!deferred_mode_enabled) {
- emit_signal("color_changed", color);
+ emit_signal(SNAME("color_changed"), color);
} else if (!bev->is_pressed() && bev->get_button_index() == MOUSE_BUTTON_LEFT) {
- emit_signal("color_changed", color);
+ emit_signal(SNAME("color_changed"), color);
}
}
@@ -921,7 +921,7 @@ void ColorPicker::_w_input(const Ref<InputEvent> &p_event) {
set_pick_color(color);
_update_color();
if (!deferred_mode_enabled) {
- emit_signal("color_changed", color);
+ emit_signal(SNAME("color_changed"), color);
}
}
}
@@ -941,12 +941,12 @@ void ColorPicker::_preset_input(const Ref<InputEvent> &p_event) {
}
set_pick_color(presets[index]);
_update_color();
- emit_signal("color_changed", color);
+ emit_signal(SNAME("color_changed"), color);
} else if (bev->is_pressed() && bev->get_button_index() == MOUSE_BUTTON_RIGHT && presets_enabled) {
index = bev->get_position().x / (preset->get_size().x / presets.size());
Color clicked_preset = presets[index];
erase_preset(clicked_preset);
- emit_signal("preset_removed", clicked_preset);
+ emit_signal(SNAME("preset_removed"), clicked_preset);
bt_add_preset->show();
}
}
@@ -972,7 +972,7 @@ void ColorPicker::_screen_input(const Ref<InputEvent> &p_event) {
Ref<InputEventMouseButton> bev = p_event;
if (bev.is_valid() && bev->get_button_index() == MOUSE_BUTTON_LEFT && !bev->is_pressed()) {
- emit_signal("color_changed", color);
+ emit_signal(SNAME("color_changed"), color);
screen->hide();
}
@@ -995,7 +995,7 @@ void ColorPicker::_screen_input(const Ref<InputEvent> &p_event) {
void ColorPicker::_add_preset_pressed() {
add_preset(color);
- emit_signal("preset_added", color);
+ emit_signal(SNAME("preset_added"), color);
}
void ColorPicker::_screen_pick_pressed() {
@@ -1012,7 +1012,7 @@ void ColorPicker::_screen_pick_pressed() {
screen->set_default_cursor_shape(CURSOR_POINTING_HAND);
screen->connect("gui_input", callable_mp(this, &ColorPicker::_screen_input));
// It immediately toggles off in the first press otherwise.
- screen->call_deferred("connect", "hidden", Callable(btn_pick, "set_pressed"), varray(false));
+ screen->call_deferred(SNAME("connect"), "hidden", Callable(btn_pick, "set_pressed"), varray(false));
}
screen->raise();
#ifndef _MSC_VER
@@ -1131,7 +1131,7 @@ ColorPicker::ColorPicker() :
uv_edit->set_mouse_filter(MOUSE_FILTER_PASS);
uv_edit->set_h_size_flags(SIZE_EXPAND_FILL);
uv_edit->set_v_size_flags(SIZE_EXPAND_FILL);
- uv_edit->set_custom_minimum_size(Size2(get_theme_constant("sv_width"), get_theme_constant("sv_height")));
+ uv_edit->set_custom_minimum_size(Size2(get_theme_constant(SNAME("sv_width")), get_theme_constant(SNAME("sv_height"))));
uv_edit->connect("draw", callable_mp(this, &ColorPicker::_hsv_draw), make_binds(0, uv_edit));
HBoxContainer *hb_smpl = memnew(HBoxContainer);
@@ -1161,7 +1161,7 @@ ColorPicker::ColorPicker() :
HBoxContainer *hbc = memnew(HBoxContainer);
labels[i] = memnew(Label());
- labels[i]->set_custom_minimum_size(Size2(get_theme_constant("label_width"), 0));
+ labels[i]->set_custom_minimum_size(Size2(get_theme_constant(SNAME("label_width")), 0));
labels[i]->set_v_size_flags(SIZE_SHRINK_CENTER);
hbc->add_child(labels[i]);
@@ -1220,7 +1220,7 @@ ColorPicker::ColorPicker() :
wheel_edit->set_h_size_flags(SIZE_EXPAND_FILL);
wheel_edit->set_v_size_flags(SIZE_EXPAND_FILL);
- wheel_edit->set_custom_minimum_size(Size2(get_theme_constant("sv_width"), get_theme_constant("sv_height")));
+ wheel_edit->set_custom_minimum_size(Size2(get_theme_constant(SNAME("sv_width")), get_theme_constant(SNAME("sv_height"))));
hb_edit->add_child(wheel_edit);
wheel_mat.instantiate();
@@ -1245,7 +1245,7 @@ ColorPicker::ColorPicker() :
wheel_uv->connect("draw", callable_mp(this, &ColorPicker::_hsv_draw), make_binds(0, wheel_uv));
hb_edit->add_child(w_edit);
- w_edit->set_custom_minimum_size(Size2(get_theme_constant("h_width"), 0));
+ w_edit->set_custom_minimum_size(Size2(get_theme_constant(SNAME("h_width")), 0));
w_edit->set_h_size_flags(SIZE_FILL);
w_edit->set_v_size_flags(SIZE_EXPAND_FILL);
w_edit->connect("gui_input", callable_mp(this, &ColorPicker::_w_input));
@@ -1285,11 +1285,11 @@ void ColorPickerButton::_about_to_popup() {
void ColorPickerButton::_color_changed(const Color &p_color) {
color = p_color;
update();
- emit_signal("color_changed", color);
+ emit_signal(SNAME("color_changed"), color);
}
void ColorPickerButton::_modal_closed() {
- emit_signal("popup_closed");
+ emit_signal(SNAME("popup_closed"));
set_pressed(false);
}
@@ -1327,14 +1327,14 @@ void ColorPickerButton::pressed() {
void ColorPickerButton::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_DRAW: {
- const Ref<StyleBox> normal = get_theme_stylebox("normal");
+ const Ref<StyleBox> normal = get_theme_stylebox(SNAME("normal"));
const Rect2 r = Rect2(normal->get_offset(), get_size() - normal->get_minimum_size());
- draw_texture_rect(Control::get_theme_icon("bg", "ColorPickerButton"), r, true);
+ draw_texture_rect(Control::get_theme_icon(SNAME("bg"), SNAME("ColorPickerButton")), r, true);
draw_rect(r, color);
if (color.r > 1 || color.g > 1 || color.b > 1) {
// Draw an indicator to denote that the color is "overbright" and can't be displayed accurately in the preview
- draw_texture(Control::get_theme_icon("overbright_indicator", "ColorPicker"), normal->get_offset());
+ draw_texture(Control::get_theme_icon(SNAME("overbright_indicator"), SNAME("ColorPicker")), normal->get_offset());
}
} break;
case NOTIFICATION_WM_CLOSE_REQUEST: {
@@ -1399,7 +1399,7 @@ void ColorPickerButton::_update_picker() {
picker->set_pick_color(color);
picker->set_edit_alpha(edit_alpha);
picker->set_display_old_color(true);
- emit_signal("picker_created");
+ emit_signal(SNAME("picker_created"));
}
}
diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp
index 9d0a6a3380..f5c764e9cc 100644
--- a/scene/gui/dialogs.cpp
+++ b/scene/gui/dialogs.cpp
@@ -76,7 +76,7 @@ void AcceptDialog::_notification(int p_what) {
} break;
case NOTIFICATION_THEME_CHANGED: {
- bg->add_theme_style_override("panel", bg->get_theme_stylebox("panel", "AcceptDialog"));
+ bg->add_theme_style_override("panel", bg->get_theme_stylebox(SNAME("panel"), SNAME("AcceptDialog")));
} break;
case NOTIFICATION_EXIT_TREE: {
@@ -106,7 +106,7 @@ void AcceptDialog::_ok_pressed() {
set_visible(false);
}
ok_pressed();
- emit_signal("confirmed");
+ emit_signal(SNAME("confirmed"));
}
void AcceptDialog::_cancel_pressed() {
@@ -116,9 +116,9 @@ void AcceptDialog::_cancel_pressed() {
parent_visible = nullptr;
}
- call_deferred("hide");
+ call_deferred(SNAME("hide"));
- emit_signal("cancelled");
+ emit_signal(SNAME("cancelled"));
cancel_pressed();
@@ -168,7 +168,7 @@ void AcceptDialog::_update_child_rects() {
if (label->get_text().is_empty()) {
label_size.height = 0;
}
- int margin = hbc->get_theme_constant("margin", "Dialogs");
+ int margin = hbc->get_theme_constant(SNAME("margin"), SNAME("Dialogs"));
Size2 size = get_size();
Size2 hminsize = hbc->get_combined_minimum_size();
@@ -200,7 +200,7 @@ void AcceptDialog::_update_child_rects() {
}
Size2 AcceptDialog::_get_contents_minimum_size() const {
- int margin = hbc->get_theme_constant("margin", "Dialogs");
+ int margin = hbc->get_theme_constant(SNAME("margin"), SNAME("Dialogs"));
Size2 minsize = label->get_combined_minimum_size();
for (int i = 0; i < get_child_count(); i++) {
@@ -230,7 +230,7 @@ Size2 AcceptDialog::_get_contents_minimum_size() const {
}
void AcceptDialog::_custom_action(const String &p_action) {
- emit_signal("custom_action", p_action);
+ emit_signal(SNAME("custom_action"), p_action);
custom_action(p_action);
}
@@ -326,8 +326,8 @@ AcceptDialog::AcceptDialog() {
hbc = memnew(HBoxContainer);
- int margin = hbc->get_theme_constant("margin", "Dialogs");
- int button_margin = hbc->get_theme_constant("button_margin", "Dialogs");
+ int margin = hbc->get_theme_constant(SNAME("margin"), SNAME("Dialogs"));
+ int button_margin = hbc->get_theme_constant(SNAME("button_margin"), SNAME("Dialogs"));
label = memnew(Label);
label->set_anchor(SIDE_RIGHT, Control::ANCHOR_END);
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index f8cee6daec..9ed3a2244e 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -49,9 +49,9 @@ VBoxContainer *FileDialog::get_vbox() {
}
void FileDialog::_theme_changed() {
- Color font_color = vbox->get_theme_color("font_color", "Button");
- Color font_hover_color = vbox->get_theme_color("font_hover_color", "Button");
- Color font_pressed_color = vbox->get_theme_color("font_pressed_color", "Button");
+ Color font_color = vbox->get_theme_color(SNAME("font_color"), SNAME("Button"));
+ Color font_hover_color = vbox->get_theme_color(SNAME("font_hover_color"), SNAME("Button"));
+ Color font_pressed_color = vbox->get_theme_color(SNAME("font_pressed_color"), SNAME("Button"));
dir_up->add_theme_color_override("icon_normal_color", font_color);
dir_up->add_theme_color_override("icon_hover_color", font_hover_color);
@@ -81,16 +81,16 @@ void FileDialog::_notification(int p_what) {
}
}
if (p_what == NOTIFICATION_ENTER_TREE) {
- dir_up->set_icon(vbox->get_theme_icon("parent_folder", "FileDialog"));
+ dir_up->set_icon(vbox->get_theme_icon(SNAME("parent_folder"), SNAME("FileDialog")));
if (vbox->is_layout_rtl()) {
- dir_prev->set_icon(vbox->get_theme_icon("forward_folder", "FileDialog"));
- dir_next->set_icon(vbox->get_theme_icon("back_folder", "FileDialog"));
+ dir_prev->set_icon(vbox->get_theme_icon(SNAME("forward_folder"), SNAME("FileDialog")));
+ dir_next->set_icon(vbox->get_theme_icon(SNAME("back_folder"), SNAME("FileDialog")));
} else {
- dir_prev->set_icon(vbox->get_theme_icon("back_folder", "FileDialog"));
- dir_next->set_icon(vbox->get_theme_icon("forward_folder", "FileDialog"));
+ dir_prev->set_icon(vbox->get_theme_icon(SNAME("back_folder"), SNAME("FileDialog")));
+ dir_next->set_icon(vbox->get_theme_icon(SNAME("forward_folder"), SNAME("FileDialog")));
}
- refresh->set_icon(vbox->get_theme_icon("reload", "FileDialog"));
- show_hidden->set_icon(vbox->get_theme_icon("toggle_hidden", "FileDialog"));
+ refresh->set_icon(vbox->get_theme_icon(SNAME("reload"), SNAME("FileDialog")));
+ show_hidden->set_icon(vbox->get_theme_icon(SNAME("toggle_hidden"), SNAME("FileDialog")));
_theme_changed();
}
}
@@ -170,7 +170,7 @@ void FileDialog::_file_submitted(const String &p_file) {
void FileDialog::_save_confirm_pressed() {
String f = dir_access->get_current_dir().plus_file(file->get_text());
- emit_signal("file_selected", f);
+ emit_signal(SNAME("file_selected"), f);
hide();
}
@@ -224,7 +224,7 @@ void FileDialog::_action_pressed() {
}
if (files.size()) {
- emit_signal("files_selected", files);
+ emit_signal(SNAME("files_selected"), files);
hide();
}
@@ -234,7 +234,7 @@ void FileDialog::_action_pressed() {
String f = dir_access->get_current_dir().plus_file(file->get_text());
if ((mode == FILE_MODE_OPEN_ANY || mode == FILE_MODE_OPEN_FILE) && dir_access->file_exists(f)) {
- emit_signal("file_selected", f);
+ emit_signal(SNAME("file_selected"), f);
hide();
} else if (mode == FILE_MODE_OPEN_ANY || mode == FILE_MODE_OPEN_DIR) {
String path = dir_access->get_current_dir();
@@ -248,7 +248,7 @@ void FileDialog::_action_pressed() {
}
}
- emit_signal("dir_selected", path);
+ emit_signal(SNAME("dir_selected"), path);
hide();
}
@@ -308,7 +308,7 @@ void FileDialog::_action_pressed() {
confirm_save->set_text(TTRC("File exists, overwrite?"));
confirm_save->popup_centered(Size2(200, 80));
} else {
- emit_signal("file_selected", f);
+ emit_signal(SNAME("file_selected"), f);
hide();
}
}
@@ -437,8 +437,8 @@ void FileDialog::_tree_item_activated() {
if (mode == FILE_MODE_OPEN_FILE || mode == FILE_MODE_OPEN_FILES || mode == FILE_MODE_OPEN_DIR || mode == FILE_MODE_OPEN_ANY) {
file->set_text("");
}
- call_deferred("_update_file_list");
- call_deferred("_update_dir");
+ call_deferred(SNAME("_update_file_list"));
+ call_deferred(SNAME("_update_dir"));
_push_history();
} else {
_action_pressed();
@@ -468,10 +468,10 @@ void FileDialog::update_file_list() {
dir_access->list_dir_begin();
TreeItem *root = tree->create_item();
- Ref<Texture2D> folder = vbox->get_theme_icon("folder", "FileDialog");
- Ref<Texture2D> file_icon = vbox->get_theme_icon("file", "FileDialog");
- const Color folder_color = vbox->get_theme_color("folder_icon_modulate", "FileDialog");
- const Color file_color = vbox->get_theme_color("file_icon_modulate", "FileDialog");
+ Ref<Texture2D> folder = vbox->get_theme_icon(SNAME("folder"), SNAME("FileDialog"));
+ Ref<Texture2D> file_icon = vbox->get_theme_icon(SNAME("file"), SNAME("FileDialog"));
+ const Color folder_color = vbox->get_theme_color(SNAME("folder_icon_modulate"), SNAME("FileDialog"));
+ const Color file_color = vbox->get_theme_color(SNAME("file_icon_modulate"), SNAME("FileDialog"));
List<String> files;
List<String> dirs;
@@ -573,7 +573,7 @@ void FileDialog::update_file_list() {
ti->set_icon_modulate(0, file_color);
if (mode == FILE_MODE_OPEN_DIR) {
- ti->set_custom_color(0, vbox->get_theme_color("files_disabled", "FileDialog"));
+ ti->set_custom_color(0, vbox->get_theme_color(SNAME("files_disabled"), SNAME("FileDialog")));
ti->set_selectable(0, false);
}
Dictionary d;
diff --git a/scene/gui/gradient_edit.cpp b/scene/gui/gradient_edit.cpp
index 7278ca6e94..83ecf1d534 100644
--- a/scene/gui/gradient_edit.cpp
+++ b/scene/gui/gradient_edit.cpp
@@ -101,7 +101,7 @@ void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) {
grabbed = -1;
grabbing = false;
update();
- emit_signal("ramp_changed");
+ emit_signal(SNAME("ramp_changed"));
accept_event();
}
@@ -121,7 +121,7 @@ void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) {
grabbed = -1;
grabbing = false;
update();
- emit_signal("ramp_changed");
+ emit_signal(SNAME("ramp_changed"));
accept_event();
}
}
@@ -145,7 +145,7 @@ void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) {
}
}
- emit_signal("ramp_changed");
+ emit_signal(SNAME("ramp_changed"));
update();
}
}
@@ -214,13 +214,13 @@ void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) {
}
}
- emit_signal("ramp_changed");
+ emit_signal(SNAME("ramp_changed"));
}
if (mb.is_valid() && mb->get_button_index() == 1 && !mb->is_pressed()) {
if (grabbing) {
grabbing = false;
- emit_signal("ramp_changed");
+ emit_signal(SNAME("ramp_changed"));
}
update();
}
@@ -288,7 +288,7 @@ void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) {
}
}
- emit_signal("ramp_changed");
+ emit_signal(SNAME("ramp_changed"));
update();
}
@@ -436,7 +436,7 @@ void GradientEdit::_color_changed(const Color &p_color) {
}
points.write[grabbed].color = p_color;
update();
- emit_signal("ramp_changed");
+ emit_signal(SNAME("ramp_changed"));
}
void GradientEdit::set_ramp(const Vector<float> &p_offsets, const Vector<Color> &p_colors) {
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index 39aa6749e7..2281fb19c6 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -162,7 +162,7 @@ void GraphEditMinimap::_gui_input(const Ref<InputEvent> &p_ev) {
if (mb->is_pressed()) {
is_pressing = true;
- Ref<Texture2D> resizer = get_theme_icon("resizer");
+ Ref<Texture2D> resizer = get_theme_icon(SNAME("resizer"));
Rect2 resizer_hitbox = Rect2(Point2(), resizer->get_size());
if (resizer_hitbox.has_point(mb->get_position())) {
is_resizing = true;
@@ -257,7 +257,7 @@ Vector2 GraphEdit::get_scroll_ofs() const {
void GraphEdit::_scroll_moved(double) {
if (!awaiting_scroll_offset_update) {
- call_deferred("_update_scroll_offset");
+ call_deferred(SNAME("_update_scroll_offset"));
awaiting_scroll_offset_update = true;
}
top_layer->update();
@@ -265,7 +265,7 @@ void GraphEdit::_scroll_moved(double) {
update();
if (!setting_scroll_ofs) { //in godot, signals on change value are avoided as a convention
- emit_signal("scroll_offset_changed", get_scroll_ofs());
+ emit_signal(SNAME("scroll_offset_changed"), get_scroll_ofs());
}
}
@@ -345,7 +345,7 @@ void GraphEdit::_update_scroll() {
set_block_minimum_size_adjust(false);
if (!awaiting_scroll_offset_update) {
- call_deferred("_update_scroll_offset");
+ call_deferred(SNAME("_update_scroll_offset"));
awaiting_scroll_offset_update = true;
}
@@ -371,7 +371,7 @@ void GraphEdit::_graph_node_raised(Node *p_gn) {
move_child(connections_layer, first_not_comment);
top_layer->raise();
- emit_signal("node_selected", p_gn);
+ emit_signal(SNAME("node_selected"), p_gn);
}
void GraphEdit::_graph_node_moved(Node *p_gn) {
@@ -395,7 +395,7 @@ void GraphEdit::_graph_node_slot_updated(int p_index, Node *p_gn) {
void GraphEdit::add_child_notify(Node *p_child) {
Control::add_child_notify(p_child);
- top_layer->call_deferred("raise"); // Top layer always on top!
+ top_layer->call_deferred(SNAME("raise")); // Top layer always on top!
GraphNode *gn = Object::cast_to<GraphNode>(p_child);
if (gn) {
@@ -421,7 +421,7 @@ void GraphEdit::remove_child_notify(Node *p_child) {
}
if (top_layer != nullptr && is_inside_tree()) {
- top_layer->call_deferred("raise"); // Top layer always on top!
+ top_layer->call_deferred(SNAME("raise")); // Top layer always on top!
}
GraphNode *gn = Object::cast_to<GraphNode>(p_child);
@@ -442,14 +442,14 @@ void GraphEdit::remove_child_notify(Node *p_child) {
void GraphEdit::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
- port_grab_distance_horizontal = get_theme_constant("port_grab_distance_horizontal");
- port_grab_distance_vertical = get_theme_constant("port_grab_distance_vertical");
-
- zoom_minus->set_icon(get_theme_icon("minus"));
- zoom_reset->set_icon(get_theme_icon("reset"));
- zoom_plus->set_icon(get_theme_icon("more"));
- snap_button->set_icon(get_theme_icon("snap"));
- minimap_button->set_icon(get_theme_icon("minimap"));
+ port_grab_distance_horizontal = get_theme_constant(SNAME("port_grab_distance_horizontal"));
+ port_grab_distance_vertical = get_theme_constant(SNAME("port_grab_distance_vertical"));
+
+ zoom_minus->set_icon(get_theme_icon(SNAME("minus")));
+ zoom_reset->set_icon(get_theme_icon(SNAME("reset")));
+ zoom_plus->set_icon(get_theme_icon(SNAME("more")));
+ snap_button->set_icon(get_theme_icon(SNAME("snap")));
+ minimap_button->set_icon(get_theme_icon(SNAME("minimap")));
}
if (p_what == NOTIFICATION_READY) {
Size2 hmin = h_scroll->get_combined_minimum_size();
@@ -466,7 +466,7 @@ void GraphEdit::_notification(int p_what) {
v_scroll->set_anchor_and_offset(SIDE_BOTTOM, ANCHOR_END, 0);
}
if (p_what == NOTIFICATION_DRAW) {
- draw_style_box(get_theme_stylebox("bg"), Rect2(Point2(), get_size()));
+ draw_style_box(get_theme_stylebox(SNAME("bg")), Rect2(Point2(), get_size()));
if (is_using_snap()) {
//draw grid
@@ -479,8 +479,8 @@ void GraphEdit::_notification(int p_what) {
Point2i from = (offset / float(snap)).floor();
Point2i len = (size / float(snap)).floor() + Vector2(1, 1);
- Color grid_minor = get_theme_color("grid_minor");
- Color grid_major = get_theme_color("grid_major");
+ Color grid_minor = get_theme_color(SNAME("grid_minor"));
+ Color grid_major = get_theme_color(SNAME("grid_major"));
for (int i = from.x; i < from.x + len.x; i++) {
Color color;
@@ -518,7 +518,7 @@ void GraphEdit::_notification(int p_what) {
}
bool GraphEdit::_filter_input(const Point2 &p_point) {
- Ref<Texture2D> port = get_theme_icon("port", "GraphNode");
+ Ref<Texture2D> port = get_theme_icon(SNAME("port"), SNAME("GraphNode"));
for (int i = get_child_count() - 1; i >= 0; i--) {
GraphNode *gn = Object::cast_to<GraphNode>(get_child(i));
@@ -548,7 +548,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
Ref<InputEventMouseButton> mb = p_ev;
if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT && mb->is_pressed()) {
connecting_valid = false;
- Ref<Texture2D> port = get_theme_icon("port", "GraphNode");
+ Ref<Texture2D> port = get_theme_icon(SNAME("port"), SNAME("GraphNode"));
click_pos = mb->get_position() / zoom;
for (int i = get_child_count() - 1; i >= 0; i--) {
GraphNode *gn = Object::cast_to<GraphNode>(get_child(i));
@@ -574,7 +574,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
connecting_to = pos;
just_disconnected = true;
- emit_signal("disconnection_request", E->get().from, E->get().from_port, E->get().to, E->get().to_port);
+ emit_signal(SNAME("disconnection_request"), E->get().from, E->get().from_port, E->get().to, E->get().to_port);
to = get_node(String(connecting_from)); //maybe it was erased
if (Object::cast_to<GraphNode>(to)) {
connecting = true;
@@ -616,7 +616,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
connecting_to = pos;
just_disconnected = true;
- emit_signal("disconnection_request", E->get().from, E->get().from_port, E->get().to, E->get().to_port);
+ emit_signal(SNAME("disconnection_request"), E->get().from, E->get().from_port, E->get().to, E->get().to_port);
fr = get_node(String(connecting_from)); //maybe it was erased
if (Object::cast_to<GraphNode>(fr)) {
connecting = true;
@@ -652,7 +652,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
connecting_valid = just_disconnected || click_pos.distance_to(connecting_to / zoom) > 20.0 * zoom;
if (connecting_valid) {
- Ref<Texture2D> port = get_theme_icon("port", "GraphNode");
+ Ref<Texture2D> port = get_theme_icon(SNAME("port"), SNAME("GraphNode"));
Vector2 mpos = mm->get_position() / zoom;
for (int i = get_child_count() - 1; i >= 0; i--) {
GraphNode *gn = Object::cast_to<GraphNode>(get_child(i));
@@ -701,7 +701,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
SWAP(from, to);
SWAP(from_slot, to_slot);
}
- emit_signal("connection_request", from, from_slot, to, to_slot);
+ emit_signal(SNAME("connection_request"), from, from_slot, to, to_slot);
} else if (!just_disconnected) {
String from = connecting_from;
@@ -709,9 +709,9 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
Vector2 ofs = Vector2(mb->get_position().x, mb->get_position().y);
if (!connecting_out) {
- emit_signal("connection_from_empty", from, from_slot, ofs);
+ emit_signal(SNAME("connection_from_empty"), from, from_slot, ofs);
} else {
- emit_signal("connection_to_empty", from, from_slot, ofs);
+ emit_signal(SNAME("connection_to_empty"), from, from_slot, ofs);
}
}
}
@@ -819,8 +819,8 @@ void GraphEdit::_draw_cos_line(CanvasItem *p_where, const Vector2 &p_from, const
//cubic bezier code
float diff = p_to.x - p_from.x;
float cp_offset;
- int cp_len = get_theme_constant("bezier_len_pos") * p_bezier_ratio;
- int cp_neg_len = get_theme_constant("bezier_len_neg") * p_bezier_ratio;
+ int cp_len = get_theme_constant(SNAME("bezier_len_pos")) * p_bezier_ratio;
+ int cp_neg_len = get_theme_constant(SNAME("bezier_len_neg")) * p_bezier_ratio;
if (diff > 0) {
cp_offset = MIN(cp_len, diff * 0.5);
@@ -849,7 +849,7 @@ void GraphEdit::_draw_cos_line(CanvasItem *p_where, const Vector2 &p_from, const
}
void GraphEdit::_connections_layer_draw() {
- Color activity_color = get_theme_color("activity");
+ Color activity_color = get_theme_color(SNAME("activity"));
//draw connections
List<List<Connection>::Element *> to_erase;
for (List<Connection>::Element *E = connections.front(); E; E = E->next()) {
@@ -934,8 +934,8 @@ void GraphEdit::_top_layer_draw() {
}
if (box_selecting) {
- top_layer->draw_rect(box_selecting_rect, get_theme_color("selection_fill"));
- top_layer->draw_rect(box_selecting_rect, get_theme_color("selection_stroke"), false);
+ top_layer->draw_rect(box_selecting_rect, get_theme_color(SNAME("selection_fill")));
+ top_layer->draw_rect(box_selecting_rect, get_theme_color(SNAME("selection_stroke")), false);
}
}
@@ -948,7 +948,7 @@ void GraphEdit::_minimap_draw() {
// Draw the minimap background.
Rect2 minimap_rect = Rect2(Point2(), minimap->get_size());
- minimap->draw_style_box(minimap->get_theme_stylebox("bg"), minimap_rect);
+ minimap->draw_style_box(minimap->get_theme_stylebox(SNAME("bg")), minimap_rect);
Vector2 graph_offset = minimap->_get_graph_offset();
Vector2 minimap_offset = minimap->minimap_offset;
@@ -964,7 +964,7 @@ void GraphEdit::_minimap_draw() {
Vector2 node_size = minimap->_convert_from_graph_position(gn->get_size() * zoom);
Rect2 node_rect = Rect2(node_position, node_size);
- Ref<StyleBoxFlat> sb_minimap = minimap->get_theme_stylebox("node")->duplicate();
+ Ref<StyleBoxFlat> sb_minimap = minimap->get_theme_stylebox(SNAME("node"))->duplicate();
// Override default values with colors provided by the GraphNode's stylebox, if possible.
Ref<StyleBoxFlat> sbf = gn->get_theme_stylebox(gn->is_selected() ? "commentfocus" : "comment");
@@ -987,7 +987,7 @@ void GraphEdit::_minimap_draw() {
Vector2 node_size = minimap->_convert_from_graph_position(gn->get_size() * zoom);
Rect2 node_rect = Rect2(node_position, node_size);
- Ref<StyleBoxFlat> sb_minimap = minimap->get_theme_stylebox("node")->duplicate();
+ Ref<StyleBoxFlat> sb_minimap = minimap->get_theme_stylebox(SNAME("node"))->duplicate();
// Override default values with colors provided by the GraphNode's stylebox, if possible.
Ref<StyleBoxFlat> sbf = gn->get_theme_stylebox(gn->is_selected() ? "selectedframe" : "frame");
@@ -1000,7 +1000,7 @@ void GraphEdit::_minimap_draw() {
}
// Draw node connections.
- Color activity_color = get_theme_color("activity");
+ Color activity_color = get_theme_color(SNAME("activity"));
for (List<Connection>::Element *E = connections.front(); E; E = E->next()) {
NodePath fromnp(E->get().from);
@@ -1039,11 +1039,11 @@ void GraphEdit::_minimap_draw() {
// Draw the "camera" viewport.
Rect2 camera_rect = minimap->get_camera_rect();
- minimap->draw_style_box(minimap->get_theme_stylebox("camera"), camera_rect);
+ minimap->draw_style_box(minimap->get_theme_stylebox(SNAME("camera")), camera_rect);
// Draw the resizer control.
- Ref<Texture2D> resizer = minimap->get_theme_icon("resizer");
- Color resizer_color = minimap->get_theme_color("resizer_color");
+ Ref<Texture2D> resizer = minimap->get_theme_icon(SNAME("resizer"));
+ Color resizer_color = minimap->get_theme_color(SNAME("resizer_color"));
minimap->draw_texture(resizer, Point2(), resizer_color);
}
@@ -1070,7 +1070,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
if (mm.is_valid() && dragging) {
if (!moving_selection) {
- emit_signal("begin_node_move");
+ emit_signal(SNAME("begin_node_move"));
moving_selection = true;
}
@@ -1113,17 +1113,17 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
if (in_box) {
if (!gn->is_selected() && box_selection_mode_additive) {
- emit_signal("node_selected", gn);
+ emit_signal(SNAME("node_selected"), gn);
} else if (gn->is_selected() && !box_selection_mode_additive) {
- emit_signal("node_deselected", gn);
+ emit_signal(SNAME("node_deselected"), gn);
}
gn->set_selected(box_selection_mode_additive);
} else {
bool select = (previous_selected.find(gn) != nullptr);
if (gn->is_selected() && !select) {
- emit_signal("node_deselected", gn);
+ emit_signal(SNAME("node_deselected"), gn);
} else if (!gn->is_selected() && select) {
- emit_signal("node_selected", gn);
+ emit_signal(SNAME("node_selected"), gn);
}
gn->set_selected(select);
}
@@ -1146,9 +1146,9 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
bool select = (previous_selected.find(gn) != nullptr);
if (gn->is_selected() && !select) {
- emit_signal("node_deselected", gn);
+ emit_signal(SNAME("node_deselected"), gn);
} else if (!gn->is_selected() && select) {
- emit_signal("node_selected", gn);
+ emit_signal(SNAME("node_selected"), gn);
}
gn->set_selected(select);
}
@@ -1160,7 +1160,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
top_layer->update();
minimap->update();
} else {
- emit_signal("popup_request", b->get_global_position());
+ emit_signal(SNAME("popup_request"), b->get_global_position());
}
}
}
@@ -1175,7 +1175,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
Rect2 r = gn->get_rect();
r.size *= zoom;
if (r.has_point(b->get_position())) {
- emit_signal("node_deselected", gn);
+ emit_signal(SNAME("node_deselected"), gn);
gn->set_selected(false);
}
}
@@ -1192,7 +1192,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
}
if (moving_selection) {
- emit_signal("end_node_move");
+ emit_signal(SNAME("end_node_move"));
moving_selection = false;
}
@@ -1238,7 +1238,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
o_gn->set_selected(true);
} else {
if (o_gn->is_selected()) {
- emit_signal("node_deselected", o_gn);
+ emit_signal(SNAME("node_deselected"), o_gn);
}
o_gn->set_selected(false);
}
@@ -1298,7 +1298,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
continue;
}
if (gn2->is_selected()) {
- emit_signal("node_deselected", gn2);
+ emit_signal(SNAME("node_deselected"), gn2);
}
gn2->set_selected(false);
}
@@ -1333,16 +1333,16 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
if (p_ev->is_pressed()) {
if (p_ev->is_action("ui_graph_duplicate")) {
- emit_signal("duplicate_nodes_request");
+ emit_signal(SNAME("duplicate_nodes_request"));
accept_event();
} else if (p_ev->is_action("ui_copy")) {
- emit_signal("copy_nodes_request");
+ emit_signal(SNAME("copy_nodes_request"));
accept_event();
} else if (p_ev->is_action("ui_paste")) {
- emit_signal("paste_nodes_request");
+ emit_signal(SNAME("paste_nodes_request"));
accept_event();
} else if (p_ev->is_action("ui_graph_delete")) {
- emit_signal("delete_nodes_request");
+ emit_signal(SNAME("delete_nodes_request"));
accept_event();
}
}
diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp
index 836bffdf46..e85cefcb7b 100644
--- a/scene/gui/graph_node.cpp
+++ b/scene/gui/graph_node.cpp
@@ -180,9 +180,9 @@ void GraphNode::_resort() {
/** First pass, determine minimum size AND amount of stretchable elements */
Size2i new_size = get_size();
- Ref<StyleBox> sb = get_theme_stylebox("frame");
+ Ref<StyleBox> sb = get_theme_stylebox(SNAME("frame"));
- int sep = get_theme_constant("separation");
+ int sep = get_theme_constant(SNAME("separation"));
bool first = true;
int children_count = 0;
@@ -323,8 +323,8 @@ void GraphNode::_resort() {
bool GraphNode::has_point(const Point2 &p_point) const {
if (comment) {
- Ref<StyleBox> comment = get_theme_stylebox("comment");
- Ref<Texture2D> resizer = get_theme_icon("resizer");
+ Ref<StyleBox> comment = get_theme_stylebox(SNAME("comment"));
+ Ref<Texture2D> resizer = get_theme_icon(SNAME("resizer"));
if (Rect2(get_size() - resizer->get_size(), resizer->get_size()).has_point(p_point)) {
return true;
@@ -355,18 +355,18 @@ void GraphNode::_notification(int p_what) {
//sb=sb->duplicate();
//sb->call("set_modulate",modulate);
- Ref<Texture2D> port = get_theme_icon("port");
- Ref<Texture2D> close = get_theme_icon("close");
- Ref<Texture2D> resizer = get_theme_icon("resizer");
- int close_offset = get_theme_constant("close_offset");
- int close_h_offset = get_theme_constant("close_h_offset");
- Color close_color = get_theme_color("close_color");
- Color resizer_color = get_theme_color("resizer_color");
- int title_offset = get_theme_constant("title_offset");
- int title_h_offset = get_theme_constant("title_h_offset");
- Color title_color = get_theme_color("title_color");
+ Ref<Texture2D> port = get_theme_icon(SNAME("port"));
+ Ref<Texture2D> close = get_theme_icon(SNAME("close"));
+ Ref<Texture2D> resizer = get_theme_icon(SNAME("resizer"));
+ int close_offset = get_theme_constant(SNAME("close_offset"));
+ int close_h_offset = get_theme_constant(SNAME("close_h_offset"));
+ Color close_color = get_theme_color(SNAME("close_color"));
+ Color resizer_color = get_theme_color(SNAME("resizer_color"));
+ int title_offset = get_theme_constant(SNAME("title_offset"));
+ int title_h_offset = get_theme_constant(SNAME("title_h_offset"));
+ Color title_color = get_theme_color(SNAME("title_color"));
Point2i icofs = -port->get_size() * 0.5;
- int edgeofs = get_theme_constant("port_offset");
+ int edgeofs = get_theme_constant(SNAME("port_offset"));
icofs.y += sb->get_margin(SIDE_TOP);
draw_style_box(sb, Rect2(Point2(), get_size()));
@@ -375,10 +375,10 @@ void GraphNode::_notification(int p_what) {
case OVERLAY_DISABLED: {
} break;
case OVERLAY_BREAKPOINT: {
- draw_style_box(get_theme_stylebox("breakpoint"), Rect2(Point2(), get_size()));
+ draw_style_box(get_theme_stylebox(SNAME("breakpoint")), Rect2(Point2(), get_size()));
} break;
case OVERLAY_POSITION: {
- draw_style_box(get_theme_stylebox("position"), Rect2(Point2(), get_size()));
+ draw_style_box(get_theme_stylebox(SNAME("position")), Rect2(Point2(), get_size()));
} break;
}
@@ -446,8 +446,8 @@ void GraphNode::_notification(int p_what) {
}
void GraphNode::_shape() {
- Ref<Font> font = get_theme_font("title_font");
- int font_size = get_theme_font_size("title_font_size");
+ Ref<Font> font = get_theme_font(SNAME("title_font"));
+ int font_size = get_theme_font_size(SNAME("title_font_size"));
title_buf->clear();
if (text_direction == Control::TEXT_DIRECTION_INHERITED) {
@@ -481,7 +481,7 @@ void GraphNode::set_slot(int p_idx, bool p_enable_left, int p_type_left, const C
update();
connpos_dirty = true;
- emit_signal("slot_updated", p_idx);
+ emit_signal(SNAME("slot_updated"), p_idx);
}
void GraphNode::clear_slot(int p_idx) {
@@ -510,7 +510,7 @@ void GraphNode::set_slot_enabled_left(int p_idx, bool p_enable_left) {
update();
connpos_dirty = true;
- emit_signal("slot_updated", p_idx);
+ emit_signal(SNAME("slot_updated"), p_idx);
}
void GraphNode::set_slot_type_left(int p_idx, int p_type_left) {
@@ -520,7 +520,7 @@ void GraphNode::set_slot_type_left(int p_idx, int p_type_left) {
update();
connpos_dirty = true;
- emit_signal("slot_updated", p_idx);
+ emit_signal(SNAME("slot_updated"), p_idx);
}
int GraphNode::get_slot_type_left(int p_idx) const {
@@ -537,7 +537,7 @@ void GraphNode::set_slot_color_left(int p_idx, const Color &p_color_left) {
update();
connpos_dirty = true;
- emit_signal("slot_updated", p_idx);
+ emit_signal(SNAME("slot_updated"), p_idx);
}
Color GraphNode::get_slot_color_left(int p_idx) const {
@@ -561,7 +561,7 @@ void GraphNode::set_slot_enabled_right(int p_idx, bool p_enable_right) {
update();
connpos_dirty = true;
- emit_signal("slot_updated", p_idx);
+ emit_signal(SNAME("slot_updated"), p_idx);
}
void GraphNode::set_slot_type_right(int p_idx, int p_type_right) {
@@ -571,7 +571,7 @@ void GraphNode::set_slot_type_right(int p_idx, int p_type_right) {
update();
connpos_dirty = true;
- emit_signal("slot_updated", p_idx);
+ emit_signal(SNAME("slot_updated"), p_idx);
}
int GraphNode::get_slot_type_right(int p_idx) const {
@@ -588,7 +588,7 @@ void GraphNode::set_slot_color_right(int p_idx, const Color &p_color_right) {
update();
connpos_dirty = true;
- emit_signal("slot_updated", p_idx);
+ emit_signal(SNAME("slot_updated"), p_idx);
}
Color GraphNode::get_slot_color_right(int p_idx) const {
@@ -599,14 +599,14 @@ Color GraphNode::get_slot_color_right(int p_idx) const {
}
Size2 GraphNode::get_minimum_size() const {
- int sep = get_theme_constant("separation");
- Ref<StyleBox> sb = get_theme_stylebox("frame");
+ int sep = get_theme_constant(SNAME("separation"));
+ Ref<StyleBox> sb = get_theme_stylebox(SNAME("frame"));
bool first = true;
Size2 minsize;
minsize.x = title_buf->get_size().x;
if (show_close) {
- Ref<Texture2D> close = get_theme_icon("close");
+ Ref<Texture2D> close = get_theme_icon(SNAME("close"));
minsize.x += sep + close->get_width();
}
@@ -699,7 +699,7 @@ String GraphNode::get_language() const {
void GraphNode::set_position_offset(const Vector2 &p_offset) {
position_offset = p_offset;
- emit_signal("position_offset_changed");
+ emit_signal(SNAME("position_offset_changed"));
update();
}
@@ -720,7 +720,7 @@ void GraphNode::set_drag(bool p_drag) {
if (p_drag) {
drag_from = get_position_offset();
} else {
- emit_signal("dragged", drag_from, get_position_offset()); //useful for undo/redo
+ emit_signal(SNAME("dragged"), drag_from, get_position_offset()); //useful for undo/redo
}
}
@@ -738,10 +738,10 @@ bool GraphNode::is_close_button_visible() const {
}
void GraphNode::_connpos_update() {
- int edgeofs = get_theme_constant("port_offset");
- int sep = get_theme_constant("separation");
+ int edgeofs = get_theme_constant(SNAME("port_offset"));
+ int sep = get_theme_constant(SNAME("separation"));
- Ref<StyleBox> sb = get_theme_stylebox("frame");
+ Ref<StyleBox> sb = get_theme_stylebox(SNAME("frame"));
conn_input_cache.clear();
conn_output_cache.clear();
int vofs = 0;
@@ -875,12 +875,12 @@ void GraphNode::_gui_input(const Ref<InputEvent> &p_ev) {
if (close_rect.size != Size2() && close_rect.has_point(mpos)) {
//send focus to parent
get_parent_control()->grab_focus();
- emit_signal("close_request");
+ emit_signal(SNAME("close_request"));
accept_event();
return;
}
- Ref<Texture2D> resizer = get_theme_icon("resizer");
+ Ref<Texture2D> resizer = get_theme_icon(SNAME("resizer"));
if (resizable && mpos.x > get_size().x - resizer->get_width() && mpos.y > get_size().y - resizer->get_height()) {
resizing = true;
@@ -890,7 +890,7 @@ void GraphNode::_gui_input(const Ref<InputEvent> &p_ev) {
return;
}
- emit_signal("raise_request");
+ emit_signal(SNAME("raise_request"));
}
if (!mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
@@ -904,7 +904,7 @@ void GraphNode::_gui_input(const Ref<InputEvent> &p_ev) {
Vector2 diff = mpos - resizing_from;
- emit_signal("resize_request", resizing_from_size + diff);
+ emit_signal(SNAME("resize_request"), resizing_from_size + diff);
}
}
diff --git a/scene/gui/grid_container.cpp b/scene/gui/grid_container.cpp
index a54f5eef06..1107e3a4af 100644
--- a/scene/gui/grid_container.cpp
+++ b/scene/gui/grid_container.cpp
@@ -38,8 +38,8 @@ void GridContainer::_notification(int p_what) {
Set<int> col_expanded; // Columns which have the SIZE_EXPAND flag set.
Set<int> row_expanded; // Rows which have the SIZE_EXPAND flag set.
- int hsep = get_theme_constant("hseparation");
- int vsep = get_theme_constant("vseparation");
+ int hsep = get_theme_constant(SNAME("hseparation"));
+ int vsep = get_theme_constant(SNAME("vseparation"));
int max_col = MIN(get_child_count(), columns);
int max_row = ceil((float)get_child_count() / (float)columns);
@@ -213,8 +213,8 @@ Size2 GridContainer::get_minimum_size() const {
Map<int, int> col_minw;
Map<int, int> row_minh;
- int hsep = get_theme_constant("hseparation");
- int vsep = get_theme_constant("vseparation");
+ int hsep = get_theme_constant(SNAME("hseparation"));
+ int vsep = get_theme_constant(SNAME("vseparation"));
int max_row = 0;
int max_col = 0;
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index b0d54bf8c9..fdf6181f1d 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -42,7 +42,7 @@ void ItemList::_shape(int p_idx) {
} else {
item.text_buf->set_direction((TextServer::Direction)item.text_direction);
}
- item.text_buf->add_string(item.text, get_theme_font("font"), get_theme_font_size("font_size"), item.opentype_features, (item.language != "") ? item.language : TranslationServer::get_singleton()->get_tool_locale());
+ item.text_buf->add_string(item.text, get_theme_font(SNAME("font")), get_theme_font_size(SNAME("font_size")), item.opentype_features, (item.language != "") ? item.language : TranslationServer::get_singleton()->get_tool_locale());
if (icon_mode == ICON_MODE_TOP && max_text_lines > 0) {
item.text_buf->set_flags(TextServer::BREAK_MANDATORY | TextServer::BREAK_WORD_BOUND | TextServer::BREAK_GRAPHEME_BOUND);
} else {
@@ -548,7 +548,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
if (defer_select_single >= 0 && mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT && !mb->is_pressed()) {
select(defer_select_single, true);
- emit_signal("multi_selected", defer_select_single, true);
+ emit_signal(SNAME("multi_selected"), defer_select_single, true);
defer_select_single = -1;
return;
}
@@ -556,7 +556,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
if (mb.is_valid() && (mb->get_button_index() == MOUSE_BUTTON_LEFT || (allow_rmb_select && mb->get_button_index() == MOUSE_BUTTON_RIGHT)) && mb->is_pressed()) {
search_string = ""; //any mousepress cancels
Vector2 pos = mb->get_position();
- Ref<StyleBox> bg = get_theme_stylebox("bg");
+ Ref<StyleBox> bg = get_theme_stylebox(SNAME("bg"));
pos -= bg->get_offset();
pos.y += scroll_bar->get_value();
@@ -583,7 +583,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
if (select_mode == SELECT_MULTI && items[i].selected && mb->is_command_pressed()) {
deselect(i);
- emit_signal("multi_selected", i, false);
+ emit_signal(SNAME("multi_selected"), i, false);
} else if (select_mode == SELECT_MULTI && mb->is_shift_pressed() && current >= 0 && current < items.size() && current != i) {
int from = current;
@@ -595,12 +595,12 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
bool selected = !items[j].selected;
select(j, false);
if (selected) {
- emit_signal("multi_selected", j, true);
+ emit_signal(SNAME("multi_selected"), j, true);
}
}
if (mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
- emit_signal("item_rmb_selected", i, get_local_mouse_position());
+ emit_signal(SNAME("item_rmb_selected"), i, get_local_mouse_position());
}
} else {
if (!mb->is_double_click() && !mb->is_command_pressed() && select_mode == SELECT_MULTI && items[i].selectable && !items[i].disabled && items[i].selected && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
@@ -609,7 +609,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
}
if (items[i].selected && mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
- emit_signal("item_rmb_selected", i, get_local_mouse_position());
+ emit_signal(SNAME("item_rmb_selected"), i, get_local_mouse_position());
} else {
bool selected = items[i].selected;
@@ -617,16 +617,16 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
if (!selected || allow_reselect) {
if (select_mode == SELECT_SINGLE) {
- emit_signal("item_selected", i);
+ emit_signal(SNAME("item_selected"), i);
} else {
- emit_signal("multi_selected", i, true);
+ emit_signal(SNAME("multi_selected"), i, true);
}
}
if (mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
- emit_signal("item_rmb_selected", i, get_local_mouse_position());
+ emit_signal(SNAME("item_rmb_selected"), i, get_local_mouse_position());
} else if (/*select_mode==SELECT_SINGLE &&*/ mb->is_double_click()) {
- emit_signal("item_activated", i);
+ emit_signal(SNAME("item_activated"), i);
}
}
}
@@ -634,13 +634,13 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
return;
}
if (mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
- emit_signal("rmb_clicked", mb->get_position());
+ emit_signal(SNAME("rmb_clicked"), mb->get_position());
return;
}
// Since closest is null, more likely we clicked on empty space, so send signal to interested controls. Allows, for example, implement items deselecting.
- emit_signal("nothing_selected");
+ emit_signal(SNAME("nothing_selected"));
}
if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && mb->is_pressed()) {
scroll_bar->set_value(scroll_bar->get_value() - scroll_bar->get_page() * mb->get_factor() / 8);
@@ -661,7 +661,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
set_current(i);
ensure_current_is_visible();
if (select_mode == SELECT_SINGLE) {
- emit_signal("item_selected", current);
+ emit_signal(SNAME("item_selected"), current);
}
break;
@@ -676,7 +676,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
set_current(current - current_columns);
ensure_current_is_visible();
if (select_mode == SELECT_SINGLE) {
- emit_signal("item_selected", current);
+ emit_signal(SNAME("item_selected"), current);
}
accept_event();
}
@@ -691,7 +691,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
set_current(i);
ensure_current_is_visible();
if (select_mode == SELECT_SINGLE) {
- emit_signal("item_selected", current);
+ emit_signal(SNAME("item_selected"), current);
}
break;
}
@@ -705,7 +705,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
set_current(current + current_columns);
ensure_current_is_visible();
if (select_mode == SELECT_SINGLE) {
- emit_signal("item_selected", current);
+ emit_signal(SNAME("item_selected"), current);
}
accept_event();
}
@@ -717,7 +717,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
set_current(current - current_columns * i);
ensure_current_is_visible();
if (select_mode == SELECT_SINGLE) {
- emit_signal("item_selected", current);
+ emit_signal(SNAME("item_selected"), current);
}
accept_event();
break;
@@ -731,7 +731,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
set_current(current + current_columns * i);
ensure_current_is_visible();
if (select_mode == SELECT_SINGLE) {
- emit_signal("item_selected", current);
+ emit_signal(SNAME("item_selected"), current);
}
accept_event();
@@ -745,7 +745,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
set_current(current - 1);
ensure_current_is_visible();
if (select_mode == SELECT_SINGLE) {
- emit_signal("item_selected", current);
+ emit_signal(SNAME("item_selected"), current);
}
accept_event();
}
@@ -756,7 +756,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
set_current(current + 1);
ensure_current_is_visible();
if (select_mode == SELECT_SINGLE) {
- emit_signal("item_selected", current);
+ emit_signal(SNAME("item_selected"), current);
}
accept_event();
}
@@ -766,17 +766,17 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
if (current >= 0 && current < items.size()) {
if (items[current].selectable && !items[current].disabled && !items[current].selected) {
select(current, false);
- emit_signal("multi_selected", current, true);
+ emit_signal(SNAME("multi_selected"), current, true);
} else if (items[current].selected) {
deselect(current);
- emit_signal("multi_selected", current, false);
+ emit_signal(SNAME("multi_selected"), current, false);
}
}
} else if (p_event->is_action("ui_accept")) {
search_string = ""; //any mousepress cancels
if (current >= 0 && current < items.size()) {
- emit_signal("item_activated", current);
+ emit_signal(SNAME("item_activated"), current);
}
} else {
Ref<InputEventKey> k = p_event;
@@ -812,7 +812,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
set_current(i);
ensure_current_is_visible();
if (select_mode == SELECT_SINGLE) {
- emit_signal("item_selected", current);
+ emit_signal(SNAME("item_selected"), current);
}
break;
}
@@ -867,7 +867,7 @@ void ItemList::_notification(int p_what) {
}
if (p_what == NOTIFICATION_DRAW) {
- Ref<StyleBox> bg = get_theme_stylebox("bg");
+ Ref<StyleBox> bg = get_theme_stylebox(SNAME("bg"));
int mw = scroll_bar->get_minimum_size().x;
scroll_bar->set_anchor_and_offset(SIDE_LEFT, ANCHOR_END, -mw);
@@ -884,24 +884,24 @@ void ItemList::_notification(int p_what) {
draw_style_box(bg, Rect2(Point2(), size));
- int hseparation = get_theme_constant("hseparation");
- int vseparation = get_theme_constant("vseparation");
- int icon_margin = get_theme_constant("icon_margin");
- int line_separation = get_theme_constant("line_separation");
- Color font_outline_color = get_theme_color("font_outline_color");
- int outline_size = get_theme_constant("outline_size");
+ int hseparation = get_theme_constant(SNAME("hseparation"));
+ int vseparation = get_theme_constant(SNAME("vseparation"));
+ int icon_margin = get_theme_constant(SNAME("icon_margin"));
+ int line_separation = get_theme_constant(SNAME("line_separation"));
+ Color font_outline_color = get_theme_color(SNAME("font_outline_color"));
+ int outline_size = get_theme_constant(SNAME("outline_size"));
- Ref<StyleBox> sbsel = has_focus() ? get_theme_stylebox("selected_focus") : get_theme_stylebox("selected");
- Ref<StyleBox> cursor = has_focus() ? get_theme_stylebox("cursor") : get_theme_stylebox("cursor_unfocused");
+ Ref<StyleBox> sbsel = has_focus() ? get_theme_stylebox(SNAME("selected_focus")) : get_theme_stylebox(SNAME("selected"));
+ Ref<StyleBox> cursor = has_focus() ? get_theme_stylebox(SNAME("cursor")) : get_theme_stylebox(SNAME("cursor_unfocused"));
bool rtl = is_layout_rtl();
- Color guide_color = get_theme_color("guide_color");
- Color font_color = get_theme_color("font_color");
- Color font_selected_color = get_theme_color("font_selected_color");
+ Color guide_color = get_theme_color(SNAME("guide_color"));
+ Color font_color = get_theme_color(SNAME("font_color"));
+ Color font_selected_color = get_theme_color(SNAME("font_selected_color"));
if (has_focus()) {
RenderingServer::get_singleton()->canvas_item_add_clip_ignore(get_canvas_item(), true);
- draw_style_box(get_theme_stylebox("bg_focus"), Rect2(Point2(), size));
+ draw_style_box(get_theme_stylebox(SNAME("bg_focus")), Rect2(Point2(), size));
RenderingServer::get_singleton()->canvas_item_add_clip_ignore(get_canvas_item(), false);
}
@@ -1299,7 +1299,7 @@ void ItemList::_scroll_changed(double) {
int ItemList::get_item_at_position(const Point2 &p_pos, bool p_exact) const {
Vector2 pos = p_pos;
- Ref<StyleBox> bg = get_theme_stylebox("bg");
+ Ref<StyleBox> bg = get_theme_stylebox(SNAME("bg"));
pos -= bg->get_offset();
pos.y += scroll_bar->get_value();
@@ -1337,7 +1337,7 @@ bool ItemList::is_pos_at_end_of_items(const Point2 &p_pos) const {
}
Vector2 pos = p_pos;
- Ref<StyleBox> bg = get_theme_stylebox("bg");
+ Ref<StyleBox> bg = get_theme_stylebox(SNAME("bg"));
pos -= bg->get_offset();
pos.y += scroll_bar->get_value();
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp
index 78b9ad2569..06faf3fa3e 100644
--- a/scene/gui/label.cpp
+++ b/scene/gui/label.cpp
@@ -64,7 +64,7 @@ bool Label::is_uppercase() const {
}
int Label::get_line_height(int p_line) const {
- Ref<Font> font = get_theme_font("font");
+ Ref<Font> font = get_theme_font(SNAME("font"));
if (p_line >= 0 && p_line < lines_rid.size()) {
return TS->shaped_text_get_size(lines_rid[p_line]).y + font->get_spacing(Font::SPACING_TOP) + font->get_spacing(Font::SPACING_BOTTOM);
} else if (lines_rid.size() > 0) {
@@ -74,12 +74,12 @@ int Label::get_line_height(int p_line) const {
}
return h;
} else {
- return font->get_height(get_theme_font_size("font_size"));
+ return font->get_height(get_theme_font_size(SNAME("font_size")));
}
}
void Label::_shape() {
- Ref<StyleBox> style = get_theme_stylebox("normal", "Label");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("normal"), SNAME("Label"));
int width = (get_size().width - style->get_minimum_size().width);
if (dirty) {
@@ -89,7 +89,7 @@ void Label::_shape() {
} else {
TS->shaped_text_set_direction(text_rid, (TextServer::Direction)text_direction);
}
- TS->shaped_text_add_string(text_rid, (uppercase) ? xl_text.to_upper() : xl_text, get_theme_font("font")->get_rids(), get_theme_font_size("font_size"), opentype_features, (language != "") ? language : TranslationServer::get_singleton()->get_tool_locale());
+ TS->shaped_text_add_string(text_rid, (uppercase) ? xl_text.to_upper() : xl_text, get_theme_font(SNAME("font"))->get_rids(), get_theme_font_size(SNAME("font_size")), opentype_features, (language != "") ? language : TranslationServer::get_singleton()->get_tool_locale());
TS->shaped_text_set_bidi_override(text_rid, structured_text_parser(st_parser, st_args, xl_text));
dirty = false;
lines_dirty = true;
@@ -200,9 +200,9 @@ void Label::_shape() {
}
void Label::_update_visible() {
- int line_spacing = get_theme_constant("line_spacing", "Label");
- Ref<StyleBox> style = get_theme_stylebox("normal", "Label");
- Ref<Font> font = get_theme_font("font");
+ int line_spacing = get_theme_constant(SNAME("line_spacing"), SNAME("Label"));
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("normal"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SNAME("font"));
int lines_visible = lines_rid.size();
if (max_lines_visible >= 0 && lines_visible > max_lines_visible) {
@@ -244,15 +244,15 @@ void Label::_notification(int p_what) {
Size2 string_size;
Size2 size = get_size();
- Ref<StyleBox> style = get_theme_stylebox("normal");
- Ref<Font> font = get_theme_font("font");
- Color font_color = get_theme_color("font_color");
- Color font_shadow_color = get_theme_color("font_shadow_color");
- Point2 shadow_ofs(get_theme_constant("shadow_offset_x"), get_theme_constant("shadow_offset_y"));
- int line_spacing = get_theme_constant("line_spacing");
- Color font_outline_color = get_theme_color("font_outline_color");
- int outline_size = get_theme_constant("outline_size");
- int shadow_outline_size = get_theme_constant("shadow_outline_size");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("normal"));
+ Ref<Font> font = get_theme_font(SNAME("font"));
+ Color font_color = get_theme_color(SNAME("font_color"));
+ Color font_shadow_color = get_theme_color(SNAME("font_shadow_color"));
+ Point2 shadow_ofs(get_theme_constant(SNAME("shadow_offset_x")), get_theme_constant(SNAME("shadow_offset_y")));
+ int line_spacing = get_theme_constant(SNAME("line_spacing"));
+ Color font_outline_color = get_theme_color(SNAME("font_outline_color"));
+ int outline_size = get_theme_constant(SNAME("outline_size"));
+ int shadow_outline_size = get_theme_constant(SNAME("shadow_outline_size"));
bool rtl = is_layout_rtl();
style->draw(ci, Rect2(Point2(0, 0), get_size()));
@@ -429,10 +429,10 @@ Size2 Label::get_minimum_size() const {
Size2 min_size = minsize;
- Ref<Font> font = get_theme_font("font");
- min_size.height = MAX(min_size.height, font->get_height(get_theme_font_size("font_size")) + font->get_spacing(Font::SPACING_TOP) + font->get_spacing(Font::SPACING_BOTTOM));
+ Ref<Font> font = get_theme_font(SNAME("font"));
+ min_size.height = MAX(min_size.height, font->get_height(get_theme_font_size(SNAME("font_size"))) + font->get_spacing(Font::SPACING_TOP) + font->get_spacing(Font::SPACING_BOTTOM));
- Size2 min_style = get_theme_stylebox("normal")->get_minimum_size();
+ Size2 min_style = get_theme_stylebox(SNAME("normal"))->get_minimum_size();
if (autowrap_mode != AUTOWRAP_OFF) {
return Size2(1, (clip || overrun_behavior != OVERRUN_NO_TRIMMING) ? 1 : min_size.height) + min_style;
} else {
@@ -455,9 +455,9 @@ int Label::get_line_count() const {
}
int Label::get_visible_line_count() const {
- Ref<Font> font = get_theme_font("font");
- Ref<StyleBox> style = get_theme_stylebox("normal");
- int line_spacing = get_theme_constant("line_spacing");
+ Ref<Font> font = get_theme_font(SNAME("font"));
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("normal"));
+ int line_spacing = get_theme_constant(SNAME("line_spacing"));
int lines_visible = 0;
float total_h = 0.0;
for (int64_t i = lines_skipped; i < lines_rid.size(); i++) {
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index c862624f98..8248cfbe4a 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -350,7 +350,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
if (context_menu_enabled) {
if (k->is_action("ui_menu", true)) {
_ensure_menu();
- Point2 pos = Point2(get_caret_pixel_pos().x, (get_size().y + get_theme_font("font")->get_height(get_theme_font_size("font_size"))) / 2);
+ Point2 pos = Point2(get_caret_pixel_pos().x, (get_size().y + get_theme_font(SNAME("font"))->get_height(get_theme_font_size(SNAME("font_size")))) / 2);
menu->set_position(get_global_transform().xform(pos));
menu->set_size(Vector2(1, 1));
_generate_context_menu();
@@ -361,7 +361,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
// Default is ENTER and KP_ENTER. Cannot use ui_accept as default includes SPACE
if (k->is_action("ui_text_submit", false)) {
- emit_signal("text_submitted", text);
+ emit_signal(SNAME("text_submitted"), text);
if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_VIRTUAL_KEYBOARD) && virtual_keyboard_enabled) {
DisplayServer::get_singleton()->virtual_keyboard_hide();
}
@@ -569,8 +569,8 @@ bool LineEdit::_is_over_clear_button(const Point2 &p_pos) const {
if (!clear_button_enabled || !has_point(p_pos)) {
return false;
}
- Ref<Texture2D> icon = Control::get_theme_icon("clear");
- int x_ofs = get_theme_stylebox("normal")->get_offset().x;
+ Ref<Texture2D> icon = Control::get_theme_icon(SNAME("clear"));
+ int x_ofs = get_theme_stylebox(SNAME("normal"))->get_offset().x;
return p_pos.x > get_size().width - icon->get_width() - x_ofs;
}
@@ -627,17 +627,17 @@ void LineEdit::_notification(int p_what) {
RID ci = get_canvas_item();
- Ref<StyleBox> style = get_theme_stylebox("normal");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("normal"));
if (!is_editable()) {
- style = get_theme_stylebox("read_only");
+ style = get_theme_stylebox(SNAME("read_only"));
draw_caret = false;
}
- Ref<Font> font = get_theme_font("font");
+ Ref<Font> font = get_theme_font(SNAME("font"));
style->draw(ci, Rect2(Point2(), size));
if (has_focus()) {
- get_theme_stylebox("focus")->draw(ci, Rect2(Point2(), size));
+ get_theme_stylebox(SNAME("focus"))->draw(ci, Rect2(Point2(), size));
}
int x_ofs = 0;
@@ -675,10 +675,10 @@ void LineEdit::_notification(int p_what) {
int y_area = height - style->get_minimum_size().height;
int y_ofs = style->get_offset().y + (y_area - text_height) / 2;
- Color selection_color = get_theme_color("selection_color");
- Color font_color = is_editable() ? get_theme_color("font_color") : get_theme_color("font_uneditable_color");
- Color font_selected_color = get_theme_color("font_selected_color");
- Color caret_color = get_theme_color("caret_color");
+ Color selection_color = get_theme_color(SNAME("selection_color"));
+ Color font_color = is_editable() ? get_theme_color(SNAME("font_color")) : get_theme_color(SNAME("font_uneditable_color"));
+ Color font_selected_color = get_theme_color(SNAME("font_selected_color"));
+ Color caret_color = get_theme_color(SNAME("caret_color"));
// Draw placeholder color.
if (using_placeholder) {
@@ -687,13 +687,13 @@ void LineEdit::_notification(int p_what) {
bool display_clear_icon = !using_placeholder && is_editable() && clear_button_enabled;
if (right_icon.is_valid() || display_clear_icon) {
- Ref<Texture2D> r_icon = display_clear_icon ? Control::get_theme_icon("clear") : right_icon;
+ Ref<Texture2D> r_icon = display_clear_icon ? Control::get_theme_icon(SNAME("clear")) : right_icon;
Color color_icon(1, 1, 1, !is_editable() ? .5 * .9 : .9);
if (display_clear_icon) {
if (clear_button_status.press_attempt && clear_button_status.pressing_inside) {
- color_icon = get_theme_color("clear_button_color_pressed");
+ color_icon = get_theme_color(SNAME("clear_button_color_pressed"));
} else {
- color_icon = get_theme_color("clear_button_color");
+ color_icon = get_theme_color(SNAME("clear_button_color"));
}
}
@@ -740,8 +740,8 @@ void LineEdit::_notification(int p_what) {
// Draw text.
ofs.y += TS->shaped_text_get_ascent(text_rid);
- Color font_outline_color = get_theme_color("font_outline_color");
- int outline_size = get_theme_constant("outline_size");
+ Color font_outline_color = get_theme_color(SNAME("font_outline_color"));
+ int outline_size = get_theme_constant(SNAME("outline_size"));
if (outline_size > 0 && font_outline_color.a > 0) {
Vector2 oofs = ofs;
for (int i = 0; i < gl_size; i++) {
@@ -786,7 +786,7 @@ void LineEdit::_notification(int p_what) {
if (l_caret == Rect2() && t_caret == Rect2()) {
// No carets, add one at the start.
- int h = get_theme_font("font")->get_height(get_theme_font_size("font_size"));
+ int h = get_theme_font(SNAME("font"))->get_height(get_theme_font_size(SNAME("font_size")));
int y = style->get_offset().y + (y_area - h) / 2;
if (rtl) {
l_dir = TextServer::DIRECTION_RTL;
@@ -1008,7 +1008,7 @@ void LineEdit::shift_selection_check_post(bool p_shift) {
}
void LineEdit::set_caret_at_pixel_pos(int p_x) {
- Ref<StyleBox> style = get_theme_stylebox("normal");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("normal"));
bool rtl = is_layout_rtl();
int x_ofs = 0;
@@ -1041,7 +1041,7 @@ void LineEdit::set_caret_at_pixel_pos(int p_x) {
bool using_placeholder = text.is_empty() && ime_text.is_empty();
bool display_clear_icon = !using_placeholder && is_editable() && clear_button_enabled;
if (right_icon.is_valid() || display_clear_icon) {
- Ref<Texture2D> r_icon = display_clear_icon ? Control::get_theme_icon("clear") : right_icon;
+ Ref<Texture2D> r_icon = display_clear_icon ? Control::get_theme_icon(SNAME("clear")) : right_icon;
if (align == ALIGN_CENTER) {
if (scroll_offset == 0) {
x_ofs = MAX(style->get_margin(SIDE_LEFT), int(get_size().width - text_width - r_icon->get_width() - style->get_margin(SIDE_RIGHT) * 2) / 2);
@@ -1056,7 +1056,7 @@ void LineEdit::set_caret_at_pixel_pos(int p_x) {
}
Vector2i LineEdit::get_caret_pixel_pos() {
- Ref<StyleBox> style = get_theme_stylebox("normal");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("normal"));
bool rtl = is_layout_rtl();
int x_ofs = 0;
@@ -1089,7 +1089,7 @@ Vector2i LineEdit::get_caret_pixel_pos() {
bool using_placeholder = text.is_empty() && ime_text.is_empty();
bool display_clear_icon = !using_placeholder && is_editable() && clear_button_enabled;
if (right_icon.is_valid() || display_clear_icon) {
- Ref<Texture2D> r_icon = display_clear_icon ? Control::get_theme_icon("clear") : right_icon;
+ Ref<Texture2D> r_icon = display_clear_icon ? Control::get_theme_icon(SNAME("clear")) : right_icon;
if (align == ALIGN_CENTER) {
if (scroll_offset == 0) {
x_ofs = MAX(style->get_margin(SIDE_LEFT), int(get_size().width - text_width - r_icon->get_width() - style->get_margin(SIDE_RIGHT) * 2) / 2);
@@ -1402,7 +1402,7 @@ void LineEdit::set_caret_column(int p_column) {
return;
}
- Ref<StyleBox> style = get_theme_stylebox("normal");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("normal"));
bool rtl = is_layout_rtl();
int x_ofs = 0;
@@ -1436,7 +1436,7 @@ void LineEdit::set_caret_column(int p_column) {
bool using_placeholder = text.is_empty() && ime_text.is_empty();
bool display_clear_icon = !using_placeholder && is_editable() && clear_button_enabled;
if (right_icon.is_valid() || display_clear_icon) {
- Ref<Texture2D> r_icon = display_clear_icon ? Control::get_theme_icon("clear") : right_icon;
+ Ref<Texture2D> r_icon = display_clear_icon ? Control::get_theme_icon(SNAME("clear")) : right_icon;
if (align == ALIGN_CENTER) {
if (scroll_offset == 0) {
x_ofs = MAX(style->get_margin(SIDE_LEFT), int(get_size().width - text_width - r_icon->get_width() - style->get_margin(SIDE_RIGHT) * 2) / 2);
@@ -1480,7 +1480,7 @@ void LineEdit::insert_text_at_caret(String p_text) {
// Truncate text to append to fit in max_length, if needed.
int available_chars = max_length - text.length();
if (p_text.length() > available_chars) {
- emit_signal("text_change_rejected", p_text.substr(available_chars));
+ emit_signal(SNAME("text_change_rejected"), p_text.substr(available_chars));
p_text = p_text.substr(0, available_chars);
}
}
@@ -1507,15 +1507,15 @@ void LineEdit::clear_internal() {
}
Size2 LineEdit::get_minimum_size() const {
- Ref<StyleBox> style = get_theme_stylebox("normal");
- Ref<Font> font = get_theme_font("font");
- int font_size = get_theme_font_size("font_size");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("normal"));
+ Ref<Font> font = get_theme_font(SNAME("font"));
+ int font_size = get_theme_font_size(SNAME("font_size"));
Size2 min_size;
// Minimum size of text.
int em_space_size = font->get_char_size('M', 0, font_size).x;
- min_size.width = get_theme_constant("minimum_character_width") * em_space_size;
+ min_size.width = get_theme_constant(SNAME("minimum_character_width")) * em_space_size;
if (expand_to_text_length) {
// Add a space because some fonts are too exact, and because caret needs a bit more when at the end.
@@ -1528,7 +1528,7 @@ Size2 LineEdit::get_minimum_size() const {
bool using_placeholder = text.is_empty() && ime_text.is_empty();
bool display_clear_icon = !using_placeholder && is_editable() && clear_button_enabled;
if (right_icon.is_valid() || display_clear_icon) {
- Ref<Texture2D> r_icon = display_clear_icon ? Control::get_theme_icon("clear") : right_icon;
+ Ref<Texture2D> r_icon = display_clear_icon ? Control::get_theme_icon(SNAME("clear")) : right_icon;
min_size.width += r_icon->get_width();
min_size.height = MAX(min_size.height, r_icon->get_height());
}
@@ -1908,7 +1908,7 @@ void LineEdit::_text_changed() {
}
void LineEdit::_emit_text_change() {
- emit_signal("text_changed", text);
+ emit_signal(SNAME("text_changed"), text);
text_changed_dirty = false;
}
@@ -1935,8 +1935,8 @@ void LineEdit::_shape() {
}
TS->shaped_text_set_preserve_control(text_rid, draw_control_chars);
- const Ref<Font> &font = get_theme_font("font");
- int font_size = get_theme_font_size("font_size");
+ const Ref<Font> &font = get_theme_font(SNAME("font"));
+ int font_size = get_theme_font_size(SNAME("font_size"));
TS->shaped_text_add_string(text_rid, t, font->get_rids(), font_size, opentype_features, (language != "") ? language : TranslationServer::get_singleton()->get_tool_locale());
TS->shaped_text_set_bidi_override(text_rid, structured_text_parser(st_parser, st_args, t));
@@ -1952,12 +1952,12 @@ void LineEdit::_shape() {
void LineEdit::_fit_to_width() {
if (align == ALIGN_FILL) {
- Ref<StyleBox> style = get_theme_stylebox("normal");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("normal"));
int t_width = get_size().width - style->get_margin(SIDE_RIGHT) - style->get_margin(SIDE_LEFT);
bool using_placeholder = text.is_empty() && ime_text.is_empty();
bool display_clear_icon = !using_placeholder && is_editable() && clear_button_enabled;
if (right_icon.is_valid() || display_clear_icon) {
- Ref<Texture2D> r_icon = display_clear_icon ? Control::get_theme_icon("clear") : right_icon;
+ Ref<Texture2D> r_icon = display_clear_icon ? Control::get_theme_icon(SNAME("clear")) : right_icon;
t_width -= r_icon->get_width();
}
TS->shaped_text_fit_to_width(text_rid, MAX(t_width, full_width));
diff --git a/scene/gui/link_button.cpp b/scene/gui/link_button.cpp
index ee0618a991..419d49bccf 100644
--- a/scene/gui/link_button.cpp
+++ b/scene/gui/link_button.cpp
@@ -32,8 +32,8 @@
#include "core/string/translation.h"
void LinkButton::_shape() {
- Ref<Font> font = get_theme_font("font");
- int font_size = get_theme_font_size("font_size");
+ Ref<Font> font = get_theme_font(SNAME("font"));
+ int font_size = get_theme_font_size(SNAME("font_size"));
text_buf->clear();
if (text_direction == Control::TEXT_DIRECTION_INHERITED) {
@@ -158,41 +158,41 @@ void LinkButton::_notification(int p_what) {
switch (get_draw_mode()) {
case DRAW_NORMAL: {
- color = get_theme_color("font_color");
+ color = get_theme_color(SNAME("font_color"));
do_underline = underline_mode == UNDERLINE_MODE_ALWAYS;
} break;
case DRAW_HOVER_PRESSED:
case DRAW_PRESSED: {
- if (has_theme_color("font_pressed_color")) {
- color = get_theme_color("font_pressed_color");
+ if (has_theme_color(SNAME("font_pressed_color"))) {
+ color = get_theme_color(SNAME("font_pressed_color"));
} else {
- color = get_theme_color("font_color");
+ color = get_theme_color(SNAME("font_color"));
}
do_underline = underline_mode != UNDERLINE_MODE_NEVER;
} break;
case DRAW_HOVER: {
- color = get_theme_color("font_hover_color");
+ color = get_theme_color(SNAME("font_hover_color"));
do_underline = underline_mode != UNDERLINE_MODE_NEVER;
} break;
case DRAW_DISABLED: {
- color = get_theme_color("font_disabled_color");
+ color = get_theme_color(SNAME("font_disabled_color"));
do_underline = underline_mode == UNDERLINE_MODE_ALWAYS;
} break;
}
if (has_focus()) {
- Ref<StyleBox> style = get_theme_stylebox("focus");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("focus"));
style->draw(ci, Rect2(Point2(), size));
}
int width = text_buf->get_line_width();
- Color font_outline_color = get_theme_color("font_outline_color");
- int outline_size = get_theme_constant("outline_size");
+ Color font_outline_color = get_theme_color(SNAME("font_outline_color"));
+ int outline_size = get_theme_constant(SNAME("outline_size"));
if (is_layout_rtl()) {
if (outline_size > 0 && font_outline_color.a > 0) {
text_buf->draw_outline(get_canvas_item(), Vector2(size.width - width, 0), outline_size, font_outline_color);
@@ -206,7 +206,7 @@ void LinkButton::_notification(int p_what) {
}
if (do_underline) {
- int underline_spacing = get_theme_constant("underline_spacing") + text_buf->get_line_underline_position();
+ int underline_spacing = get_theme_constant(SNAME("underline_spacing")) + text_buf->get_line_underline_position();
int y = text_buf->get_line_ascent() + underline_spacing;
if (is_layout_rtl()) {
diff --git a/scene/gui/margin_container.cpp b/scene/gui/margin_container.cpp
index 0e9610d0a3..50b4d192a9 100644
--- a/scene/gui/margin_container.cpp
+++ b/scene/gui/margin_container.cpp
@@ -31,10 +31,10 @@
#include "margin_container.h"
Size2 MarginContainer::get_minimum_size() const {
- int margin_left = get_theme_constant("margin_left");
- int margin_top = get_theme_constant("margin_top");
- int margin_right = get_theme_constant("margin_right");
- int margin_bottom = get_theme_constant("margin_bottom");
+ int margin_left = get_theme_constant(SNAME("margin_left"));
+ int margin_top = get_theme_constant(SNAME("margin_top"));
+ int margin_right = get_theme_constant(SNAME("margin_right"));
+ int margin_bottom = get_theme_constant(SNAME("margin_bottom"));
Size2 max;
@@ -68,10 +68,10 @@ Size2 MarginContainer::get_minimum_size() const {
void MarginContainer::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_SORT_CHILDREN: {
- int margin_left = get_theme_constant("margin_left");
- int margin_top = get_theme_constant("margin_top");
- int margin_right = get_theme_constant("margin_right");
- int margin_bottom = get_theme_constant("margin_bottom");
+ int margin_left = get_theme_constant(SNAME("margin_left"));
+ int margin_top = get_theme_constant(SNAME("margin_top"));
+ int margin_right = get_theme_constant(SNAME("margin_right"));
+ int margin_bottom = get_theme_constant(SNAME("margin_bottom"));
Size2 s = get_size();
diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp
index e52b6917be..cd55f258b3 100644
--- a/scene/gui/option_button.cpp
+++ b/scene/gui/option_button.cpp
@@ -35,12 +35,12 @@
Size2 OptionButton::get_minimum_size() const {
Size2 minsize = Button::get_minimum_size();
- if (has_theme_icon("arrow")) {
- const Size2 padding = get_theme_stylebox("normal")->get_minimum_size();
- const Size2 arrow_size = Control::get_theme_icon("arrow")->get_size();
+ if (has_theme_icon(SNAME("arrow"))) {
+ const Size2 padding = get_theme_stylebox(SNAME("normal"))->get_minimum_size();
+ const Size2 arrow_size = Control::get_theme_icon(SNAME("arrow"))->get_size();
Size2 content_size = minsize - padding;
- content_size.width += arrow_size.width + get_theme_constant("hseparation");
+ content_size.width += arrow_size.width + get_theme_constant(SNAME("hseparation"));
content_size.height = MAX(content_size.height, arrow_size.height);
minsize = content_size + padding;
@@ -52,26 +52,26 @@ Size2 OptionButton::get_minimum_size() const {
void OptionButton::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_DRAW: {
- if (!has_theme_icon("arrow")) {
+ if (!has_theme_icon(SNAME("arrow"))) {
return;
}
RID ci = get_canvas_item();
- Ref<Texture2D> arrow = Control::get_theme_icon("arrow");
+ Ref<Texture2D> arrow = Control::get_theme_icon(SNAME("arrow"));
Color clr = Color(1, 1, 1);
- if (get_theme_constant("modulate_arrow")) {
+ if (get_theme_constant(SNAME("modulate_arrow"))) {
switch (get_draw_mode()) {
case DRAW_PRESSED:
- clr = get_theme_color("font_pressed_color");
+ clr = get_theme_color(SNAME("font_pressed_color"));
break;
case DRAW_HOVER:
- clr = get_theme_color("font_hover_color");
+ clr = get_theme_color(SNAME("font_hover_color"));
break;
case DRAW_DISABLED:
- clr = get_theme_color("font_disabled_color");
+ clr = get_theme_color(SNAME("font_disabled_color"));
break;
default:
- clr = get_theme_color("font_color");
+ clr = get_theme_color(SNAME("font_color"));
}
}
@@ -79,22 +79,22 @@ void OptionButton::_notification(int p_what) {
Point2 ofs;
if (is_layout_rtl()) {
- ofs = Point2(get_theme_constant("arrow_margin"), int(Math::abs((size.height - arrow->get_height()) / 2)));
+ ofs = Point2(get_theme_constant(SNAME("arrow_margin")), int(Math::abs((size.height - arrow->get_height()) / 2)));
} else {
- ofs = Point2(size.width - arrow->get_width() - get_theme_constant("arrow_margin"), int(Math::abs((size.height - arrow->get_height()) / 2)));
+ ofs = Point2(size.width - arrow->get_width() - get_theme_constant(SNAME("arrow_margin")), int(Math::abs((size.height - arrow->get_height()) / 2)));
}
arrow->draw(ci, ofs, clr);
} break;
case NOTIFICATION_TRANSLATION_CHANGED:
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
case NOTIFICATION_THEME_CHANGED: {
- if (has_theme_icon("arrow")) {
+ if (has_theme_icon(SNAME("arrow"))) {
if (is_layout_rtl()) {
- _set_internal_margin(SIDE_LEFT, Control::get_theme_icon("arrow")->get_width());
+ _set_internal_margin(SIDE_LEFT, Control::get_theme_icon(SNAME("arrow"))->get_width());
_set_internal_margin(SIDE_RIGHT, 0.f);
} else {
_set_internal_margin(SIDE_LEFT, 0.f);
- _set_internal_margin(SIDE_RIGHT, Control::get_theme_icon("arrow")->get_width());
+ _set_internal_margin(SIDE_RIGHT, Control::get_theme_icon(SNAME("arrow"))->get_width());
}
}
} break;
@@ -107,7 +107,7 @@ void OptionButton::_notification(int p_what) {
}
void OptionButton::_focused(int p_which) {
- emit_signal("item_focused", p_which);
+ emit_signal(SNAME("item_focused"), p_which);
}
void OptionButton::_selected(int p_which) {
@@ -220,7 +220,7 @@ void OptionButton::_select(int p_which, bool p_emit) {
set_icon(popup->get_item_icon(current));
if (is_inside_tree() && p_emit) {
- emit_signal("item_selected", current);
+ emit_signal(SNAME("item_selected"), current);
}
}
@@ -339,12 +339,12 @@ OptionButton::OptionButton() {
set_toggle_mode(true);
set_text_align(ALIGN_LEFT);
if (is_layout_rtl()) {
- if (has_theme_icon("arrow")) {
- _set_internal_margin(SIDE_LEFT, Control::get_theme_icon("arrow")->get_width());
+ if (has_theme_icon(SNAME("arrow"))) {
+ _set_internal_margin(SIDE_LEFT, Control::get_theme_icon(SNAME("arrow"))->get_width());
}
} else {
- if (has_theme_icon("arrow")) {
- _set_internal_margin(SIDE_RIGHT, Control::get_theme_icon("arrow")->get_width());
+ if (has_theme_icon(SNAME("arrow"))) {
+ _set_internal_margin(SIDE_RIGHT, Control::get_theme_icon(SNAME("arrow"))->get_width());
}
}
set_action_mode(ACTION_MODE_BUTTON_PRESS);
diff --git a/scene/gui/panel.cpp b/scene/gui/panel.cpp
index 995e985c3a..e8e7e3d997 100644
--- a/scene/gui/panel.cpp
+++ b/scene/gui/panel.cpp
@@ -35,7 +35,7 @@
void Panel::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
RID ci = get_canvas_item();
- Ref<StyleBox> style = mode == MODE_BACKGROUND ? get_theme_stylebox("panel") : get_theme_stylebox("panel_fg");
+ Ref<StyleBox> style = mode == MODE_BACKGROUND ? get_theme_stylebox(SNAME("panel")) : get_theme_stylebox(SNAME("panel_fg"));
style->draw(ci, Rect2(Point2(), get_size()));
}
}
diff --git a/scene/gui/panel_container.cpp b/scene/gui/panel_container.cpp
index 11d822c5e1..d910e1e882 100644
--- a/scene/gui/panel_container.cpp
+++ b/scene/gui/panel_container.cpp
@@ -33,10 +33,10 @@
Size2 PanelContainer::get_minimum_size() const {
Ref<StyleBox> style;
- if (has_theme_stylebox("panel")) {
- style = get_theme_stylebox("panel");
+ if (has_theme_stylebox(SNAME("panel"))) {
+ style = get_theme_stylebox(SNAME("panel"));
} else {
- style = get_theme_stylebox("panel", "PanelContainer");
+ style = get_theme_stylebox(SNAME("panel"), SNAME("PanelContainer"));
}
Size2 ms;
@@ -65,10 +65,10 @@ void PanelContainer::_notification(int p_what) {
RID ci = get_canvas_item();
Ref<StyleBox> style;
- if (has_theme_stylebox("panel")) {
- style = get_theme_stylebox("panel");
+ if (has_theme_stylebox(SNAME("panel"))) {
+ style = get_theme_stylebox(SNAME("panel"));
} else {
- style = get_theme_stylebox("panel", "PanelContainer");
+ style = get_theme_stylebox(SNAME("panel"), SNAME("PanelContainer"));
}
style->draw(ci, Rect2(Point2(), get_size()));
@@ -77,10 +77,10 @@ void PanelContainer::_notification(int p_what) {
if (p_what == NOTIFICATION_SORT_CHILDREN) {
Ref<StyleBox> style;
- if (has_theme_stylebox("panel")) {
- style = get_theme_stylebox("panel");
+ if (has_theme_stylebox(SNAME("panel"))) {
+ style = get_theme_stylebox(SNAME("panel"));
} else {
- style = get_theme_stylebox("panel", "PanelContainer");
+ style = get_theme_stylebox(SNAME("panel"), SNAME("PanelContainer"));
}
Size2 size = get_size();
diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp
index 36bcca61a7..5e1c8cec37 100644
--- a/scene/gui/popup.cpp
+++ b/scene/gui/popup.cpp
@@ -71,7 +71,7 @@ void Popup::_notification(int p_what) {
_initialize_visible_parents();
} else {
_deinitialize_visible_parents();
- emit_signal("popup_hide");
+ emit_signal(SNAME("popup_hide"));
}
} break;
@@ -103,9 +103,9 @@ void Popup::_close_pressed() {
_deinitialize_visible_parents();
- call_deferred("hide");
+ call_deferred(SNAME("hide"));
- emit_signal("cancelled");
+ emit_signal(SNAME("cancelled"));
}
void Popup::set_as_minsize() {
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index 2100707d2d..ee9e0e8ab8 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -46,15 +46,15 @@ String PopupMenu::_get_accel_text(const Item &p_item) const {
}
Size2 PopupMenu::_get_contents_minimum_size() const {
- int vseparation = get_theme_constant("vseparation");
- int hseparation = get_theme_constant("hseparation");
+ int vseparation = get_theme_constant(SNAME("vseparation"));
+ int hseparation = get_theme_constant(SNAME("hseparation"));
- Size2 minsize = get_theme_stylebox("panel")->get_minimum_size(); // Accounts for margin in the margin container
+ Size2 minsize = get_theme_stylebox(SNAME("panel"))->get_minimum_size(); // Accounts for margin in the margin container
minsize.x += scroll_container->get_v_scrollbar()->get_size().width * 2; // Adds a buffer so that the scrollbar does not render over the top of content
float max_w = 0.0;
float icon_w = 0.0;
- int check_w = MAX(get_theme_icon("checked")->get_width(), get_theme_icon("radio_checked")->get_width()) + hseparation;
+ int check_w = MAX(get_theme_icon(SNAME("checked"))->get_width(), get_theme_icon(SNAME("radio_checked"))->get_width()) + hseparation;
int accel_max_w = 0;
bool has_check = false;
@@ -81,7 +81,7 @@ Size2 PopupMenu::_get_contents_minimum_size() const {
}
if (items[i].submenu != "") {
- size.width += get_theme_icon("submenu")->get_width();
+ size.width += get_theme_icon(SNAME("submenu"))->get_width();
}
max_w = MAX(max_w, size.width);
@@ -89,7 +89,7 @@ Size2 PopupMenu::_get_contents_minimum_size() const {
minsize.height += size.height;
}
- int item_side_padding = get_theme_constant("item_start_padding") + get_theme_constant("item_end_padding");
+ int item_side_padding = get_theme_constant(SNAME("item_start_padding")) + get_theme_constant(SNAME("item_end_padding"));
minsize.width += max_w + icon_w + accel_max_w + item_side_padding;
if (has_check) {
@@ -112,24 +112,24 @@ int PopupMenu::_get_item_height(int p_item) const {
int icon_height = items[p_item].get_icon_size().height;
if (items[p_item].checkable_type) {
- icon_height = MAX(icon_height, MAX(get_theme_icon("checked")->get_height(), get_theme_icon("radio_checked")->get_height()));
+ icon_height = MAX(icon_height, MAX(get_theme_icon(SNAME("checked"))->get_height(), get_theme_icon(SNAME("radio_checked"))->get_height()));
}
int text_height = items[p_item].text_buf->get_size().height;
if (text_height == 0 && !items[p_item].separator) {
- text_height = get_theme_font("font")->get_height(get_theme_font_size("font_size"));
+ text_height = get_theme_font(SNAME("font"))->get_height(get_theme_font_size(SNAME("font_size")));
}
int separator_height = 0;
if (items[p_item].separator) {
- separator_height = MAX(get_theme_stylebox("separator")->get_minimum_size().height, MAX(get_theme_stylebox("labeled_separator_left")->get_minimum_size().height, get_theme_stylebox("labeled_separator_right")->get_minimum_size().height));
+ separator_height = MAX(get_theme_stylebox(SNAME("separator"))->get_minimum_size().height, MAX(get_theme_stylebox(SNAME("labeled_separator_left"))->get_minimum_size().height, get_theme_stylebox(SNAME("labeled_separator_right"))->get_minimum_size().height));
}
return MAX(separator_height, MAX(text_height, icon_height));
}
int PopupMenu::_get_items_total_height() const {
- int vsep = get_theme_constant("vseparation");
+ int vsep = get_theme_constant(SNAME("vseparation"));
// Get total height of all items by taking max of icon height and font height
int items_total_height = 0;
@@ -163,9 +163,9 @@ int PopupMenu::_get_mouse_over(const Point2 &p_over) const {
return -1;
}
- Ref<StyleBox> style = get_theme_stylebox("panel"); // Accounts for margin in the margin container
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("panel")); // Accounts for margin in the margin container
- int vseparation = get_theme_constant("vseparation");
+ int vseparation = get_theme_constant(SNAME("vseparation"));
Point2 ofs = style->get_offset() + Point2(0, vseparation / 2);
@@ -195,8 +195,8 @@ void PopupMenu::_activate_submenu(int p_over) {
return; //already visible!
}
- Ref<StyleBox> style = get_theme_stylebox("panel");
- int vsep = get_theme_constant("vseparation");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("panel"));
+ int vsep = get_theme_constant(SNAME("vseparation"));
Point2 this_pos = get_position();
Rect2 this_rect(this_pos, get_size());
@@ -264,7 +264,7 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
for (int i = search_from; i < items.size(); i++) {
if (!items[i].separator && !items[i].disabled) {
mouse_over = i;
- emit_signal("id_focused", i);
+ emit_signal(SNAME("id_focused"), i);
_scroll_to_item(i);
control->update();
set_input_as_handled();
@@ -278,7 +278,7 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
for (int i = 0; i < search_from; i++) {
if (!items[i].separator && !items[i].disabled) {
mouse_over = i;
- emit_signal("id_focused", i);
+ emit_signal(SNAME("id_focused"), i);
_scroll_to_item(i);
control->update();
set_input_as_handled();
@@ -296,7 +296,7 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
for (int i = search_from; i >= 0; i--) {
if (!items[i].separator && !items[i].disabled) {
mouse_over = i;
- emit_signal("id_focused", i);
+ emit_signal(SNAME("id_focused"), i);
_scroll_to_item(i);
control->update();
set_input_as_handled();
@@ -310,7 +310,7 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
for (int i = items.size() - 1; i >= search_from; i--) {
if (!items[i].separator && !items[i].disabled) {
mouse_over = i;
- emit_signal("id_focused", i);
+ emit_signal(SNAME("id_focused"), i);
_scroll_to_item(i);
control->update();
set_input_as_handled();
@@ -459,7 +459,7 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
if (items[i].text.findn(search_string) == 0) {
mouse_over = i;
- emit_signal("id_focused", i);
+ emit_signal(SNAME("id_focused"), i);
_scroll_to_item(i);
control->update();
set_input_as_handled();
@@ -474,37 +474,37 @@ void PopupMenu::_draw_items() {
RID ci = control->get_canvas_item();
Size2 margin_size;
- margin_size.width = margin_container->get_theme_constant("margin_right") + margin_container->get_theme_constant("margin_left");
- margin_size.height = margin_container->get_theme_constant("margin_top") + margin_container->get_theme_constant("margin_bottom");
+ margin_size.width = margin_container->get_theme_constant(SNAME("margin_right")) + margin_container->get_theme_constant(SNAME("margin_left"));
+ margin_size.height = margin_container->get_theme_constant(SNAME("margin_top")) + margin_container->get_theme_constant(SNAME("margin_bottom"));
// Space between the item content and the sides of popup menu.
- int item_start_padding = get_theme_constant("item_start_padding");
- int item_end_padding = get_theme_constant("item_end_padding");
+ int item_start_padding = get_theme_constant(SNAME("item_start_padding"));
+ int item_end_padding = get_theme_constant(SNAME("item_end_padding"));
bool rtl = control->is_layout_rtl();
- Ref<StyleBox> style = get_theme_stylebox("panel");
- Ref<StyleBox> hover = get_theme_stylebox("hover");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("panel"));
+ Ref<StyleBox> hover = get_theme_stylebox(SNAME("hover"));
// In Item::checkable_type enum order (less the non-checkable member)
- Ref<Texture2D> check[] = { get_theme_icon("checked"), get_theme_icon("radio_checked") };
- Ref<Texture2D> uncheck[] = { get_theme_icon("unchecked"), get_theme_icon("radio_unchecked") };
+ Ref<Texture2D> check[] = { get_theme_icon(SNAME("checked")), get_theme_icon(SNAME("radio_checked")) };
+ Ref<Texture2D> uncheck[] = { get_theme_icon(SNAME("unchecked")), get_theme_icon(SNAME("radio_unchecked")) };
Ref<Texture2D> submenu;
if (rtl) {
- submenu = get_theme_icon("submenu_mirrored");
+ submenu = get_theme_icon(SNAME("submenu_mirrored"));
} else {
- submenu = get_theme_icon("submenu");
+ submenu = get_theme_icon(SNAME("submenu"));
}
- Ref<StyleBox> separator = get_theme_stylebox("separator");
- Ref<StyleBox> labeled_separator_left = get_theme_stylebox("labeled_separator_left");
- Ref<StyleBox> labeled_separator_right = get_theme_stylebox("labeled_separator_right");
+ Ref<StyleBox> separator = get_theme_stylebox(SNAME("separator"));
+ Ref<StyleBox> labeled_separator_left = get_theme_stylebox(SNAME("labeled_separator_left"));
+ Ref<StyleBox> labeled_separator_right = get_theme_stylebox(SNAME("labeled_separator_right"));
- int vseparation = get_theme_constant("vseparation");
- int hseparation = get_theme_constant("hseparation");
- Color font_color = get_theme_color("font_color");
- Color font_disabled_color = get_theme_color("font_disabled_color");
- Color font_accelerator_color = get_theme_color("font_accelerator_color");
- Color font_hover_color = get_theme_color("font_hover_color");
- Color font_separator_color = get_theme_color("font_separator_color");
+ int vseparation = get_theme_constant(SNAME("vseparation"));
+ int hseparation = get_theme_constant(SNAME("hseparation"));
+ Color font_color = get_theme_color(SNAME("font_color"));
+ Color font_disabled_color = get_theme_color(SNAME("font_disabled_color"));
+ Color font_accelerator_color = get_theme_color(SNAME("font_accelerator_color"));
+ Color font_hover_color = get_theme_color(SNAME("font_hover_color"));
+ Color font_separator_color = get_theme_color(SNAME("font_separator_color"));
float scroll_width = scroll_container->get_v_scrollbar()->is_visible_in_tree() ? scroll_container->get_v_scrollbar()->get_size().width : 0;
float display_width = control->get_size().width - scroll_width;
@@ -525,7 +525,7 @@ void PopupMenu::_draw_items() {
float check_ofs = 0.0;
if (has_check) {
- check_ofs = MAX(get_theme_icon("checked")->get_width(), get_theme_icon("radio_checked")->get_width()) + hseparation;
+ check_ofs = MAX(get_theme_icon(SNAME("checked"))->get_width(), get_theme_icon(SNAME("radio_checked"))->get_width()) + hseparation;
}
Point2 ofs = Point2();
@@ -606,8 +606,8 @@ void PopupMenu::_draw_items() {
}
// Text
- Color font_outline_color = get_theme_color("font_outline_color");
- int outline_size = get_theme_constant("outline_size");
+ Color font_outline_color = get_theme_color(SNAME("font_outline_color"));
+ int outline_size = get_theme_constant(SNAME("outline_size"));
if (items[i].separator) {
if (text != String()) {
int center = (display_width - items[i].text_buf->get_size().width) / 2;
@@ -657,7 +657,7 @@ void PopupMenu::_draw_items() {
}
void PopupMenu::_draw_background() {
- Ref<StyleBox> style = get_theme_stylebox("panel");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("panel"));
RID ci2 = margin_container->get_canvas_item();
style->draw(ci2, Rect2(Point2(), margin_container->get_size()));
}
@@ -691,8 +691,8 @@ void PopupMenu::_shape_item(int p_item) {
if (items.write[p_item].dirty) {
items.write[p_item].text_buf->clear();
- Ref<Font> font = get_theme_font("font");
- int font_size = get_theme_font_size("font_size");
+ Ref<Font> font = get_theme_font(SNAME("font"));
+ int font_size = get_theme_font_size(SNAME("font_size"));
if (items[p_item].text_direction == Control::TEXT_DIRECTION_INHERITED) {
items.write[p_item].text_buf->set_direction(is_layout_rtl() ? TextServer::DIRECTION_RTL : TextServer::DIRECTION_LTR);
@@ -791,7 +791,7 @@ void PopupMenu::_notification(int p_what) {
}
// Set margin on the margin container
- Ref<StyleBox> panel_style = get_theme_stylebox("panel");
+ Ref<StyleBox> panel_style = get_theme_stylebox(SNAME("panel"));
margin_container->add_theme_constant_override("margin_top", panel_style->get_margin(Side::SIDE_TOP));
margin_container->add_theme_constant_override("margin_bottom", panel_style->get_margin(Side::SIDE_BOTTOM));
margin_container->add_theme_constant_override("margin_left", panel_style->get_margin(Side::SIDE_LEFT));
@@ -1376,8 +1376,8 @@ void PopupMenu::activate_item(int p_item) {
need_hide = false;
}
- emit_signal("id_pressed", id);
- emit_signal("index_pressed", p_item);
+ emit_signal(SNAME("id_pressed"), id);
+ emit_signal(SNAME("index_pressed"), p_item);
if (need_hide) {
hide();
diff --git a/scene/gui/progress_bar.cpp b/scene/gui/progress_bar.cpp
index 6e8dfd5994..2cfaaa2fde 100644
--- a/scene/gui/progress_bar.cpp
+++ b/scene/gui/progress_bar.cpp
@@ -32,10 +32,10 @@
#include "scene/resources/text_line.h"
Size2 ProgressBar::get_minimum_size() const {
- Ref<StyleBox> bg = get_theme_stylebox("bg");
- Ref<StyleBox> fg = get_theme_stylebox("fg");
- Ref<Font> font = get_theme_font("font");
- int font_size = get_theme_font_size("font_size");
+ Ref<StyleBox> bg = get_theme_stylebox(SNAME("bg"));
+ Ref<StyleBox> fg = get_theme_stylebox(SNAME("fg"));
+ Ref<Font> font = get_theme_font(SNAME("font"));
+ int font_size = get_theme_font_size(SNAME("font_size"));
Size2 minimum_size = bg->get_minimum_size();
minimum_size.height = MAX(minimum_size.height, fg->get_minimum_size().height);
@@ -53,11 +53,11 @@ Size2 ProgressBar::get_minimum_size() const {
void ProgressBar::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
- Ref<StyleBox> bg = get_theme_stylebox("bg");
- Ref<StyleBox> fg = get_theme_stylebox("fg");
- Ref<Font> font = get_theme_font("font");
- int font_size = get_theme_font_size("font_size");
- Color font_color = get_theme_color("font_color");
+ Ref<StyleBox> bg = get_theme_stylebox(SNAME("bg"));
+ Ref<StyleBox> fg = get_theme_stylebox(SNAME("fg"));
+ Ref<Font> font = get_theme_font(SNAME("font"));
+ int font_size = get_theme_font_size(SNAME("font_size"));
+ Color font_color = get_theme_color(SNAME("font_color"));
draw_style_box(bg, Rect2(Point2(), get_size()));
float r = get_as_ratio();
@@ -75,8 +75,8 @@ void ProgressBar::_notification(int p_what) {
String txt = TS->format_number(itos(int(get_as_ratio() * 100))) + TS->percent_sign();
TextLine tl = TextLine(txt, font, font_size);
Vector2 text_pos = (Point2(get_size().width - tl.get_size().x, get_size().height - tl.get_size().y) / 2).round();
- Color font_outline_color = get_theme_color("font_outline_color");
- int outline_size = get_theme_constant("outline_size");
+ Color font_outline_color = get_theme_color(SNAME("font_outline_color"));
+ int outline_size = get_theme_constant(SNAME("outline_size"));
if (outline_size > 0 && font_outline_color.a > 0) {
tl.draw_outline(get_canvas_item(), text_pos, outline_size, font_outline_color);
}
diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp
index 4ea1e1eb9f..92d4261d8d 100644
--- a/scene/gui/range.cpp
+++ b/scene/gui/range.cpp
@@ -42,7 +42,7 @@ TypedArray<String> Range::get_configuration_warnings() const {
void Range::_value_changed_notify() {
_value_changed(shared->val);
- emit_signal("value_changed", shared->val);
+ emit_signal(SNAME("value_changed"), shared->val);
update();
}
@@ -57,7 +57,7 @@ void Range::Shared::emit_value_changed() {
}
void Range::_changed_notify(const char *p_what) {
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
update();
}
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index f32ad2144a..99395aae30 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -136,7 +136,7 @@ RichTextLabel::Item *RichTextLabel::_get_prev_item(Item *p_item, bool p_free) co
}
Rect2 RichTextLabel::_get_text_rect() {
- Ref<StyleBox> style = get_theme_stylebox("normal");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("normal"));
return Rect2(style->get_offset(), get_size() - style->get_minimum_size());
}
@@ -229,8 +229,8 @@ void RichTextLabel::_resize_line(ItemFrame *p_frame, int p_line, const Ref<Font>
switch (it->type) {
case ITEM_TABLE: {
ItemTable *table = static_cast<ItemTable *>(it);
- int hseparation = get_theme_constant("table_hseparation");
- int vseparation = get_theme_constant("table_vseparation");
+ int hseparation = get_theme_constant(SNAME("table_hseparation"));
+ int vseparation = get_theme_constant(SNAME("table_vseparation"));
int col_count = table->columns.size();
for (int i = 0; i < col_count; i++) {
@@ -458,8 +458,8 @@ void RichTextLabel::_shape_line(ItemFrame *p_frame, int p_line, const Ref<Font>
} break;
case ITEM_TABLE: {
ItemTable *table = static_cast<ItemTable *>(it);
- int hseparation = get_theme_constant("table_hseparation");
- int vseparation = get_theme_constant("table_vseparation");
+ int hseparation = get_theme_constant(SNAME("table_hseparation"));
+ int vseparation = get_theme_constant(SNAME("table_vseparation"));
int col_count = table->columns.size();
int t_char_count = 0;
// Set minimums to zero.
@@ -672,11 +672,11 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o
if (prefix != "") {
Ref<Font> font = _find_font(l.from);
if (font.is_null()) {
- font = get_theme_font("normal_font");
+ font = get_theme_font(SNAME("normal_font"));
}
int font_size = _find_font_size(l.from);
if (font_size == -1) {
- font_size = get_theme_font_size("normal_font_size");
+ font_size = get_theme_font_size(SNAME("normal_font_size"));
}
if (rtl) {
float offx = 0.0f;
@@ -775,10 +775,10 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o
} break;
case ITEM_TABLE: {
ItemTable *table = static_cast<ItemTable *>(it);
- Color odd_row_bg = get_theme_color("table_odd_row_bg");
- Color even_row_bg = get_theme_color("table_even_row_bg");
- Color border = get_theme_color("table_border");
- int hseparation = get_theme_constant("table_hseparation");
+ Color odd_row_bg = get_theme_color(SNAME("table_odd_row_bg"));
+ Color even_row_bg = get_theme_color(SNAME("table_even_row_bg"));
+ Color border = get_theme_color(SNAME("table_border"));
+ int hseparation = get_theme_constant(SNAME("table_hseparation"));
int col_count = table->columns.size();
int row_count = table->rows.size();
@@ -916,7 +916,7 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o
}
}
- Point2 shadow_ofs(get_theme_constant("shadow_offset_x"), get_theme_constant("shadow_offset_y"));
+ Point2 shadow_ofs(get_theme_constant(SNAME("shadow_offset_x")), get_theme_constant(SNAME("shadow_offset_y")));
// Draw glyph outlines.
for (int j = 0; j < glyphs[i].repeat; j++) {
@@ -940,8 +940,8 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o
_draw_fbg_boxes(ci, rid, fbg_line_off, it_from, it_to, chr_range.x, chr_range.y, 0);
// Draw main text.
- Color selection_fg = get_theme_color("font_selected_color");
- Color selection_bg = get_theme_color("selection_color");
+ Color selection_fg = get_theme_color(SNAME("font_selected_color"));
+ Color selection_bg = get_theme_color(SNAME("selection_color"));
int sel_start = -1;
int sel_end = -1;
@@ -1192,8 +1192,8 @@ float RichTextLabel::_find_click_in_line(ItemFrame *p_frame, int p_line, const V
if (rect.has_point(p_click - p_ofs - off)) {
switch (it->type) {
case ITEM_TABLE: {
- int hseparation = get_theme_constant("table_hseparation");
- int vseparation = get_theme_constant("table_vseparation");
+ int hseparation = get_theme_constant(SNAME("table_hseparation"));
+ int vseparation = get_theme_constant(SNAME("table_vseparation"));
ItemTable *table = static_cast<ItemTable *>(it);
@@ -1362,7 +1362,7 @@ void RichTextLabel::_notification(int p_what) {
case NOTIFICATION_MOUSE_EXIT: {
if (meta_hovering) {
meta_hovering = nullptr;
- emit_signal("meta_hover_ended", current_meta);
+ emit_signal(SNAME("meta_hover_ended"), current_meta);
current_meta = false;
update();
}
@@ -1395,11 +1395,11 @@ void RichTextLabel::_notification(int p_what) {
Size2 size = get_size();
Rect2 text_rect = _get_text_rect();
- draw_style_box(get_theme_stylebox("normal"), Rect2(Point2(), size));
+ draw_style_box(get_theme_stylebox(SNAME("normal")), Rect2(Point2(), size));
if (has_focus()) {
RenderingServer::get_singleton()->canvas_item_add_clip_ignore(ci, true);
- draw_style_box(get_theme_stylebox("focus"), Rect2(Point2(), size));
+ draw_style_box(get_theme_stylebox(SNAME("focus")), Rect2(Point2(), size));
RenderingServer::get_singleton()->canvas_item_add_clip_ignore(ci, false);
}
@@ -1419,13 +1419,13 @@ void RichTextLabel::_notification(int p_what) {
if (from_line >= main->lines.size()) {
break; //nothing to draw
}
- Ref<Font> base_font = get_theme_font("normal_font");
- Color base_color = get_theme_color("default_color");
- Color outline_color = get_theme_color("font_outline_color");
- int outline_size = get_theme_constant("outline_size");
- Color font_shadow_color = get_theme_color("font_shadow_color");
- bool use_outline = get_theme_constant("shadow_as_outline");
- Point2 shadow_ofs(get_theme_constant("shadow_offset_x"), get_theme_constant("shadow_offset_y"));
+ Ref<Font> base_font = get_theme_font(SNAME("normal_font"));
+ Color base_color = get_theme_color(SNAME("default_color"));
+ Color outline_color = get_theme_color(SNAME("font_outline_color"));
+ int outline_size = get_theme_constant(SNAME("outline_size"));
+ Color font_shadow_color = get_theme_color(SNAME("font_shadow_color"));
+ bool use_outline = get_theme_constant(SNAME("shadow_as_outline"));
+ Point2 shadow_ofs(get_theme_constant(SNAME("shadow_offset_x")), get_theme_constant(SNAME("shadow_offset_y")));
visible_paragraph_count = 0;
visible_line_count = 0;
@@ -1568,7 +1568,7 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) {
Variant meta;
if (!outside && _find_meta(c_item, &meta)) {
//meta clicked
- emit_signal("meta_clicked", meta);
+ emit_signal(SNAME("meta_clicked"), meta);
}
}
}
@@ -1611,11 +1611,11 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) {
handled = true;
}
if (k->is_action("ui_up") && vscroll->is_visible_in_tree()) {
- vscroll->set_value(vscroll->get_value() - get_theme_font("normal_font")->get_height(get_theme_font_size("normal_font_size")));
+ vscroll->set_value(vscroll->get_value() - get_theme_font(SNAME("normal_font"))->get_height(get_theme_font_size(SNAME("normal_font_size"))));
handled = true;
}
if (k->is_action("ui_down") && vscroll->is_visible_in_tree()) {
- vscroll->set_value(vscroll->get_value() + get_theme_font("normal_font")->get_height(get_theme_font_size("normal_font_size")));
+ vscroll->set_value(vscroll->get_value() + get_theme_font(SNAME("normal_font"))->get_height(get_theme_font_size(SNAME("normal_font_size"))));
handled = true;
}
if (k->is_action("ui_home") && vscroll->is_visible_in_tree()) {
@@ -1693,15 +1693,15 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) {
if (c_item && !outside && _find_meta(c_item, &meta, &item_meta)) {
if (meta_hovering != item_meta) {
if (meta_hovering) {
- emit_signal("meta_hover_ended", current_meta);
+ emit_signal(SNAME("meta_hover_ended"), current_meta);
}
meta_hovering = item_meta;
current_meta = meta;
- emit_signal("meta_hover_started", meta);
+ emit_signal(SNAME("meta_hover_started"), meta);
}
} else if (meta_hovering) {
meta_hovering = nullptr;
- emit_signal("meta_hover_ended", current_meta);
+ emit_signal(SNAME("meta_hover_ended"), current_meta);
current_meta = false;
}
}
@@ -2105,8 +2105,8 @@ void RichTextLabel::_validate_line_caches(ItemFrame *p_frame) {
}
Rect2 text_rect = _get_text_rect();
- Ref<Font> base_font = get_theme_font("normal_font");
- int base_font_size = get_theme_font_size("normal_font_size");
+ Ref<Font> base_font = get_theme_font(SNAME("normal_font"));
+ int base_font_size = get_theme_font_size(SNAME("normal_font_size"));
for (int i = p_frame->first_resized_line; i < p_frame->lines.size(); i++) {
_resize_line(p_frame, i, base_font, base_font_size, text_rect.get_size().width - scroll_w);
@@ -2140,8 +2140,8 @@ void RichTextLabel::_validate_line_caches(ItemFrame *p_frame) {
}
Rect2 text_rect = _get_text_rect();
- Ref<Font> base_font = get_theme_font("normal_font");
- int base_font_size = get_theme_font_size("normal_font_size");
+ Ref<Font> base_font = get_theme_font(SNAME("normal_font"));
+ int base_font_size = get_theme_font_size(SNAME("normal_font_size"));
int total_chars = (p_frame->first_invalid_line == 0) ? 0 : (p_frame->lines[p_frame->first_invalid_line].char_offset + p_frame->lines[p_frame->first_invalid_line].char_count);
for (int i = p_frame->first_invalid_line; i < p_frame->lines.size(); i++) {
@@ -2406,35 +2406,35 @@ void RichTextLabel::push_font(const Ref<Font> &p_font) {
}
void RichTextLabel::push_normal() {
- Ref<Font> normal_font = get_theme_font("normal_font");
+ Ref<Font> normal_font = get_theme_font(SNAME("normal_font"));
ERR_FAIL_COND(normal_font.is_null());
push_font(normal_font);
}
void RichTextLabel::push_bold() {
- Ref<Font> bold_font = get_theme_font("bold_font");
+ Ref<Font> bold_font = get_theme_font(SNAME("bold_font"));
ERR_FAIL_COND(bold_font.is_null());
push_font(bold_font);
}
void RichTextLabel::push_bold_italics() {
- Ref<Font> bold_italics_font = get_theme_font("bold_italics_font");
+ Ref<Font> bold_italics_font = get_theme_font(SNAME("bold_italics_font"));
ERR_FAIL_COND(bold_italics_font.is_null());
push_font(bold_italics_font);
}
void RichTextLabel::push_italics() {
- Ref<Font> italics_font = get_theme_font("italics_font");
+ Ref<Font> italics_font = get_theme_font(SNAME("italics_font"));
ERR_FAIL_COND(italics_font.is_null());
push_font(italics_font);
}
void RichTextLabel::push_mono() {
- Ref<Font> mono_font = get_theme_font("mono_font");
+ Ref<Font> mono_font = get_theme_font(SNAME("mono_font"));
ERR_FAIL_COND(mono_font.is_null());
push_font(mono_font);
@@ -2774,13 +2774,13 @@ Error RichTextLabel::append_bbcode(const String &p_bbcode) {
int pos = 0;
List<String> tag_stack;
- Ref<Font> normal_font = get_theme_font("normal_font");
- Ref<Font> bold_font = get_theme_font("bold_font");
- Ref<Font> italics_font = get_theme_font("italics_font");
- Ref<Font> bold_italics_font = get_theme_font("bold_italics_font");
- Ref<Font> mono_font = get_theme_font("mono_font");
+ Ref<Font> normal_font = get_theme_font(SNAME("normal_font"));
+ Ref<Font> bold_font = get_theme_font(SNAME("bold_font"));
+ Ref<Font> italics_font = get_theme_font(SNAME("italics_font"));
+ Ref<Font> bold_italics_font = get_theme_font(SNAME("bold_italics_font"));
+ Ref<Font> mono_font = get_theme_font(SNAME("mono_font"));
- Color base_color = get_theme_color("default_color");
+ Color base_color = get_theme_color(SNAME("default_color"));
int indent_level = 0;
@@ -3140,11 +3140,11 @@ Error RichTextLabel::append_bbcode(const String &p_bbcode) {
tag_stack.push_front("url");
} else if (tag.begins_with("dropcap")) {
Vector<String> subtag = tag.substr(5, tag.length()).split(" ");
- Ref<Font> f = get_theme_font("normal_font");
- int fs = get_theme_font_size("normal_font_size") * 3;
- Color color = get_theme_color("default_color");
- Color outline_color = get_theme_color("outline_color");
- int outline_size = get_theme_constant("outline_size");
+ Ref<Font> f = get_theme_font(SNAME("normal_font"));
+ int fs = get_theme_font_size(SNAME("normal_font_size")) * 3;
+ Color color = get_theme_color(SNAME("default_color"));
+ Color outline_color = get_theme_color(SNAME("outline_color"));
+ int outline_size = get_theme_constant(SNAME("outline_size"));
Rect2 dropcap_margins = Rect2();
for (int i = 0; i < subtag.size(); i++) {
@@ -4168,7 +4168,7 @@ void RichTextLabel::set_fixed_size_to_width(int p_width) {
}
Size2 RichTextLabel::get_minimum_size() const {
- Ref<StyleBox> style = get_theme_stylebox("normal");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("normal"));
Size2 size = style->get_minimum_size();
if (fixed_width != -1) {
diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp
index 62276e3af0..ce04a0204b 100644
--- a/scene/gui/scroll_bar.cpp
+++ b/scene/gui/scroll_bar.cpp
@@ -46,7 +46,7 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
Ref<InputEventMouseMotion> m = p_event;
if (!m.is_valid() || drag.active) {
- emit_signal("scrolling");
+ emit_signal(SNAME("scrolling"));
}
Ref<InputEventMouseButton> b = p_event;
@@ -70,8 +70,8 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
if (b->is_pressed()) {
double ofs = orientation == VERTICAL ? b->get_position().y : b->get_position().x;
- Ref<Texture2D> decr = get_theme_icon("decrement");
- Ref<Texture2D> incr = get_theme_icon("increment");
+ Ref<Texture2D> decr = get_theme_icon(SNAME("decrement"));
+ Ref<Texture2D> incr = get_theme_icon(SNAME("increment"));
double decr_size = orientation == VERTICAL ? decr->get_height() : decr->get_width();
double incr_size = orientation == VERTICAL ? incr->get_height() : incr->get_width();
@@ -140,7 +140,7 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
if (drag.active) {
double ofs = orientation == VERTICAL ? m->get_position().y : m->get_position().x;
- Ref<Texture2D> decr = get_theme_icon("decrement");
+ Ref<Texture2D> decr = get_theme_icon(SNAME("decrement"));
double decr_size = orientation == VERTICAL ? decr->get_height() : decr->get_width();
ofs -= decr_size;
@@ -150,8 +150,8 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
set_as_ratio(drag.value_at_click + diff);
} else {
double ofs = orientation == VERTICAL ? m->get_position().y : m->get_position().x;
- Ref<Texture2D> decr = get_theme_icon("decrement");
- Ref<Texture2D> incr = get_theme_icon("increment");
+ Ref<Texture2D> decr = get_theme_icon(SNAME("decrement"));
+ Ref<Texture2D> incr = get_theme_icon(SNAME("increment"));
double decr_size = orientation == VERTICAL ? decr->get_height() : decr->get_width();
double incr_size = orientation == VERTICAL ? incr->get_height() : incr->get_width();
@@ -215,17 +215,17 @@ void ScrollBar::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
RID ci = get_canvas_item();
- Ref<Texture2D> decr = highlight == HIGHLIGHT_DECR ? get_theme_icon("decrement_highlight") : get_theme_icon("decrement");
- Ref<Texture2D> incr = highlight == HIGHLIGHT_INCR ? get_theme_icon("increment_highlight") : get_theme_icon("increment");
- Ref<StyleBox> bg = has_focus() ? get_theme_stylebox("scroll_focus") : get_theme_stylebox("scroll");
+ Ref<Texture2D> decr = highlight == HIGHLIGHT_DECR ? get_theme_icon(SNAME("decrement_highlight")) : get_theme_icon(SNAME("decrement"));
+ Ref<Texture2D> incr = highlight == HIGHLIGHT_INCR ? get_theme_icon(SNAME("increment_highlight")) : get_theme_icon(SNAME("increment"));
+ Ref<StyleBox> bg = has_focus() ? get_theme_stylebox(SNAME("scroll_focus")) : get_theme_stylebox(SNAME("scroll"));
Ref<StyleBox> grabber;
if (drag.active) {
- grabber = get_theme_stylebox("grabber_pressed");
+ grabber = get_theme_stylebox(SNAME("grabber_pressed"));
} else if (highlight == HIGHLIGHT_RANGE) {
- grabber = get_theme_stylebox("grabber_highlight");
+ grabber = get_theme_stylebox(SNAME("grabber_highlight"));
} else {
- grabber = get_theme_stylebox("grabber");
+ grabber = get_theme_stylebox(SNAME("grabber"));
}
Point2 ofs;
@@ -389,7 +389,7 @@ void ScrollBar::_notification(int p_what) {
}
double ScrollBar::get_grabber_min_size() const {
- Ref<StyleBox> grabber = get_theme_stylebox("grabber");
+ Ref<StyleBox> grabber = get_theme_stylebox(SNAME("grabber"));
Size2 gminsize = grabber->get_minimum_size() + grabber->get_center_size();
return (orientation == VERTICAL) ? gminsize.height : gminsize.width;
}
@@ -415,17 +415,17 @@ double ScrollBar::get_area_size() const {
switch (orientation) {
case VERTICAL: {
double area = get_size().height;
- area -= get_theme_stylebox("scroll")->get_minimum_size().height;
- area -= get_theme_icon("increment")->get_height();
- area -= get_theme_icon("decrement")->get_height();
+ area -= get_theme_stylebox(SNAME("scroll"))->get_minimum_size().height;
+ area -= get_theme_icon(SNAME("increment"))->get_height();
+ area -= get_theme_icon(SNAME("decrement"))->get_height();
area -= get_grabber_min_size();
return area;
} break;
case HORIZONTAL: {
double area = get_size().width;
- area -= get_theme_stylebox("scroll")->get_minimum_size().width;
- area -= get_theme_icon("increment")->get_width();
- area -= get_theme_icon("decrement")->get_width();
+ area -= get_theme_stylebox(SNAME("scroll"))->get_minimum_size().width;
+ area -= get_theme_icon(SNAME("increment"))->get_width();
+ area -= get_theme_icon(SNAME("decrement"))->get_width();
area -= get_grabber_min_size();
return area;
} break;
@@ -439,13 +439,13 @@ double ScrollBar::get_area_offset() const {
double ofs = 0.0;
if (orientation == VERTICAL) {
- ofs += get_theme_stylebox("hscroll")->get_margin(SIDE_TOP);
- ofs += get_theme_icon("decrement")->get_height();
+ ofs += get_theme_stylebox(SNAME("hscroll"))->get_margin(SIDE_TOP);
+ ofs += get_theme_icon(SNAME("decrement"))->get_height();
}
if (orientation == HORIZONTAL) {
- ofs += get_theme_stylebox("hscroll")->get_margin(SIDE_LEFT);
- ofs += get_theme_icon("decrement")->get_width();
+ ofs += get_theme_stylebox(SNAME("hscroll"))->get_margin(SIDE_LEFT);
+ ofs += get_theme_icon(SNAME("decrement"))->get_width();
}
return ofs;
@@ -456,9 +456,9 @@ double ScrollBar::get_grabber_offset() const {
}
Size2 ScrollBar::get_minimum_size() const {
- Ref<Texture2D> incr = get_theme_icon("increment");
- Ref<Texture2D> decr = get_theme_icon("decrement");
- Ref<StyleBox> bg = get_theme_stylebox("scroll");
+ Ref<Texture2D> incr = get_theme_icon(SNAME("increment"));
+ Ref<Texture2D> decr = get_theme_icon(SNAME("decrement"));
+ Ref<StyleBox> bg = get_theme_stylebox(SNAME("scroll"));
Size2 minsize;
if (orientation == VERTICAL) {
diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp
index 177f146b6a..eb5fc924da 100644
--- a/scene/gui/scroll_container.cpp
+++ b/scene/gui/scroll_container.cpp
@@ -33,7 +33,7 @@
#include "scene/main/window.h"
Size2 ScrollContainer::get_minimum_size() const {
- Ref<StyleBox> sb = get_theme_stylebox("bg");
+ Ref<StyleBox> sb = get_theme_stylebox(SNAME("bg"));
Size2 min_size;
for (int i = 0; i < get_child_count(); i++) {
@@ -77,7 +77,7 @@ void ScrollContainer::_cancel_drag() {
drag_from = Vector2();
if (beyond_deadzone) {
- emit_signal("scroll_ended");
+ emit_signal(SNAME("scroll_ended"));
propagate_notification(NOTIFICATION_SCROLL_END);
beyond_deadzone = false;
}
@@ -173,7 +173,7 @@ void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (beyond_deadzone || (scroll_h && Math::abs(drag_accum.x) > deadzone) || (scroll_v && Math::abs(drag_accum.y) > deadzone)) {
if (!beyond_deadzone) {
propagate_notification(NOTIFICATION_SCROLL_BEGIN);
- emit_signal("scroll_started");
+ emit_signal(SNAME("scroll_started"));
beyond_deadzone = true;
// resetting drag_accum here ensures smooth scrolling after reaching deadzone
@@ -260,7 +260,7 @@ void ScrollContainer::_update_dimensions() {
Size2 size = get_size();
Point2 ofs;
- Ref<StyleBox> sb = get_theme_stylebox("bg");
+ Ref<StyleBox> sb = get_theme_stylebox(SNAME("bg"));
size -= sb->get_minimum_size();
ofs += sb->get_offset();
bool rtl = is_layout_rtl();
@@ -319,7 +319,7 @@ void ScrollContainer::_update_dimensions() {
void ScrollContainer::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED || p_what == NOTIFICATION_LAYOUT_DIRECTION_CHANGED || p_what == NOTIFICATION_TRANSLATION_CHANGED) {
_updating_scrollbars = true;
- call_deferred("_update_scrollbar_position");
+ call_deferred(SNAME("_update_scrollbar_position"));
};
if (p_what == NOTIFICATION_READY) {
@@ -332,7 +332,7 @@ void ScrollContainer::_notification(int p_what) {
};
if (p_what == NOTIFICATION_DRAW) {
- Ref<StyleBox> sb = get_theme_stylebox("bg");
+ Ref<StyleBox> sb = get_theme_stylebox(SNAME("bg"));
draw_style_box(sb, Rect2(Vector2(), get_size()));
update_scrollbars();
@@ -409,7 +409,7 @@ void ScrollContainer::_notification(int p_what) {
void ScrollContainer::update_scrollbars() {
Size2 size = get_size();
- Ref<StyleBox> sb = get_theme_stylebox("bg");
+ Ref<StyleBox> sb = get_theme_stylebox(SNAME("bg"));
size -= sb->get_minimum_size();
Size2 hmin;
diff --git a/scene/gui/separator.cpp b/scene/gui/separator.cpp
index 3cb8ccf135..1f3cb7aa24 100644
--- a/scene/gui/separator.cpp
+++ b/scene/gui/separator.cpp
@@ -33,9 +33,9 @@
Size2 Separator::get_minimum_size() const {
Size2 ms(3, 3);
if (orientation == VERTICAL) {
- ms.x = get_theme_constant("separation");
+ ms.x = get_theme_constant(SNAME("separation"));
} else { // HORIZONTAL
- ms.y = get_theme_constant("separation");
+ ms.y = get_theme_constant(SNAME("separation"));
}
return ms;
}
@@ -44,7 +44,7 @@ void Separator::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_DRAW: {
Size2i size = get_size();
- Ref<StyleBox> style = get_theme_stylebox("separator");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("separator"));
Size2i ssize = style->get_minimum_size() + style->get_center_size();
if (orientation == VERTICAL) {
diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp
index 5947f3b99e..61b5325175 100644
--- a/scene/gui/slider.cpp
+++ b/scene/gui/slider.cpp
@@ -32,10 +32,10 @@
#include "core/os/keyboard.h"
Size2 Slider::get_minimum_size() const {
- Ref<StyleBox> style = get_theme_stylebox("slider");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("slider"));
Size2i ss = style->get_minimum_size() + style->get_center_size();
- Ref<Texture2D> grabber = get_theme_icon("grabber");
+ Ref<Texture2D> grabber = get_theme_icon(SNAME("grabber"));
Size2i rs = grabber->get_size();
if (orientation == HORIZONTAL) {
@@ -89,7 +89,7 @@ void Slider::_gui_input(Ref<InputEvent> p_event) {
if (mm.is_valid()) {
if (grab.active) {
Size2i size = get_size();
- Ref<Texture2D> grabber = get_theme_icon("grabber");
+ Ref<Texture2D> grabber = get_theme_icon(SNAME("grabber"));
float motion = (orientation == VERTICAL ? mm->get_position().y : mm->get_position().x) - grab.pos;
if (orientation == VERTICAL) {
motion = -motion;
@@ -161,11 +161,11 @@ void Slider::_notification(int p_what) {
case NOTIFICATION_DRAW: {
RID ci = get_canvas_item();
Size2i size = get_size();
- Ref<StyleBox> style = get_theme_stylebox("slider");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("slider"));
bool highlighted = mouse_inside || has_focus();
Ref<StyleBox> grabber_area = get_theme_stylebox(highlighted ? "grabber_area_highlight" : "grabber_area");
Ref<Texture2D> grabber = get_theme_icon(editable ? (highlighted ? "grabber_highlight" : "grabber") : "grabber_disabled");
- Ref<Texture2D> tick = get_theme_icon("tick");
+ Ref<Texture2D> tick = get_theme_icon(SNAME("tick"));
double ratio = Math::is_nan(get_as_ratio()) ? 0 : get_as_ratio();
if (orientation == VERTICAL) {
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp
index 5c7b375608..3f0368a4e2 100644
--- a/scene/gui/spin_box.cpp
+++ b/scene/gui/spin_box.cpp
@@ -188,7 +188,7 @@ inline void SpinBox::_adjust_width_for_icon(const Ref<Texture2D> &icon) {
void SpinBox::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
- Ref<Texture2D> updown = get_theme_icon("updown");
+ Ref<Texture2D> updown = get_theme_icon(SNAME("updown"));
_adjust_width_for_icon(updown);
@@ -204,15 +204,15 @@ void SpinBox::_notification(int p_what) {
} else if (p_what == NOTIFICATION_FOCUS_EXIT) {
//_value_changed(0);
} else if (p_what == NOTIFICATION_ENTER_TREE) {
- _adjust_width_for_icon(get_theme_icon("updown"));
+ _adjust_width_for_icon(get_theme_icon(SNAME("updown")));
_value_changed(0);
} else if (p_what == NOTIFICATION_EXIT_TREE) {
_release_mouse();
} else if (p_what == NOTIFICATION_TRANSLATION_CHANGED) {
_value_changed(0);
} else if (p_what == NOTIFICATION_THEME_CHANGED) {
- call_deferred("minimum_size_changed");
- get_line_edit()->call_deferred("minimum_size_changed");
+ call_deferred(SNAME("minimum_size_changed"));
+ get_line_edit()->call_deferred(SNAME("minimum_size_changed"));
} else if (p_what == NOTIFICATION_LAYOUT_DIRECTION_CHANGED || p_what == NOTIFICATION_TRANSLATION_CHANGED) {
update();
}
diff --git a/scene/gui/split_container.cpp b/scene/gui/split_container.cpp
index 9796b32c6b..3114e5b7c0 100644
--- a/scene/gui/split_container.cpp
+++ b/scene/gui/split_container.cpp
@@ -76,8 +76,8 @@ void SplitContainer::_resort() {
bool second_expanded = (vertical ? second->get_v_size_flags() : second->get_h_size_flags()) & SIZE_EXPAND;
// Determine the separation between items
- Ref<Texture2D> g = get_theme_icon("grabber");
- int sep = get_theme_constant("separation");
+ Ref<Texture2D> g = get_theme_icon(SNAME("grabber"));
+ int sep = get_theme_constant(SNAME("separation"));
sep = (dragger_visibility != DRAGGER_HIDDEN_COLLAPSED) ? MAX(sep, vertical ? g->get_height() : g->get_width()) : 0;
// Compute the minimum size
@@ -131,8 +131,8 @@ Size2 SplitContainer::get_minimum_size() const {
/* Calculate MINIMUM SIZE */
Size2i minimum;
- Ref<Texture2D> g = get_theme_icon("grabber");
- int sep = get_theme_constant("separation");
+ Ref<Texture2D> g = get_theme_icon(SNAME("grabber"));
+ int sep = get_theme_constant(SNAME("separation"));
sep = (dragger_visibility != DRAGGER_HIDDEN_COLLAPSED) ? MAX(sep, vertical ? g->get_height() : g->get_width()) : 0;
for (int i = 0; i < 2; i++) {
@@ -173,7 +173,7 @@ void SplitContainer::_notification(int p_what) {
} break;
case NOTIFICATION_MOUSE_EXIT: {
mouse_inside = false;
- if (get_theme_constant("autohide")) {
+ if (get_theme_constant(SNAME("autohide"))) {
update();
}
} break;
@@ -182,7 +182,7 @@ void SplitContainer::_notification(int p_what) {
return;
}
- if (collapsed || (!dragging && !mouse_inside && get_theme_constant("autohide"))) {
+ if (collapsed || (!dragging && !mouse_inside && get_theme_constant(SNAME("autohide")))) {
return;
}
@@ -190,8 +190,8 @@ void SplitContainer::_notification(int p_what) {
return;
}
- int sep = dragger_visibility != DRAGGER_HIDDEN_COLLAPSED ? get_theme_constant("separation") : 0;
- Ref<Texture2D> tex = get_theme_icon("grabber");
+ int sep = dragger_visibility != DRAGGER_HIDDEN_COLLAPSED ? get_theme_constant(SNAME("separation")) : 0;
+ Ref<Texture2D> tex = get_theme_icon(SNAME("grabber"));
Size2 size = get_size();
if (vertical) {
@@ -218,7 +218,7 @@ void SplitContainer::_gui_input(const Ref<InputEvent> &p_event) {
if (mb.is_valid()) {
if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
if (mb->is_pressed()) {
- int sep = get_theme_constant("separation");
+ int sep = get_theme_constant(SNAME("separation"));
if (vertical) {
if (mb->get_position().y > middle_sep && mb->get_position().y < middle_sep + sep) {
@@ -244,14 +244,14 @@ void SplitContainer::_gui_input(const Ref<InputEvent> &p_event) {
if (mm.is_valid()) {
bool mouse_inside_state = false;
if (vertical) {
- mouse_inside_state = mm->get_position().y > middle_sep && mm->get_position().y < middle_sep + get_theme_constant("separation");
+ mouse_inside_state = mm->get_position().y > middle_sep && mm->get_position().y < middle_sep + get_theme_constant(SNAME("separation"));
} else {
- mouse_inside_state = mm->get_position().x > middle_sep && mm->get_position().x < middle_sep + get_theme_constant("separation");
+ mouse_inside_state = mm->get_position().x > middle_sep && mm->get_position().x < middle_sep + get_theme_constant(SNAME("separation"));
}
if (mouse_inside != mouse_inside_state) {
mouse_inside = mouse_inside_state;
- if (get_theme_constant("autohide")) {
+ if (get_theme_constant(SNAME("autohide"))) {
update();
}
}
@@ -267,7 +267,7 @@ void SplitContainer::_gui_input(const Ref<InputEvent> &p_event) {
}
should_clamp_split_offset = true;
queue_sort();
- emit_signal("dragged", get_split_offset());
+ emit_signal(SNAME("dragged"), get_split_offset());
}
}
@@ -277,7 +277,7 @@ Control::CursorShape SplitContainer::get_cursor_shape(const Point2 &p_pos) const
}
if (!collapsed && _getch(0) && _getch(1) && dragger_visibility == DRAGGER_VISIBLE) {
- int sep = get_theme_constant("separation");
+ int sep = get_theme_constant(SNAME("separation"));
if (vertical) {
if (p_pos.y > middle_sep && p_pos.y < middle_sep + sep) {
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index 133966013b..8f84585f9b 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -43,9 +43,9 @@ int TabContainer::_get_top_margin() const {
}
// Respect the minimum tab height.
- Ref<StyleBox> tab_unselected = get_theme_stylebox("tab_unselected");
- Ref<StyleBox> tab_selected = get_theme_stylebox("tab_selected");
- Ref<StyleBox> tab_disabled = get_theme_stylebox("tab_disabled");
+ Ref<StyleBox> tab_unselected = get_theme_stylebox(SNAME("tab_unselected"));
+ Ref<StyleBox> tab_selected = get_theme_stylebox(SNAME("tab_selected"));
+ Ref<StyleBox> tab_disabled = get_theme_stylebox(SNAME("tab_disabled"));
int tab_height = MAX(MAX(tab_unselected->get_minimum_size().height, tab_selected->get_minimum_size().height), tab_disabled->get_minimum_size().height);
@@ -88,11 +88,11 @@ void TabContainer::_gui_input(const Ref<InputEvent> &p_event) {
}
// Handle menu button.
- Ref<Texture2D> menu = get_theme_icon("menu");
+ Ref<Texture2D> menu = get_theme_icon(SNAME("menu"));
if (is_layout_rtl()) {
if (popup && pos.x < menu->get_width()) {
- emit_signal("pre_popup_pressed");
+ emit_signal(SNAME("pre_popup_pressed"));
Vector2 popup_pos = get_screen_position();
popup_pos.y += menu->get_height();
@@ -103,7 +103,7 @@ void TabContainer::_gui_input(const Ref<InputEvent> &p_event) {
}
} else {
if (popup && pos.x > size.width - menu->get_width()) {
- emit_signal("pre_popup_pressed");
+ emit_signal(SNAME("pre_popup_pressed"));
Vector2 popup_pos = get_screen_position();
popup_pos.x += size.width - popup->get_size().width;
@@ -129,8 +129,8 @@ void TabContainer::_gui_input(const Ref<InputEvent> &p_event) {
popup_ofs = menu->get_width();
}
- Ref<Texture2D> increment = get_theme_icon("increment");
- Ref<Texture2D> decrement = get_theme_icon("decrement");
+ Ref<Texture2D> increment = get_theme_icon(SNAME("increment"));
+ Ref<Texture2D> decrement = get_theme_icon(SNAME("decrement"));
if (is_layout_rtl()) {
if (pos.x < popup_ofs + decrement->get_width()) {
if (last_tab_cache < tabs.size() - 1) {
@@ -203,7 +203,7 @@ void TabContainer::_gui_input(const Ref<InputEvent> &p_event) {
return;
}
- Ref<Texture2D> menu = get_theme_icon("menu");
+ Ref<Texture2D> menu = get_theme_icon(SNAME("menu"));
if (popup) {
if (is_layout_rtl()) {
if (pos.x <= menu->get_width()) {
@@ -248,8 +248,8 @@ void TabContainer::_gui_input(const Ref<InputEvent> &p_event) {
popup_ofs = menu->get_width();
}
- Ref<Texture2D> increment = get_theme_icon("increment");
- Ref<Texture2D> decrement = get_theme_icon("decrement");
+ Ref<Texture2D> increment = get_theme_icon(SNAME("increment"));
+ Ref<Texture2D> decrement = get_theme_icon(SNAME("decrement"));
if (is_layout_rtl()) {
if (pos.x <= popup_ofs + decrement->get_width()) {
@@ -289,10 +289,10 @@ void TabContainer::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_RESIZED: {
Vector<Control *> tabs = _get_tabs();
- int side_margin = get_theme_constant("side_margin");
- Ref<Texture2D> menu = get_theme_icon("menu");
- Ref<Texture2D> increment = get_theme_icon("increment");
- Ref<Texture2D> decrement = get_theme_icon("decrement");
+ int side_margin = get_theme_constant(SNAME("side_margin"));
+ Ref<Texture2D> menu = get_theme_icon(SNAME("menu"));
+ Ref<Texture2D> increment = get_theme_icon(SNAME("increment"));
+ Ref<Texture2D> decrement = get_theme_icon(SNAME("decrement"));
int header_width = get_size().width - side_margin * 2;
// Find the width of the header area.
@@ -332,26 +332,26 @@ void TabContainer::_notification(int p_what) {
bool rtl = is_layout_rtl();
// Draw only the tab area if the header is hidden.
- Ref<StyleBox> panel = get_theme_stylebox("panel");
+ Ref<StyleBox> panel = get_theme_stylebox(SNAME("panel"));
if (!tabs_visible) {
panel->draw(canvas, Rect2(0, 0, size.width, size.height));
return;
}
Vector<Control *> tabs = _get_tabs();
- Ref<StyleBox> tab_unselected = get_theme_stylebox("tab_unselected");
- Ref<StyleBox> tab_selected = get_theme_stylebox("tab_selected");
- Ref<StyleBox> tab_disabled = get_theme_stylebox("tab_disabled");
- Ref<Texture2D> increment = get_theme_icon("increment");
- Ref<Texture2D> increment_hl = get_theme_icon("increment_highlight");
- Ref<Texture2D> decrement = get_theme_icon("decrement");
- Ref<Texture2D> decrement_hl = get_theme_icon("decrement_highlight");
- Ref<Texture2D> menu = get_theme_icon("menu");
- Ref<Texture2D> menu_hl = get_theme_icon("menu_highlight");
- Color font_selected_color = get_theme_color("font_selected_color");
- Color font_unselected_color = get_theme_color("font_unselected_color");
- Color font_disabled_color = get_theme_color("font_disabled_color");
- int side_margin = get_theme_constant("side_margin");
+ Ref<StyleBox> tab_unselected = get_theme_stylebox(SNAME("tab_unselected"));
+ Ref<StyleBox> tab_selected = get_theme_stylebox(SNAME("tab_selected"));
+ Ref<StyleBox> tab_disabled = get_theme_stylebox(SNAME("tab_disabled"));
+ Ref<Texture2D> increment = get_theme_icon(SNAME("increment"));
+ Ref<Texture2D> increment_hl = get_theme_icon(SNAME("increment_highlight"));
+ Ref<Texture2D> decrement = get_theme_icon(SNAME("decrement"));
+ Ref<Texture2D> decrement_hl = get_theme_icon(SNAME("decrement_highlight"));
+ Ref<Texture2D> menu = get_theme_icon(SNAME("menu"));
+ Ref<Texture2D> menu_hl = get_theme_icon(SNAME("menu_highlight"));
+ Color font_selected_color = get_theme_color(SNAME("font_selected_color"));
+ Color font_unselected_color = get_theme_color(SNAME("font_unselected_color"));
+ Color font_disabled_color = get_theme_color(SNAME("font_disabled_color"));
+ int side_margin = get_theme_constant(SNAME("side_margin"));
// Find out start and width of the header area.
int header_x = side_margin;
@@ -529,7 +529,7 @@ void TabContainer::_notification(int p_what) {
text_buf.write[i]->clear();
}
_theme_changing = true;
- call_deferred("_on_theme_changed"); // Wait until all changed theme.
+ call_deferred(SNAME("_on_theme_changed")); // Wait until all changed theme.
} break;
}
}
@@ -537,10 +537,10 @@ void TabContainer::_notification(int p_what) {
void TabContainer::_draw_tab(Ref<StyleBox> &p_tab_style, Color &p_font_color, int p_index, float p_x) {
Vector<Control *> tabs = _get_tabs();
RID canvas = get_canvas_item();
- Ref<Font> font = get_theme_font("font");
- Color font_outline_color = get_theme_color("font_outline_color");
- int outline_size = get_theme_constant("outline_size");
- int icon_text_distance = get_theme_constant("icon_separation");
+ Ref<Font> font = get_theme_font(SNAME("font"));
+ Color font_outline_color = get_theme_color(SNAME("font_outline_color"));
+ int outline_size = get_theme_constant(SNAME("outline_size"));
+ int icon_text_distance = get_theme_constant(SNAME("icon_separation"));
int tab_width = _get_tab_width(p_index);
int header_height = _get_top_margin();
@@ -580,8 +580,8 @@ void TabContainer::_refresh_texts() {
text_buf.clear();
Vector<Control *> tabs = _get_tabs();
bool rtl = is_layout_rtl();
- Ref<Font> font = get_theme_font("font");
- int font_size = get_theme_font_size("font_size");
+ Ref<Font> font = get_theme_font(SNAME("font"));
+ int font_size = get_theme_font_size(SNAME("font_size"));
for (int i = 0; i < tabs.size(); i++) {
Control *control = Object::cast_to<Control>(tabs[i]);
String text = control->has_meta("_tab_name") ? String(tr(String(control->get_meta("_tab_name")))) : String(tr(control->get_name()));
@@ -609,7 +609,7 @@ void TabContainer::_on_theme_changed() {
}
void TabContainer::_repaint() {
- Ref<StyleBox> sb = get_theme_stylebox("panel");
+ Ref<StyleBox> sb = get_theme_stylebox(SNAME("panel"));
Vector<Control *> tabs = _get_tabs();
for (int i = 0; i < tabs.size(); i++) {
Control *c = tabs[i];
@@ -646,8 +646,8 @@ int TabContainer::_get_tab_width(int p_index) const {
}
// Get the width of the text displayed on the tab.
- Ref<Font> font = get_theme_font("font");
- int font_size = get_theme_font_size("font_size");
+ Ref<Font> font = get_theme_font(SNAME("font"));
+ int font_size = get_theme_font_size(SNAME("font_size"));
String text = control->has_meta("_tab_name") ? String(tr(String(control->get_meta("_tab_name")))) : String(tr(control->get_name()));
int width = font->get_string_size(text, font_size).width;
@@ -657,15 +657,15 @@ int TabContainer::_get_tab_width(int p_index) const {
if (icon.is_valid()) {
width += icon->get_width();
if (text != "") {
- width += get_theme_constant("icon_separation");
+ width += get_theme_constant(SNAME("icon_separation"));
}
}
}
// Respect a minimum size.
- Ref<StyleBox> tab_unselected = get_theme_stylebox("tab_unselected");
- Ref<StyleBox> tab_selected = get_theme_stylebox("tab_selected");
- Ref<StyleBox> tab_disabled = get_theme_stylebox("tab_disabled");
+ Ref<StyleBox> tab_unselected = get_theme_stylebox(SNAME("tab_unselected"));
+ Ref<StyleBox> tab_selected = get_theme_stylebox(SNAME("tab_selected"));
+ Ref<StyleBox> tab_disabled = get_theme_stylebox(SNAME("tab_disabled"));
if (get_tab_disabled(p_index)) {
width += tab_disabled->get_minimum_size().width;
} else if (p_index == current) {
@@ -715,7 +715,7 @@ void TabContainer::add_child_notify(Node *p_child) {
c->hide();
} else {
c->show();
- //call_deferred("set_current_tab",0);
+ //call_deferred(SNAME("set_current_tab"),0);
first = true;
current = 0;
previous = 0;
@@ -724,7 +724,7 @@ void TabContainer::add_child_notify(Node *p_child) {
if (tabs_visible) {
c->set_offset(SIDE_TOP, _get_top_margin());
}
- Ref<StyleBox> sb = get_theme_stylebox("panel");
+ Ref<StyleBox> sb = get_theme_stylebox(SNAME("panel"));
c->set_offset(Side(SIDE_TOP), c->get_offset(Side(SIDE_TOP)) + sb->get_margin(Side(SIDE_TOP)));
c->set_offset(Side(SIDE_LEFT), c->get_offset(Side(SIDE_LEFT)) + sb->get_margin(Side(SIDE_LEFT)));
c->set_offset(Side(SIDE_RIGHT), c->get_offset(Side(SIDE_RIGHT)) - sb->get_margin(Side(SIDE_RIGHT)));
@@ -732,13 +732,13 @@ void TabContainer::add_child_notify(Node *p_child) {
update();
p_child->connect("renamed", callable_mp(this, &TabContainer::_child_renamed_callback));
if (first && is_inside_tree()) {
- emit_signal("tab_changed", current);
+ emit_signal(SNAME("tab_changed"), current);
}
}
void TabContainer::move_child_notify(Node *p_child) {
Container::move_child_notify(p_child);
- call_deferred("_update_current_tab");
+ call_deferred(SNAME("_update_current_tab"));
_refresh_texts();
update();
}
@@ -756,11 +756,11 @@ void TabContainer::set_current_tab(int p_current) {
_repaint();
if (pending_previous == current) {
- emit_signal("tab_selected", current);
+ emit_signal(SNAME("tab_selected"), current);
} else {
previous = pending_previous;
- emit_signal("tab_selected", current);
- emit_signal("tab_changed", current);
+ emit_signal(SNAME("tab_selected"), current);
+ emit_signal(SNAME("tab_changed"), current);
}
update();
@@ -799,7 +799,7 @@ void TabContainer::remove_child_notify(Node *p_child) {
return;
}
- call_deferred("_update_current_tab");
+ call_deferred(SNAME("_update_current_tab"));
p_child->disconnect("renamed", callable_mp(this, &TabContainer::_child_renamed_callback));
@@ -913,7 +913,7 @@ void TabContainer::drop_data(const Point2 &p_point, const Variant &p_data) {
}
move_child(moving_tabc, hover_now);
set_current_tab(hover_now);
- emit_signal("tab_changed", hover_now);
+ emit_signal(SNAME("tab_changed"), hover_now);
}
}
}
@@ -944,12 +944,12 @@ int TabContainer::get_tab_idx_at_point(const Point2 &p_point) const {
Popup *popup = get_popup();
if (popup) {
- Ref<Texture2D> menu = get_theme_icon("menu");
+ Ref<Texture2D> menu = get_theme_icon(SNAME("menu"));
button_ofs += menu->get_width();
}
if (buttons_visible_cache) {
- Ref<Texture2D> increment = get_theme_icon("increment");
- Ref<Texture2D> decrement = get_theme_icon("decrement");
+ Ref<Texture2D> increment = get_theme_icon(SNAME("increment"));
+ Ref<Texture2D> decrement = get_theme_icon(SNAME("decrement"));
button_ofs += increment->get_width() + decrement->get_width();
}
if (px > size.width - button_ofs) {
@@ -1136,17 +1136,17 @@ Size2 TabContainer::get_minimum_size() const {
ms.y = MAX(ms.y, cms.y);
}
- Ref<StyleBox> tab_unselected = get_theme_stylebox("tab_unselected");
- Ref<StyleBox> tab_selected = get_theme_stylebox("tab_selected");
- Ref<StyleBox> tab_disabled = get_theme_stylebox("tab_disabled");
- Ref<Font> font = get_theme_font("font");
+ Ref<StyleBox> tab_unselected = get_theme_stylebox(SNAME("tab_unselected"));
+ Ref<StyleBox> tab_selected = get_theme_stylebox(SNAME("tab_selected"));
+ Ref<StyleBox> tab_disabled = get_theme_stylebox(SNAME("tab_disabled"));
+ Ref<Font> font = get_theme_font(SNAME("font"));
if (tabs_visible) {
ms.y += MAX(MAX(tab_unselected->get_minimum_size().y, tab_selected->get_minimum_size().y), tab_disabled->get_minimum_size().y);
ms.y += _get_top_margin();
}
- Ref<StyleBox> sb = get_theme_stylebox("panel");
+ Ref<StyleBox> sb = get_theme_stylebox(SNAME("panel"));
ms += sb->get_minimum_size();
return ms;
diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp
index 6f1cff9ec8..9e8fe27ffb 100644
--- a/scene/gui/tabs.cpp
+++ b/scene/gui/tabs.cpp
@@ -38,9 +38,9 @@
#include "scene/gui/texture_rect.h"
Size2 Tabs::get_minimum_size() const {
- Ref<StyleBox> tab_unselected = get_theme_stylebox("tab_unselected");
- Ref<StyleBox> tab_selected = get_theme_stylebox("tab_selected");
- Ref<StyleBox> tab_disabled = get_theme_stylebox("tab_disabled");
+ Ref<StyleBox> tab_unselected = get_theme_stylebox(SNAME("tab_unselected"));
+ Ref<StyleBox> tab_selected = get_theme_stylebox(SNAME("tab_selected"));
+ Ref<StyleBox> tab_disabled = get_theme_stylebox(SNAME("tab_disabled"));
int y_margin = MAX(MAX(tab_unselected->get_minimum_size().height, tab_selected->get_minimum_size().height), tab_disabled->get_minimum_size().height);
@@ -51,7 +51,7 @@ Size2 Tabs::get_minimum_size() const {
if (tex.is_valid()) {
ms.height = MAX(ms.height, tex->get_size().height);
if (tabs[i].text != "") {
- ms.width += get_theme_constant("hseparation");
+ ms.width += get_theme_constant(SNAME("hseparation"));
}
}
@@ -69,15 +69,15 @@ Size2 Tabs::get_minimum_size() const {
if (tabs[i].right_button.is_valid()) {
Ref<Texture2D> rb = tabs[i].right_button;
Size2 bms = rb->get_size();
- bms.width += get_theme_constant("hseparation");
+ bms.width += get_theme_constant(SNAME("hseparation"));
ms.width += bms.width;
ms.height = MAX(bms.height + tab_unselected->get_minimum_size().height, ms.height);
}
if (cb_displaypolicy == CLOSE_BUTTON_SHOW_ALWAYS || (cb_displaypolicy == CLOSE_BUTTON_SHOW_ACTIVE_ONLY && i == current)) {
- Ref<Texture2D> cb = get_theme_icon("close");
+ Ref<Texture2D> cb = get_theme_icon(SNAME("close"));
Size2 bms = cb->get_size();
- bms.width += get_theme_constant("hseparation");
+ bms.width += get_theme_constant(SNAME("hseparation"));
ms.width += bms.width;
ms.height = MAX(bms.height + tab_unselected->get_minimum_size().height, ms.height);
}
@@ -100,8 +100,8 @@ void Tabs::_gui_input(const Ref<InputEvent> &p_event) {
highlight_arrow = -1;
if (buttons_visible) {
- Ref<Texture2D> incr = get_theme_icon("increment");
- Ref<Texture2D> decr = get_theme_icon("decrement");
+ Ref<Texture2D> incr = get_theme_icon(SNAME("increment"));
+ Ref<Texture2D> decr = get_theme_icon(SNAME("decrement"));
if (is_layout_rtl()) {
if (pos.x < decr->get_width()) {
@@ -148,7 +148,7 @@ void Tabs::_gui_input(const Ref<InputEvent> &p_event) {
if (rb_pressing && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
if (rb_hover != -1) {
//pressed
- emit_signal("right_button_pressed", rb_hover);
+ emit_signal(SNAME("right_button_pressed"), rb_hover);
}
rb_pressing = false;
@@ -158,7 +158,7 @@ void Tabs::_gui_input(const Ref<InputEvent> &p_event) {
if (cb_pressing && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
if (cb_hover != -1) {
//pressed
- emit_signal("tab_closed", cb_hover);
+ emit_signal(SNAME("tab_closed"), cb_hover);
}
cb_pressing = false;
@@ -170,8 +170,8 @@ void Tabs::_gui_input(const Ref<InputEvent> &p_event) {
Point2 pos(mb->get_position().x, mb->get_position().y);
if (buttons_visible) {
- Ref<Texture2D> incr = get_theme_icon("increment");
- Ref<Texture2D> decr = get_theme_icon("decrement");
+ Ref<Texture2D> incr = get_theme_icon(SNAME("increment"));
+ Ref<Texture2D> decr = get_theme_icon(SNAME("decrement"));
if (is_layout_rtl()) {
if (pos.x < decr->get_width()) {
@@ -229,15 +229,15 @@ void Tabs::_gui_input(const Ref<InputEvent> &p_event) {
if (found != -1) {
set_current_tab(found);
- emit_signal("tab_clicked", found);
+ emit_signal(SNAME("tab_clicked"), found);
}
}
}
}
void Tabs::_shape(int p_tab) {
- Ref<Font> font = get_theme_font("font");
- int font_size = get_theme_font_size("font_size");
+ Ref<Font> font = get_theme_font(SNAME("font"));
+ int font_size = get_theme_font_size(SNAME("font_size"));
tabs.write[p_tab].xl_text = tr(tabs[p_tab].text);
tabs.write[p_tab].text_buf->clear();
@@ -274,15 +274,15 @@ void Tabs::_notification(int p_what) {
_update_cache();
RID ci = get_canvas_item();
- Ref<StyleBox> tab_unselected = get_theme_stylebox("tab_unselected");
- Ref<StyleBox> tab_selected = get_theme_stylebox("tab_selected");
- Ref<StyleBox> tab_disabled = get_theme_stylebox("tab_disabled");
- Color font_selected_color = get_theme_color("font_selected_color");
- Color font_unselected_color = get_theme_color("font_unselected_color");
- Color font_disabled_color = get_theme_color("font_disabled_color");
- Ref<Texture2D> close = get_theme_icon("close");
- Color font_outline_color = get_theme_color("font_outline_color");
- int outline_size = get_theme_constant("outline_size");
+ Ref<StyleBox> tab_unselected = get_theme_stylebox(SNAME("tab_unselected"));
+ Ref<StyleBox> tab_selected = get_theme_stylebox(SNAME("tab_selected"));
+ Ref<StyleBox> tab_disabled = get_theme_stylebox(SNAME("tab_disabled"));
+ Color font_selected_color = get_theme_color(SNAME("font_selected_color"));
+ Color font_unselected_color = get_theme_color(SNAME("font_unselected_color"));
+ Color font_disabled_color = get_theme_color(SNAME("font_disabled_color"));
+ Ref<Texture2D> close = get_theme_icon(SNAME("close"));
+ Color font_outline_color = get_theme_color(SNAME("font_outline_color"));
+ int outline_size = get_theme_constant(SNAME("outline_size"));
Vector2 size = get_size();
bool rtl = is_layout_rtl();
@@ -306,10 +306,10 @@ void Tabs::_notification(int p_what) {
w = 0;
}
- Ref<Texture2D> incr = get_theme_icon("increment");
- Ref<Texture2D> decr = get_theme_icon("decrement");
- Ref<Texture2D> incr_hl = get_theme_icon("increment_highlight");
- Ref<Texture2D> decr_hl = get_theme_icon("decrement_highlight");
+ Ref<Texture2D> incr = get_theme_icon(SNAME("increment"));
+ Ref<Texture2D> decr = get_theme_icon(SNAME("decrement"));
+ Ref<Texture2D> incr_hl = get_theme_icon(SNAME("increment_highlight"));
+ Ref<Texture2D> decr_hl = get_theme_icon(SNAME("decrement_highlight"));
int limit = get_size().width;
int limit_minus_buttons = get_size().width - incr->get_width() - decr->get_width();
@@ -363,7 +363,7 @@ void Tabs::_notification(int p_what) {
icon->draw(ci, Point2i(w, sb->get_margin(SIDE_TOP) + ((sb_rect.size.y - sb_ms.y) - icon->get_height()) / 2));
}
if (tabs[i].text != "") {
- w += icon->get_width() + get_theme_constant("hseparation");
+ w += icon->get_width() + get_theme_constant(SNAME("hseparation"));
}
}
@@ -384,10 +384,10 @@ void Tabs::_notification(int p_what) {
w += tabs[i].size_text;
if (tabs[i].right_button.is_valid()) {
- Ref<StyleBox> style = get_theme_stylebox("button");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("button"));
Ref<Texture2D> rb = tabs[i].right_button;
- w += get_theme_constant("hseparation");
+ w += get_theme_constant(SNAME("hseparation"));
Rect2 rb_rect;
rb_rect.size = style->get_minimum_size() + rb->get_size();
@@ -400,7 +400,7 @@ void Tabs::_notification(int p_what) {
if (rb_hover == i) {
if (rb_pressing) {
- get_theme_stylebox("button_pressed")->draw(ci, rb_rect);
+ get_theme_stylebox(SNAME("button_pressed"))->draw(ci, rb_rect);
} else {
style->draw(ci, rb_rect);
}
@@ -416,10 +416,10 @@ void Tabs::_notification(int p_what) {
}
if (cb_displaypolicy == CLOSE_BUTTON_SHOW_ALWAYS || (cb_displaypolicy == CLOSE_BUTTON_SHOW_ACTIVE_ONLY && i == current)) {
- Ref<StyleBox> style = get_theme_stylebox("button");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("button"));
Ref<Texture2D> cb = close;
- w += get_theme_constant("hseparation");
+ w += get_theme_constant(SNAME("hseparation"));
Rect2 cb_rect;
cb_rect.size = style->get_minimum_size() + cb->get_size();
@@ -432,7 +432,7 @@ void Tabs::_notification(int p_what) {
if (!tabs[i].disabled && cb_hover == i) {
if (cb_pressing) {
- get_theme_stylebox("button_pressed")->draw(ci, cb_rect);
+ get_theme_stylebox(SNAME("button_pressed"))->draw(ci, cb_rect);
} else {
style->draw(ci, cb_rect);
}
@@ -503,7 +503,7 @@ void Tabs::set_current_tab(int p_current) {
_update_cache();
update();
- emit_signal("tab_changed", p_current);
+ emit_signal(SNAME("tab_changed"), p_current);
}
int Tabs::get_current_tab() const {
@@ -659,7 +659,7 @@ void Tabs::_update_hover() {
}
if (hover != hover_now) {
hover = hover_now;
- emit_signal("tab_hovered", hover);
+ emit_signal(SNAME("tab_hovered"), hover);
}
if (hover_buttons == -1) { // no hover
@@ -669,11 +669,11 @@ void Tabs::_update_hover() {
}
void Tabs::_update_cache() {
- Ref<StyleBox> tab_disabled = get_theme_stylebox("tab_disabled");
- Ref<StyleBox> tab_unselected = get_theme_stylebox("tab_unselected");
- Ref<StyleBox> tab_selected = get_theme_stylebox("tab_selected");
- Ref<Texture2D> incr = get_theme_icon("increment");
- Ref<Texture2D> decr = get_theme_icon("decrement");
+ Ref<StyleBox> tab_disabled = get_theme_stylebox(SNAME("tab_disabled"));
+ Ref<StyleBox> tab_unselected = get_theme_stylebox(SNAME("tab_unselected"));
+ Ref<StyleBox> tab_selected = get_theme_stylebox(SNAME("tab_selected"));
+ Ref<Texture2D> incr = get_theme_icon(SNAME("increment"));
+ Ref<Texture2D> decr = get_theme_icon(SNAME("decrement"));
int limit_minus_buttons = get_size().width - incr->get_width() - decr->get_width();
int w = 0;
@@ -712,12 +712,12 @@ void Tabs::_update_cache() {
slen = m_width - (sb->get_margin(SIDE_LEFT) + sb->get_margin(SIDE_RIGHT));
if (tabs[i].icon.is_valid()) {
slen -= tabs[i].icon->get_width();
- slen -= get_theme_constant("hseparation");
+ slen -= get_theme_constant(SNAME("hseparation"));
}
if (cb_displaypolicy == CLOSE_BUTTON_SHOW_ALWAYS || (cb_displaypolicy == CLOSE_BUTTON_SHOW_ACTIVE_ONLY && i == current)) {
- Ref<Texture2D> cb = get_theme_icon("close");
+ Ref<Texture2D> cb = get_theme_icon(SNAME("close"));
slen -= cb->get_width();
- slen -= get_theme_constant("hseparation");
+ slen -= get_theme_constant(SNAME("hseparation"));
}
slen = MAX(slen, 1);
lsize = m_width;
@@ -745,7 +745,7 @@ void Tabs::add_tab(const String &p_str, const Ref<Texture2D> &p_icon) {
t.xl_text = tr(p_str);
t.text_buf.instantiate();
t.text_buf->set_direction(is_layout_rtl() ? TextServer::DIRECTION_RTL : TextServer::DIRECTION_LTR);
- t.text_buf->add_string(t.xl_text, get_theme_font("font"), get_theme_font_size("font_size"), Dictionary(), TranslationServer::get_singleton()->get_tool_locale());
+ t.text_buf->add_string(t.xl_text, get_theme_font(SNAME("font")), get_theme_font_size(SNAME("font_size")), Dictionary(), TranslationServer::get_singleton()->get_tool_locale());
t.icon = p_icon;
t.disabled = false;
t.ofs_cache = 0;
@@ -753,7 +753,7 @@ void Tabs::add_tab(const String &p_str, const Ref<Texture2D> &p_icon) {
tabs.push_back(t);
_update_cache();
- call_deferred("_update_hover");
+ call_deferred(SNAME("_update_hover"));
update();
minimum_size_changed();
}
@@ -762,7 +762,7 @@ void Tabs::clear_tabs() {
tabs.clear();
current = 0;
previous = 0;
- call_deferred("_update_hover");
+ call_deferred(SNAME("_update_hover"));
update();
}
@@ -773,7 +773,7 @@ void Tabs::remove_tab(int p_idx) {
current--;
}
_update_cache();
- call_deferred("_update_hover");
+ call_deferred(SNAME("_update_hover"));
update();
minimum_size_changed();
@@ -870,7 +870,7 @@ void Tabs::drop_data(const Point2 &p_point, const Variant &p_data) {
hover_now = get_tab_count() - 1;
}
move_tab(tab_from_id, hover_now);
- emit_signal("reposition_active_tab_request", hover_now);
+ emit_signal(SNAME("reposition_active_tab_request"), hover_now);
set_current_tab(hover_now);
} else if (get_tabs_rearrange_group() != -1) {
// drag and drop between Tabs
@@ -887,7 +887,7 @@ void Tabs::drop_data(const Point2 &p_point, const Variant &p_data) {
tabs.insert(hover_now, moving_tab);
from_tabs->remove_tab(tab_from_id);
set_current_tab(hover_now);
- emit_signal("tab_changed", hover_now);
+ emit_signal(SNAME("tab_changed"), hover_now);
_update_cache();
}
}
@@ -949,9 +949,9 @@ void Tabs::move_tab(int from, int to) {
int Tabs::get_tab_width(int p_idx) const {
ERR_FAIL_INDEX_V(p_idx, tabs.size(), 0);
- Ref<StyleBox> tab_unselected = get_theme_stylebox("tab_unselected");
- Ref<StyleBox> tab_selected = get_theme_stylebox("tab_selected");
- Ref<StyleBox> tab_disabled = get_theme_stylebox("tab_disabled");
+ Ref<StyleBox> tab_unselected = get_theme_stylebox(SNAME("tab_unselected"));
+ Ref<StyleBox> tab_selected = get_theme_stylebox(SNAME("tab_selected"));
+ Ref<StyleBox> tab_disabled = get_theme_stylebox(SNAME("tab_disabled"));
int x = 0;
@@ -959,7 +959,7 @@ int Tabs::get_tab_width(int p_idx) const {
if (tex.is_valid()) {
x += tex->get_width();
if (tabs[p_idx].text != "") {
- x += get_theme_constant("hseparation");
+ x += get_theme_constant(SNAME("hseparation"));
}
}
@@ -976,13 +976,13 @@ int Tabs::get_tab_width(int p_idx) const {
if (tabs[p_idx].right_button.is_valid()) {
Ref<Texture2D> rb = tabs[p_idx].right_button;
x += rb->get_width();
- x += get_theme_constant("hseparation");
+ x += get_theme_constant(SNAME("hseparation"));
}
if (cb_displaypolicy == CLOSE_BUTTON_SHOW_ALWAYS || (cb_displaypolicy == CLOSE_BUTTON_SHOW_ACTIVE_ONLY && p_idx == current)) {
- Ref<Texture2D> cb = get_theme_icon("close");
+ Ref<Texture2D> cb = get_theme_icon(SNAME("close"));
x += cb->get_width();
- x += get_theme_constant("hseparation");
+ x += get_theme_constant(SNAME("hseparation"));
}
return x;
@@ -993,8 +993,8 @@ void Tabs::_ensure_no_over_offset() {
return;
}
- Ref<Texture2D> incr = get_theme_icon("increment");
- Ref<Texture2D> decr = get_theme_icon("decrement");
+ Ref<Texture2D> incr = get_theme_icon(SNAME("increment"));
+ Ref<Texture2D> decr = get_theme_icon(SNAME("decrement"));
int limit = get_size().width;
int limit_minus_buttons = get_size().width - incr->get_width() - decr->get_width();
@@ -1034,8 +1034,8 @@ void Tabs::ensure_tab_visible(int p_idx) {
}
int prev_offset = offset;
- Ref<Texture2D> incr = get_theme_icon("increment");
- Ref<Texture2D> decr = get_theme_icon("decrement");
+ Ref<Texture2D> incr = get_theme_icon(SNAME("increment"));
+ Ref<Texture2D> decr = get_theme_icon(SNAME("decrement"));
int limit = get_size().width;
int limit_minus_buttons = get_size().width - incr->get_width() - decr->get_width();
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 9450b39aed..8444cc27f4 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -542,8 +542,8 @@ void TextEdit::_notification(int p_what) {
} break;
case NOTIFICATION_VISIBILITY_CHANGED: {
if (is_visible()) {
- call_deferred("_update_scrollbars");
- call_deferred("_update_wrap_at");
+ call_deferred(SNAME("_update_scrollbars"));
+ call_deferred(SNAME("_update_wrap_at"));
}
} break;
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
@@ -2361,7 +2361,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
}
if (mpos.x > left_margin && mpos.x <= (left_margin + gutters[i].width) - 3) {
- emit_signal("gutter_clicked", row, i);
+ emit_signal(SNAME("gutter_clicked"), row, i);
return;
}
@@ -2483,7 +2483,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
int row, col;
_get_mouse_pos(Point2i(mpos.x, mpos.y), row, col);
- emit_signal("symbol_lookup", highlighted_word, row, col);
+ emit_signal(SNAME("symbol_lookup"), highlighted_word, row, col);
return;
}
@@ -2525,7 +2525,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (!dragging_minimap && !dragging_selection && mm->is_command_pressed() && mm->get_button_mask() == 0) {
String new_word = get_word_at_pos(mpos);
if (new_word != highlighted_word) {
- emit_signal("symbol_validate", new_word);
+ emit_signal(SNAME("symbol_validate"), new_word);
}
} else {
if (highlighted_word != String()) {
@@ -2576,7 +2576,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (select_identifiers_enabled) {
if (k->is_pressed() && !dragging_minimap && !dragging_selection) {
Point2 mp = _get_local_mouse_pos();
- emit_signal("symbol_validate", get_word_at_pos(mp));
+ emit_signal(SNAME("symbol_validate"), get_word_at_pos(mp));
} else {
set_highlighted_word(String());
}
@@ -2992,7 +2992,7 @@ void TextEdit::_base_insert_text(int p_line, int p_char, const String &p_text, i
}
text_changed_dirty = true;
}
- emit_signal("lines_edited_from", p_line, r_end_line);
+ emit_signal(SNAME("lines_edited_from"), p_line, r_end_line);
}
String TextEdit::_base_get_text(int p_from_line, int p_from_column, int p_to_line, int p_to_column) const {
@@ -3043,7 +3043,7 @@ void TextEdit::_base_remove_text(int p_from_line, int p_from_column, int p_to_li
}
text_changed_dirty = true;
}
- emit_signal("lines_edited_from", p_to_line, p_from_line);
+ emit_signal(SNAME("lines_edited_from"), p_to_line, p_from_line);
}
void TextEdit::_insert_text(int p_line, int p_char, const String &p_text, int *r_end_line, int *r_end_char) {
@@ -4034,35 +4034,35 @@ void TextEdit::_toggle_draw_caret() {
}
void TextEdit::_update_caches() {
- cache.style_normal = get_theme_stylebox("normal");
- cache.style_focus = get_theme_stylebox("focus");
- cache.style_readonly = get_theme_stylebox("read_only");
- cache.font = get_theme_font("font");
- cache.font_size = get_theme_font_size("font_size");
- cache.outline_color = get_theme_color("font_outline_color");
- cache.outline_size = get_theme_constant("outline_size");
- cache.caret_color = get_theme_color("caret_color");
- cache.caret_background_color = get_theme_color("caret_background_color");
- cache.font_color = get_theme_color("font_color");
- cache.font_selected_color = get_theme_color("font_selected_color");
- cache.font_readonly_color = get_theme_color("font_readonly_color");
- cache.selection_color = get_theme_color("selection_color");
- cache.current_line_color = get_theme_color("current_line_color");
- cache.line_length_guideline_color = get_theme_color("line_length_guideline_color");
- cache.code_folding_color = get_theme_color("code_folding_color", "CodeEdit");
- cache.brace_mismatch_color = get_theme_color("brace_mismatch_color");
- cache.word_highlighted_color = get_theme_color("word_highlighted_color");
- cache.search_result_color = get_theme_color("search_result_color");
- cache.search_result_border_color = get_theme_color("search_result_border_color");
- cache.background_color = get_theme_color("background_color");
+ cache.style_normal = get_theme_stylebox(SNAME("normal"));
+ cache.style_focus = get_theme_stylebox(SNAME("focus"));
+ cache.style_readonly = get_theme_stylebox(SNAME("read_only"));
+ cache.font = get_theme_font(SNAME("font"));
+ cache.font_size = get_theme_font_size(SNAME("font_size"));
+ cache.outline_color = get_theme_color(SNAME("font_outline_color"));
+ cache.outline_size = get_theme_constant(SNAME("outline_size"));
+ cache.caret_color = get_theme_color(SNAME("caret_color"));
+ cache.caret_background_color = get_theme_color(SNAME("caret_background_color"));
+ cache.font_color = get_theme_color(SNAME("font_color"));
+ cache.font_selected_color = get_theme_color(SNAME("font_selected_color"));
+ cache.font_readonly_color = get_theme_color(SNAME("font_readonly_color"));
+ cache.selection_color = get_theme_color(SNAME("selection_color"));
+ cache.current_line_color = get_theme_color(SNAME("current_line_color"));
+ cache.line_length_guideline_color = get_theme_color(SNAME("line_length_guideline_color"));
+ cache.code_folding_color = get_theme_color(SNAME("code_folding_color"), SNAME("CodeEdit"));
+ cache.brace_mismatch_color = get_theme_color(SNAME("brace_mismatch_color"));
+ cache.word_highlighted_color = get_theme_color(SNAME("word_highlighted_color"));
+ cache.search_result_color = get_theme_color(SNAME("search_result_color"));
+ cache.search_result_border_color = get_theme_color(SNAME("search_result_border_color"));
+ cache.background_color = get_theme_color(SNAME("background_color"));
#ifdef TOOLS_ENABLED
- cache.line_spacing = get_theme_constant("line_spacing") * EDSCALE;
+ cache.line_spacing = get_theme_constant(SNAME("line_spacing")) * EDSCALE;
#else
- cache.line_spacing = get_theme_constant("line_spacing");
+ cache.line_spacing = get_theme_constant(SNAME("line_spacing"));
#endif
- cache.tab_icon = get_theme_icon("tab");
- cache.space_icon = get_theme_icon("space");
- cache.folded_eol_icon = get_theme_icon("folded_eol_icon", "CodeEdit");
+ cache.tab_icon = get_theme_icon(SNAME("tab"));
+ cache.space_icon = get_theme_icon(SNAME("space"));
+ cache.folded_eol_icon = get_theme_icon(SNAME("folded_eol_icon"), SNAME("CodeEdit"));
TextServer::Direction dir;
if (text_direction == Control::TEXT_DIRECTION_INHERITED) {
@@ -4119,7 +4119,7 @@ void TextEdit::add_gutter(int p_at) {
for (int i = 0; i < text.size() + 1; i++) {
text.add_gutter(p_at);
}
- emit_signal("gutter_added");
+ emit_signal(SNAME("gutter_added"));
update();
}
@@ -4131,7 +4131,7 @@ void TextEdit::remove_gutter(int p_gutter) {
for (int i = 0; i < text.size() + 1; i++) {
text.remove_gutter(p_gutter);
}
- emit_signal("gutter_removed");
+ emit_signal(SNAME("gutter_removed"));
update();
}
@@ -4755,12 +4755,12 @@ bool TextEdit::search(const String &p_key, uint32_t p_search_flags, int p_from_l
}
void TextEdit::_cursor_changed_emit() {
- emit_signal("cursor_changed");
+ emit_signal(SNAME("cursor_changed"));
cursor_changed_dirty = false;
}
void TextEdit::_text_changed_emit() {
- emit_signal("text_changed");
+ emit_signal(SNAME("text_changed"));
text_changed_dirty = false;
}
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 4d2cb81f23..09db3205d9 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -416,7 +416,7 @@ void TreeItem::set_collapsed(bool p_collapsed) {
if (tree->select_mode == Tree::SELECT_MULTI) {
tree->selected_item = this;
- emit_signal("cell_selected");
+ emit_signal(SNAME("cell_selected"));
} else {
select(tree->selected_col);
}
@@ -426,7 +426,7 @@ void TreeItem::set_collapsed(bool p_collapsed) {
}
_changed_notify();
- tree->emit_signal("item_collapsed", this);
+ tree->emit_signal(SNAME("item_collapsed"), this);
}
bool TreeItem::is_collapsed() {
@@ -1215,62 +1215,62 @@ TreeItem::~TreeItem() {
/**********************************************/
void Tree::update_cache() {
- cache.font = get_theme_font("font");
- cache.font_size = get_theme_font_size("font_size");
- cache.tb_font = get_theme_font("title_button_font");
- cache.tb_font_size = get_theme_font_size("title_button_font_size");
- cache.bg = get_theme_stylebox("bg");
- cache.selected = get_theme_stylebox("selected");
- cache.selected_focus = get_theme_stylebox("selected_focus");
- cache.cursor = get_theme_stylebox("cursor");
- cache.cursor_unfocus = get_theme_stylebox("cursor_unfocused");
- cache.button_pressed = get_theme_stylebox("button_pressed");
-
- cache.checked = get_theme_icon("checked");
- cache.unchecked = get_theme_icon("unchecked");
+ cache.font = get_theme_font(SNAME("font"));
+ cache.font_size = get_theme_font_size(SNAME("font_size"));
+ cache.tb_font = get_theme_font(SNAME("title_button_font"));
+ cache.tb_font_size = get_theme_font_size(SNAME("title_button_font_size"));
+ cache.bg = get_theme_stylebox(SNAME("bg"));
+ cache.selected = get_theme_stylebox(SNAME("selected"));
+ cache.selected_focus = get_theme_stylebox(SNAME("selected_focus"));
+ cache.cursor = get_theme_stylebox(SNAME("cursor"));
+ cache.cursor_unfocus = get_theme_stylebox(SNAME("cursor_unfocused"));
+ cache.button_pressed = get_theme_stylebox(SNAME("button_pressed"));
+
+ cache.checked = get_theme_icon(SNAME("checked"));
+ cache.unchecked = get_theme_icon(SNAME("unchecked"));
if (is_layout_rtl()) {
- cache.arrow_collapsed = get_theme_icon("arrow_collapsed_mirrored");
+ cache.arrow_collapsed = get_theme_icon(SNAME("arrow_collapsed_mirrored"));
} else {
- cache.arrow_collapsed = get_theme_icon("arrow_collapsed");
- }
- cache.arrow = get_theme_icon("arrow");
- cache.select_arrow = get_theme_icon("select_arrow");
- cache.updown = get_theme_icon("updown");
-
- cache.custom_button = get_theme_stylebox("custom_button");
- cache.custom_button_hover = get_theme_stylebox("custom_button_hover");
- cache.custom_button_pressed = get_theme_stylebox("custom_button_pressed");
- cache.custom_button_font_highlight = get_theme_color("custom_button_font_highlight");
-
- cache.font_color = get_theme_color("font_color");
- cache.font_selected_color = get_theme_color("font_selected_color");
- cache.drop_position_color = get_theme_color("drop_position_color");
- cache.hseparation = get_theme_constant("hseparation");
- cache.vseparation = get_theme_constant("vseparation");
- cache.item_margin = get_theme_constant("item_margin");
- cache.button_margin = get_theme_constant("button_margin");
-
- cache.font_outline_color = get_theme_color("font_outline_color");
- cache.font_outline_size = get_theme_constant("outline_size");
-
- cache.draw_guides = get_theme_constant("draw_guides");
- cache.guide_color = get_theme_color("guide_color");
- cache.draw_relationship_lines = get_theme_constant("draw_relationship_lines");
- cache.relationship_line_width = get_theme_constant("relationship_line_width");
- cache.parent_hl_line_width = get_theme_constant("parent_hl_line_width");
- cache.children_hl_line_width = get_theme_constant("children_hl_line_width");
- cache.parent_hl_line_margin = get_theme_constant("parent_hl_line_margin");
- cache.relationship_line_color = get_theme_color("relationship_line_color");
- cache.parent_hl_line_color = get_theme_color("parent_hl_line_color");
- cache.children_hl_line_color = get_theme_color("children_hl_line_color");
-
- cache.scroll_border = get_theme_constant("scroll_border");
- cache.scroll_speed = get_theme_constant("scroll_speed");
-
- cache.title_button = get_theme_stylebox("title_button_normal");
- cache.title_button_pressed = get_theme_stylebox("title_button_pressed");
- cache.title_button_hover = get_theme_stylebox("title_button_hover");
- cache.title_button_color = get_theme_color("title_button_color");
+ cache.arrow_collapsed = get_theme_icon(SNAME("arrow_collapsed"));
+ }
+ cache.arrow = get_theme_icon(SNAME("arrow"));
+ cache.select_arrow = get_theme_icon(SNAME("select_arrow"));
+ cache.updown = get_theme_icon(SNAME("updown"));
+
+ cache.custom_button = get_theme_stylebox(SNAME("custom_button"));
+ cache.custom_button_hover = get_theme_stylebox(SNAME("custom_button_hover"));
+ cache.custom_button_pressed = get_theme_stylebox(SNAME("custom_button_pressed"));
+ cache.custom_button_font_highlight = get_theme_color(SNAME("custom_button_font_highlight"));
+
+ cache.font_color = get_theme_color(SNAME("font_color"));
+ cache.font_selected_color = get_theme_color(SNAME("font_selected_color"));
+ cache.drop_position_color = get_theme_color(SNAME("drop_position_color"));
+ cache.hseparation = get_theme_constant(SNAME("hseparation"));
+ cache.vseparation = get_theme_constant(SNAME("vseparation"));
+ cache.item_margin = get_theme_constant(SNAME("item_margin"));
+ cache.button_margin = get_theme_constant(SNAME("button_margin"));
+
+ cache.font_outline_color = get_theme_color(SNAME("font_outline_color"));
+ cache.font_outline_size = get_theme_constant(SNAME("outline_size"));
+
+ cache.draw_guides = get_theme_constant(SNAME("draw_guides"));
+ cache.guide_color = get_theme_color(SNAME("guide_color"));
+ cache.draw_relationship_lines = get_theme_constant(SNAME("draw_relationship_lines"));
+ cache.relationship_line_width = get_theme_constant(SNAME("relationship_line_width"));
+ cache.parent_hl_line_width = get_theme_constant(SNAME("parent_hl_line_width"));
+ cache.children_hl_line_width = get_theme_constant(SNAME("children_hl_line_width"));
+ cache.parent_hl_line_margin = get_theme_constant(SNAME("parent_hl_line_margin"));
+ cache.relationship_line_color = get_theme_color(SNAME("relationship_line_color"));
+ cache.parent_hl_line_color = get_theme_color(SNAME("parent_hl_line_color"));
+ cache.children_hl_line_color = get_theme_color(SNAME("children_hl_line_color"));
+
+ cache.scroll_border = get_theme_constant(SNAME("scroll_border"));
+ cache.scroll_speed = get_theme_constant(SNAME("scroll_speed"));
+
+ cache.title_button = get_theme_stylebox(SNAME("title_button_normal"));
+ cache.title_button_pressed = get_theme_stylebox(SNAME("title_button_pressed"));
+ cache.title_button_hover = get_theme_stylebox(SNAME("title_button_hover"));
+ cache.title_button_color = get_theme_color(SNAME("title_button_color"));
v_scroll->set_custom_step(cache.font->get_height(cache.font_size));
}
@@ -2075,7 +2075,7 @@ void Tree::select_single_item(TreeItem *p_selected, TreeItem *p_current, int p_c
selected_item = p_selected;
selected_col = 0;
if (!emitted_row) {
- emit_signal("item_selected");
+ emit_signal(SNAME("item_selected"));
emitted_row = true;
}
/*
@@ -2095,28 +2095,28 @@ void Tree::select_single_item(TreeItem *p_selected, TreeItem *p_current, int p_c
selected_item = p_selected;
selected_col = i;
- emit_signal("cell_selected");
+ emit_signal(SNAME("cell_selected"));
if (select_mode == SELECT_MULTI) {
- emit_signal("multi_selected", p_current, i, true);
+ emit_signal(SNAME("multi_selected"), p_current, i, true);
} else if (select_mode == SELECT_SINGLE) {
- emit_signal("item_selected");
+ emit_signal(SNAME("item_selected"));
}
} else if (select_mode == SELECT_MULTI && (selected_item != p_selected || selected_col != i)) {
selected_item = p_selected;
selected_col = i;
- emit_signal("cell_selected");
+ emit_signal(SNAME("cell_selected"));
}
} else {
if (r_in_range && *r_in_range && !p_force_deselect) {
if (!c.selected && c.selectable) {
c.selected = true;
- emit_signal("multi_selected", p_current, i, true);
+ emit_signal(SNAME("multi_selected"), p_current, i, true);
}
} else if (!r_in_range || p_force_deselect) {
if (select_mode == SELECT_MULTI && c.selected) {
- emit_signal("multi_selected", p_current, i, false);
+ emit_signal(SNAME("multi_selected"), p_current, i, false);
}
c.selected = false;
}
@@ -2184,7 +2184,7 @@ void Tree::_range_click_timeout() {
}
if (propagate_mouse_activated) {
- emit_signal("item_activated");
+ emit_signal(SNAME("item_activated"));
propagate_mouse_activated = false;
}
@@ -2297,7 +2297,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, int
cache.click_column = col;
cache.click_pos = get_global_mouse_position() - get_global_position();
update();
- //emit_signal("button_pressed");
+ //emit_signal(SNAME("button_pressed"));
return -1;
}
@@ -2318,15 +2318,15 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, int
if (select_mode == SELECT_MULTI && p_mod->is_command_pressed() && c.selectable) {
if (!c.selected || p_button == MOUSE_BUTTON_RIGHT) {
p_item->select(col);
- emit_signal("multi_selected", p_item, col, true);
+ emit_signal(SNAME("multi_selected"), p_item, col, true);
if (p_button == MOUSE_BUTTON_RIGHT) {
- emit_signal("item_rmb_selected", get_local_mouse_position());
+ emit_signal(SNAME("item_rmb_selected"), get_local_mouse_position());
}
//p_item->selected_signal.call(col);
} else {
p_item->deselect(col);
- emit_signal("multi_selected", p_item, col, false);
+ emit_signal(SNAME("multi_selected"), p_item, col, false);
//p_item->deselected_signal.call(col);
}
@@ -2337,7 +2337,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, int
select_single_item(p_item, root, col, selected_item, &inrange);
if (p_button == MOUSE_BUTTON_RIGHT) {
- emit_signal("item_rmb_selected", get_local_mouse_position());
+ emit_signal(SNAME("item_rmb_selected"), get_local_mouse_position());
}
} else {
int icount = _count_selected_items(root);
@@ -2351,14 +2351,14 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, int
}
if (p_button == MOUSE_BUTTON_RIGHT) {
- emit_signal("item_rmb_selected", get_local_mouse_position());
+ emit_signal(SNAME("item_rmb_selected"), get_local_mouse_position());
}
}
}
/*
if (!c.selected && select_mode==SELECT_MULTI) {
- emit_signal("multi_selected",p_item,col,true);
+ emit_signal(SNAME("multi_selected"),p_item,col,true);
}
*/
update();
@@ -2472,7 +2472,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, int
custom_popup_rect = Rect2i(get_global_position() + Point2i(col_ofs, _get_title_button_height() + y_ofs + item_h - cache.offset.y), Size2(get_column_width(col), item_h));
if (on_arrow || !p_item->cells[col].custom_button) {
- emit_signal("custom_popup_edited", ((bool)(x >= (col_width - item_h / 2))));
+ emit_signal(SNAME("custom_popup_edited"), ((bool)(x >= (col_width - item_h / 2))));
}
if (!p_item->cells[col].custom_button || !on_arrow) {
@@ -2524,7 +2524,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, int
}
}
if (p_item == root && p_button == MOUSE_BUTTON_RIGHT) {
- emit_signal("empty_rmb", get_local_mouse_position());
+ emit_signal(SNAME("empty_rmb"), get_local_mouse_position());
}
}
@@ -2630,7 +2630,7 @@ void Tree::_go_left() {
} else {
if (select_mode == SELECT_MULTI) {
selected_col--;
- emit_signal("cell_selected");
+ emit_signal(SNAME("cell_selected"));
} else {
selected_item->select(selected_col - 1);
}
@@ -2651,7 +2651,7 @@ void Tree::_go_right() {
} else {
if (select_mode == SELECT_MULTI) {
selected_col++;
- emit_signal("cell_selected");
+ emit_signal(SNAME("cell_selected"));
} else {
selected_item->select(selected_col + 1);
}
@@ -2684,7 +2684,7 @@ void Tree::_go_up() {
return;
}
selected_item = prev;
- emit_signal("cell_selected");
+ emit_signal(SNAME("cell_selected"));
update();
} else {
int col = selected_col < 0 ? 0 : selected_col;
@@ -2727,7 +2727,7 @@ void Tree::_go_down() {
}
selected_item = next;
- emit_signal("cell_selected");
+ emit_signal(SNAME("cell_selected"));
update();
} else {
int col = selected_col < 0 ? 0 : selected_col;
@@ -2828,7 +2828,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
if (select_mode == SELECT_MULTI) {
selected_item = next;
- emit_signal("cell_selected");
+ emit_signal(SNAME("cell_selected"));
update();
} else {
while (next && !next->cells[selected_col].selectable) {
@@ -2866,7 +2866,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
if (select_mode == SELECT_MULTI) {
selected_item = prev;
- emit_signal("cell_selected");
+ emit_signal(SNAME("cell_selected"));
update();
} else {
while (prev && !prev->cells[selected_col].selectable) {
@@ -2882,7 +2882,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
if (selected_item) {
//bring up editor if possible
if (!edit_selected()) {
- emit_signal("item_activated");
+ emit_signal(SNAME("item_activated"));
incr_search.clear();
}
}
@@ -2894,10 +2894,10 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
}
if (selected_item->is_selected(selected_col)) {
selected_item->deselect(selected_col);
- emit_signal("multi_selected", selected_item, selected_col, false);
+ emit_signal(SNAME("multi_selected"), selected_item, selected_col, false);
} else if (selected_item->is_selectable(selected_col)) {
selected_item->select(selected_col);
- emit_signal("multi_selected", selected_item, selected_col, true);
+ emit_signal(SNAME("multi_selected"), selected_item, selected_col, true);
}
}
accept_event();
@@ -3081,7 +3081,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
for (int i = 0; i < columns.size(); i++) {
len += get_column_width(i);
if (pos.x < len) {
- emit_signal("column_title_pressed", i);
+ emit_signal(SNAME("column_title_pressed"), i);
break;
}
}
@@ -3108,10 +3108,10 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
}
if (rect.has_point(mpos)) {
if (!edit_selected()) {
- emit_signal("item_double_clicked");
+ emit_signal(SNAME("item_double_clicked"));
}
} else {
- emit_signal("item_double_clicked");
+ emit_signal(SNAME("item_double_clicked"));
}
}
pressing_for_editor = false;
@@ -3120,7 +3120,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
if (cache.click_type == Cache::CLICK_BUTTON && cache.click_item != nullptr) {
// make sure in case of wrong reference after reconstructing whole TreeItems
cache.click_item = get_item_at_position(cache.click_pos);
- emit_signal("button_pressed", cache.click_item, cache.click_column, cache.click_id);
+ emit_signal(SNAME("button_pressed"), cache.click_item, cache.click_column, cache.click_id);
}
cache.click_type = Cache::CLICK_NONE;
cache.click_index = -1;
@@ -3180,7 +3180,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
}
if (!root || (!root->get_first_child() && hide_root)) {
if (b->get_button_index() == MOUSE_BUTTON_RIGHT && allow_rmb_select) {
- emit_signal("empty_tree_rmb_selected", get_local_mouse_position());
+ emit_signal(SNAME("empty_tree_rmb_selected"), get_local_mouse_position());
}
break;
}
@@ -3231,13 +3231,13 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
if (b->get_button_index() == MOUSE_BUTTON_LEFT) {
if (get_item_at_position(b->get_position()) == nullptr && !b->is_shift_pressed() && !b->is_ctrl_pressed() && !b->is_command_pressed()) {
- emit_signal("nothing_selected");
+ emit_signal(SNAME("nothing_selected"));
}
}
}
if (propagate_mouse_activated) {
- emit_signal("item_activated");
+ emit_signal(SNAME("item_activated"));
propagate_mouse_activated = false;
}
@@ -3306,7 +3306,7 @@ bool Tree::edit_selected() {
edited_item = s;
edited_col = col;
custom_popup_rect = Rect2i(get_global_position() + rect.position, rect.size);
- emit_signal("custom_popup_edited", false);
+ emit_signal(SNAME("custom_popup_edited"), false);
item_edited(col, s);
return true;
@@ -3542,8 +3542,8 @@ void Tree::_notification(int p_what) {
RID ci = get_canvas_item();
Ref<StyleBox> bg = cache.bg;
- Color font_outline_color = get_theme_color("font_outline_color");
- int outline_size = get_theme_constant("outline_size");
+ Color font_outline_color = get_theme_color(SNAME("font_outline_color"));
+ int outline_size = get_theme_constant(SNAME("outline_size"));
Point2 draw_ofs;
draw_ofs += bg->get_offset();
@@ -3593,7 +3593,7 @@ void Tree::_notification(int p_what) {
// Otherwise, section heading backgrounds can appear to be in front of the focus outline when scrolling.
if (has_focus()) {
RenderingServer::get_singleton()->canvas_item_add_clip_ignore(ci, true);
- const Ref<StyleBox> bg_focus = get_theme_stylebox("bg_focus");
+ const Ref<StyleBox> bg_focus = get_theme_stylebox(SNAME("bg_focus"));
bg_focus->draw(ci, Rect2(Point2(), get_size()));
RenderingServer::get_singleton()->canvas_item_add_clip_ignore(ci, false);
}
@@ -3694,9 +3694,9 @@ void Tree::item_edited(int p_column, TreeItem *p_item, bool p_lmb) {
edited_item->cells.write[p_column].dirty = true;
}
if (p_lmb) {
- emit_signal("item_edited");
+ emit_signal(SNAME("item_edited"));
} else {
- emit_signal("item_rmb_edited");
+ emit_signal(SNAME("item_rmb_edited"));
}
}
@@ -3714,7 +3714,7 @@ void Tree::item_selected(int p_column, TreeItem *p_item) {
}
p_item->cells.write[p_column].selected = true;
- //emit_signal("multi_selected",p_item,p_column,true); - NO this is for TreeItem::select
+ //emit_signal(SNAME("multi_selected"),p_item,p_column,true); - NO this is for TreeItem::select
selected_col = p_column;
if (!selected_item) {
@@ -4075,7 +4075,7 @@ void Tree::ensure_cursor_is_visible() {
if (cell_h > screen_h) { // Screen size is too small, maybe it was not resized yet.
v_scroll->set_value(y_offset);
} else if (y_offset + cell_h > v_scroll->get_value() + screen_h) {
- v_scroll->call_deferred("set_value", y_offset - screen_h + cell_h);
+ v_scroll->call_deferred(SNAME("set_value"), y_offset - screen_h + cell_h);
} else if (y_offset < v_scroll->get_value()) {
v_scroll->set_value(y_offset);
}
@@ -4093,7 +4093,7 @@ void Tree::ensure_cursor_is_visible() {
if (cell_w > screen_w) {
h_scroll->set_value(x_offset);
} else if (x_offset + cell_w > h_scroll->get_value() + screen_w) {
- h_scroll->call_deferred("set_value", x_offset - screen_w + cell_w);
+ h_scroll->call_deferred(SNAME("set_value"), x_offset - screen_w + cell_w);
} else if (x_offset < h_scroll->get_value()) {
h_scroll->set_value(x_offset);
}