From 31b7f02a29cdf4f1c30cfc37962f43f67380b9ad Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Fri, 19 Jun 2020 20:49:04 +0200 Subject: [PATCH] Remove ToolButton in favor of Button ToolButton has no redeeming differences with Button; it's just a Button with the Flat property enabled by default. Removing it avoids some confusion when creating GUIs. Existing ToolButtons will be converted to Buttons, but the Flat property won't be enabled automatically. This closes https://github.com/godotengine/godot-proposals/issues/1081. --- doc/classes/EditorPlugin.xml | 2 +- doc/classes/ToolButton.xml | 57 ------------------ editor/animation_track_editor.cpp | 15 +++-- editor/animation_track_editor.h | 9 ++- editor/code_editor.cpp | 12 ++-- editor/code_editor.h | 9 ++- editor/create_dialog.cpp | 3 +- editor/debugger/script_editor_debugger.cpp | 24 +++++--- editor/editor_audio_buses.cpp | 9 ++- editor/editor_audio_buses.h | 1 - editor/editor_file_dialog.cpp | 30 ++++++---- editor/editor_file_dialog.h | 21 ++++--- editor/editor_help.cpp | 6 +- editor/editor_help.h | 4 +- editor/editor_help_search.cpp | 6 +- editor/editor_help_search.h | 4 +- editor/editor_log.cpp | 2 +- editor/editor_log.h | 15 +++-- editor/editor_node.cpp | 46 +++++++++------ editor/editor_node.h | 38 ++++++------ editor/editor_plugin.cpp | 2 +- editor/editor_plugin.h | 3 +- editor/editor_properties.cpp | 3 +- editor/editor_themes.cpp | 16 ++--- editor/filesystem_dock.cpp | 9 ++- editor/filesystem_dock.h | 1 - editor/groups_editor.cpp | 6 +- editor/groups_editor.h | 5 +- editor/inspector_dock.cpp | 12 ++-- editor/inspector_dock.h | 9 ++- editor/node_dock.cpp | 6 +- editor/node_dock.h | 4 +- editor/plugins/abstract_polygon_2d_editor.cpp | 9 ++- editor/plugins/abstract_polygon_2d_editor.h | 7 +-- .../animation_blend_space_1d_editor.cpp | 15 +++-- .../plugins/animation_blend_space_1d_editor.h | 12 ++-- .../animation_blend_space_2d_editor.cpp | 21 ++++--- .../plugins/animation_blend_space_2d_editor.h | 14 ++--- .../animation_player_editor_plugin.cpp | 24 +++++--- .../plugins/animation_player_editor_plugin.h | 4 +- .../animation_state_machine_editor.cpp | 18 ++++-- .../plugins/animation_state_machine_editor.h | 12 ++-- editor/plugins/audio_stream_editor_plugin.cpp | 6 +- editor/plugins/audio_stream_editor_plugin.h | 4 +- .../plugins/baked_lightmap_editor_plugin.cpp | 3 +- editor/plugins/baked_lightmap_editor_plugin.h | 2 +- editor/plugins/canvas_item_editor_plugin.cpp | 59 ++++++++++++------- editor/plugins/canvas_item_editor_plugin.h | 38 ++++++------ .../collision_polygon_3d_editor_plugin.cpp | 6 +- .../collision_polygon_3d_editor_plugin.h | 5 +- editor/plugins/gi_probe_editor_plugin.cpp | 3 +- editor/plugins/gi_probe_editor_plugin.h | 2 +- editor/plugins/item_list_editor_plugin.cpp | 3 +- editor/plugins/item_list_editor_plugin.h | 2 +- editor/plugins/node_3d_editor_plugin.cpp | 24 ++++---- editor/plugins/path_2d_editor_plugin.cpp | 15 +++-- editor/plugins/path_2d_editor_plugin.h | 11 ++-- editor/plugins/path_3d_editor_plugin.cpp | 12 ++-- editor/plugins/path_3d_editor_plugin.h | 8 +-- .../physical_bone_3d_editor_plugin.cpp | 3 +- .../plugins/physical_bone_3d_editor_plugin.h | 2 +- editor/plugins/polygon_2d_editor_plugin.cpp | 19 +++--- editor/plugins/polygon_2d_editor_plugin.h | 10 ++-- editor/plugins/script_editor_plugin.cpp | 15 +++-- editor/plugins/script_editor_plugin.h | 9 ++- .../plugins/sprite_frames_editor_plugin.cpp | 33 +++++++---- editor/plugins/sprite_frames_editor_plugin.h | 22 +++---- .../plugins/texture_region_editor_plugin.cpp | 9 ++- editor/plugins/texture_region_editor_plugin.h | 6 +- editor/plugins/theme_editor_plugin.cpp | 5 +- editor/plugins/tile_map_editor_plugin.cpp | 29 +++++---- editor/plugins/tile_map_editor_plugin.h | 19 +++--- editor/plugins/tile_set_editor_plugin.cpp | 36 +++++------ editor/plugins/tile_set_editor_plugin.h | 6 +- .../plugins/version_control_editor_plugin.cpp | 2 +- .../plugins/version_control_editor_plugin.h | 4 +- .../plugins/visual_shader_editor_plugin.cpp | 6 +- editor/plugins/visual_shader_editor_plugin.h | 4 +- editor/project_export.cpp | 6 +- editor/project_manager.cpp | 1 - editor/project_manager.h | 1 - editor/project_settings_editor.cpp | 3 +- editor/project_settings_editor.h | 2 +- editor/scene_tree_dock.cpp | 21 ++++--- editor/scene_tree_dock.h | 11 ++-- editor/settings_config_dialog.cpp | 3 +- editor/settings_config_dialog.h | 3 +- .../navigation_mesh_editor_plugin.cpp | 6 +- .../navigation_mesh_editor_plugin.h | 4 +- modules/gridmap/grid_map_editor_plugin.cpp | 6 +- modules/gridmap/grid_map_editor_plugin.h | 4 +- .../GodotTools/GodotTools/BottomPanel.cs | 8 +-- .../GodotTools/GodotTools/GodotSharpEditor.cs | 4 +- scene/gui/color_picker.cpp | 3 +- scene/gui/color_picker.h | 3 +- scene/gui/file_dialog.cpp | 15 +++-- scene/gui/file_dialog.h | 7 +-- scene/gui/graph_edit.cpp | 13 ++-- scene/gui/graph_edit.h | 10 ++-- scene/gui/tool_button.cpp | 35 ----------- scene/gui/tool_button.h | 43 -------------- scene/register_scene_types.cpp | 3 +- .../resources/default_theme/default_theme.cpp | 24 ++++---- 103 files changed, 616 insertions(+), 590 deletions(-) delete mode 100644 doc/classes/ToolButton.xml delete mode 100644 scene/gui/tool_button.cpp delete mode 100644 scene/gui/tool_button.h diff --git a/doc/classes/EditorPlugin.xml b/doc/classes/EditorPlugin.xml index 19583fca282..2fa791a9df0 100644 --- a/doc/classes/EditorPlugin.xml +++ b/doc/classes/EditorPlugin.xml @@ -22,7 +22,7 @@ - + diff --git a/doc/classes/ToolButton.xml b/doc/classes/ToolButton.xml deleted file mode 100644 index f78627b1634..00000000000 --- a/doc/classes/ToolButton.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - Flat button helper class. - - - This is a helper class to generate a flat [Button] (see [member Button.flat]), creating a [ToolButton] is equivalent to: - [codeblock] - var btn = Button.new() - btn.flat = true - [/codeblock] - - - - - - - - - - - - - [StyleBox] used when the [ToolButton] is disabled. - - - [StyleBox] used when the [ToolButton] is focused. It is displayed over the current [StyleBox], so using [StyleBoxEmpty] will just disable the focus visual effect. - - - [Font] of the [ToolButton]'s text. - - - Default text [Color] of the [ToolButton]. - - - Text [Color] used when the [ToolButton] is disabled. - - - Text [Color] used when the [ToolButton] is being hovered. - - - Text [Color] used when the [ToolButton] is being pressed. - - - [StyleBox] used when the [ToolButton] is being hovered. - - - The horizontal space between [ToolButton]'s icon and text. - - - Default [StyleBox] for the [ToolButton]. - - - [StyleBox] used when the [ToolButton] is being pressed. - - - diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 8fd1f5951ed..f36e84dab6f 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -1783,7 +1783,8 @@ AnimationTimelineEdit::AnimationTimelineEdit() { length->set_tooltip(TTR("Animation length (seconds)")); length->connect("value_changed", callable_mp(this, &AnimationTimelineEdit::_anim_length_changed)); len_hb->add_child(length); - loop = memnew(ToolButton); + loop = memnew(Button); + loop->set_flat(true); loop->set_tooltip(TTR("Animation Looping")); loop->connect("pressed", callable_mp(this, &AnimationTimelineEdit::_anim_loop_pressed)); loop->set_toggle_mode(true); @@ -2786,7 +2787,8 @@ Variant AnimationTrackEdit::get_drag_data(const Point2 &p_point) { drag_data["group"] = base_path; drag_data["index"] = track; - ToolButton *tb = memnew(ToolButton); + Button *tb = memnew(Button); + tb->set_flat(true); tb->set_text(path_cache); tb->set_icon(icon_cache); set_drag_preview(tb); @@ -5640,14 +5642,16 @@ AnimationTrackEditor::AnimationTrackEditor() { bottom_hb->add_spacer(); - selected_filter = memnew(ToolButton); + selected_filter = memnew(Button); + selected_filter->set_flat(true); selected_filter->connect("pressed", callable_mp(this, &AnimationTrackEditor::_view_group_toggle)); //same function works the same selected_filter->set_toggle_mode(true); selected_filter->set_tooltip(TTR("Only show tracks from nodes selected in tree.")); bottom_hb->add_child(selected_filter); - view_group = memnew(ToolButton); + view_group = memnew(Button); + view_group->set_flat(true); view_group->connect("pressed", callable_mp(this, &AnimationTrackEditor::_view_group_toggle)); view_group->set_toggle_mode(true); view_group->set_tooltip(TTR("Group tracks by node or display them as plain list.")); @@ -5655,7 +5659,8 @@ AnimationTrackEditor::AnimationTrackEditor() { bottom_hb->add_child(view_group); bottom_hb->add_child(memnew(VSeparator)); - snap = memnew(ToolButton); + snap = memnew(Button); + snap->set_flat(true); snap->set_text(TTR("Snap:") + " "); bottom_hb->add_child(snap); snap->set_disabled(true); diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h index 6a46a1e3ffc..911280dc3bc 100644 --- a/editor/animation_track_editor.h +++ b/editor/animation_track_editor.h @@ -44,7 +44,6 @@ #include "scene/gui/spin_box.h" #include "scene/gui/tab_container.h" #include "scene/gui/texture_rect.h" -#include "scene/gui/tool_button.h" #include "scene/resources/animation.h" #include "scene_tree_editor.h" @@ -59,7 +58,7 @@ class AnimationTimelineEdit : public Range { HBoxContainer *len_hb; EditorSpinSlider *length; - ToolButton *loop; + Button *loop; TextureRect *time_icon; MenuButton *add_track; @@ -310,7 +309,7 @@ class AnimationTrackEditor : public VBoxContainer { HSlider *zoom; EditorSpinSlider *step; TextureRect *zoom_icon; - ToolButton *snap; + Button *snap; OptionButton *snap_mode; Button *imported_anim_warning; @@ -457,8 +456,8 @@ class AnimationTrackEditor : public VBoxContainer { void _anim_duplicate_keys(bool transpose); void _view_group_toggle(); - ToolButton *view_group; - ToolButton *selected_filter; + Button *view_group; + Button *selected_filter; void _selection_changed(); diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 717c1406c89..c5df947d64d 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -628,12 +628,14 @@ FindReplaceBar::FindReplaceBar() { hbc_button_search->add_child(matches_label); matches_label->hide(); - find_prev = memnew(ToolButton); + find_prev = memnew(Button); + find_prev->set_flat(true); hbc_button_search->add_child(find_prev); find_prev->set_focus_mode(FOCUS_NONE); find_prev->connect("pressed", callable_mp(this, &FindReplaceBar::search_prev)); - find_next = memnew(ToolButton); + find_next = memnew(Button); + find_next->set_flat(true); hbc_button_search->add_child(find_next); find_next->set_focus_mode(FOCUS_NONE); find_next->connect("pressed", callable_mp(this, &FindReplaceBar::search_next)); @@ -1706,7 +1708,8 @@ CodeTextEditor::CodeTextEditor() { error_line = 0; error_column = 0; - toggle_scripts_button = memnew(ToolButton); + toggle_scripts_button = memnew(Button); + toggle_scripts_button->set_flat(true); toggle_scripts_button->connect("pressed", callable_mp(this, &CodeTextEditor::_toggle_scripts_pressed)); status_bar->add_child(toggle_scripts_button); toggle_scripts_button->hide(); @@ -1726,7 +1729,8 @@ CodeTextEditor::CodeTextEditor() { find_replace_bar->connect("error", callable_mp(error, &Label::set_text)); // Warnings - warning_button = memnew(ToolButton); + warning_button = memnew(Button); + warning_button->set_flat(true); status_bar->add_child(warning_button); warning_button->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER); warning_button->set_default_cursor_shape(CURSOR_POINTING_HAND); diff --git a/editor/code_editor.h b/editor/code_editor.h index d806be885f1..ab298202bd3 100644 --- a/editor/code_editor.h +++ b/editor/code_editor.h @@ -37,7 +37,6 @@ #include "scene/gui/dialogs.h" #include "scene/gui/line_edit.h" #include "scene/gui/text_edit.h" -#include "scene/gui/tool_button.h" #include "scene/main/timer.h" class GotoLineDialog : public ConfirmationDialog { @@ -63,8 +62,8 @@ class FindReplaceBar : public HBoxContainer { LineEdit *search_text; Label *matches_label; - ToolButton *find_prev; - ToolButton *find_next; + Button *find_prev; + Button *find_next; CheckBox *case_sensitive; CheckBox *whole_words; TextureButton *hide_button; @@ -142,8 +141,8 @@ class CodeTextEditor : public VBoxContainer { FindReplaceBar *find_replace_bar; HBoxContainer *status_bar; - ToolButton *toggle_scripts_button; - ToolButton *warning_button; + Button *toggle_scripts_button; + Button *warning_button; Label *warning_count_label; Label *line_and_col_txt; diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index 73468f8ce0f..310de9dd90a 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -673,7 +673,8 @@ Variant CreateDialog::get_drag_data_fw(const Point2 &p_point, Control *p_from) { d["type"] = "create_favorite_drag"; d["class"] = ti->get_text(0); - ToolButton *tb = memnew(ToolButton); + Button *tb = memnew(Button); + tb->set_flat(true); tb->set_icon(ti->get_icon(0)); tb->set_text(ti->get_text(0)); favorites->set_drag_preview(tb); diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index 49137f76faf..a042afc7884 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -1517,27 +1517,31 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { hbc->add_child(memnew(VSeparator)); - skip_breakpoints = memnew(ToolButton); + skip_breakpoints = memnew(Button); + skip_breakpoints->set_flat(true); hbc->add_child(skip_breakpoints); skip_breakpoints->set_tooltip(TTR("Skip Breakpoints")); skip_breakpoints->connect("pressed", callable_mp(this, &ScriptEditorDebugger::debug_skip_breakpoints)); hbc->add_child(memnew(VSeparator)); - copy = memnew(ToolButton); + copy = memnew(Button); + copy->set_flat(true); hbc->add_child(copy); copy->set_tooltip(TTR("Copy Error")); copy->connect("pressed", callable_mp(this, &ScriptEditorDebugger::debug_copy)); hbc->add_child(memnew(VSeparator)); - step = memnew(ToolButton); + step = memnew(Button); + step->set_flat(true); hbc->add_child(step); step->set_tooltip(TTR("Step Into")); step->set_shortcut(ED_GET_SHORTCUT("debugger/step_into")); step->connect("pressed", callable_mp(this, &ScriptEditorDebugger::debug_step)); - next = memnew(ToolButton); + next = memnew(Button); + next->set_flat(true); hbc->add_child(next); next->set_tooltip(TTR("Step Over")); next->set_shortcut(ED_GET_SHORTCUT("debugger/step_over")); @@ -1545,13 +1549,15 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { hbc->add_child(memnew(VSeparator)); - dobreak = memnew(ToolButton); + dobreak = memnew(Button); + dobreak->set_flat(true); hbc->add_child(dobreak); dobreak->set_tooltip(TTR("Break")); dobreak->set_shortcut(ED_GET_SHORTCUT("debugger/break")); dobreak->connect("pressed", callable_mp(this, &ScriptEditorDebugger::debug_break)); - docontinue = memnew(ToolButton); + docontinue = memnew(Button); + docontinue->set_flat(true); hbc->add_child(docontinue); docontinue->set_tooltip(TTR("Continue")); docontinue->set_shortcut(ED_GET_SHORTCUT("debugger/continue")); @@ -1730,9 +1736,11 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { vmem_total->set_editable(false); vmem_total->set_custom_minimum_size(Size2(100, 0) * EDSCALE); vmem_hb->add_child(vmem_total); - vmem_refresh = memnew(ToolButton); + vmem_refresh = memnew(Button); + vmem_refresh->set_flat(true); vmem_hb->add_child(vmem_refresh); - vmem_export = memnew(ToolButton); + vmem_export = memnew(Button); + vmem_export->set_flat(true); vmem_export->set_tooltip(TTR("Export list to a CSV file")); vmem_hb->add_child(vmem_export); vmem_vb->add_child(vmem_hb); diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index 5cf5201b18a..10825973ae4 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -782,19 +782,22 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { HBoxContainer *hbc = memnew(HBoxContainer); vb->add_child(hbc); - solo = memnew(ToolButton); + solo = memnew(Button); + solo->set_flat(true); solo->set_toggle_mode(true); solo->set_tooltip(TTR("Solo")); solo->set_focus_mode(FOCUS_NONE); solo->connect("pressed", callable_mp(this, &EditorAudioBus::_solo_toggled)); hbc->add_child(solo); - mute = memnew(ToolButton); + mute = memnew(Button); + mute->set_flat(true); mute->set_toggle_mode(true); mute->set_tooltip(TTR("Mute")); mute->set_focus_mode(FOCUS_NONE); mute->connect("pressed", callable_mp(this, &EditorAudioBus::_mute_toggled)); hbc->add_child(mute); - bypass = memnew(ToolButton); + bypass = memnew(Button); + bypass->set_flat(true); bypass->set_toggle_mode(true); bypass->set_tooltip(TTR("Bypass")); bypass->set_focus_mode(FOCUS_NONE); diff --git a/editor/editor_audio_buses.h b/editor/editor_audio_buses.h index 65caf84f0f2..5d5502002de 100644 --- a/editor/editor_audio_buses.h +++ b/editor/editor_audio_buses.h @@ -45,7 +45,6 @@ #include "scene/gui/slider.h" #include "scene/gui/texture_progress.h" #include "scene/gui/texture_rect.h" -#include "scene/gui/tool_button.h" #include "scene/gui/tree.h" class EditorAudioBuses; diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index 5ae5d1cb318..663f3dd8561 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -1455,11 +1455,14 @@ EditorFileDialog::EditorFileDialog() { HBoxContainer *pathhb = memnew(HBoxContainer); - dir_prev = memnew(ToolButton); + dir_prev = memnew(Button); + dir_prev->set_flat(true); dir_prev->set_tooltip(TTR("Go to previous folder.")); - dir_next = memnew(ToolButton); + dir_next = memnew(Button); + dir_next->set_flat(true); dir_next->set_tooltip(TTR("Go to next folder.")); - dir_up = memnew(ToolButton); + dir_up = memnew(Button); + dir_up->set_flat(true); dir_up->set_tooltip(TTR("Go to parent folder.")); pathhb->add_child(dir_prev); @@ -1479,18 +1482,21 @@ EditorFileDialog::EditorFileDialog() { pathhb->add_child(dir); dir->set_h_size_flags(Control::SIZE_EXPAND_FILL); - refresh = memnew(ToolButton); + refresh = memnew(Button); + refresh->set_flat(true); refresh->set_tooltip(TTR("Refresh files.")); refresh->connect("pressed", callable_mp(this, &EditorFileDialog::update_file_list)); pathhb->add_child(refresh); - favorite = memnew(ToolButton); + favorite = memnew(Button); + favorite->set_flat(true); favorite->set_toggle_mode(true); favorite->set_tooltip(TTR("(Un)favorite current folder.")); favorite->connect("pressed", callable_mp(this, &EditorFileDialog::_favorite_pressed)); pathhb->add_child(favorite); - show_hidden = memnew(ToolButton); + show_hidden = memnew(Button); + show_hidden->set_flat(true); show_hidden->set_toggle_mode(true); show_hidden->set_pressed(is_showing_hidden_files()); show_hidden->set_tooltip(TTR("Toggle the visibility of hidden files.")); @@ -1502,7 +1508,8 @@ EditorFileDialog::EditorFileDialog() { Ref view_mode_group; view_mode_group.instance(); - mode_thumbnails = memnew(ToolButton); + mode_thumbnails = memnew(Button); + mode_thumbnails->set_flat(true); mode_thumbnails->connect("pressed", callable_mp(this, &EditorFileDialog::set_display_mode), varray(DISPLAY_THUMBNAILS)); mode_thumbnails->set_toggle_mode(true); mode_thumbnails->set_pressed(display_mode == DISPLAY_THUMBNAILS); @@ -1510,7 +1517,8 @@ EditorFileDialog::EditorFileDialog() { mode_thumbnails->set_tooltip(TTR("View items as a grid of thumbnails.")); pathhb->add_child(mode_thumbnails); - mode_list = memnew(ToolButton); + mode_list = memnew(Button); + mode_list->set_flat(true); mode_list->connect("pressed", callable_mp(this, &EditorFileDialog::set_display_mode), varray(DISPLAY_LIST)); mode_list->set_toggle_mode(true); mode_list->set_pressed(display_mode == DISPLAY_LIST); @@ -1547,10 +1555,12 @@ EditorFileDialog::EditorFileDialog() { fav_vb->add_child(fav_hb); fav_hb->add_child(memnew(Label(TTR("Favorites:")))); fav_hb->add_spacer(); - fav_up = memnew(ToolButton); + fav_up = memnew(Button); + fav_up->set_flat(true); fav_hb->add_child(fav_up); fav_up->connect("pressed", callable_mp(this, &EditorFileDialog::_favorite_move_up)); - fav_down = memnew(ToolButton); + fav_down = memnew(Button); + fav_down->set_flat(true); fav_hb->add_child(fav_down); fav_down->connect("pressed", callable_mp(this, &EditorFileDialog::_favorite_move_down)); diff --git a/editor/editor_file_dialog.h b/editor/editor_file_dialog.h index cbedfc72a6b..1e224b933da 100644 --- a/editor/editor_file_dialog.h +++ b/editor/editor_file_dialog.h @@ -40,7 +40,6 @@ #include "scene/gui/separator.h" #include "scene/gui/split_container.h" #include "scene/gui/texture_rect.h" -#include "scene/gui/tool_button.h" class DependencyRemoveDialog; @@ -95,9 +94,9 @@ private: bool can_create_dir; LineEdit *dir; - ToolButton *dir_prev; - ToolButton *dir_next; - ToolButton *dir_up; + Button *dir_prev; + Button *dir_next; + Button *dir_up; HBoxContainer *drives_container; HBoxContainer *shortcuts_container; @@ -116,15 +115,15 @@ private: ConfirmationDialog *confirm_save; DependencyRemoveDialog *remove_dialog; - ToolButton *mode_thumbnails; - ToolButton *mode_list; + Button *mode_thumbnails; + Button *mode_list; - ToolButton *refresh; - ToolButton *favorite; - ToolButton *show_hidden; + Button *refresh; + Button *favorite; + Button *show_hidden; - ToolButton *fav_up; - ToolButton *fav_down; + Button *fav_up; + Button *fav_down; ItemList *favorites; ItemList *recent; diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index f50ac6d580d..2a59aadd61e 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -1664,12 +1664,14 @@ FindBar::FindBar() { add_child(matches_label); matches_label->hide(); - find_prev = memnew(ToolButton); + find_prev = memnew(Button); + find_prev->set_flat(true); add_child(find_prev); find_prev->set_focus_mode(FOCUS_NONE); find_prev->connect("pressed", callable_mp(this, &FindBar::search_prev)); - find_next = memnew(ToolButton); + find_next = memnew(Button); + find_next->set_flat(true); add_child(find_next); find_next->set_focus_mode(FOCUS_NONE); find_next->connect("pressed", callable_mp(this, &FindBar::search_next)); diff --git a/editor/editor_help.h b/editor/editor_help.h index 4d42c1d38a9..7c3edeb2994 100644 --- a/editor/editor_help.h +++ b/editor/editor_help.h @@ -47,8 +47,8 @@ class FindBar : public HBoxContainer { GDCLASS(FindBar, HBoxContainer); LineEdit *search_text; - ToolButton *find_prev; - ToolButton *find_next; + Button *find_prev; + Button *find_next; Label *matches_label; TextureButton *hide_button; String prev_search; diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp index 5bfcbf06fc1..d2b9405552c 100644 --- a/editor/editor_help_search.cpp +++ b/editor/editor_help_search.cpp @@ -201,14 +201,16 @@ EditorHelpSearch::EditorHelpSearch() { register_text_enter(search_box); hbox->add_child(search_box); - case_sensitive_button = memnew(ToolButton); + case_sensitive_button = memnew(Button); + case_sensitive_button->set_flat(true); case_sensitive_button->set_tooltip(TTR("Case Sensitive")); case_sensitive_button->connect("pressed", callable_mp(this, &EditorHelpSearch::_update_results)); case_sensitive_button->set_toggle_mode(true); case_sensitive_button->set_focus_mode(Control::FOCUS_NONE); hbox->add_child(case_sensitive_button); - hierarchy_button = memnew(ToolButton); + hierarchy_button = memnew(Button); + hierarchy_button->set_flat(true); hierarchy_button->set_tooltip(TTR("Show Hierarchy")); hierarchy_button->connect("pressed", callable_mp(this, &EditorHelpSearch::_update_results)); hierarchy_button->set_toggle_mode(true); diff --git a/editor/editor_help_search.h b/editor/editor_help_search.h index f7dbc5c3add..b37f74fd7eb 100644 --- a/editor/editor_help_search.h +++ b/editor/editor_help_search.h @@ -54,8 +54,8 @@ class EditorHelpSearch : public ConfirmationDialog { }; LineEdit *search_box; - ToolButton *case_sensitive_button; - ToolButton *hierarchy_button; + Button *case_sensitive_button; + Button *hierarchy_button; OptionButton *filter_combo; Tree *results_tree; bool old_search; diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp index ea5f73acd14..9595eb8a72d 100644 --- a/editor/editor_log.cpp +++ b/editor/editor_log.cpp @@ -124,7 +124,7 @@ void EditorLog::add_message(const String &p_msg, MessageType p_type) { } } -void EditorLog::set_tool_button(ToolButton *p_tool_button) { +void EditorLog::set_tool_button(Button *p_tool_button) { tool_button = p_tool_button; } diff --git a/editor/editor_log.h b/editor/editor_log.h index 1c9a2d40623..3bf5615346c 100644 --- a/editor/editor_log.h +++ b/editor/editor_log.h @@ -31,17 +31,16 @@ #ifndef EDITOR_LOG_H #define EDITOR_LOG_H -#include "scene/gui/control.h" -#include "scene/gui/label.h" -#include "scene/gui/rich_text_label.h" -#include "scene/gui/texture_button.h" -//#include "scene/gui/empty_control.h" #include "core/os/thread.h" #include "pane_drag.h" #include "scene/gui/box_container.h" +#include "scene/gui/button.h" +#include "scene/gui/control.h" +#include "scene/gui/label.h" #include "scene/gui/panel_container.h" +#include "scene/gui/rich_text_label.h" +#include "scene/gui/texture_button.h" #include "scene/gui/texture_rect.h" -#include "scene/gui/tool_button.h" class EditorLog : public VBoxContainer { GDCLASS(EditorLog, VBoxContainer); @@ -52,7 +51,7 @@ class EditorLog : public VBoxContainer { RichTextLabel *log; HBoxContainer *title_hb; //PaneDrag *pd; - ToolButton *tool_button; + Button *tool_button; static void _error_handler(void *p_self, const char *p_func, const char *p_file, int p_line, const char *p_error, const char *p_errorexp, ErrorHandlerType p_type); @@ -78,7 +77,7 @@ public: }; void add_message(const String &p_msg, MessageType p_type = MSG_TYPE_STD); - void set_tool_button(ToolButton *p_tool_button); + void set_tool_button(Button *p_tool_button); void deinit(); void clear(); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 9a9a1bfdeb1..bb34a459387 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -58,7 +58,6 @@ #include "scene/gui/tab_container.h" #include "scene/gui/tabs.h" #include "scene/gui/texture_progress.h" -#include "scene/gui/tool_button.h" #include "scene/resources/packed_scene.h" #include "servers/navigation_server_2d.h" #include "servers/navigation_server_3d.h" @@ -485,7 +484,7 @@ void EditorNode::_notification(int p_what) { // update_icons for (int i = 0; i < singleton->main_editor_buttons.size(); i++) { - ToolButton *tb = singleton->main_editor_buttons[i]; + Button *tb = singleton->main_editor_buttons[i]; EditorPlugin *p_editor = singleton->editor_table[i]; Ref icon = p_editor->get_icon(); @@ -2776,7 +2775,8 @@ void EditorNode::select_editor_by_name(const String &p_name) { void EditorNode::add_editor_plugin(EditorPlugin *p_editor, bool p_config_changed) { if (p_editor->has_main_screen()) { - ToolButton *tb = memnew(ToolButton); + Button *tb = memnew(Button); + tb->set_flat(true); tb->set_toggle_mode(true); tb->connect("pressed", callable_mp(singleton, &EditorNode::_editor_select), varray(singleton->main_editor_buttons.size())); tb->set_text(p_editor->get_name()); @@ -4621,8 +4621,9 @@ void EditorNode::_scene_tab_changed(int p_tab) { editor_data.get_undo_redo().commit_action(); } -ToolButton *EditorNode::add_bottom_panel_item(String p_text, Control *p_item) { - ToolButton *tb = memnew(ToolButton); +Button *EditorNode::add_bottom_panel_item(String p_text, Control *p_item) { + Button *tb = memnew(Button); + tb->set_flat(true); tb->connect("toggled", callable_mp(this, &EditorNode::_bottom_panel_switch), varray(bottom_panel_items.size())); tb->set_text(p_text); tb->set_toggle_mode(true); @@ -5698,7 +5699,8 @@ EditorNode::EditorNode() { dock_select_popup->add_child(dock_vb); HBoxContainer *dock_hb = memnew(HBoxContainer); - dock_tab_move_left = memnew(ToolButton); + dock_tab_move_left = memnew(Button); + dock_tab_move_left->set_flat(true); dock_tab_move_left->set_icon(theme->get_icon("Back", "EditorIcons")); dock_tab_move_left->set_focus_mode(Control::FOCUS_NONE); dock_tab_move_left->connect("pressed", callable_mp(this, &EditorNode::_dock_move_left)); @@ -5710,7 +5712,8 @@ EditorNode::EditorNode() { dock_label->set_align(Label::ALIGN_CENTER); dock_hb->add_child(dock_label); - dock_tab_move_right = memnew(ToolButton); + dock_tab_move_right = memnew(Button); + dock_tab_move_right->set_flat(true); dock_tab_move_right->set_icon(theme->get_icon("Forward", "EditorIcons")); dock_tab_move_right->set_focus_mode(Control::FOCUS_NONE); dock_tab_move_right->connect("pressed", callable_mp(this, &EditorNode::_dock_move_right)); @@ -5804,7 +5807,8 @@ EditorNode::EditorNode() { srt->add_child(tabbar_container); tabbar_container->add_child(scene_tabs); - distraction_free = memnew(ToolButton); + distraction_free = memnew(Button); + distraction_free->set_flat(true); #ifdef OSX_ENABLED distraction_free->set_shortcut(ED_SHORTCUT("editor/distraction_free_mode", TTR("Distraction Free Mode"), KEY_MASK_CMD | KEY_MASK_CTRL | KEY_D)); #else @@ -5815,7 +5819,8 @@ EditorNode::EditorNode() { distraction_free->set_icon(gui_base->get_theme_icon("DistractionFree", "EditorIcons")); distraction_free->set_toggle_mode(true); - scene_tab_add = memnew(ToolButton); + scene_tab_add = memnew(Button); + scene_tab_add->set_flat(true); tabbar_container->add_child(scene_tab_add); tabbar_container->add_child(distraction_free); scene_tab_add->set_tooltip(TTR("Add a new scene.")); @@ -5852,7 +5857,8 @@ EditorNode::EditorNode() { file_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox("MenuHover", "EditorStyles")); left_menu_hb->add_child(file_menu); - prev_scene = memnew(ToolButton); + prev_scene = memnew(Button); + prev_scene->set_flat(true); prev_scene->set_icon(gui_base->get_theme_icon("PrevScene", "EditorIcons")); prev_scene->set_tooltip(TTR("Go to previously opened scene.")); prev_scene->set_disabled(true); @@ -6081,7 +6087,8 @@ EditorNode::EditorNode() { HBoxContainer *play_hb = memnew(HBoxContainer); menu_hb->add_child(play_hb); - play_button = memnew(ToolButton); + play_button = memnew(Button); + play_button->set_flat(true); play_hb->add_child(play_button); play_button->set_toggle_mode(true); play_button->set_icon(gui_base->get_theme_icon("MainPlay", "EditorIcons")); @@ -6094,7 +6101,8 @@ EditorNode::EditorNode() { play_button->set_shortcut(ED_SHORTCUT("editor/play", TTR("Play"), KEY_F5)); #endif - pause_button = memnew(ToolButton); + pause_button = memnew(Button); + pause_button->set_flat(true); pause_button->set_toggle_mode(true); pause_button->set_icon(gui_base->get_theme_icon("Pause", "EditorIcons")); pause_button->set_focus_mode(Control::FOCUS_NONE); @@ -6107,7 +6115,8 @@ EditorNode::EditorNode() { pause_button->set_shortcut(ED_SHORTCUT("editor/pause_scene", TTR("Pause Scene"), KEY_F7)); #endif - stop_button = memnew(ToolButton); + stop_button = memnew(Button); + stop_button->set_flat(true); play_hb->add_child(stop_button); stop_button->set_focus_mode(Control::FOCUS_NONE); stop_button->set_icon(gui_base->get_theme_icon("Stop", "EditorIcons")); @@ -6124,7 +6133,8 @@ EditorNode::EditorNode() { play_hb->add_child(run_native); run_native->connect("native_run", callable_mp(this, &EditorNode::_run_native)); - play_scene_button = memnew(ToolButton); + play_scene_button = memnew(Button); + play_scene_button->set_flat(true); play_hb->add_child(play_scene_button); play_scene_button->set_toggle_mode(true); play_scene_button->set_focus_mode(Control::FOCUS_NONE); @@ -6137,7 +6147,8 @@ EditorNode::EditorNode() { play_scene_button->set_shortcut(ED_SHORTCUT("editor/play_scene", TTR("Play Scene"), KEY_F6)); #endif - play_custom_scene_button = memnew(ToolButton); + play_custom_scene_button = memnew(Button); + play_custom_scene_button->set_flat(true); play_hb->add_child(play_custom_scene_button); play_custom_scene_button->set_toggle_mode(true); play_custom_scene_button->set_focus_mode(Control::FOCUS_NONE); @@ -6298,7 +6309,8 @@ EditorNode::EditorNode() { version_label->set_self_modulate(Color(1, 1, 1, 0.6)); bottom_panel_hb->add_child(version_label); - bottom_panel_raise = memnew(ToolButton); + bottom_panel_raise = memnew(Button); + bottom_panel_raise->set_flat(true); bottom_panel_raise->set_icon(gui_base->get_theme_icon("ExpandBottomDock", "EditorIcons")); bottom_panel_raise->set_shortcut(ED_SHORTCUT("editor/bottom_panel_expand", TTR("Expand Bottom Panel"), KEY_MASK_SHIFT | KEY_F12)); @@ -6309,7 +6321,7 @@ EditorNode::EditorNode() { bottom_panel_raise->connect("toggled", callable_mp(this, &EditorNode::_bottom_panel_raise_toggled)); log = memnew(EditorLog); - ToolButton *output_button = add_bottom_panel_item(TTR("Output"), log); + Button *output_button = add_bottom_panel_item(TTR("Output"), log); log->set_tool_button(output_button); old_split_ofs = 0; diff --git a/editor/editor_node.h b/editor/editor_node.h index 7c9cf44d6cb..b0e0c5614c0 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -83,7 +83,7 @@ class ScriptCreateDialog; class TabContainer; class Tabs; class TextureProgress; -class ToolButton; +class Button; class VSplitContainer; class Window; class SubViewport; @@ -265,15 +265,15 @@ private: MenuButton *settings_menu; MenuButton *help_menu; PopupMenu *tool_menu; - ToolButton *export_button; - ToolButton *prev_scene; - ToolButton *play_button; - ToolButton *pause_button; - ToolButton *stop_button; - ToolButton *run_settings_button; - ToolButton *play_scene_button; - ToolButton *play_custom_scene_button; - ToolButton *search_button; + Button *export_button; + Button *prev_scene; + Button *play_button; + Button *pause_button; + Button *stop_button; + Button *run_settings_button; + Button *play_scene_button; + Button *play_custom_scene_button; + Button *search_button; TextureProgress *audio_vu; Timer *screenshot_timer; @@ -336,7 +336,7 @@ private: EditorQuickOpen *quick_run; HBoxContainer *main_editor_button_vb; - Vector main_editor_buttons; + Vector