summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/color_picker.cpp2
-rw-r--r--scene/gui/container.cpp2
-rw-r--r--scene/gui/control.cpp2
-rw-r--r--scene/gui/dialogs.cpp2
-rw-r--r--scene/gui/file_dialog.cpp6
-rw-r--r--scene/gui/item_list.cpp2
-rw-r--r--scene/gui/line_edit.cpp20
-rw-r--r--scene/gui/range.cpp2
-rw-r--r--scene/gui/rich_text_label.cpp4
-rw-r--r--scene/gui/scroll_container.cpp2
-rw-r--r--scene/gui/text_edit.cpp12
-rw-r--r--scene/gui/tree.cpp8
12 files changed, 32 insertions, 32 deletions
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index 8b02567d88..a80506029c 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -591,7 +591,7 @@ void ColorPicker::_screen_input(const Ref<InputEvent> &p_event) {
}
Ref<Image> img = r->get_texture()->get_data();
- if (img.is_valid() && !img->empty()) {
+ if (img.is_valid() && !img->is_empty()) {
Vector2 ofs = mev->get_global_position() - r->get_visible_rect().get_position();
Color c = img->get_pixel(ofs.x, r->get_visible_rect().size.height - ofs.y);
diff --git a/scene/gui/container.cpp b/scene/gui/container.cpp
index f01da703c1..38e938ebea 100644
--- a/scene/gui/container.cpp
+++ b/scene/gui/container.cpp
@@ -163,7 +163,7 @@ String Container::get_configuration_warning() const {
String warning = Control::get_configuration_warning();
if (get_class() == "Container" && get_script().is_null()) {
- if (!warning.empty()) {
+ if (!warning.is_empty()) {
warning += "\n\n";
}
warning += TTR("Container by itself serves no purpose unless a script configures its children placement behavior.\nIf you don't intend to add a script, use a plain Control node instead.");
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 62cbec4ae5..bac7e56aac 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -2698,7 +2698,7 @@ String Control::get_configuration_warning() const {
String warning = CanvasItem::get_configuration_warning();
if (data.mouse_filter == MOUSE_FILTER_IGNORE && data.tooltip != "") {
- if (!warning.empty()) {
+ if (!warning.is_empty()) {
warning += "\n\n";
}
warning += TTR("The Hint Tooltip won't be displayed as the control's Mouse Filter is set to \"Ignore\". To solve this, set the Mouse Filter to \"Stop\" or \"Pass\".");
diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp
index 9f5f6c21c8..199af936a6 100644
--- a/scene/gui/dialogs.cpp
+++ b/scene/gui/dialogs.cpp
@@ -165,7 +165,7 @@ void AcceptDialog::register_text_enter(Node *p_line_edit) {
void AcceptDialog::_update_child_rects() {
Size2 label_size = label->get_minimum_size();
- if (label->get_text().empty()) {
+ if (label->get_text().is_empty()) {
label_size.height = 0;
}
int margin = hbc->get_theme_constant("margin", "Dialogs");
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index 041b8ef174..3da12c038a 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -434,7 +434,7 @@ void FileDialog::update_file_list() {
dirs.sort_custom<NaturalNoCaseComparator>();
files.sort_custom<NaturalNoCaseComparator>();
- while (!dirs.empty()) {
+ while (!dirs.is_empty()) {
String &dir_name = dirs.front()->get();
TreeItem *ti = tree->create_item(root);
ti->set_text(0, dir_name);
@@ -478,8 +478,8 @@ void FileDialog::update_file_list() {
String base_dir = dir_access->get_current_dir();
- while (!files.empty()) {
- bool match = patterns.empty();
+ while (!files.is_empty()) {
+ bool match = patterns.is_empty();
String match_str;
for (List<String>::Element *E = patterns.front(); E; E = E->next()) {
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index e0aef32e15..221e74d35b 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -1314,7 +1314,7 @@ int ItemList::get_item_at_position(const Point2 &p_pos, bool p_exact) const {
}
bool ItemList::is_pos_at_end_of_items(const Point2 &p_pos) const {
- if (items.empty()) {
+ if (items.is_empty()) {
return true;
}
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index e623ba987f..921c9875b3 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -69,7 +69,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
_reset_caret_blink_timer();
if (b->is_pressed()) {
accept_event(); //don't pass event further when clicked on text field
- if (!text.empty() && is_editable() && _is_over_clear_button(b->get_position())) {
+ if (!text.is_empty() && is_editable() && _is_over_clear_button(b->get_position())) {
clear_button_status.press_attempt = true;
clear_button_status.pressing_inside = true;
update();
@@ -106,7 +106,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
update();
} else {
- if (!text.empty() && is_editable() && clear_button_enabled) {
+ if (!text.is_empty() && is_editable() && clear_button_enabled) {
bool press_attempt = clear_button_status.press_attempt;
clear_button_status.press_attempt = false;
if (press_attempt && clear_button_status.pressing_inside && _is_over_clear_button(b->get_position())) {
@@ -136,7 +136,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
Ref<InputEventMouseMotion> m = p_event;
if (m.is_valid()) {
- if (!text.empty() && is_editable() && clear_button_enabled) {
+ if (!text.is_empty() && is_editable() && clear_button_enabled) {
bool last_press_inside = clear_button_status.pressing_inside;
clear_button_status.pressing_inside = clear_button_status.press_attempt && _is_over_clear_button(m->get_position());
if (last_press_inside != clear_button_status.pressing_inside) {
@@ -653,7 +653,7 @@ void LineEdit::drop_data(const Point2 &p_point, const Variant &p_data) {
}
Control::CursorShape LineEdit::get_cursor_shape(const Point2 &p_pos) const {
- if (!text.empty() && is_editable() && _is_over_clear_button(p_pos)) {
+ if (!text.is_empty() && is_editable() && _is_over_clear_button(p_pos)) {
return CURSOR_ARROW;
}
return Control::get_cursor_shape(p_pos);
@@ -735,7 +735,7 @@ void LineEdit::_notification(int p_what) {
}
int x_ofs = 0;
- bool using_placeholder = text.empty() && ime_text.empty();
+ bool using_placeholder = text.is_empty() && ime_text.is_empty();
float text_width = TS->shaped_text_get_size(text_rid).x;
float text_height = TS->shaped_text_get_size(text_rid).y + font->get_spacing(Font::SPACING_TOP) + font->get_spacing(Font::SPACING_BOTTOM);
@@ -1109,7 +1109,7 @@ void LineEdit::set_cursor_at_pixel_pos(int p_x) {
} break;
}
- bool using_placeholder = text.empty() && ime_text.empty();
+ 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;
@@ -1157,7 +1157,7 @@ Vector2i LineEdit::get_cursor_pixel_pos() {
} break;
}
- bool using_placeholder = text.empty() && ime_text.empty();
+ 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;
@@ -1482,7 +1482,7 @@ void LineEdit::set_cursor_position(int p_pos) {
}
int ofs_max = get_size().width - style->get_margin(SIDE_RIGHT);
- bool using_placeholder = text.empty() && ime_text.empty();
+ 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;
@@ -1570,7 +1570,7 @@ Size2 LineEdit::get_minimum_size() const {
min_size.height = MAX(TS->shaped_text_get_size(text_rid).y + font->get_spacing(Font::SPACING_TOP) + font->get_spacing(Font::SPACING_BOTTOM), font->get_height(font_size));
// Take icons into account.
- bool using_placeholder = text.empty() && ime_text.empty();
+ 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;
@@ -1995,7 +1995,7 @@ void LineEdit::_fit_to_width() {
if (align == ALIGN_FILL) {
Ref<StyleBox> style = get_theme_stylebox("normal");
int t_width = get_size().width - style->get_margin(SIDE_RIGHT) - style->get_margin(SIDE_LEFT);
- bool using_placeholder = text.empty() && ime_text.empty();
+ 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;
diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp
index bdb9f408f0..6342109660 100644
--- a/scene/gui/range.cpp
+++ b/scene/gui/range.cpp
@@ -34,7 +34,7 @@ String Range::get_configuration_warning() const {
String warning = Control::get_configuration_warning();
if (shared->exp_ratio && shared->min <= 0) {
- if (!warning.empty()) {
+ if (!warning.is_empty()) {
warning += "\n\n";
}
warning += TTR("If \"Exp Edit\" is enabled, \"Min Value\" must be greater than 0.");
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 69b2c6ac7e..5258aae80c 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -2723,7 +2723,7 @@ Error RichTextLabel::append_bbcode(const String &p_bbcode) {
String bbcode_name;
typedef Map<String, String> OptionMap;
OptionMap bbcode_options;
- if (!split_tag_block.empty()) {
+ if (!split_tag_block.is_empty()) {
bbcode_name = split_tag_block[0];
for (int i = 1; i < split_tag_block.size(); i++) {
const String &expr = split_tag_block[i];
@@ -3071,7 +3071,7 @@ Error RichTextLabel::append_bbcode(const String &p_bbcode) {
int width = 0;
int height = 0;
- if (!bbcode_value.empty()) {
+ if (!bbcode_value.is_empty()) {
int sep = bbcode_value.find("x");
if (sep == -1) {
width = bbcode_value.to_int();
diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp
index 942593df27..35f504812d 100644
--- a/scene/gui/scroll_container.cpp
+++ b/scene/gui/scroll_container.cpp
@@ -558,7 +558,7 @@ String ScrollContainer::get_configuration_warning() const {
}
if (found != 1) {
- if (!warning.empty()) {
+ if (!warning.is_empty()) {
warning += "\n\n";
}
warning += TTR("ScrollContainer is intended to work with a single child control.\nUse a container as child (VBox, HBox, etc.), or a Control and set the custom minimum size manually.");
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 27d82c7ac7..d044d2421b 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -189,12 +189,12 @@ void TextEdit::Text::invalidate_cache(int p_line, int p_column, const String &p_
text.write[p_line].data_buf->set_preserve_control(draw_control_chars);
if (p_ime_text.length() > 0) {
text.write[p_line].data_buf->add_string(p_ime_text, font, font_size, opentype_features, language);
- if (!p_bidi_override.empty()) {
+ if (!p_bidi_override.is_empty()) {
TS->shaped_text_set_bidi_override(text.write[p_line].data_buf->get_rid(), p_bidi_override);
}
} else {
text.write[p_line].data_buf->add_string(text[p_line].data, font, font_size, opentype_features, language);
- if (!text[p_line].bidi_override.empty()) {
+ if (!text[p_line].bidi_override.is_empty()) {
TS->shaped_text_set_bidi_override(text.write[p_line].data_buf->get_rid(), text[p_line].bidi_override);
}
}
@@ -1167,7 +1167,7 @@ void TextEdit::_notification(int p_what) {
}
int start = TS->shaped_text_get_range(rid).x;
- if (!search_text.empty()) { // Search highhlight
+ if (!search_text.is_empty()) { // Search highhlight
int search_text_col = _get_column_pos_of_word(search_text, str, search_flags, 0);
while (search_text_col != -1) {
Vector<Vector2> sel = TS->shaped_text_get_selection(rid, search_text_col + start, search_text_col + search_text.length() + start);
@@ -1190,7 +1190,7 @@ void TextEdit::_notification(int p_what) {
}
}
- if (highlight_all_occurrences && !only_whitespaces_highlighted && !highlighted_text.empty()) { // Highlight
+ if (highlight_all_occurrences && !only_whitespaces_highlighted && !highlighted_text.is_empty()) { // Highlight
int highlighted_text_col = _get_column_pos_of_word(highlighted_text, str, SEARCH_MATCH_CASE | SEARCH_WHOLE_WORDS, 0);
while (highlighted_text_col != -1) {
Vector<Vector2> sel = TS->shaped_text_get_selection(rid, highlighted_text_col + start, highlighted_text_col + highlighted_text.length() + start);
@@ -5197,7 +5197,7 @@ void TextEdit::paste() {
cursor_set_line(selection.from_line);
cursor_set_column(selection.from_column);
- } else if (!cut_copy_line.empty() && cut_copy_line == clipboard) {
+ } else if (!cut_copy_line.is_empty() && cut_copy_line == clipboard) {
cursor_set_column(0);
String ins = "\n";
clipboard += ins;
@@ -6469,7 +6469,7 @@ void TextEdit::query_code_comple() {
c--;
}
- bool ignored = completion_active && !completion_options.empty();
+ bool ignored = completion_active && !completion_options.is_empty();
if (ignored) {
ScriptCodeCompletionOption::Kind kind = ScriptCodeCompletionOption::KIND_PLAIN_TEXT;
const ScriptCodeCompletionOption *previous_option = nullptr;
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index ad4545cf6c..cb9729a5e8 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -163,7 +163,7 @@ void TreeItem::set_text(int p_column, String p_text) {
cells.write[p_column].max = INT_MIN;
for (int i = 0; i < strings.size(); i++) {
int value = i;
- if (!strings[i].get_slicec(':', 1).empty()) {
+ if (!strings[i].get_slicec(':', 1).is_empty()) {
value = strings[i].get_slicec(':', 1).to_int();
}
cells.write[p_column].min = MIN(cells[p_column].min, value);
@@ -1212,7 +1212,7 @@ void Tree::update_item_cell(TreeItem *p_item, int p_col) {
Vector<String> strings = p_item->cells[p_col].text.split(",");
for (int j = 0; j < strings.size(); j++) {
int value = j;
- if (!strings[j].get_slicec(':', 1).empty()) {
+ if (!strings[j].get_slicec(':', 1).is_empty()) {
value = strings[j].get_slicec(':', 1).to_int();
}
if (option == value) {
@@ -2031,7 +2031,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool
popup_menu->clear();
for (int i = 0; i < c.text.get_slice_count(","); i++) {
String s = c.text.get_slicec(',', i);
- popup_menu->add_item(s.get_slicec(':', 0), s.get_slicec(':', 1).empty() ? i : s.get_slicec(':', 1).to_int());
+ popup_menu->add_item(s.get_slicec(':', 0), s.get_slicec(':', 1).is_empty() ? i : s.get_slicec(':', 1).to_int());
}
popup_menu->set_size(Size2(col_width, 0));
@@ -2930,7 +2930,7 @@ bool Tree::edit_selected() {
popup_menu->clear();
for (int i = 0; i < c.text.get_slice_count(","); i++) {
String s2 = c.text.get_slicec(',', i);
- popup_menu->add_item(s2.get_slicec(':', 0), s2.get_slicec(':', 1).empty() ? i : s2.get_slicec(':', 1).to_int());
+ popup_menu->add_item(s2.get_slicec(':', 0), s2.get_slicec(':', 1).is_empty() ? i : s2.get_slicec(':', 1).to_int());
}
popup_menu->set_size(Size2(rect.size.width, 0));