diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2020-06-19 20:49:04 +0200 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2020-06-19 20:49:49 +0200 |
commit | 31b7f02a29cdf4f1c30cfc37962f43f67380b9ad (patch) | |
tree | 1c0de1bac35046915575687e8d8993643d372474 /editor/plugins | |
parent | cb9d02a8d1b5bb71abcec6be0e75002c5ea656c4 (diff) |
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.
Diffstat (limited to 'editor/plugins')
46 files changed, 336 insertions, 242 deletions
diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp index b905c8db12..e99ffe2b83 100644 --- a/editor/plugins/abstract_polygon_2d_editor.cpp +++ b/editor/plugins/abstract_polygon_2d_editor.cpp @@ -703,17 +703,20 @@ AbstractPolygon2DEditor::AbstractPolygon2DEditor(EditorNode *p_editor, bool p_wi edge_point = PosVertex(); add_child(memnew(VSeparator)); - button_create = memnew(ToolButton); + button_create = memnew(Button); + button_create->set_flat(true); add_child(button_create); button_create->connect("pressed", callable_mp(this, &AbstractPolygon2DEditor::_menu_option), varray(MODE_CREATE)); button_create->set_toggle_mode(true); - button_edit = memnew(ToolButton); + button_edit = memnew(Button); + button_edit->set_flat(true); add_child(button_edit); button_edit->connect("pressed", callable_mp(this, &AbstractPolygon2DEditor::_menu_option), varray(MODE_EDIT)); button_edit->set_toggle_mode(true); - button_delete = memnew(ToolButton); + button_delete = memnew(Button); + button_delete->set_flat(true); add_child(button_delete); button_delete->connect("pressed", callable_mp(this, &AbstractPolygon2DEditor::_menu_option), varray(MODE_DELETE)); button_delete->set_toggle_mode(true); diff --git a/editor/plugins/abstract_polygon_2d_editor.h b/editor/plugins/abstract_polygon_2d_editor.h index d5b3a916d1..b3a17f7660 100644 --- a/editor/plugins/abstract_polygon_2d_editor.h +++ b/editor/plugins/abstract_polygon_2d_editor.h @@ -34,16 +34,15 @@ #include "editor/editor_node.h" #include "editor/editor_plugin.h" #include "scene/2d/polygon_2d.h" -#include "scene/gui/tool_button.h" class CanvasItemEditor; class AbstractPolygon2DEditor : public HBoxContainer { GDCLASS(AbstractPolygon2DEditor, HBoxContainer); - ToolButton *button_create; - ToolButton *button_edit; - ToolButton *button_delete; + Button *button_create; + Button *button_edit; + Button *button_delete; struct Vertex { Vertex() {} diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp index 75eacf56ec..959301907c 100644 --- a/editor/plugins/animation_blend_space_1d_editor.cpp +++ b/editor/plugins/animation_blend_space_1d_editor.cpp @@ -595,7 +595,8 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { Ref<ButtonGroup> bg; bg.instance(); - tool_blend = memnew(ToolButton); + tool_blend = memnew(Button); + tool_blend->set_flat(true); tool_blend->set_toggle_mode(true); tool_blend->set_button_group(bg); top_hb->add_child(tool_blend); @@ -603,14 +604,16 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { tool_blend->set_tooltip(TTR("Set the blending position within the space")); tool_blend->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_tool_switch), varray(3)); - tool_select = memnew(ToolButton); + tool_select = memnew(Button); + tool_select->set_flat(true); tool_select->set_toggle_mode(true); tool_select->set_button_group(bg); top_hb->add_child(tool_select); tool_select->set_tooltip(TTR("Select and move points, create points with RMB.")); tool_select->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_tool_switch), varray(0)); - tool_create = memnew(ToolButton); + tool_create = memnew(Button); + tool_create->set_flat(true); tool_create->set_toggle_mode(true); tool_create->set_button_group(bg); top_hb->add_child(tool_create); @@ -619,14 +622,16 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { tool_erase_sep = memnew(VSeparator); top_hb->add_child(tool_erase_sep); - tool_erase = memnew(ToolButton); + tool_erase = memnew(Button); + tool_erase->set_flat(true); top_hb->add_child(tool_erase); tool_erase->set_tooltip(TTR("Erase points.")); tool_erase->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_erase_selected)); top_hb->add_child(memnew(VSeparator)); - snap = memnew(ToolButton); + snap = memnew(Button); + snap->set_flat(true); snap->set_toggle_mode(true); top_hb->add_child(snap); snap->set_pressed(true); diff --git a/editor/plugins/animation_blend_space_1d_editor.h b/editor/plugins/animation_blend_space_1d_editor.h index 8cfd6714ad..c319b648ba 100644 --- a/editor/plugins/animation_blend_space_1d_editor.h +++ b/editor/plugins/animation_blend_space_1d_editor.h @@ -47,15 +47,15 @@ class AnimationNodeBlendSpace1DEditor : public AnimationTreeNodeEditorPlugin { Ref<AnimationNodeBlendSpace1D> blend_space; HBoxContainer *goto_parent_hb; - ToolButton *goto_parent; + Button *goto_parent; PanelContainer *panel; - ToolButton *tool_blend; - ToolButton *tool_select; - ToolButton *tool_create; + Button *tool_blend; + Button *tool_select; + Button *tool_create; VSeparator *tool_erase_sep; - ToolButton *tool_erase; - ToolButton *snap; + Button *tool_erase; + Button *snap; SpinBox *snap_value; LineEdit *label_value; diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp index a7d5c2207b..1ab114fc01 100644 --- a/editor/plugins/animation_blend_space_2d_editor.cpp +++ b/editor/plugins/animation_blend_space_2d_editor.cpp @@ -819,7 +819,8 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { Ref<ButtonGroup> bg; bg.instance(); - tool_blend = memnew(ToolButton); + tool_blend = memnew(Button); + tool_blend->set_flat(true); tool_blend->set_toggle_mode(true); tool_blend->set_button_group(bg); top_hb->add_child(tool_blend); @@ -827,21 +828,24 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { tool_blend->set_tooltip(TTR("Set the blending position within the space")); tool_blend->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_tool_switch), varray(3)); - tool_select = memnew(ToolButton); + tool_select = memnew(Button); + tool_select->set_flat(true); tool_select->set_toggle_mode(true); tool_select->set_button_group(bg); top_hb->add_child(tool_select); tool_select->set_tooltip(TTR("Select and move points, create points with RMB.")); tool_select->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_tool_switch), varray(0)); - tool_create = memnew(ToolButton); + tool_create = memnew(Button); + tool_create->set_flat(true); tool_create->set_toggle_mode(true); tool_create->set_button_group(bg); top_hb->add_child(tool_create); tool_create->set_tooltip(TTR("Create points.")); tool_create->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_tool_switch), varray(1)); - tool_triangle = memnew(ToolButton); + tool_triangle = memnew(Button); + tool_triangle->set_flat(true); tool_triangle->set_toggle_mode(true); tool_triangle->set_button_group(bg); top_hb->add_child(tool_triangle); @@ -850,7 +854,8 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { tool_erase_sep = memnew(VSeparator); top_hb->add_child(tool_erase_sep); - tool_erase = memnew(ToolButton); + tool_erase = memnew(Button); + tool_erase->set_flat(true); top_hb->add_child(tool_erase); tool_erase->set_tooltip(TTR("Erase points and triangles.")); tool_erase->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_erase_selected)); @@ -858,7 +863,8 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { top_hb->add_child(memnew(VSeparator)); - auto_triangles = memnew(ToolButton); + auto_triangles = memnew(Button); + auto_triangles->set_flat(true); top_hb->add_child(auto_triangles); auto_triangles->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_auto_triangles_toggled)); auto_triangles->set_toggle_mode(true); @@ -866,7 +872,8 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { top_hb->add_child(memnew(VSeparator)); - snap = memnew(ToolButton); + snap = memnew(Button); + snap->set_flat(true); snap->set_toggle_mode(true); top_hb->add_child(snap); snap->set_pressed(true); diff --git a/editor/plugins/animation_blend_space_2d_editor.h b/editor/plugins/animation_blend_space_2d_editor.h index b430a12297..659b96cefa 100644 --- a/editor/plugins/animation_blend_space_2d_editor.h +++ b/editor/plugins/animation_blend_space_2d_editor.h @@ -47,18 +47,18 @@ class AnimationNodeBlendSpace2DEditor : public AnimationTreeNodeEditorPlugin { Ref<AnimationNodeBlendSpace2D> blend_space; PanelContainer *panel; - ToolButton *tool_blend; - ToolButton *tool_select; - ToolButton *tool_create; - ToolButton *tool_triangle; + Button *tool_blend; + Button *tool_select; + Button *tool_create; + Button *tool_triangle; VSeparator *tool_erase_sep; - ToolButton *tool_erase; - ToolButton *snap; + Button *tool_erase; + Button *snap; SpinBox *snap_x; SpinBox *snap_y; OptionButton *interpolation; - ToolButton *auto_triangles; + Button *auto_triangles; LineEdit *label_x; LineEdit *label_y; diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index 9a5b825683..035526ca55 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -1502,24 +1502,29 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay HBoxContainer *hb = memnew(HBoxContainer); add_child(hb); - play_bw_from = memnew(ToolButton); + play_bw_from = memnew(Button); + play_bw_from->set_flat(true); play_bw_from->set_tooltip(TTR("Play selected animation backwards from current pos. (A)")); hb->add_child(play_bw_from); - play_bw = memnew(ToolButton); + play_bw = memnew(Button); + play_bw->set_flat(true); play_bw->set_tooltip(TTR("Play selected animation backwards from end. (Shift+A)")); hb->add_child(play_bw); - stop = memnew(ToolButton); + stop = memnew(Button); + stop->set_flat(true); stop->set_toggle_mode(true); hb->add_child(stop); stop->set_tooltip(TTR("Stop animation playback. (S)")); - play = memnew(ToolButton); + play = memnew(Button); + play->set_flat(true); play->set_tooltip(TTR("Play selected animation from start. (Shift+D)")); hb->add_child(play); - play_from = memnew(ToolButton); + play_from = memnew(Button); + play_from->set_flat(true); play_from->set_tooltip(TTR("Play selected animation from current pos. (D)")); hb->add_child(play_from); @@ -1571,7 +1576,8 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay animation->set_tooltip(TTR("Display list of animations in player.")); animation->set_clip_text(true); - autoplay = memnew(ToolButton); + autoplay = memnew(Button); + autoplay->set_flat(true); hb->add_child(autoplay); autoplay->set_tooltip(TTR("Autoplay on Load")); @@ -1583,7 +1589,8 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay hb->add_child(memnew(VSeparator)); - onion_toggle = memnew(ToolButton); + onion_toggle = memnew(Button); + onion_toggle->set_flat(true); onion_toggle->set_toggle_mode(true); onion_toggle->set_tooltip(TTR("Enable Onion Skinning")); onion_toggle->connect("pressed", callable_mp(this, &AnimationPlayerEditor::_onion_skinning_menu), varray(ONION_SKINNING_ENABLE)); @@ -1608,7 +1615,8 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay hb->add_child(memnew(VSeparator)); - pin = memnew(ToolButton); + pin = memnew(Button); + pin->set_flat(true); pin->set_toggle_mode(true); pin->set_tooltip(TTR("Pin AnimationPlayer")); hb->add_child(pin); diff --git a/editor/plugins/animation_player_editor_plugin.h b/editor/plugins/animation_player_editor_plugin.h index 18f2d3b25e..fe96deecf2 100644 --- a/editor/plugins/animation_player_editor_plugin.h +++ b/editor/plugins/animation_player_editor_plugin.h @@ -96,9 +96,9 @@ class AnimationPlayerEditor : public VBoxContainer { Button *autoplay; MenuButton *tool_anim; - ToolButton *onion_toggle; + Button *onion_toggle; MenuButton *onion_skinning; - ToolButton *pin; + Button *pin; SpinBox *frame; LineEdit *scale; LineEdit *name; diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index a435b1c482..0970608853 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -1208,7 +1208,8 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { Ref<ButtonGroup> bg; bg.instance(); - tool_select = memnew(ToolButton); + tool_select = memnew(Button); + tool_select->set_flat(true); top_hb->add_child(tool_select); tool_select->set_toggle_mode(true); tool_select->set_button_group(bg); @@ -1216,14 +1217,16 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { tool_select->set_tooltip(TTR("Select and move nodes.\nRMB to add new nodes.\nShift+LMB to create connections.")); tool_select->connect("pressed", callable_mp(this, &AnimationNodeStateMachineEditor::_update_mode), varray(), CONNECT_DEFERRED); - tool_create = memnew(ToolButton); + tool_create = memnew(Button); + tool_create->set_flat(true); top_hb->add_child(tool_create); tool_create->set_toggle_mode(true); tool_create->set_button_group(bg); tool_create->set_tooltip(TTR("Create new nodes.")); tool_create->connect("pressed", callable_mp(this, &AnimationNodeStateMachineEditor::_update_mode), varray(), CONNECT_DEFERRED); - tool_connect = memnew(ToolButton); + tool_connect = memnew(Button); + tool_connect->set_flat(true); top_hb->add_child(tool_connect); tool_connect->set_toggle_mode(true); tool_connect->set_button_group(bg); @@ -1233,7 +1236,8 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { tool_erase_hb = memnew(HBoxContainer); top_hb->add_child(tool_erase_hb); tool_erase_hb->add_child(memnew(VSeparator)); - tool_erase = memnew(ToolButton); + tool_erase = memnew(Button); + tool_erase->set_flat(true); tool_erase->set_tooltip(TTR("Remove selected node or transition.")); tool_erase_hb->add_child(tool_erase); tool_erase->connect("pressed", callable_mp(this, &AnimationNodeStateMachineEditor::_erase_selected)); @@ -1241,13 +1245,15 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { tool_erase_hb->add_child(memnew(VSeparator)); - tool_autoplay = memnew(ToolButton); + tool_autoplay = memnew(Button); + tool_autoplay->set_flat(true); tool_autoplay->set_tooltip(TTR("Toggle autoplay this animation on start, restart or seek to zero.")); tool_erase_hb->add_child(tool_autoplay); tool_autoplay->connect("pressed", callable_mp(this, &AnimationNodeStateMachineEditor::_autoplay_selected)); tool_autoplay->set_disabled(true); - tool_end = memnew(ToolButton); + tool_end = memnew(Button); + tool_end->set_flat(true); tool_end->set_tooltip(TTR("Set the end animation. This is useful for sub-transitions.")); tool_erase_hb->add_child(tool_end); tool_end->connect("pressed", callable_mp(this, &AnimationNodeStateMachineEditor::_end_selected)); diff --git a/editor/plugins/animation_state_machine_editor.h b/editor/plugins/animation_state_machine_editor.h index 022c32ef48..c4caf2e52b 100644 --- a/editor/plugins/animation_state_machine_editor.h +++ b/editor/plugins/animation_state_machine_editor.h @@ -46,16 +46,16 @@ class AnimationNodeStateMachineEditor : public AnimationTreeNodeEditorPlugin { Ref<AnimationNodeStateMachine> state_machine; - ToolButton *tool_select; - ToolButton *tool_create; - ToolButton *tool_connect; + Button *tool_select; + Button *tool_create; + Button *tool_connect; Popup *name_edit_popup; LineEdit *name_edit; HBoxContainer *tool_erase_hb; - ToolButton *tool_erase; - ToolButton *tool_autoplay; - ToolButton *tool_end; + Button *tool_erase; + Button *tool_autoplay; + Button *tool_end; OptionButton *transition_mode; OptionButton *play_mode; diff --git a/editor/plugins/audio_stream_editor_plugin.cpp b/editor/plugins/audio_stream_editor_plugin.cpp index 3b7a9320f0..b0f65af245 100644 --- a/editor/plugins/audio_stream_editor_plugin.cpp +++ b/editor/plugins/audio_stream_editor_plugin.cpp @@ -220,12 +220,14 @@ AudioStreamEditor::AudioStreamEditor() { hbox->add_theme_constant_override("separation", 0); vbox->add_child(hbox); - _play_button = memnew(ToolButton); + _play_button = memnew(Button); + _play_button->set_flat(true); hbox->add_child(_play_button); _play_button->set_focus_mode(Control::FOCUS_NONE); _play_button->connect("pressed", callable_mp(this, &AudioStreamEditor::_play)); - _stop_button = memnew(ToolButton); + _stop_button = memnew(Button); + _stop_button->set_flat(true); hbox->add_child(_stop_button); _stop_button->set_focus_mode(Control::FOCUS_NONE); _stop_button->connect("pressed", callable_mp(this, &AudioStreamEditor::_stop)); diff --git a/editor/plugins/audio_stream_editor_plugin.h b/editor/plugins/audio_stream_editor_plugin.h index dd7caaa15e..de176aab49 100644 --- a/editor/plugins/audio_stream_editor_plugin.h +++ b/editor/plugins/audio_stream_editor_plugin.h @@ -47,8 +47,8 @@ class AudioStreamEditor : public ColorRect { Label *_current_label; Label *_duration_label; - ToolButton *_play_button; - ToolButton *_stop_button; + Button *_play_button; + Button *_stop_button; float _current; bool _dragging; diff --git a/editor/plugins/baked_lightmap_editor_plugin.cpp b/editor/plugins/baked_lightmap_editor_plugin.cpp index 8fbe1646f7..ee9feb7f74 100644 --- a/editor/plugins/baked_lightmap_editor_plugin.cpp +++ b/editor/plugins/baked_lightmap_editor_plugin.cpp @@ -117,7 +117,8 @@ void BakedLightmapEditorPlugin::_bind_methods() { BakedLightmapEditorPlugin::BakedLightmapEditorPlugin(EditorNode *p_node) { editor = p_node; - bake = memnew(ToolButton); + bake = memnew(Button); + bake->set_flat(true); bake->set_icon(editor->get_gui_base()->get_theme_icon("Bake", "EditorIcons")); bake->set_text(TTR("Bake Lightmaps")); bake->hide(); diff --git a/editor/plugins/baked_lightmap_editor_plugin.h b/editor/plugins/baked_lightmap_editor_plugin.h index 67fb368a86..54eb0f71ec 100644 --- a/editor/plugins/baked_lightmap_editor_plugin.h +++ b/editor/plugins/baked_lightmap_editor_plugin.h @@ -41,7 +41,7 @@ class BakedLightmapEditorPlugin : public EditorPlugin { BakedLightmap *lightmap; - ToolButton *bake; + Button *bake; EditorNode *editor; EditorFileDialog *file_dialog; diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 2f7080b1a5..4797ae642e 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -4447,7 +4447,7 @@ void CanvasItemEditor::_button_override_camera(bool p_pressed) { } void CanvasItemEditor::_button_tool_select(int p_index) { - ToolButton *tb[TOOL_MAX] = { select_button, list_select_button, move_button, scale_button, rotate_button, pivot_button, pan_button, ruler_button }; + Button *tb[TOOL_MAX] = { select_button, list_select_button, move_button, scale_button, rotate_button, pivot_button, pan_button, ruler_button }; for (int i = 0; i < TOOL_MAX; i++) { tb[i]->set_pressed(i == p_index); } @@ -5577,13 +5577,15 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { viewport->add_child(controls_vb); - zoom_minus = memnew(ToolButton); + zoom_minus = memnew(Button); + zoom_minus->set_flat(true); zoom_hb->add_child(zoom_minus); zoom_minus->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_zoom_minus)); zoom_minus->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_minus", TTR("Zoom Out"), KEY_MASK_CMD | KEY_MINUS)); zoom_minus->set_focus_mode(FOCUS_NONE); - zoom_reset = memnew(ToolButton); + zoom_reset = memnew(Button); + zoom_reset->set_flat(true); zoom_hb->add_child(zoom_reset); zoom_reset->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_zoom_reset)); zoom_reset->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_reset", TTR("Zoom Reset"), KEY_MASK_CMD | KEY_0)); @@ -5592,7 +5594,8 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { // Prevent the button's size from changing when the text size changes zoom_reset->set_custom_minimum_size(Size2(75 * EDSCALE, 0)); - zoom_plus = memnew(ToolButton); + zoom_plus = memnew(Button); + zoom_plus->set_flat(true); zoom_hb->add_child(zoom_plus); zoom_plus->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_zoom_plus)); zoom_plus->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_plus", TTR("Zoom In"), KEY_MASK_CMD | KEY_EQUAL)); // Usually direct access key for PLUS @@ -5600,7 +5603,8 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { updating_scroll = false; - select_button = memnew(ToolButton); + select_button = memnew(Button); + select_button->set_flat(true); hb->add_child(select_button); select_button->set_toggle_mode(true); select_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_SELECT)); @@ -5610,21 +5614,24 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { hb->add_child(memnew(VSeparator)); - move_button = memnew(ToolButton); + move_button = memnew(Button); + move_button->set_flat(true); hb->add_child(move_button); move_button->set_toggle_mode(true); move_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_MOVE)); move_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/move_mode", TTR("Move Mode"), KEY_W)); move_button->set_tooltip(TTR("Move Mode")); - rotate_button = memnew(ToolButton); + rotate_button = memnew(Button); + rotate_button->set_flat(true); hb->add_child(rotate_button); rotate_button->set_toggle_mode(true); rotate_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_ROTATE)); rotate_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/rotate_mode", TTR("Rotate Mode"), KEY_E)); rotate_button->set_tooltip(TTR("Rotate Mode")); - scale_button = memnew(ToolButton); + scale_button = memnew(Button); + scale_button->set_flat(true); hb->add_child(scale_button); scale_button->set_toggle_mode(true); scale_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_SCALE)); @@ -5633,26 +5640,30 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { hb->add_child(memnew(VSeparator)); - list_select_button = memnew(ToolButton); + list_select_button = memnew(Button); + list_select_button->set_flat(true); hb->add_child(list_select_button); list_select_button->set_toggle_mode(true); list_select_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_LIST_SELECT)); list_select_button->set_tooltip(TTR("Show a list of all objects at the position clicked\n(same as Alt+RMB in select mode).")); - pivot_button = memnew(ToolButton); + pivot_button = memnew(Button); + pivot_button->set_flat(true); hb->add_child(pivot_button); pivot_button->set_toggle_mode(true); pivot_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_EDIT_PIVOT)); pivot_button->set_tooltip(TTR("Click to change object's rotation pivot.")); - pan_button = memnew(ToolButton); + pan_button = memnew(Button); + pan_button->set_flat(true); hb->add_child(pan_button); pan_button->set_toggle_mode(true); pan_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_PAN)); pan_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/pan_mode", TTR("Pan Mode"), KEY_G)); pan_button->set_tooltip(TTR("Pan Mode")); - ruler_button = memnew(ToolButton); + ruler_button = memnew(Button); + ruler_button->set_flat(true); hb->add_child(ruler_button); ruler_button->set_toggle_mode(true); ruler_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_RULER)); @@ -5661,14 +5672,16 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { hb->add_child(memnew(VSeparator)); - smart_snap_button = memnew(ToolButton); + smart_snap_button = memnew(Button); + smart_snap_button->set_flat(true); hb->add_child(smart_snap_button); smart_snap_button->set_toggle_mode(true); smart_snap_button->connect("toggled", callable_mp(this, &CanvasItemEditor::_button_toggle_smart_snap)); smart_snap_button->set_tooltip(TTR("Toggle smart snapping.")); smart_snap_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/use_smart_snap", TTR("Use Smart Snap"), KEY_MASK_SHIFT | KEY_S)); - grid_snap_button = memnew(ToolButton); + grid_snap_button = memnew(Button); + grid_snap_button->set_flat(true); hb->add_child(grid_snap_button); grid_snap_button->set_toggle_mode(true); grid_snap_button->connect("toggled", callable_mp(this, &CanvasItemEditor::_button_toggle_grid_snap)); @@ -5707,23 +5720,27 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { hb->add_child(memnew(VSeparator)); - lock_button = memnew(ToolButton); + lock_button = memnew(Button); + lock_button->set_flat(true); hb->add_child(lock_button); lock_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback), varray(LOCK_SELECTED)); lock_button->set_tooltip(TTR("Lock the selected object in place (can't be moved).")); - unlock_button = memnew(ToolButton); + unlock_button = memnew(Button); + unlock_button->set_flat(true); hb->add_child(unlock_button); unlock_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback), varray(UNLOCK_SELECTED)); unlock_button->set_tooltip(TTR("Unlock the selected object (can be moved).")); - group_button = memnew(ToolButton); + group_button = memnew(Button); + group_button->set_flat(true); hb->add_child(group_button); group_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback), varray(GROUP_SELECTED)); group_button->set_tooltip(TTR("Makes sure the object's children are not selectable.")); - ungroup_button = memnew(ToolButton); + ungroup_button = memnew(Button); + ungroup_button->set_flat(true); hb->add_child(ungroup_button); ungroup_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback), varray(UNGROUP_SELECTED)); ungroup_button->set_tooltip(TTR("Restores the object's children's ability to be selected.")); @@ -5748,7 +5765,8 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { hb->add_child(memnew(VSeparator)); - override_camera_button = memnew(ToolButton); + override_camera_button = memnew(Button); + override_camera_button->set_flat(true); hb->add_child(override_camera_button); override_camera_button->connect("toggled", callable_mp(this, &CanvasItemEditor::_button_override_camera)); override_camera_button->set_toggle_mode(true); @@ -5795,7 +5813,8 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { anchors_popup->set_name("Anchors"); anchors_popup->connect("id_pressed", callable_mp(this, &CanvasItemEditor::_popup_callback)); - anchor_mode_button = memnew(ToolButton); + anchor_mode_button = memnew(Button); + anchor_mode_button->set_flat(true); hb->add_child(anchor_mode_button); anchor_mode_button->set_toggle_mode(true); anchor_mode_button->hide(); diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index 765d5f81d0..c5d74c6fc9 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -228,9 +228,9 @@ private: VScrollBar *v_scroll; HBoxContainer *hb; - ToolButton *zoom_minus; - ToolButton *zoom_reset; - ToolButton *zoom_plus; + Button *zoom_minus; + Button *zoom_reset; + Button *zoom_plus; Map<Control *, Timer *> popup_temporarily_timers; @@ -336,31 +336,31 @@ private: }; List<PoseClipboard> pose_clipboard; - ToolButton *select_button; + Button *select_button; - ToolButton *move_button; - ToolButton *scale_button; - ToolButton *rotate_button; + Button *move_button; + Button *scale_button; + Button *rotate_button; - ToolButton *list_select_button; - ToolButton *pivot_button; - ToolButton *pan_button; + Button *list_select_button; + Button *pivot_button; + Button *pan_button; - ToolButton *ruler_button; + Button *ruler_button; - ToolButton *smart_snap_button; - ToolButton *grid_snap_button; + Button *smart_snap_button; + Button *grid_snap_button; MenuButton *snap_config_menu; PopupMenu *smartsnap_config_popup; - ToolButton *lock_button; - ToolButton *unlock_button; + Button *lock_button; + Button *unlock_button; - ToolButton *group_button; - ToolButton *ungroup_button; + Button *group_button; + Button *ungroup_button; MenuButton *skeleton_menu; - ToolButton *override_camera_button; + Button *override_camera_button; MenuButton *view_menu; HBoxContainer *animation_hb; MenuButton *animation_menu; @@ -369,7 +369,7 @@ private: PopupMenu *anchors_and_margins_popup; PopupMenu *anchors_popup; - ToolButton *anchor_mode_button; + Button *anchor_mode_button; Button *key_loc_button; Button *key_rot_button; diff --git a/editor/plugins/collision_polygon_3d_editor_plugin.cpp b/editor/plugins/collision_polygon_3d_editor_plugin.cpp index d9d9cf6a87..6eb17685f6 100644 --- a/editor/plugins/collision_polygon_3d_editor_plugin.cpp +++ b/editor/plugins/collision_polygon_3d_editor_plugin.cpp @@ -501,12 +501,14 @@ CollisionPolygon3DEditor::CollisionPolygon3DEditor(EditorNode *p_editor) { undo_redo = EditorNode::get_undo_redo(); add_child(memnew(VSeparator)); - button_create = memnew(ToolButton); + button_create = memnew(Button); + button_create->set_flat(true); add_child(button_create); button_create->connect("pressed", callable_mp(this, &CollisionPolygon3DEditor::_menu_option), varray(MODE_CREATE)); button_create->set_toggle_mode(true); - button_edit = memnew(ToolButton); + button_edit = memnew(Button); + button_edit->set_flat(true); add_child(button_edit); button_edit->connect("pressed", callable_mp(this, &CollisionPolygon3DEditor::_menu_option), varray(MODE_EDIT)); button_edit->set_toggle_mode(true); diff --git a/editor/plugins/collision_polygon_3d_editor_plugin.h b/editor/plugins/collision_polygon_3d_editor_plugin.h index 5215cbb678..05b8df520c 100644 --- a/editor/plugins/collision_polygon_3d_editor_plugin.h +++ b/editor/plugins/collision_polygon_3d_editor_plugin.h @@ -36,7 +36,6 @@ #include "scene/3d/collision_polygon_3d.h" #include "scene/3d/immediate_geometry_3d.h" #include "scene/3d/mesh_instance_3d.h" -#include "scene/gui/tool_button.h" class CanvasItemEditor; @@ -53,8 +52,8 @@ class CollisionPolygon3DEditor : public HBoxContainer { Mode mode; - ToolButton *button_create; - ToolButton *button_edit; + Button *button_create; + Button *button_edit; Ref<StandardMaterial3D> line_material; Ref<StandardMaterial3D> handle_material; diff --git a/editor/plugins/gi_probe_editor_plugin.cpp b/editor/plugins/gi_probe_editor_plugin.cpp index 94f771e643..1b48e17772 100644 --- a/editor/plugins/gi_probe_editor_plugin.cpp +++ b/editor/plugins/gi_probe_editor_plugin.cpp @@ -144,7 +144,8 @@ GIProbeEditorPlugin::GIProbeEditorPlugin(EditorNode *p_node) { bake_hb = memnew(HBoxContainer); bake_hb->set_h_size_flags(Control::SIZE_EXPAND_FILL); bake_hb->hide(); - bake = memnew(ToolButton); + bake = memnew(Button); + bake->set_flat(true); bake->set_icon(editor->get_gui_base()->get_theme_icon("Bake", "EditorIcons")); bake->set_text(TTR("Bake GI Probe")); bake->connect("pressed", callable_mp(this, &GIProbeEditorPlugin::_bake)); diff --git a/editor/plugins/gi_probe_editor_plugin.h b/editor/plugins/gi_probe_editor_plugin.h index 508c3d825b..e55f287908 100644 --- a/editor/plugins/gi_probe_editor_plugin.h +++ b/editor/plugins/gi_probe_editor_plugin.h @@ -43,7 +43,7 @@ class GIProbeEditorPlugin : public EditorPlugin { HBoxContainer *bake_hb; Label *bake_info; - ToolButton *bake; + Button *bake; EditorNode *editor; EditorFileDialog *probe_file; diff --git a/editor/plugins/item_list_editor_plugin.cpp b/editor/plugins/item_list_editor_plugin.cpp index 7402baad57..b4dcbdfe20 100644 --- a/editor/plugins/item_list_editor_plugin.cpp +++ b/editor/plugins/item_list_editor_plugin.cpp @@ -325,7 +325,8 @@ ItemListEditor::ItemListEditor() { selected_idx = -1; item_list = nullptr; - toolbar_button = memnew(ToolButton); + toolbar_button = memnew(Button); + toolbar_button->set_flat(true); toolbar_button->set_text(TTR("Items")); add_child(toolbar_button); toolbar_button->connect("pressed", callable_mp(this, &ItemListEditor::_edit_items)); diff --git a/editor/plugins/item_list_editor_plugin.h b/editor/plugins/item_list_editor_plugin.h index 61dd617e3b..d89631633c 100644 --- a/editor/plugins/item_list_editor_plugin.h +++ b/editor/plugins/item_list_editor_plugin.h @@ -198,7 +198,7 @@ class ItemListEditor : public HBoxContainer { Node *item_list; - ToolButton *toolbar_button; + Button *toolbar_button; AcceptDialog *dialog; EditorInspector *property_editor; diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 975957d56c..896471dab5 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -6048,7 +6048,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) { button_binds.resize(1); String sct; - tool_button[TOOL_MODE_SELECT] = memnew(ToolButton); + tool_button[TOOL_MODE_SELECT] = memnew(Button); hbc_menu->add_child(tool_button[TOOL_MODE_SELECT]); tool_button[TOOL_MODE_SELECT]->set_toggle_mode(true); tool_button[TOOL_MODE_SELECT]->set_flat(true); @@ -6060,7 +6060,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) { hbc_menu->add_child(memnew(VSeparator)); - tool_button[TOOL_MODE_MOVE] = memnew(ToolButton); + tool_button[TOOL_MODE_MOVE] = memnew(Button); hbc_menu->add_child(tool_button[TOOL_MODE_MOVE]); tool_button[TOOL_MODE_MOVE]->set_toggle_mode(true); tool_button[TOOL_MODE_MOVE]->set_flat(true); @@ -6068,7 +6068,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) { tool_button[TOOL_MODE_MOVE]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed), button_binds); tool_button[TOOL_MODE_MOVE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_move", TTR("Move Mode"), KEY_W)); - tool_button[TOOL_MODE_ROTATE] = memnew(ToolButton); + tool_button[TOOL_MODE_ROTATE] = memnew(Button); hbc_menu->add_child(tool_button[TOOL_MODE_ROTATE]); tool_button[TOOL_MODE_ROTATE]->set_toggle_mode(true); tool_button[TOOL_MODE_ROTATE]->set_flat(true); @@ -6076,7 +6076,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) { tool_button[TOOL_MODE_ROTATE]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed), button_binds); tool_button[TOOL_MODE_ROTATE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_rotate", TTR("Rotate Mode"), KEY_E)); - tool_button[TOOL_MODE_SCALE] = memnew(ToolButton); + tool_button[TOOL_MODE_SCALE] = memnew(Button); hbc_menu->add_child(tool_button[TOOL_MODE_SCALE]); tool_button[TOOL_MODE_SCALE]->set_toggle_mode(true); tool_button[TOOL_MODE_SCALE]->set_flat(true); @@ -6086,7 +6086,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) { hbc_menu->add_child(memnew(VSeparator)); - tool_button[TOOL_MODE_LIST_SELECT] = memnew(ToolButton); + tool_button[TOOL_MODE_LIST_SELECT] = memnew(Button); hbc_menu->add_child(tool_button[TOOL_MODE_LIST_SELECT]); tool_button[TOOL_MODE_LIST_SELECT]->set_toggle_mode(true); tool_button[TOOL_MODE_LIST_SELECT]->set_flat(true); @@ -6094,25 +6094,25 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) { tool_button[TOOL_MODE_LIST_SELECT]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed), button_binds); tool_button[TOOL_MODE_LIST_SELECT]->set_tooltip(TTR("Show a list of all objects at the position clicked\n(same as Alt+RMB in select mode).")); - tool_button[TOOL_LOCK_SELECTED] = memnew(ToolButton); + tool_button[TOOL_LOCK_SELECTED] = memnew(Button); hbc_menu->add_child(tool_button[TOOL_LOCK_SELECTED]); button_binds.write[0] = MENU_LOCK_SELECTED; tool_button[TOOL_LOCK_SELECTED]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed), button_binds); tool_button[TOOL_LOCK_SELECTED]->set_tooltip(TTR("Lock the selected object in place (can't be moved).")); - tool_button[TOOL_UNLOCK_SELECTED] = memnew(ToolButton); + tool_button[TOOL_UNLOCK_SELECTED] = memnew(Button); hbc_menu->add_child(tool_button[TOOL_UNLOCK_SELECTED]); button_binds.write[0] = MENU_UNLOCK_SELECTED; tool_button[TOOL_UNLOCK_SELECTED]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed), button_binds); tool_button[TOOL_UNLOCK_SELECTED]->set_tooltip(TTR("Unlock the selected object (can be moved).")); - tool_button[TOOL_GROUP_SELECTED] = memnew(ToolButton); + tool_button[TOOL_GROUP_SELECTED] = memnew(Button); hbc_menu->add_child(tool_button[TOOL_GROUP_SELECTED]); button_binds.write[0] = MENU_GROUP_SELECTED; tool_button[TOOL_GROUP_SELECTED]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed), button_binds); tool_button[TOOL_GROUP_SELECTED]->set_tooltip(TTR("Makes sure the object's children are not selectable.")); - tool_button[TOOL_UNGROUP_SELECTED] = memnew(ToolButton); + tool_button[TOOL_UNGROUP_SELECTED] = memnew(Button); hbc_menu->add_child(tool_button[TOOL_UNGROUP_SELECTED]); button_binds.write[0] = MENU_UNGROUP_SELECTED; tool_button[TOOL_UNGROUP_SELECTED]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed), button_binds); @@ -6120,7 +6120,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) { hbc_menu->add_child(memnew(VSeparator)); - tool_option_button[TOOL_OPT_LOCAL_COORDS] = memnew(ToolButton); + tool_option_button[TOOL_OPT_LOCAL_COORDS] = memnew(Button); hbc_menu->add_child(tool_option_button[TOOL_OPT_LOCAL_COORDS]); tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_toggle_mode(true); tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_flat(true); @@ -6128,7 +6128,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) { tool_option_button[TOOL_OPT_LOCAL_COORDS]->connect("toggled", callable_mp(this, &Node3DEditor::_menu_item_toggled), button_binds); tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_shortcut(ED_SHORTCUT("spatial_editor/local_coords", TTR("Use Local Space"), KEY_T)); - tool_option_button[TOOL_OPT_USE_SNAP] = memnew(ToolButton); + tool_option_button[TOOL_OPT_USE_SNAP] = memnew(Button); hbc_menu->add_child(tool_option_button[TOOL_OPT_USE_SNAP]); tool_option_button[TOOL_OPT_USE_SNAP]->set_toggle_mode(true); tool_option_button[TOOL_OPT_USE_SNAP]->set_flat(true); @@ -6138,7 +6138,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) { hbc_menu->add_child(memnew(VSeparator)); - tool_option_button[TOOL_OPT_OVERRIDE_CAMERA] = memnew(ToolButton); + tool_option_button[TOOL_OPT_OVERRIDE_CAMERA] = memnew(Button); hbc_menu->add_child(tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]); tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->set_toggle_mode(true); tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->set_flat(true); diff --git a/editor/plugins/path_2d_editor_plugin.cpp b/editor/plugins/path_2d_editor_plugin.cpp index a3dab665b8..f79098ce5d 100644 --- a/editor/plugins/path_2d_editor_plugin.cpp +++ b/editor/plugins/path_2d_editor_plugin.cpp @@ -532,35 +532,40 @@ Path2DEditor::Path2DEditor(EditorNode *p_editor) { sep = memnew(VSeparator); base_hb->add_child(sep); - curve_edit = memnew(ToolButton); + curve_edit = memnew(Button); + curve_edit->set_flat(true); curve_edit->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("CurveEdit", "EditorIcons")); curve_edit->set_toggle_mode(true); curve_edit->set_focus_mode(Control::FOCUS_NONE); curve_edit->set_tooltip(TTR("Select Points") + "\n" + TTR("Shift+Drag: Select Control Points") + "\n" + keycode_get_string(KEY_MASK_CMD) + TTR("Click: Add Point") + "\n" + TTR("Left Click: Split Segment (in curve)") + "\n" + TTR("Right Click: Delete Point")); curve_edit->connect("pressed", callable_mp(this, &Path2DEditor::_mode_selected), varray(MODE_EDIT)); base_hb->add_child(curve_edit); - curve_edit_curve = memnew(ToolButton); + curve_edit_curve = memnew(Button); + curve_edit_curve->set_flat(true); curve_edit_curve->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("CurveCurve", "EditorIcons")); curve_edit_curve->set_toggle_mode(true); curve_edit_curve->set_focus_mode(Control::FOCUS_NONE); curve_edit_curve->set_tooltip(TTR("Select Control Points (Shift+Drag)")); curve_edit_curve->connect("pressed", callable_mp(this, &Path2DEditor::_mode_selected), varray(MODE_EDIT_CURVE)); base_hb->add_child(curve_edit_curve); - curve_create = memnew(ToolButton); + curve_create = memnew(Button); + curve_create->set_flat(true); curve_create->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("CurveCreate", "EditorIcons")); curve_create->set_toggle_mode(true); curve_create->set_focus_mode(Control::FOCUS_NONE); curve_create->set_tooltip(TTR("Add Point (in empty space)")); curve_create->connect("pressed", callable_mp(this, &Path2DEditor::_mode_selected), varray(MODE_CREATE)); base_hb->add_child(curve_create); - curve_del = memnew(ToolButton); + curve_del = memnew(Button); + curve_del->set_flat(true); curve_del->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("CurveDelete", "EditorIcons")); curve_del->set_toggle_mode(true); curve_del->set_focus_mode(Control::FOCUS_NONE); curve_del->set_tooltip(TTR("Delete Point")); curve_del->connect("pressed", callable_mp(this, &Path2DEditor::_mode_selected), varray(MODE_DELETE)); base_hb->add_child(curve_del); - curve_close = memnew(ToolButton); + curve_close = memnew(Button); + curve_close->set_flat(true); curve_close->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("CurveClose", "EditorIcons")); curve_close->set_focus_mode(Control::FOCUS_NONE); curve_close->set_tooltip(TTR("Close Curve")); diff --git a/editor/plugins/path_2d_editor_plugin.h b/editor/plugins/path_2d_editor_plugin.h index 390dfdfdf7..d0c02b28d4 100644 --- a/editor/plugins/path_2d_editor_plugin.h +++ b/editor/plugins/path_2d_editor_plugin.h @@ -34,7 +34,6 @@ #include "editor/editor_node.h" #include "editor/editor_plugin.h" #include "scene/2d/path_2d.h" -#include "scene/gui/tool_button.h" class CanvasItemEditor; @@ -60,11 +59,11 @@ class Path2DEditor : public HBoxContainer { }; Mode mode; - ToolButton *curve_create; - ToolButton *curve_edit; - ToolButton *curve_edit_curve; - ToolButton *curve_del; - ToolButton *curve_close; + Button *curve_create; + Button *curve_edit; + Button *curve_edit_curve; + Button *curve_del; + Button *curve_close; MenuButton *handle_menu; bool mirror_handle_angle; diff --git a/editor/plugins/path_3d_editor_plugin.cpp b/editor/plugins/path_3d_editor_plugin.cpp index 25cffa3d6c..f53130c24d 100644 --- a/editor/plugins/path_3d_editor_plugin.cpp +++ b/editor/plugins/path_3d_editor_plugin.cpp @@ -557,28 +557,32 @@ Path3DEditorPlugin::Path3DEditorPlugin(EditorNode *p_node) { sep = memnew(VSeparator); sep->hide(); Node3DEditor::get_singleton()->add_control_to_menu_panel(sep); - curve_edit = memnew(ToolButton); + curve_edit = memnew(Button); + curve_edit->set_flat(true); curve_edit->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("CurveEdit", "EditorIcons")); curve_edit->set_toggle_mode(true); curve_edit->hide(); curve_edit->set_focus_mode(Control::FOCUS_NONE); curve_edit->set_tooltip(TTR("Select Points") + "\n" + TTR("Shift+Drag: Select Control Points") + "\n" + keycode_get_string(KEY_MASK_CMD) + TTR("Click: Add Point") + "\n" + TTR("Right Click: Delete Point")); Node3DEditor::get_singleton()->add_control_to_menu_panel(curve_edit); - curve_create = memnew(ToolButton); + curve_create = memnew(Button); + curve_create->set_flat(true); curve_create->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("CurveCreate", "EditorIcons")); curve_create->set_toggle_mode(true); curve_create->hide(); curve_create->set_focus_mode(Control::FOCUS_NONE); curve_create->set_tooltip(TTR("Add Point (in empty space)") + "\n" + TTR("Split Segment (in curve)")); Node3DEditor::get_singleton()->add_control_to_menu_panel(curve_create); - curve_del = memnew(ToolButton); + curve_del = memnew(Button); + curve_del->set_flat(true); curve_del->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("CurveDelete", "EditorIcons")); curve_del->set_toggle_mode(true); curve_del->hide(); curve_del->set_focus_mode(Control::FOCUS_NONE); curve_del->set_tooltip(TTR("Delete Point")); Node3DEditor::get_singleton()->add_control_to_menu_panel(curve_del); - curve_close = memnew(ToolButton); + curve_close = memnew(Button); + curve_close->set_flat(true); curve_close->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("CurveClose", "EditorIcons")); curve_close->hide(); curve_close->set_focus_mode(Control::FOCUS_NONE); diff --git a/editor/plugins/path_3d_editor_plugin.h b/editor/plugins/path_3d_editor_plugin.h index 8bec5df797..3a75717b73 100644 --- a/editor/plugins/path_3d_editor_plugin.h +++ b/editor/plugins/path_3d_editor_plugin.h @@ -68,10 +68,10 @@ class Path3DEditorPlugin : public EditorPlugin { GDCLASS(Path3DEditorPlugin, EditorPlugin); Separator *sep; - ToolButton *curve_create; - ToolButton *curve_edit; - ToolButton *curve_del; - ToolButton *curve_close; + Button *curve_create; + Button *curve_edit; + Button *curve_del; + Button *curve_close; MenuButton *handle_menu; EditorNode *editor; diff --git a/editor/plugins/physical_bone_3d_editor_plugin.cpp b/editor/plugins/physical_bone_3d_editor_plugin.cpp index bcbf88e7dc..30bf827b3c 100644 --- a/editor/plugins/physical_bone_3d_editor_plugin.cpp +++ b/editor/plugins/physical_bone_3d_editor_plugin.cpp @@ -55,7 +55,8 @@ PhysicalBone3DEditor::PhysicalBone3DEditor(EditorNode *p_editor) : spatial_editor_hb->add_child(memnew(VSeparator)); - button_transform_joint = memnew(ToolButton); + button_transform_joint = memnew(Button); + button_transform_joint->set_flat(true); spatial_editor_hb->add_child(button_transform_joint); button_transform_joint->set_text(TTR("Move Joint")); diff --git a/editor/plugins/physical_bone_3d_editor_plugin.h b/editor/plugins/physical_bone_3d_editor_plugin.h index 79c7cc4bb1..8699176fe0 100644 --- a/editor/plugins/physical_bone_3d_editor_plugin.h +++ b/editor/plugins/physical_bone_3d_editor_plugin.h @@ -38,7 +38,7 @@ class PhysicalBone3DEditor : public Object { EditorNode *editor; HBoxContainer *spatial_editor_hb; - ToolButton *button_transform_joint; + Button *button_transform_joint; PhysicalBone3D *selected = nullptr; diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index 1f98c0139b..1d273f74f0 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -1214,7 +1214,8 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : use_snap = EditorSettings::get_singleton()->get_project_metadata("polygon_2d_uv_editor", "snap_enabled", false); snap_show_grid = EditorSettings::get_singleton()->get_project_metadata("polygon_2d_uv_editor", "show_grid", false); - button_uv = memnew(ToolButton); + button_uv = memnew(Button); + button_uv->set_flat(true); add_child(button_uv); button_uv->set_tooltip(TTR("Open Polygon 2D UV editor.")); button_uv->connect("pressed", callable_mp(this, &Polygon2DEditor::_menu_option), varray(MODE_EDIT_UV)); @@ -1231,16 +1232,16 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : uv_edit_group.instance(); - uv_edit_mode[0] = memnew(ToolButton); + uv_edit_mode[0] = memnew(Button); uv_mode_hb->add_child(uv_edit_mode[0]); uv_edit_mode[0]->set_toggle_mode(true); - uv_edit_mode[1] = memnew(ToolButton); + uv_edit_mode[1] = memnew(Button); uv_mode_hb->add_child(uv_edit_mode[1]); uv_edit_mode[1]->set_toggle_mode(true); - uv_edit_mode[2] = memnew(ToolButton); + uv_edit_mode[2] = memnew(Button); uv_mode_hb->add_child(uv_edit_mode[2]); uv_edit_mode[2]->set_toggle_mode(true); - uv_edit_mode[3] = memnew(ToolButton); + uv_edit_mode[3] = memnew(Button); uv_mode_hb->add_child(uv_edit_mode[3]); uv_edit_mode[3]->set_toggle_mode(true); @@ -1264,7 +1265,7 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : uv_main_vb->add_child(uv_mode_hb); for (int i = 0; i < UV_MODE_MAX; i++) { - uv_button[i] = memnew(ToolButton); + uv_button[i] = memnew(Button); uv_button[i]->set_toggle_mode(true); uv_mode_hb->add_child(uv_button[i]); uv_button[i]->connect("pressed", callable_mp(this, &Polygon2DEditor::_uv_mode), varray(i)); @@ -1334,7 +1335,8 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : uv_mode_hb->add_child(memnew(VSeparator)); - b_snap_enable = memnew(ToolButton); + b_snap_enable = memnew(Button); + b_snap_enable->set_flat(true); uv_mode_hb->add_child(b_snap_enable); b_snap_enable->set_text(TTR("Snap")); b_snap_enable->set_focus_mode(FOCUS_NONE); @@ -1343,7 +1345,8 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : b_snap_enable->set_tooltip(TTR("Enable Snap")); b_snap_enable->connect("toggled", callable_mp(this, &Polygon2DEditor::_set_use_snap)); - b_snap_grid = memnew(ToolButton); + b_snap_grid = memnew(Button); + b_snap_grid->set_flat(true); uv_mode_hb->add_child(b_snap_grid); b_snap_grid->set_text(TTR("Grid")); b_snap_grid->set_focus_mode(FOCUS_NONE); diff --git a/editor/plugins/polygon_2d_editor_plugin.h b/editor/plugins/polygon_2d_editor_plugin.h index b94ae53e2b..33ea7722ac 100644 --- a/editor/plugins/polygon_2d_editor_plugin.h +++ b/editor/plugins/polygon_2d_editor_plugin.h @@ -60,16 +60,16 @@ class Polygon2DEditor : public AbstractPolygon2DEditor { UV_MODE_MAX }; - ToolButton *uv_edit_mode[4]; + Button *uv_edit_mode[4]; Ref<ButtonGroup> uv_edit_group; Polygon2D *node; UVMode uv_mode; AcceptDialog *uv_edit; - ToolButton *uv_button[UV_MODE_MAX]; - ToolButton *b_snap_enable; - ToolButton *b_snap_grid; + Button *uv_button[UV_MODE_MAX]; + Button *b_snap_enable; + Button *b_snap_grid; Panel *uv_edit_draw; HSlider *uv_zoom; SpinBox *uv_zoom_value; @@ -115,7 +115,7 @@ class Polygon2DEditor : public AbstractPolygon2DEditor { AcceptDialog *error; - ToolButton *button_uv; + Button *button_uv; bool use_snap; bool snap_show_grid; diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 48a9febcf9..3f17bf57c4 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -2988,7 +2988,8 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { filename->add_theme_style_override("normal", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("normal", "LineEdit")); buttons_hbox->add_child(filename); - members_overview_alphabeta_sort_button = memnew(ToolButton); + members_overview_alphabeta_sort_button = memnew(Button); + members_overview_alphabeta_sort_button->set_flat(true); members_overview_alphabeta_sort_button->set_tooltip(TTR("Toggle alphabetical sorting of the method list.")); members_overview_alphabeta_sort_button->set_toggle_mode(true); members_overview_alphabeta_sort_button->set_pressed(EditorSettings::get_singleton()->get("text_editor/tools/sort_members_outline_alphabetically")); @@ -3115,13 +3116,15 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { menu_hb->add_spacer(); - site_search = memnew(ToolButton); + site_search = memnew(Button); + site_search->set_flat(true); site_search->set_text(TTR("Online Docs")); site_search->connect("pressed", callable_mp(this, &ScriptEditor::_menu_option), varray(SEARCH_WEBSITE)); menu_hb->add_child(site_search); site_search->set_tooltip(TTR("Open Godot online documentation.")); - help_search = memnew(ToolButton); + help_search = memnew(Button); + help_search->set_flat(true); help_search->set_text(TTR("Search Help")); help_search->connect("pressed", callable_mp(this, &ScriptEditor::_menu_option), varray(SEARCH_HELP)); menu_hb->add_child(help_search); @@ -3129,13 +3132,15 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { menu_hb->add_child(memnew(VSeparator)); - script_back = memnew(ToolButton); + script_back = memnew(Button); + script_back->set_flat(true); script_back->connect("pressed", callable_mp(this, &ScriptEditor::_history_back)); menu_hb->add_child(script_back); script_back->set_disabled(true); script_back->set_tooltip(TTR("Go to previous edited document.")); - script_forward = memnew(ToolButton); + script_forward = memnew(Button); + script_forward->set_flat(true); script_forward->connect("pressed", callable_mp(this, &ScriptEditor::_history_forward)); menu_hb->add_child(script_forward); script_forward->set_disabled(true); diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index f7352be7e8..8c4b7de27d 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -43,7 +43,6 @@ #include "scene/gui/split_container.h" #include "scene/gui/tab_container.h" #include "scene/gui/text_edit.h" -#include "scene/gui/tool_button.h" #include "scene/gui/tree.h" #include "scene/main/timer.h" #include "scene/resources/text_file.h" @@ -211,7 +210,7 @@ class ScriptEditor : public PanelContainer { VBoxContainer *overview_vbox; HBoxContainer *buttons_hbox; Label *filename; - ToolButton *members_overview_alphabeta_sort_button; + Button *members_overview_alphabeta_sort_button; bool members_overview_enabled; ItemList *help_overview; bool help_overview_enabled; @@ -221,15 +220,15 @@ class ScriptEditor : public PanelContainer { AcceptDialog *error_dialog; ConfirmationDialog *erase_tab_confirm; ScriptCreateDialog *script_create_dialog; - ToolButton *scripts_visible; + Button *scripts_visible; String current_theme; TextureRect *script_icon; Label *script_name_label; - ToolButton *script_back; - ToolButton *script_forward; + Button *script_back; + Button *script_forward; FindInFilesDialog *find_in_files_dialog; FindInFilesPanel *find_in_files; diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index 859fec1628..7102faf58a 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -873,12 +873,14 @@ SpriteFramesEditor::SpriteFramesEditor() { HBoxContainer *hbc_animlist = memnew(HBoxContainer); sub_vb->add_child(hbc_animlist); - new_anim = memnew(ToolButton); + new_anim = memnew(Button); + new_anim->set_flat(true); new_anim->set_tooltip(TTR("New Animation")); hbc_animlist->add_child(new_anim); new_anim->connect("pressed", callable_mp(this, &SpriteFramesEditor::_animation_add)); - remove_anim = memnew(ToolButton); + remove_anim = memnew(Button); + remove_anim->set_flat(true); remove_anim->set_tooltip(TTR("Remove Animation")); hbc_animlist->add_child(remove_anim); remove_anim->connect("pressed", callable_mp(this, &SpriteFramesEditor::_animation_remove)); @@ -913,45 +915,54 @@ SpriteFramesEditor::SpriteFramesEditor() { HBoxContainer *hbc = memnew(HBoxContainer); sub_vb->add_child(hbc); - load = memnew(ToolButton); + load = memnew(Button); + load->set_flat(true); load->set_tooltip(TTR("Add a Texture from File")); hbc->add_child(load); - load_sheet = memnew(ToolButton); + load_sheet = memnew(Button); + load_sheet->set_flat(true); load_sheet->set_tooltip(TTR("Add Frames from a Sprite Sheet")); hbc->add_child(load_sheet); hbc->add_child(memnew(VSeparator)); - copy = memnew(ToolButton); + copy = memnew(Button); + copy->set_flat(true); copy->set_tooltip(TTR("Copy")); hbc->add_child(copy); - paste = memnew(ToolButton); + paste = memnew(Button); + paste->set_flat(true); paste->set_tooltip(TTR("Paste")); hbc->add_child(paste); hbc->add_child(memnew(VSeparator)); - empty = memnew(ToolButton); + empty = memnew(Button); + empty->set_flat(true); empty->set_tooltip(TTR("Insert Empty (Before)")); hbc->add_child(empty); - empty2 = memnew(ToolButton); + empty2 = memnew(Button); + empty2->set_flat(true); empty2->set_tooltip(TTR("Insert Empty (After)")); hbc->add_child(empty2); hbc->add_child(memnew(VSeparator)); - move_up = memnew(ToolButton); + move_up = memnew(Button); + move_up->set_flat(true); move_up->set_tooltip(TTR("Move (Before)")); hbc->add_child(move_up); - move_down = memnew(ToolButton); + move_down = memnew(Button); + move_down->set_flat(true); move_down->set_tooltip(TTR("Move (After)")); hbc->add_child(move_down); - _delete = memnew(ToolButton); + _delete = memnew(Button); + _delete->set_flat(true); _delete->set_tooltip(TTR("Delete")); hbc->add_child(_delete); diff --git a/editor/plugins/sprite_frames_editor_plugin.h b/editor/plugins/sprite_frames_editor_plugin.h index 45646eb9e4..c050ae484b 100644 --- a/editor/plugins/sprite_frames_editor_plugin.h +++ b/editor/plugins/sprite_frames_editor_plugin.h @@ -43,22 +43,22 @@ class SpriteFramesEditor : public HSplitContainer { GDCLASS(SpriteFramesEditor, HSplitContainer); - ToolButton *load; - ToolButton *load_sheet; - ToolButton *_delete; - ToolButton *copy; - ToolButton *paste; - ToolButton *empty; - ToolButton *empty2; - ToolButton *move_up; - ToolButton *move_down; + Button *load; + Button *load_sheet; + Button *_delete; + Button *copy; + Button *paste; + Button *empty; + Button *empty2; + Button *move_up; + Button *move_down; ItemList *tree; bool loading_scene; int sel; HSplitContainer *split; - ToolButton *new_anim; - ToolButton *remove_anim; + Button *new_anim; + Button *remove_anim; Tree *animations; SpinBox *anim_speed; diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index 9b8b111be5..3a92818779 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -1037,17 +1037,20 @@ TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) { edit_draw->add_child(zoom_hb); zoom_hb->set_begin(Point2(5, 5)); - zoom_out = memnew(ToolButton); + zoom_out = memnew(Button); + zoom_out->set_flat(true); zoom_out->set_tooltip(TTR("Zoom Out")); zoom_out->connect("pressed", callable_mp(this, &TextureRegionEditor::_zoom_out)); zoom_hb->add_child(zoom_out); - zoom_reset = memnew(ToolButton); + zoom_reset = memnew(Button); + zoom_reset->set_flat(true); zoom_reset->set_tooltip(TTR("Zoom Reset")); zoom_reset->connect("pressed", callable_mp(this, &TextureRegionEditor::_zoom_reset)); zoom_hb->add_child(zoom_reset); - zoom_in = memnew(ToolButton); + zoom_in = memnew(Button); + zoom_in->set_flat(true); zoom_in->set_tooltip(TTR("Zoom In")); zoom_in->connect("pressed", callable_mp(this, &TextureRegionEditor::_zoom_in)); zoom_hb->add_child(zoom_in); diff --git a/editor/plugins/texture_region_editor_plugin.h b/editor/plugins/texture_region_editor_plugin.h index 93da23fd50..8991603c0f 100644 --- a/editor/plugins/texture_region_editor_plugin.h +++ b/editor/plugins/texture_region_editor_plugin.h @@ -56,9 +56,9 @@ class TextureRegionEditor : public VBoxContainer { friend class TextureRegionEditorPlugin; OptionButton *snap_mode_button; - ToolButton *zoom_in; - ToolButton *zoom_reset; - ToolButton *zoom_out; + Button *zoom_in; + Button *zoom_reset; + Button *zoom_out; HBoxContainer *hb_grid; //For showing/hiding the grid controls when changing the SnapMode SpinBox *sb_step_y; SpinBox *sb_step_x; diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp index eb028659fd..43ace737c0 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -672,8 +672,9 @@ ThemeEditor::ThemeEditor() { bt->set_text(TTR("Disabled Button")); bt->set_disabled(true); first_vb->add_child(bt); - ToolButton *tb = memnew(ToolButton); - tb->set_text("ToolButton"); + Button *tb = memnew(Button); + tb->set_flat(true); + tb->set_text("Button"); first_vb->add_child(tb); CheckButton *cb = memnew(CheckButton); diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index 3281a59c1c..158f9e8587 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -91,7 +91,7 @@ void TileMapEditor::_notification(int p_what) { } void TileMapEditor::_update_button_tool() { - ToolButton *tb[4] = { paint_button, bucket_fill_button, picker_button, select_button }; + Button *tb[4] = { paint_button, bucket_fill_button, picker_button, select_button }; // Unpress all buttons for (int i = 0; i < 4; i++) { tb[i]->set_pressed(false); @@ -1959,26 +1959,30 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { toolbar->add_child(memnew(VSeparator)); // Tools. - paint_button = memnew(ToolButton); + paint_button = memnew(Button); + paint_button->set_flat(true); paint_button->set_shortcut(ED_SHORTCUT("tile_map_editor/paint_tile", TTR("Paint Tile"), KEY_P)); paint_button->set_tooltip(TTR("Shift+LMB: Line Draw\nShift+Ctrl+LMB: Rectangle Paint")); paint_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_NONE)); paint_button->set_toggle_mode(true); toolbar->add_child(paint_button); - bucket_fill_button = memnew(ToolButton); + bucket_fill_button = memnew(Button); + bucket_fill_button->set_flat(true); bucket_fill_button->set_shortcut(ED_SHORTCUT("tile_map_editor/bucket_fill", TTR("Bucket Fill"), KEY_B)); bucket_fill_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_BUCKET)); bucket_fill_button->set_toggle_mode(true); toolbar->add_child(bucket_fill_button); - picker_button = memnew(ToolButton); + picker_button = memnew(Button); + picker_button->set_flat(true); picker_button->set_shortcut(ED_SHORTCUT("tile_map_editor/pick_tile", TTR("Pick Tile"), KEY_I)); picker_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_PICKING)); picker_button->set_toggle_mode(true); toolbar->add_child(picker_button); - select_button = memnew(ToolButton); + select_button = memnew(Button); + select_button->set_flat(true); select_button->set_shortcut(ED_SHORTCUT("tile_map_editor/select", TTR("Select"), KEY_M)); select_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_SELECTING)); select_button->set_toggle_mode(true); @@ -2017,35 +2021,40 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { p->add_item(TTR("Fix Invalid Tiles"), OPTION_FIX_INVALID); p->connect("id_pressed", callable_mp(this, &TileMapEditor::_menu_option)); - rotate_left_button = memnew(ToolButton); + rotate_left_button = memnew(Button); + rotate_left_button->set_flat(true); rotate_left_button->set_tooltip(TTR("Rotate Left")); rotate_left_button->set_focus_mode(FOCUS_NONE); rotate_left_button->connect("pressed", callable_mp(this, &TileMapEditor::_rotate), varray(-1)); rotate_left_button->set_shortcut(ED_SHORTCUT("tile_map_editor/rotate_left", TTR("Rotate Left"), KEY_A)); tool_hb->add_child(rotate_left_button); - rotate_right_button = memnew(ToolButton); + rotate_right_button = memnew(Button); + rotate_right_button->set_flat(true); rotate_right_button->set_tooltip(TTR("Rotate Right")); rotate_right_button->set_focus_mode(FOCUS_NONE); rotate_right_button->connect("pressed", callable_mp(this, &TileMapEditor::_rotate), varray(1)); rotate_right_button->set_shortcut(ED_SHORTCUT("tile_map_editor/rotate_right", TTR("Rotate Right"), KEY_S)); tool_hb->add_child(rotate_right_button); - flip_horizontal_button = memnew(ToolButton); + flip_horizontal_button = memnew(Button); + flip_horizontal_button->set_flat(true); flip_horizontal_button->set_tooltip(TTR("Flip Horizontally")); flip_horizontal_button->set_focus_mode(FOCUS_NONE); flip_horizontal_button->connect("pressed", callable_mp(this, &TileMapEditor::_flip_horizontal)); flip_horizontal_button->set_shortcut(ED_SHORTCUT("tile_map_editor/flip_horizontal", TTR("Flip Horizontally"), KEY_X)); tool_hb->add_child(flip_horizontal_button); - flip_vertical_button = memnew(ToolButton); + flip_vertical_button = memnew(Button); + flip_vertical_button->set_flat(true); flip_vertical_button->set_tooltip(TTR("Flip Vertically")); flip_vertical_button->set_focus_mode(FOCUS_NONE); flip_vertical_button->connect("pressed", callable_mp(this, &TileMapEditor::_flip_vertical)); flip_vertical_button->set_shortcut(ED_SHORTCUT("tile_map_editor/flip_vertical", TTR("Flip Vertically"), KEY_Z)); tool_hb->add_child(flip_vertical_button); - clear_transform_button = memnew(ToolButton); + clear_transform_button = memnew(Button); + clear_transform_button->set_flat(true); clear_transform_button->set_tooltip(TTR("Clear Transform")); clear_transform_button->set_focus_mode(FOCUS_NONE); clear_transform_button->connect("pressed", callable_mp(this, &TileMapEditor::_clear_transform)); diff --git a/editor/plugins/tile_map_editor_plugin.h b/editor/plugins/tile_map_editor_plugin.h index e25e2d2add..1d2ecdb61f 100644 --- a/editor/plugins/tile_map_editor_plugin.h +++ b/editor/plugins/tile_map_editor_plugin.h @@ -38,7 +38,6 @@ #include "scene/gui/label.h" #include "scene/gui/line_edit.h" #include "scene/gui/menu_button.h" -#include "scene/gui/tool_button.h" class TileMapEditor : public VBoxContainer { GDCLASS(TileMapEditor, VBoxContainer); @@ -88,16 +87,16 @@ class TileMapEditor : public VBoxContainer { Label *tile_info; MenuButton *options; - ToolButton *paint_button; - ToolButton *bucket_fill_button; - ToolButton *picker_button; - ToolButton *select_button; + Button *paint_button; + Button *bucket_fill_button; + Button *picker_button; + Button *select_button; - ToolButton *flip_horizontal_button; - ToolButton *flip_vertical_button; - ToolButton *rotate_left_button; - ToolButton *rotate_right_button; - ToolButton *clear_transform_button; + Button *flip_horizontal_button; + Button *flip_vertical_button; + Button *rotate_left_button; + Button *rotate_right_button; + Button *clear_transform_button; CheckBox *manual_button; CheckBox *priority_button; diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index 07bf5b53cd..a37cf7e426 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -341,12 +341,12 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { HBoxContainer *tileset_toolbar_container = memnew(HBoxContainer); left_container->add_child(tileset_toolbar_container); - tileset_toolbar_buttons[TOOL_TILESET_ADD_TEXTURE] = memnew(ToolButton); + tileset_toolbar_buttons[TOOL_TILESET_ADD_TEXTURE] = memnew(Button); tileset_toolbar_buttons[TOOL_TILESET_ADD_TEXTURE]->connect("pressed", callable_mp(this, &TileSetEditor::_on_tileset_toolbar_button_pressed), varray(TOOL_TILESET_ADD_TEXTURE)); tileset_toolbar_container->add_child(tileset_toolbar_buttons[TOOL_TILESET_ADD_TEXTURE]); tileset_toolbar_buttons[TOOL_TILESET_ADD_TEXTURE]->set_tooltip(TTR("Add Texture(s) to TileSet.")); - tileset_toolbar_buttons[TOOL_TILESET_REMOVE_TEXTURE] = memnew(ToolButton); + tileset_toolbar_buttons[TOOL_TILESET_REMOVE_TEXTURE] = memnew(Button); tileset_toolbar_buttons[TOOL_TILESET_REMOVE_TEXTURE]->connect("pressed", callable_mp(this, &TileSetEditor::_on_tileset_toolbar_button_pressed), varray(TOOL_TILESET_REMOVE_TEXTURE)); tileset_toolbar_container->add_child(tileset_toolbar_buttons[TOOL_TILESET_REMOVE_TEXTURE]); tileset_toolbar_buttons[TOOL_TILESET_REMOVE_TEXTURE]->set_tooltip(TTR("Remove selected Texture from TileSet.")); @@ -402,13 +402,13 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { tool_hb->add_child(spacer); tool_hb->move_child(spacer, WORKSPACE_CREATE_SINGLE); - tools[SELECT_NEXT] = memnew(ToolButton); + tools[SELECT_NEXT] = memnew(Button); tool_hb->add_child(tools[SELECT_NEXT]); tool_hb->move_child(tools[SELECT_NEXT], WORKSPACE_CREATE_SINGLE); tools[SELECT_NEXT]->set_shortcut(ED_SHORTCUT("tileset_editor/next_shape", TTR("Next Coordinate"), KEY_PAGEDOWN)); tools[SELECT_NEXT]->connect("pressed", callable_mp(this, &TileSetEditor::_on_tool_clicked), varray(SELECT_NEXT)); tools[SELECT_NEXT]->set_tooltip(TTR("Select the next shape, subtile, or Tile.")); - tools[SELECT_PREVIOUS] = memnew(ToolButton); + tools[SELECT_PREVIOUS] = memnew(Button); tool_hb->add_child(tools[SELECT_PREVIOUS]); tool_hb->move_child(tools[SELECT_PREVIOUS], WORKSPACE_CREATE_SINGLE); tools[SELECT_PREVIOUS]->set_shortcut(ED_SHORTCUT("tileset_editor/previous_shape", TTR("Previous Coordinate"), KEY_PAGEUP)); @@ -465,7 +465,7 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { toolbar = memnew(HBoxContainer); Ref<ButtonGroup> tg(memnew(ButtonGroup)); - tools[TOOL_SELECT] = memnew(ToolButton); + tools[TOOL_SELECT] = memnew(Button); toolbar->add_child(tools[TOOL_SELECT]); tools[TOOL_SELECT]->set_toggle_mode(true); tools[TOOL_SELECT]->set_button_group(tg); @@ -474,27 +474,27 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { separator_bitmask = memnew(VSeparator); toolbar->add_child(separator_bitmask); - tools[BITMASK_COPY] = memnew(ToolButton); + tools[BITMASK_COPY] = memnew(Button); tools[BITMASK_COPY]->set_tooltip(TTR("Copy bitmask.")); tools[BITMASK_COPY]->connect("pressed", callable_mp(this, &TileSetEditor::_on_tool_clicked), varray(BITMASK_COPY)); toolbar->add_child(tools[BITMASK_COPY]); - tools[BITMASK_PASTE] = memnew(ToolButton); + tools[BITMASK_PASTE] = memnew(Button); tools[BITMASK_PASTE]->set_tooltip(TTR("Paste bitmask.")); tools[BITMASK_PASTE]->connect("pressed", callable_mp(this, &TileSetEditor::_on_tool_clicked), varray(BITMASK_PASTE)); toolbar->add_child(tools[BITMASK_PASTE]); - tools[BITMASK_CLEAR] = memnew(ToolButton); + tools[BITMASK_CLEAR] = memnew(Button); tools[BITMASK_CLEAR]->set_tooltip(TTR("Erase bitmask.")); tools[BITMASK_CLEAR]->connect("pressed", callable_mp(this, &TileSetEditor::_on_tool_clicked), varray(BITMASK_CLEAR)); toolbar->add_child(tools[BITMASK_CLEAR]); - tools[SHAPE_NEW_RECTANGLE] = memnew(ToolButton); + tools[SHAPE_NEW_RECTANGLE] = memnew(Button); toolbar->add_child(tools[SHAPE_NEW_RECTANGLE]); tools[SHAPE_NEW_RECTANGLE]->set_toggle_mode(true); tools[SHAPE_NEW_RECTANGLE]->set_button_group(tg); tools[SHAPE_NEW_RECTANGLE]->set_tooltip(TTR("Create a new rectangle.")); tools[SHAPE_NEW_RECTANGLE]->connect("pressed", callable_mp(this, &TileSetEditor::_on_tool_clicked), varray(SHAPE_NEW_RECTANGLE)); - tools[SHAPE_NEW_POLYGON] = memnew(ToolButton); + tools[SHAPE_NEW_POLYGON] = memnew(Button); toolbar->add_child(tools[SHAPE_NEW_POLYGON]); tools[SHAPE_NEW_POLYGON]->set_toggle_mode(true); tools[SHAPE_NEW_POLYGON]->set_button_group(tg); @@ -503,13 +503,13 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { separator_shape_toggle = memnew(VSeparator); toolbar->add_child(separator_shape_toggle); - tools[SHAPE_TOGGLE_TYPE] = memnew(ToolButton); + tools[SHAPE_TOGGLE_TYPE] = memnew(Button); tools[SHAPE_TOGGLE_TYPE]->connect("pressed", callable_mp(this, &TileSetEditor::_on_tool_clicked), varray(SHAPE_TOGGLE_TYPE)); toolbar->add_child(tools[SHAPE_TOGGLE_TYPE]); separator_delete = memnew(VSeparator); toolbar->add_child(separator_delete); - tools[SHAPE_DELETE] = memnew(ToolButton); + tools[SHAPE_DELETE] = memnew(Button); tools[SHAPE_DELETE]->connect("pressed", callable_mp(this, &TileSetEditor::_on_tool_clicked), varray(SHAPE_DELETE)); toolbar->add_child(tools[SHAPE_DELETE]); @@ -533,12 +533,12 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { separator_grid = memnew(VSeparator); toolbar->add_child(separator_grid); - tools[SHAPE_KEEP_INSIDE_TILE] = memnew(ToolButton); + tools[SHAPE_KEEP_INSIDE_TILE] = memnew(Button); tools[SHAPE_KEEP_INSIDE_TILE]->set_toggle_mode(true); tools[SHAPE_KEEP_INSIDE_TILE]->set_pressed(true); tools[SHAPE_KEEP_INSIDE_TILE]->set_tooltip(TTR("Keep polygon inside region Rect.")); toolbar->add_child(tools[SHAPE_KEEP_INSIDE_TILE]); - tools[TOOL_GRID_SNAP] = memnew(ToolButton); + tools[TOOL_GRID_SNAP] = memnew(Button); tools[TOOL_GRID_SNAP]->set_toggle_mode(true); tools[TOOL_GRID_SNAP]->set_tooltip(TTR("Enable snap and show grid (configurable via the Inspector).")); tools[TOOL_GRID_SNAP]->connect("toggled", callable_mp(this, &TileSetEditor::_on_grid_snap_toggled)); @@ -548,20 +548,20 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { separator->set_h_size_flags(SIZE_EXPAND_FILL); toolbar->add_child(separator); - tools[ZOOM_OUT] = memnew(ToolButton); + tools[ZOOM_OUT] = memnew(Button); tools[ZOOM_OUT]->connect("pressed", callable_mp(this, &TileSetEditor::_zoom_out)); toolbar->add_child(tools[ZOOM_OUT]); tools[ZOOM_OUT]->set_tooltip(TTR("Zoom Out")); - tools[ZOOM_1] = memnew(ToolButton); + tools[ZOOM_1] = memnew(Button); tools[ZOOM_1]->connect("pressed", callable_mp(this, &TileSetEditor::_zoom_reset)); toolbar->add_child(tools[ZOOM_1]); tools[ZOOM_1]->set_tooltip(TTR("Zoom Reset")); - tools[ZOOM_IN] = memnew(ToolButton); + tools[ZOOM_IN] = memnew(Button); tools[ZOOM_IN]->connect("pressed", callable_mp(this, &TileSetEditor::_zoom_in)); toolbar->add_child(tools[ZOOM_IN]); tools[ZOOM_IN]->set_tooltip(TTR("Zoom In")); - tools[VISIBLE_INFO] = memnew(ToolButton); + tools[VISIBLE_INFO] = memnew(Button); tools[VISIBLE_INFO]->set_toggle_mode(true); tools[VISIBLE_INFO]->set_tooltip(TTR("Display Tile Names (Hold Alt Key)")); toolbar->add_child(tools[VISIBLE_INFO]); diff --git a/editor/plugins/tile_set_editor_plugin.h b/editor/plugins/tile_set_editor_plugin.h index 2955dda244..d2687e7a4b 100644 --- a/editor/plugins/tile_set_editor_plugin.h +++ b/editor/plugins/tile_set_editor_plugin.h @@ -46,7 +46,7 @@ class TileSetEditor : public HSplitContainer { GDCLASS(TileSetEditor, HSplitContainer); - enum TextureToolButtons { + enum TextureButtons { TOOL_TILESET_ADD_TEXTURE, TOOL_TILESET_REMOVE_TEXTURE, TOOL_TILESET_CREATE_SCENE, @@ -111,7 +111,7 @@ class TileSetEditor : public HSplitContainer { ItemList *texture_list; int option; - ToolButton *tileset_toolbar_buttons[TOOL_TILESET_MAX]; + Button *tileset_toolbar_buttons[TOOL_TILESET_MAX]; MenuButton *tileset_toolbar_tools; Map<RID, Ref<Texture2D>> texture_map; @@ -146,7 +146,7 @@ class TileSetEditor : public HSplitContainer { Button *tool_editmode[EDITMODE_MAX]; HSeparator *separator_editmode; HBoxContainer *toolbar; - ToolButton *tools[TOOL_MAX]; + Button *tools[TOOL_MAX]; VSeparator *separator_shape_toggle; VSeparator *separator_bitmask; VSeparator *separator_delete; diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp index a1436e123d..cfbe54ef61 100644 --- a/editor/plugins/version_control_editor_plugin.cpp +++ b/editor/plugins/version_control_editor_plugin.cpp @@ -300,7 +300,7 @@ void VersionControlEditorPlugin::register_editor() { TabContainer *dock_vbc = (TabContainer *)version_commit_dock->get_parent_control(); dock_vbc->set_tab_title(version_commit_dock->get_index(), TTR("Commit")); - ToolButton *vc = EditorNode::get_singleton()->add_bottom_panel_item(TTR("Version Control"), version_control_dock); + Button *vc = EditorNode::get_singleton()->add_bottom_panel_item(TTR("Version Control"), version_control_dock); set_version_control_tool_button(vc); } } diff --git a/editor/plugins/version_control_editor_plugin.h b/editor/plugins/version_control_editor_plugin.h index 664e38d65f..248a1435fd 100644 --- a/editor/plugins/version_control_editor_plugin.h +++ b/editor/plugins/version_control_editor_plugin.h @@ -90,7 +90,7 @@ private: Label *commit_status; PanelContainer *version_control_dock; - ToolButton *version_control_dock_button; + Button *version_control_dock_button; VBoxContainer *diff_vbc; HBoxContainer *diff_hbc; Button *diff_refresh_button; @@ -121,7 +121,7 @@ public: static VersionControlEditorPlugin *get_singleton(); void popup_vcs_set_up_dialog(const Control *p_gui_base); - void set_version_control_tool_button(ToolButton *p_button) { version_control_dock_button = p_button; } + void set_version_control_tool_button(Button *p_button) { version_control_dock_button = p_button; } PopupMenu *get_version_control_actions_panel() const { return version_control_actions; } VBoxContainer *get_version_commit_dock() const { return version_commit_dock; } diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 1c2a8e48d3..89ab747cde 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -2341,13 +2341,15 @@ VisualShaderEditor::VisualShaderEditor() { graph->get_zoom_hbox()->add_child(edit_type); graph->get_zoom_hbox()->move_child(edit_type, 0); - add_node = memnew(ToolButton); + add_node = memnew(Button); + add_node->set_flat(true); graph->get_zoom_hbox()->add_child(add_node); add_node->set_text(TTR("Add Node...")); graph->get_zoom_hbox()->move_child(add_node, 0); add_node->connect("pressed", callable_mp(this, &VisualShaderEditor::_show_members_dialog), varray(false)); - preview_shader = memnew(ToolButton); + preview_shader = memnew(Button); + preview_shader->set_flat(true); preview_shader->set_toggle_mode(true); preview_shader->set_tooltip(TTR("Show resulted shader code.")); graph->get_zoom_hbox()->add_child(preview_shader); diff --git a/editor/plugins/visual_shader_editor_plugin.h b/editor/plugins/visual_shader_editor_plugin.h index d2f10d9407..b7c0fb8e45 100644 --- a/editor/plugins/visual_shader_editor_plugin.h +++ b/editor/plugins/visual_shader_editor_plugin.h @@ -60,8 +60,8 @@ class VisualShaderEditor : public VBoxContainer { Ref<VisualShader> visual_shader; HSplitContainer *main_box; GraphEdit *graph; - ToolButton *add_node; - ToolButton *preview_shader; + Button *add_node; + Button *preview_shader; OptionButton *edit_type; |