summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-06-19 23:09:49 +0200
committerGitHub <noreply@github.com>2020-06-19 23:09:49 +0200
commit6d8c14f849376905e1577f9fc3f9512bcffb1e3c (patch)
tree1c0de1bac35046915575687e8d8993643d372474 /scene
parentcb9d02a8d1b5bb71abcec6be0e75002c5ea656c4 (diff)
parent31b7f02a29cdf4f1c30cfc37962f43f67380b9ad (diff)
Merge pull request #39690 from Calinou/remove-toolbutton
Remove ToolButton in favor of Button
Diffstat (limited to 'scene')
-rw-r--r--scene/gui/color_picker.cpp3
-rw-r--r--scene/gui/color_picker.h3
-rw-r--r--scene/gui/file_dialog.cpp15
-rw-r--r--scene/gui/file_dialog.h7
-rw-r--r--scene/gui/graph_edit.cpp13
-rw-r--r--scene/gui/graph_edit.h10
-rw-r--r--scene/gui/tool_button.cpp35
-rw-r--r--scene/gui/tool_button.h43
-rw-r--r--scene/register_scene_types.cpp3
-rw-r--r--scene/resources/default_theme/default_theme.cpp24
10 files changed, 42 insertions, 114 deletions
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index 84170a65d1..fafbb298b7 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -758,7 +758,8 @@ ColorPicker::ColorPicker() :
sample->set_h_size_flags(SIZE_EXPAND_FILL);
sample->connect("draw", callable_mp(this, &ColorPicker::_sample_draw));
- btn_pick = memnew(ToolButton);
+ btn_pick = memnew(Button);
+ btn_pick->set_flat(true);
hb_smpl->add_child(btn_pick);
btn_pick->set_toggle_mode(true);
btn_pick->set_tooltip(TTR("Pick a color from the editor window."));
diff --git a/scene/gui/color_picker.h b/scene/gui/color_picker.h
index 31ae92f4e4..b2e8263e7f 100644
--- a/scene/gui/color_picker.h
+++ b/scene/gui/color_picker.h
@@ -41,7 +41,6 @@
#include "scene/gui/slider.h"
#include "scene/gui/spin_box.h"
#include "scene/gui/texture_rect.h"
-#include "scene/gui/tool_button.h"
class ColorPicker : public BoxContainer {
GDCLASS(ColorPicker, BoxContainer);
@@ -57,7 +56,7 @@ private:
HSeparator *preset_separator;
Button *bt_add_preset;
List<Color> presets;
- ToolButton *btn_pick;
+ Button *btn_pick;
CheckButton *btn_hsv;
CheckButton *btn_raw;
HSlider *scroll[4];
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index 630f3c8ff6..41ca6458af 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -45,9 +45,9 @@ VBoxContainer *FileDialog::get_vbox() {
}
void FileDialog::_theme_changed() {
- Color font_color = vbox->get_theme_color("font_color", "ToolButton");
- Color font_color_hover = vbox->get_theme_color("font_color_hover", "ToolButton");
- Color font_color_pressed = vbox->get_theme_color("font_color_pressed", "ToolButton");
+ Color font_color = vbox->get_theme_color("font_color", "Button");
+ Color font_color_hover = vbox->get_theme_color("font_color_hover", "Button");
+ Color font_color_pressed = vbox->get_theme_color("font_color_pressed", "Button");
dir_up->add_theme_color_override("icon_color_normal", font_color);
dir_up->add_theme_color_override("icon_color_hover", font_color_hover);
@@ -859,7 +859,8 @@ FileDialog::FileDialog() {
HBoxContainer *hbc = memnew(HBoxContainer);
- dir_up = memnew(ToolButton);
+ dir_up = memnew(Button);
+ dir_up->set_flat(true);
dir_up->set_tooltip(RTR("Go to parent folder."));
hbc->add_child(dir_up);
dir_up->connect("pressed", callable_mp(this, &FileDialog::_go_up));
@@ -877,12 +878,14 @@ FileDialog::FileDialog() {
hbc->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(RTR("Refresh files."));
refresh->connect("pressed", callable_mp(this, &FileDialog::update_file_list));
hbc->add_child(refresh);
- 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(RTR("Toggle the visibility of hidden files."));
diff --git a/scene/gui/file_dialog.h b/scene/gui/file_dialog.h
index 8bc536d576..44050a2376 100644
--- a/scene/gui/file_dialog.h
+++ b/scene/gui/file_dialog.h
@@ -36,7 +36,6 @@
#include "scene/gui/dialogs.h"
#include "scene/gui/line_edit.h"
#include "scene/gui/option_button.h"
-#include "scene/gui/tool_button.h"
#include "scene/gui/tree.h"
class FileDialog : public ConfirmationDialog {
@@ -87,10 +86,10 @@ private:
DirAccess *dir_access;
ConfirmationDialog *confirm_save;
- ToolButton *dir_up;
+ Button *dir_up;
- ToolButton *refresh;
- ToolButton *show_hidden;
+ Button *refresh;
+ Button *show_hidden;
Vector<String> filters;
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index 5080ba74e2..2b0e084db4 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -33,6 +33,7 @@
#include "core/input/input.h"
#include "core/os/keyboard.h"
#include "scene/gui/box_container.h"
+#include "scene/gui/button.h"
#ifdef TOOLS_ENABLED
#include "editor/editor_scale.h"
@@ -1310,25 +1311,29 @@ GraphEdit::GraphEdit() {
top_layer->add_child(zoom_hb);
zoom_hb->set_position(Vector2(10, 10));
- zoom_minus = memnew(ToolButton);
+ zoom_minus = memnew(Button);
+ zoom_minus->set_flat(true);
zoom_hb->add_child(zoom_minus);
zoom_minus->set_tooltip(RTR("Zoom Out"));
zoom_minus->connect("pressed", callable_mp(this, &GraphEdit::_zoom_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->set_tooltip(RTR("Zoom Reset"));
zoom_reset->connect("pressed", callable_mp(this, &GraphEdit::_zoom_reset));
zoom_reset->set_focus_mode(FOCUS_NONE);
- zoom_plus = memnew(ToolButton);
+ zoom_plus = memnew(Button);
+ zoom_plus->set_flat(true);
zoom_hb->add_child(zoom_plus);
zoom_plus->set_tooltip(RTR("Zoom In"));
zoom_plus->connect("pressed", callable_mp(this, &GraphEdit::_zoom_plus));
zoom_plus->set_focus_mode(FOCUS_NONE);
- snap_button = memnew(ToolButton);
+ snap_button = memnew(Button);
+ snap_button->set_flat(true);
snap_button->set_toggle_mode(true);
snap_button->set_tooltip(RTR("Enable snap and show grid."));
snap_button->connect("pressed", callable_mp(this, &GraphEdit::_snap_toggled));
diff --git a/scene/gui/graph_edit.h b/scene/gui/graph_edit.h
index c632490855..a627a8eec8 100644
--- a/scene/gui/graph_edit.h
+++ b/scene/gui/graph_edit.h
@@ -32,12 +32,12 @@
#define GRAPH_EDIT_H
#include "scene/gui/box_container.h"
+#include "scene/gui/button.h"
#include "scene/gui/graph_node.h"
#include "scene/gui/scroll_bar.h"
#include "scene/gui/slider.h"
#include "scene/gui/spin_box.h"
#include "scene/gui/texture_rect.h"
-#include "scene/gui/tool_button.h"
class GraphEdit;
@@ -65,11 +65,11 @@ public:
};
private:
- ToolButton *zoom_minus;
- ToolButton *zoom_reset;
- ToolButton *zoom_plus;
+ Button *zoom_minus;
+ Button *zoom_reset;
+ Button *zoom_plus;
- ToolButton *snap_button;
+ Button *snap_button;
SpinBox *snap_amount;
void _zoom_minus();
diff --git a/scene/gui/tool_button.cpp b/scene/gui/tool_button.cpp
deleted file mode 100644
index c9f87f0015..0000000000
--- a/scene/gui/tool_button.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-/*************************************************************************/
-/* tool_button.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#include "tool_button.h"
-
-ToolButton::ToolButton() {
- set_flat(true);
-}
diff --git a/scene/gui/tool_button.h b/scene/gui/tool_button.h
deleted file mode 100644
index 9848b21381..0000000000
--- a/scene/gui/tool_button.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*************************************************************************/
-/* tool_button.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#ifndef TOOL_BUTTON_H
-#define TOOL_BUTTON_H
-
-#include "scene/gui/button.h"
-
-class ToolButton : public Button {
- GDCLASS(ToolButton, Button);
-
-public:
- ToolButton();
-};
-
-#endif // TOOL_BUTTON_H
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index ad8a43743a..54112ef2bd 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -117,7 +117,6 @@
#include "scene/gui/texture_button.h"
#include "scene/gui/texture_progress.h"
#include "scene/gui/texture_rect.h"
-#include "scene/gui/tool_button.h"
#include "scene/gui/tree.h"
#include "scene/gui/video_player.h"
#include "scene/main/canvas_item.h"
@@ -306,7 +305,6 @@ void register_scene_types() {
ClassDB::register_class<MenuButton>();
ClassDB::register_class<CheckBox>();
ClassDB::register_class<CheckButton>();
- ClassDB::register_class<ToolButton>();
ClassDB::register_class<LinkButton>();
ClassDB::register_class<Panel>();
ClassDB::register_virtual_class<Range>();
@@ -767,6 +765,7 @@ void register_scene_types() {
#ifndef DISABLE_DEPRECATED
// Dropped in 4.0, near approximation.
ClassDB::add_compatibility_class("AnimationTreePlayer", "AnimationTree");
+ ClassDB::add_compatibility_class("ToolButton", "Button");
// Renamed in 4.0.
// Keep alphabetical ordering to easily locate classes and avoid duplicates.
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index fd5c861eb5..aebb0d7ba4 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -219,21 +219,21 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_constant("hseparation", "ColorPickerButton", 2 * scale);
- // ToolButton
+ // Button
- theme->set_stylebox("normal", "ToolButton", make_empty_stylebox(6, 4, 6, 4));
- theme->set_stylebox("pressed", "ToolButton", make_stylebox(button_pressed_png, 4, 4, 4, 4, 6, 4, 6, 4));
- theme->set_stylebox("hover", "ToolButton", make_stylebox(button_normal_png, 4, 4, 4, 4, 6, 4, 6, 4));
- theme->set_stylebox("disabled", "ToolButton", make_empty_stylebox(6, 4, 6, 4));
- theme->set_stylebox("focus", "ToolButton", focus);
- theme->set_font("font", "ToolButton", default_font);
+ theme->set_stylebox("normal", "Button", make_empty_stylebox(6, 4, 6, 4));
+ theme->set_stylebox("pressed", "Button", make_stylebox(button_pressed_png, 4, 4, 4, 4, 6, 4, 6, 4));
+ theme->set_stylebox("hover", "Button", make_stylebox(button_normal_png, 4, 4, 4, 4, 6, 4, 6, 4));
+ theme->set_stylebox("disabled", "Button", make_empty_stylebox(6, 4, 6, 4));
+ theme->set_stylebox("focus", "Button", focus);
+ theme->set_font("font", "Button", default_font);
- theme->set_color("font_color", "ToolButton", control_font_color);
- theme->set_color("font_color_pressed", "ToolButton", control_font_color_pressed);
- theme->set_color("font_color_hover", "ToolButton", control_font_color_hover);
- theme->set_color("font_color_disabled", "ToolButton", Color(0.9, 0.95, 1, 0.3));
+ theme->set_color("font_color", "Button", control_font_color);
+ theme->set_color("font_color_pressed", "Button", control_font_color_pressed);
+ theme->set_color("font_color_hover", "Button", control_font_color_hover);
+ theme->set_color("font_color_disabled", "Button", Color(0.9, 0.95, 1, 0.3));
- theme->set_constant("hseparation", "ToolButton", 3);
+ theme->set_constant("hseparation", "Button", 3);
// OptionButton