From 9605fc54c790b1c4364bc0eddfcdd65f979bfc21 Mon Sep 17 00:00:00 2001 From: Daniel Ting Date: Wed, 8 Jul 2020 18:02:38 -0500 Subject: Fix cancel/OK button order on macOS The macOS platform convention regarding button order is cancel on left, OK on right. --- scene/gui/dialogs.cpp | 8 ++++---- scene/gui/dialogs.h | 4 ++-- scene/register_scene_types.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'scene') diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index faef979090..9077bfa4ba 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -258,7 +258,7 @@ Button *AcceptDialog::add_cancel(const String &p_cancel) { if (p_cancel == "") { c = RTR("Cancel"); } - Button *b = swap_ok_cancel ? add_button(c, true) : add_button(c); + Button *b = swap_cancel_ok ? add_button(c, true) : add_button(c); b->connect("pressed", callable_mp(this, &AcceptDialog::_cancel_pressed)); return b; } @@ -286,9 +286,9 @@ void AcceptDialog::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "dialog_autowrap"), "set_autowrap", "has_autowrap"); } -bool AcceptDialog::swap_ok_cancel = false; -void AcceptDialog::set_swap_ok_cancel(bool p_swap) { - swap_ok_cancel = p_swap; +bool AcceptDialog::swap_cancel_ok = false; +void AcceptDialog::set_swap_cancel_ok(bool p_swap) { + swap_cancel_ok = p_swap; } AcceptDialog::AcceptDialog() { diff --git a/scene/gui/dialogs.h b/scene/gui/dialogs.h index 063090c832..de08685ce2 100644 --- a/scene/gui/dialogs.h +++ b/scene/gui/dialogs.h @@ -54,7 +54,7 @@ class AcceptDialog : public Window { void _custom_action(const String &p_action); void _update_child_rects(); - static bool swap_ok_cancel; + static bool swap_cancel_ok; void _input_from_window(const Ref &p_event); void _parent_focused(); @@ -75,7 +75,7 @@ protected: public: Label *get_label() { return label; } - static void set_swap_ok_cancel(bool p_swap); + static void set_swap_cancel_ok(bool p_swap); void register_text_enter(Node *p_line_edit); diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index f40fb78056..1c91effe05 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -369,7 +369,7 @@ void register_scene_types() { OS::get_singleton()->yield(); //may take time to init - AcceptDialog::set_swap_ok_cancel(GLOBAL_DEF("gui/common/swap_ok_cancel", bool(DisplayServer::get_singleton()->get_swap_ok_cancel()))); + AcceptDialog::set_swap_cancel_ok(GLOBAL_DEF("gui/common/swap_cancel_ok", bool(DisplayServer::get_singleton()->get_swap_cancel_ok()))); #endif /* REGISTER 3D */ -- cgit v1.2.3