From 07bc4e2f96f8f47991339654ff4ab16acc19d44f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 14 May 2020 14:29:06 +0200 Subject: Style: Enforce separation line between function definitions I couldn't find a tool that enforces it, so I went the manual route: ``` find -name "thirdparty" -prune \ -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \ -o -name "*.glsl" > files perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files) misc/scripts/fix_style.sh -c ``` This adds a newline after all `}` on the first column, unless they are followed by `#` (typically `#endif`). This leads to having lots of places with two lines between function/class definitions, but clang-format then fixes it as we enforce max one line of separation. This doesn't fix potential occurrences of function definitions which are indented (e.g. for a helper class defined in a .cpp), but it's better than nothing. Also can't be made to run easily on CI/hooks so we'll have to be careful with new code. Part of #33027. --- scene/gui/button.cpp | 1 + scene/gui/color_picker.cpp | 1 + scene/gui/control.cpp | 17 +++++++++++++++++ scene/gui/dialogs.cpp | 3 +++ scene/gui/file_dialog.cpp | 6 ++++++ scene/gui/graph_edit.cpp | 2 ++ scene/gui/graph_node.cpp | 5 +++++ scene/gui/item_list.cpp | 9 +++++++++ scene/gui/label.cpp | 2 ++ scene/gui/line_edit.cpp | 2 ++ scene/gui/nine_patch_rect.cpp | 1 + scene/gui/option_button.cpp | 5 +++++ scene/gui/panel.cpp | 1 + scene/gui/popup.cpp | 2 ++ scene/gui/popup_menu.cpp | 3 +++ scene/gui/range.cpp | 9 +++++++++ scene/gui/rich_text_label.cpp | 1 + scene/gui/scroll_container.cpp | 2 ++ scene/gui/tab_container.cpp | 2 ++ scene/gui/tabs.cpp | 3 +++ scene/gui/text_edit.cpp | 7 +++++++ scene/gui/texture_button.cpp | 7 +++++++ scene/gui/tree.cpp | 11 +++++++++++ 23 files changed, 102 insertions(+) (limited to 'scene/gui') diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp index cf1ff059bf..e761b2bf40 100644 --- a/scene/gui/button.cpp +++ b/scene/gui/button.cpp @@ -230,6 +230,7 @@ void Button::set_text(const String &p_text) { _change_notify("text"); minimum_size_changed(); } + String Button::get_text() const { return text; } diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index 1730df6bb3..f150028c47 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -909,6 +909,7 @@ void ColorPickerButton::set_pick_color(const Color &p_color) { update(); } + Color ColorPickerButton::get_pick_color() const { return color; } diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 3dbdd4dfab..02be8f23fb 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -326,6 +326,7 @@ bool Control::_get(const StringName &p_name, Variant &r_ret) const { return true; } + void Control::_get_property_list(List *p_list) const { Ref theme = Theme::get_default(); /* Using the default theme since the properties below are meant for editor only @@ -593,6 +594,7 @@ bool Control::clips_input() const { } return false; } + bool Control::has_point(const Point2 &p_point) const { if (get_script_instance()) { Variant v = p_point; @@ -658,6 +660,7 @@ bool Control::can_drop_data(const Point2 &p_point, const Variant &p_data) const return Variant(); } + void Control::drop_data(const Point2 &p_point, const Variant &p_data) { if (data.drag_owner.is_valid()) { Object *obj = ObjectDB::get_instance(data.drag_owner); @@ -1017,6 +1020,7 @@ bool Control::has_theme_shader(const StringName &p_name, const StringName &p_typ return has_shaders(data.theme_owner, data.theme_owner_window, p_name, type); } + bool Control::has_shaders(Control *p_theme_owner, Window *p_theme_owner_window, const StringName &p_name, const StringName &p_type) { if (_has_theme_item(p_theme_owner, p_theme_owner_window, &Theme::has_shader, p_name, p_type)) { return true; @@ -1064,6 +1068,7 @@ bool Control::has_theme_font(const StringName &p_name, const StringName &p_type) return has_fonts(data.theme_owner, data.theme_owner_window, p_name, type); } + bool Control::has_fonts(Control *p_theme_owner, Window *p_theme_owner_window, const StringName &p_name, const StringName &p_type) { if (_has_theme_item(p_theme_owner, p_theme_owner_window, &Theme::has_font, p_name, p_type)) { return true; @@ -1087,6 +1092,7 @@ bool Control::has_theme_color(const StringName &p_name, const StringName &p_type return has_colors(data.theme_owner, data.theme_owner_window, p_name, type); } + bool Control::has_colors(Control *p_theme_owner, Window *p_theme_owner_window, const StringName &p_name, const StringName &p_type) { if (_has_theme_item(p_theme_owner, p_theme_owner_window, &Theme::has_color, p_name, p_type)) { return true; @@ -1540,6 +1546,7 @@ float Control::get_margin(Margin p_margin) const { Size2 Control::get_begin() const { return Size2(data.margin[0], data.margin[1]); } + Size2 Control::get_end() const { return Size2(data.margin[2], data.margin[3]); } @@ -1706,6 +1713,7 @@ void Control::add_theme_shader_override(const StringName &p_name, const Ref &p_style) { if (data.style_override.has(p_name)) { data.style_override[p_name]->disconnect("changed", callable_mp(this, &Control::_override_changed)); @@ -1739,10 +1747,12 @@ void Control::add_theme_font_override(const StringName &p_name, const Ref } notification(NOTIFICATION_THEME_CHANGED); } + void Control::add_theme_color_override(const StringName &p_name, const Color &p_color) { data.color_override[p_name] = p_color; notification(NOTIFICATION_THEME_CHANGED); } + void Control::add_theme_constant_override(const StringName &p_name, int p_constant) { data.constant_override[p_name] = p_constant; notification(NOTIFICATION_THEME_CHANGED); @@ -1926,6 +1936,7 @@ Control *Control::find_prev_valid_focus() const { Control::FocusMode Control::get_focus_mode() const { return data.focus_mode; } + bool Control::has_focus() const { return is_inside_tree() && get_viewport()->_gui_control_has_focus(this); } @@ -2051,6 +2062,7 @@ void Control::set_tooltip(const String &p_tooltip) { String Control::get_tooltip(const Point2 &p_pos) const { return data.tooltip; } + Control *Control::make_custom_tooltip(const String &p_text) const { if (get_script_instance()) { return const_cast(this)->call("_make_custom_tooltip", p_text); @@ -2067,6 +2079,7 @@ void Control::set_default_cursor_shape(CursorShape p_shape) { Control::CursorShape Control::get_default_cursor_shape() const { return data.default_cursor; } + Control::CursorShape Control::get_cursor_shape(const Point2 &p_pos) const { return data.default_cursor; } @@ -2247,6 +2260,7 @@ void Control::set_h_size_flags(int p_flags) { int Control::get_h_size_flags() const { return data.h_size_flags; } + void Control::set_v_size_flags(int p_flags) { if (data.v_size_flags == p_flags) return; @@ -2387,6 +2401,7 @@ void Control::set_scale(const Vector2 &p_scale) { update(); _notify_transform(); } + Vector2 Control::get_scale() const { return data.scale; } @@ -2495,6 +2510,7 @@ void Control::set_v_grow_direction(GrowDirection p_direction) { data.v_grow = p_direction; _size_changed(); } + Control::GrowDirection Control::get_v_grow_direction() const { return data.v_grow; } @@ -2772,6 +2788,7 @@ void Control::_bind_methods() { BIND_VMETHOD(MethodInfo(Variant::BOOL, "has_point", PropertyInfo(Variant::VECTOR2, "point"))); } + Control::Control() { data.parent = nullptr; diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index 3e1a72beb7..37d6784e35 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -127,6 +127,7 @@ void AcceptDialog::_cancel_pressed() { String AcceptDialog::get_text() const { return label->get_text(); } + void AcceptDialog::set_text(String p_text) { label->set_text(p_text); child_controls_changed(); @@ -138,6 +139,7 @@ void AcceptDialog::set_text(String p_text) { void AcceptDialog::set_hide_on_ok(bool p_hide) { hide_on_ok = p_hide; } + bool AcceptDialog::get_hide_on_ok() const { return hide_on_ok; } @@ -145,6 +147,7 @@ bool AcceptDialog::get_hide_on_ok() const { void AcceptDialog::set_autowrap(bool p_autowrap) { label->set_autowrap(p_autowrap); } + bool AcceptDialog::has_autowrap() { return label->has_autowrap(); } diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index adf67bc7df..158662e0fc 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -541,6 +541,7 @@ void FileDialog::clear_filters() { update_filters(); invalidate(); } + void FileDialog::add_filter(const String &p_filter) { filters.push_back(p_filter); update_filters(); @@ -560,17 +561,21 @@ Vector FileDialog::get_filters() const { String FileDialog::get_current_dir() const { return dir->get_text(); } + String FileDialog::get_current_file() const { return file->get_text(); } + String FileDialog::get_current_path() const { return dir->get_text().plus_file(file->get_text()); } + void FileDialog::set_current_dir(const String &p_dir) { dir_access->change_dir(p_dir); update_dir(); invalidate(); } + void FileDialog::set_current_file(const String &p_file) { file->set_text(p_file); update_dir(); @@ -582,6 +587,7 @@ void FileDialog::set_current_file(const String &p_file) { file->grab_focus(); } } + void FileDialog::set_current_path(const String &p_path) { if (!p_path.size()) return; diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index 2129ae6126..02363e909c 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -1105,6 +1105,7 @@ Array GraphEdit::_get_connection_list() const { void GraphEdit::_zoom_minus() { set_zoom(zoom / ZOOM_SCALE); } + void GraphEdit::_zoom_reset() { set_zoom(1); } @@ -1155,6 +1156,7 @@ void GraphEdit::set_snap(int p_snap) { snap_amount->set_value(p_snap); update(); } + void GraphEdit::_snap_toggled() { update(); } diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp index efac874462..c2203364d0 100644 --- a/scene/gui/graph_node.cpp +++ b/scene/gui/graph_node.cpp @@ -92,6 +92,7 @@ bool GraphNode::_get(const StringName &p_name, Variant &r_ret) const { return true; } + void GraphNode::_get_property_list(List *p_list) const { int idx = 0; for (int i = 0; i < get_child_count(); i++) { @@ -305,11 +306,13 @@ void GraphNode::clear_slot(int p_idx) { update(); connpos_dirty = true; } + void GraphNode::clear_all_slots() { slot_info.clear(); update(); connpos_dirty = true; } + bool GraphNode::is_slot_enabled_left(int p_idx) const { if (!slot_info.has(p_idx)) return false; @@ -428,6 +431,7 @@ void GraphNode::set_show_close_button(bool p_enable) { show_close = p_enable; update(); } + bool GraphNode::is_close_button_visible() const { return show_close; } @@ -487,6 +491,7 @@ int GraphNode::get_connection_input_count() { return conn_input_cache.size(); } + int GraphNode::get_connection_output_count() { if (connpos_dirty) _connpos_update(); diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 86daa47c36..06a4534e22 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -190,6 +190,7 @@ void ItemList::set_item_tag_icon(int p_idx, const Ref &p_tag_icon) { update(); shape_changed = true; } + Ref ItemList::get_item_tag_icon(int p_idx) const { ERR_FAIL_INDEX_V(p_idx, items.size(), Ref()); @@ -231,6 +232,7 @@ Variant ItemList::get_item_metadata(int p_idx) const { ERR_FAIL_INDEX_V(p_idx, items.size(), Variant()); return items[p_idx].metadata; } + void ItemList::select(int p_idx, bool p_single) { ERR_FAIL_INDEX(p_idx, items.size()); @@ -252,6 +254,7 @@ void ItemList::select(int p_idx, bool p_single) { } update(); } + void ItemList::unselect(int p_idx) { ERR_FAIL_INDEX(p_idx, items.size()); @@ -315,6 +318,7 @@ void ItemList::move_item(int p_from_idx, int p_to_idx) { int ItemList::get_item_count() const { return items.size(); } + void ItemList::remove_item(int p_idx) { ERR_FAIL_INDEX(p_idx, items.size()); @@ -339,6 +343,7 @@ void ItemList::set_fixed_column_width(int p_size) { update(); shape_changed = true; } + int ItemList::get_fixed_column_width() const { return fixed_column_width; } @@ -348,6 +353,7 @@ void ItemList::set_same_column_width(bool p_enable) { update(); shape_changed = true; } + bool ItemList::is_same_column_width() const { return same_column_width; } @@ -358,6 +364,7 @@ void ItemList::set_max_text_lines(int p_lines) { update(); shape_changed = true; } + int ItemList::get_max_text_lines() const { return max_text_lines; } @@ -368,6 +375,7 @@ void ItemList::set_max_columns(int p_amount) { update(); shape_changed = true; } + int ItemList::get_max_columns() const { return max_columns; } @@ -400,6 +408,7 @@ void ItemList::set_fixed_icon_size(const Size2 &p_size) { Size2 ItemList::get_fixed_icon_size() const { return fixed_icon_size; } + Size2 ItemList::Item::get_icon_size() const { if (icon.is_null()) return Size2(); diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index 5f84dbe34b..f5487a49be 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -47,6 +47,7 @@ void Label::set_autowrap(bool p_autowrap) { minimum_size_changed(); } } + bool Label::has_autowrap() const { return autowrap; } @@ -56,6 +57,7 @@ void Label::set_uppercase(bool p_uppercase) { word_cache_dirty = true; update(); } + bool Label::is_uppercase() const { return uppercase; } diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index c1cfef0381..fa08f6f512 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -590,9 +590,11 @@ Variant LineEdit::get_drag_data(const Point2 &p_point) { return Variant(); } + bool LineEdit::can_drop_data(const Point2 &p_point, const Variant &p_data) const { return p_data.get_type() == Variant::STRING; } + void LineEdit::drop_data(const Point2 &p_point, const Variant &p_data) { if (p_data.get_type() == Variant::STRING) { set_cursor_at_pixel_pos(p_point.x); diff --git a/scene/gui/nine_patch_rect.cpp b/scene/gui/nine_patch_rect.cpp index a65edefa5f..4d94bbf5d9 100644 --- a/scene/gui/nine_patch_rect.cpp +++ b/scene/gui/nine_patch_rect.cpp @@ -50,6 +50,7 @@ void NinePatchRect::_notification(int p_what) { Size2 NinePatchRect::get_minimum_size() const { return Size2(margin[MARGIN_LEFT] + margin[MARGIN_RIGHT], margin[MARGIN_TOP] + margin[MARGIN_BOTTOM]); } + void NinePatchRect::_bind_methods() { ClassDB::bind_method(D_METHOD("set_texture", "texture"), &NinePatchRect::set_texture); ClassDB::bind_method(D_METHOD("get_texture"), &NinePatchRect::get_texture); diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp index b3c024bd1d..bc4eec5ba3 100644 --- a/scene/gui/option_button.cpp +++ b/scene/gui/option_button.cpp @@ -112,6 +112,7 @@ void OptionButton::add_icon_item(const Ref &p_icon, const String &p_l if (popup->get_item_count() == 1) select(0); } + void OptionButton::add_item(const String &p_label, int p_id) { popup->add_radio_check_item(p_label, p_id); if (popup->get_item_count() == 1) @@ -124,12 +125,14 @@ void OptionButton::set_item_text(int p_idx, const String &p_text) { if (current == p_idx) set_text(p_text); } + void OptionButton::set_item_icon(int p_idx, const Ref &p_icon) { popup->set_item_icon(p_idx, p_icon); if (current == p_idx) set_icon(p_icon); } + void OptionButton::set_item_id(int p_idx, int p_id) { popup->set_item_id(p_idx, p_id); } @@ -220,6 +223,7 @@ int OptionButton::get_selected_id() const { return 0; return get_item_id(current); } + Variant OptionButton::get_selected_metadata() const { int idx = get_selected(); if (idx < 0) @@ -247,6 +251,7 @@ Array OptionButton::_get_items() const { return items; } + void OptionButton::_set_items(const Array &p_items) { ERR_FAIL_COND(p_items.size() % 5); clear(); diff --git a/scene/gui/panel.cpp b/scene/gui/panel.cpp index a13d8a0cdd..d8d9beca2b 100644 --- a/scene/gui/panel.cpp +++ b/scene/gui/panel.cpp @@ -44,6 +44,7 @@ void Panel::set_mode(Mode p_mode) { mode = p_mode; update(); } + Panel::Mode Panel::get_mode() const { return mode; } diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp index 7068e2e1e2..e1fcb8c2fc 100644 --- a/scene/gui/popup.cpp +++ b/scene/gui/popup.cpp @@ -44,6 +44,7 @@ void Popup::_input_from_window(const Ref &p_event) { void Popup::_parent_focused() { _close_pressed(); } + void Popup::_notification(int p_what) { switch (p_what) { case NOTIFICATION_VISIBILITY_CHANGED: { @@ -94,6 +95,7 @@ void Popup::_close_pressed() { void Popup::set_as_minsize() { set_size(get_contents_minimum_size()); } + void Popup::_bind_methods() { ADD_SIGNAL(MethodInfo("popup_hide")); } diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 52fe991f83..c5c6305315 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -757,6 +757,7 @@ void PopupMenu::set_item_text(int p_idx, const String &p_text) { control->update(); child_controls_changed(); } + void PopupMenu::set_item_icon(int p_idx, const Ref &p_icon) { ERR_FAIL_INDEX(p_idx, items.size()); items.write[p_idx].icon = p_icon; @@ -764,6 +765,7 @@ void PopupMenu::set_item_icon(int p_idx, const Ref &p_icon) { control->update(); child_controls_changed(); } + void PopupMenu::set_item_checked(int p_idx, bool p_checked) { ERR_FAIL_INDEX(p_idx, items.size()); @@ -772,6 +774,7 @@ void PopupMenu::set_item_checked(int p_idx, bool p_checked) { control->update(); child_controls_changed(); } + void PopupMenu::set_item_id(int p_idx, int p_id) { ERR_FAIL_INDEX(p_idx, items.size()); items.write[p_idx].id = p_id; diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp index 2260a5a97c..9e30063c5b 100644 --- a/scene/gui/range.cpp +++ b/scene/gui/range.cpp @@ -94,6 +94,7 @@ void Range::set_value(double p_val) { shared->emit_value_changed(); } + void Range::set_min(double p_min) { shared->min = p_min; set_value(shared->val); @@ -102,16 +103,19 @@ void Range::set_min(double p_min) { update_configuration_warning(); } + void Range::set_max(double p_max) { shared->max = p_max; set_value(shared->val); shared->emit_changed("max"); } + void Range::set_step(double p_step) { shared->step = p_step; shared->emit_changed("step"); } + void Range::set_page(double p_page) { shared->page = p_page; set_value(shared->val); @@ -122,15 +126,19 @@ void Range::set_page(double p_page) { double Range::get_value() const { return shared->val; } + double Range::get_min() const { return shared->min; } + double Range::get_max() const { return shared->max; } + double Range::get_step() const { return shared->step; } + double Range::get_page() const { return shared->page; } @@ -154,6 +162,7 @@ void Range::set_as_ratio(double p_value) { v = CLAMP(v, get_min(), get_max()); set_value(v); } + double Range::get_as_ratio() const { ERR_FAIL_COND_V_MSG(Math::is_equal_approx(get_max(), get_min()), 0.0, "Cannot get ratio when minimum and maximum value are equal."); diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index baf8c53fef..d73c61f0f2 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -2684,6 +2684,7 @@ void RichTextLabel::set_visible_characters(int p_visible) { int RichTextLabel::get_visible_characters() const { return visible_characters; } + int RichTextLabel::get_total_character_count() const { int tc = 0; for (int i = 0; i < current_frame->lines.size(); i++) diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp index 2f54ece449..0b00883a71 100644 --- a/scene/gui/scroll_container.cpp +++ b/scene/gui/scroll_container.cpp @@ -470,6 +470,7 @@ bool ScrollContainer::is_v_scroll_enabled() const { int ScrollContainer::get_v_scroll() const { return v_scroll->get_value(); } + void ScrollContainer::set_v_scroll(int p_pos) { v_scroll->set_value(p_pos); _cancel_drag(); @@ -478,6 +479,7 @@ void ScrollContainer::set_v_scroll(int p_pos) { int ScrollContainer::get_h_scroll() const { return h_scroll->get_value(); } + void ScrollContainer::set_h_scroll(int p_pos) { h_scroll->set_value(p_pos); _cancel_drag(); diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp index 501e50e7f7..4d861f380d 100644 --- a/scene/gui/tab_container.cpp +++ b/scene/gui/tab_container.cpp @@ -796,6 +796,7 @@ void TabContainer::set_tab_icon(int p_tab, const Ref &p_icon) { child->set_meta("_tab_icon", p_icon); update(); } + Ref TabContainer::get_tab_icon(int p_tab) const { Control *child = _get_tab(p_tab); ERR_FAIL_COND_V(!child, Ref()); @@ -912,6 +913,7 @@ void TabContainer::set_drag_to_rearrange_enabled(bool p_enabled) { bool TabContainer::get_drag_to_rearrange_enabled() const { return drag_to_rearrange_enabled; } + void TabContainer::set_tabs_rearrange_group(int p_group_id) { tabs_rearrange_group = p_group_id; } diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp index 2dce34daf0..4c3fa2f038 100644 --- a/scene/gui/tabs.cpp +++ b/scene/gui/tabs.cpp @@ -435,6 +435,7 @@ void Tabs::set_tab_disabled(int p_tab, bool p_disabled) { tabs.write[p_tab].disabled = p_disabled; update(); } + bool Tabs::get_tab_disabled(int p_tab) const { ERR_FAIL_INDEX_V(p_tab, tabs.size(), false); return tabs[p_tab].disabled; @@ -447,6 +448,7 @@ void Tabs::set_tab_right_button(int p_tab, const Ref &p_right_button) update(); minimum_size_changed(); } + Ref Tabs::get_tab_right_button(int p_tab) const { ERR_FAIL_INDEX_V(p_tab, tabs.size(), Ref()); return tabs[p_tab].right_button; @@ -866,6 +868,7 @@ void Tabs::set_drag_to_rearrange_enabled(bool p_enabled) { bool Tabs::get_drag_to_rearrange_enabled() const { return drag_to_rearrange_enabled; } + void Tabs::set_tabs_rearrange_group(int p_group_id) { tabs_rearrange_group = p_group_id; } diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index ee1391806e..c5067c9efd 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -296,6 +296,7 @@ void TextEdit::Text::insert(int p_at, const String &p_text) { line.data = p_text; text.insert(p_at, line); } + void TextEdit::Text::remove(int p_at) { text.remove(p_at); } @@ -5166,27 +5167,33 @@ void TextEdit::select(int p_from_line, int p_from_column, int p_to_line, int p_t update(); } + void TextEdit::swap_lines(int line1, int line2) { String tmp = get_line(line1); String tmp2 = get_line(line2); set_line(line2, tmp); set_line(line1, tmp2); } + bool TextEdit::is_selection_active() const { return selection.active; } + int TextEdit::get_selection_from_line() const { ERR_FAIL_COND_V(!selection.active, -1); return selection.from_line; } + int TextEdit::get_selection_from_column() const { ERR_FAIL_COND_V(!selection.active, -1); return selection.from_column; } + int TextEdit::get_selection_to_line() const { ERR_FAIL_COND_V(!selection.active, -1); return selection.to_line; } + int TextEdit::get_selection_to_column() const { ERR_FAIL_COND_V(!selection.active, -1); return selection.to_column; diff --git a/scene/gui/texture_button.cpp b/scene/gui/texture_button.cpp index 325b9d00ed..0cc0e50a00 100644 --- a/scene/gui/texture_button.cpp +++ b/scene/gui/texture_button.cpp @@ -270,14 +270,17 @@ void TextureButton::set_pressed_texture(const Ref &p_pressed) { pressed = p_pressed; update(); } + void TextureButton::set_hover_texture(const Ref &p_hover) { hover = p_hover; update(); } + void TextureButton::set_disabled_texture(const Ref &p_disabled) { disabled = p_disabled; update(); } + void TextureButton::set_click_mask(const Ref &p_click_mask) { click_mask = p_click_mask; update(); @@ -286,15 +289,19 @@ void TextureButton::set_click_mask(const Ref &p_click_mask) { Ref TextureButton::get_normal_texture() const { return normal; } + Ref TextureButton::get_pressed_texture() const { return pressed; } + Ref TextureButton::get_hover_texture() const { return hover; } + Ref TextureButton::get_disabled_texture() const { return disabled; } + Ref TextureButton::get_click_mask() const { return click_mask; } diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index c0bdc3923b..df4420ca8c 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -249,6 +249,7 @@ bool TreeItem::is_range_exponential(int p_column) const { ERR_FAIL_INDEX_V(p_column, cells.size(), false); return cells[p_column].expr; } + void TreeItem::set_range_config(int p_column, double p_min, double p_max, double p_step, bool p_exp) { ERR_FAIL_INDEX(p_column, cells.size()); cells.write[p_column].min = p_min; @@ -481,21 +482,25 @@ int TreeItem::get_button_count(int p_column) const { ERR_FAIL_INDEX_V(p_column, cells.size(), -1); return cells[p_column].buttons.size(); } + Ref TreeItem::get_button(int p_column, int p_idx) const { ERR_FAIL_INDEX_V(p_column, cells.size(), Ref()); ERR_FAIL_INDEX_V(p_idx, cells[p_column].buttons.size(), Ref()); return cells[p_column].buttons[p_idx].texture; } + String TreeItem::get_button_tooltip(int p_column, int p_idx) const { ERR_FAIL_INDEX_V(p_column, cells.size(), String()); ERR_FAIL_INDEX_V(p_idx, cells[p_column].buttons.size(), String()); return cells[p_column].buttons[p_idx].tooltip; } + int TreeItem::get_button_id(int p_column, int p_idx) const { ERR_FAIL_INDEX_V(p_column, cells.size(), -1); ERR_FAIL_INDEX_V(p_idx, cells[p_column].buttons.size(), -1); return cells[p_column].buttons[p_idx].id; } + void TreeItem::erase_button(int p_column, int p_idx) { ERR_FAIL_INDEX(p_column, cells.size()); ERR_FAIL_INDEX(p_idx, cells[p_column].buttons.size()); @@ -560,12 +565,14 @@ void TreeItem::set_custom_color(int p_column, const Color &p_color) { cells.write[p_column].color = p_color; _changed_notify(p_column); } + Color TreeItem::get_custom_color(int p_column) const { ERR_FAIL_INDEX_V(p_column, cells.size(), Color()); if (!cells[p_column].custom_color) return Color(); return cells[p_column].color; } + void TreeItem::clear_custom_color(int p_column) { ERR_FAIL_INDEX(p_column, cells.size()); cells.write[p_column].custom_color = false; @@ -1435,6 +1442,7 @@ int Tree::_count_selected_items(TreeItem *p_from) const { return count; } + void Tree::select_single_item(TreeItem *p_selected, TreeItem *p_current, int p_col, TreeItem *p_prev, bool *r_in_range, bool p_force_deselect) { TreeItem::Cell &selected_cell = p_selected->cells.write[p_col]; @@ -2891,6 +2899,7 @@ TreeItem *Tree::create_item(TreeItem *p_parent, int p_idx) { TreeItem *Tree::get_root() { return root; } + TreeItem *Tree::get_last_item() { TreeItem *last = root; @@ -3009,6 +3018,7 @@ void Tree::set_column_min_width(int p_column, int p_min_width) { columns.write[p_column].min_width = p_min_width; update(); } + void Tree::set_column_expand(int p_column, bool p_expand) { ERR_FAIL_INDEX(p_column, columns.size()); @@ -3457,6 +3467,7 @@ int Tree::get_drop_section_at_position(const Point2 &p_pos) const { return -100; } + TreeItem *Tree::get_item_at_position(const Point2 &p_pos) const { if (root) { Point2 pos = p_pos; -- cgit v1.2.3