mirror of
https://github.com/godotengine/godot.git
synced 2024-11-21 19:42:43 +00:00
Fix cancel/OK button order on macOS
The macOS platform convention regarding button order is cancel on left, OK on right.
This commit is contained in:
parent
dcd11faad3
commit
9605fc54c7
@ -139,7 +139,7 @@
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_swap_ok_cancel">
|
||||
<method name="get_swap_cancel_ok">
|
||||
<return type="bool">
|
||||
</return>
|
||||
<description>
|
||||
|
@ -472,8 +472,8 @@
|
||||
<member name="gui/common/default_scroll_deadzone" type="int" setter="" getter="" default="0">
|
||||
Default value for [member ScrollContainer.scroll_deadzone], which will be used for all [ScrollContainer]s unless overridden.
|
||||
</member>
|
||||
<member name="gui/common/swap_ok_cancel" type="bool" setter="" getter="" default="false">
|
||||
If [code]true[/code], swaps OK and Cancel buttons in dialogs on Windows and UWP to follow interface conventions.
|
||||
<member name="gui/common/swap_cancel_ok" type="bool" setter="" getter="" default="false">
|
||||
If [code]true[/code], swaps Cancel and OK buttons in dialogs on Windows and UWP to follow interface conventions.
|
||||
</member>
|
||||
<member name="gui/common/text_edit_undo_stack_max_size" type="int" setter="" getter="" default="1024">
|
||||
</member>
|
||||
|
@ -182,7 +182,7 @@ EditorDirDialog::EditorDirDialog() {
|
||||
|
||||
tree->connect("item_activated", callable_mp(this, &EditorDirDialog::_item_activated));
|
||||
|
||||
makedir = add_button(TTR("Create Folder"), DisplayServer::get_singleton()->get_swap_ok_cancel(), "makedir");
|
||||
makedir = add_button(TTR("Create Folder"), DisplayServer::get_singleton()->get_swap_cancel_ok(), "makedir");
|
||||
makedir->connect("pressed", callable_mp(this, &EditorDirDialog::_make_dir));
|
||||
|
||||
makedialog = memnew(ConfirmationDialog);
|
||||
|
@ -6478,7 +6478,7 @@ EditorNode::EditorNode() {
|
||||
confirmation->connect("confirmed", callable_mp(this, &EditorNode::_menu_confirm_current));
|
||||
|
||||
save_confirmation = memnew(ConfirmationDialog);
|
||||
save_confirmation->add_button(TTR("Don't Save"), DisplayServer::get_singleton()->get_swap_ok_cancel(), "discard");
|
||||
save_confirmation->add_button(TTR("Don't Save"), DisplayServer::get_singleton()->get_swap_cancel_ok(), "discard");
|
||||
gui_base->add_child(save_confirmation);
|
||||
save_confirmation->connect("confirmed", callable_mp(this, &EditorNode::_menu_confirm_current));
|
||||
save_confirmation->connect("custom_action", callable_mp(this, &EditorNode::_discard_changes));
|
||||
@ -6697,7 +6697,7 @@ EditorNode::EditorNode() {
|
||||
|
||||
open_imported = memnew(ConfirmationDialog);
|
||||
open_imported->get_ok()->set_text(TTR("Open Anyway"));
|
||||
new_inherited_button = open_imported->add_button(TTR("New Inherited"), !DisplayServer::get_singleton()->get_swap_ok_cancel(), "inherit");
|
||||
new_inherited_button = open_imported->add_button(TTR("New Inherited"), !DisplayServer::get_singleton()->get_swap_cancel_ok(), "inherit");
|
||||
open_imported->connect("confirmed", callable_mp(this, &EditorNode::_open_imported));
|
||||
open_imported->connect("custom_action", callable_mp(this, &EditorNode::_inherit_imported));
|
||||
gui_base->add_child(open_imported);
|
||||
|
@ -3166,7 +3166,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
|
||||
|
||||
erase_tab_confirm = memnew(ConfirmationDialog);
|
||||
erase_tab_confirm->get_ok()->set_text(TTR("Save"));
|
||||
erase_tab_confirm->add_button(TTR("Discard"), DisplayServer::get_singleton()->get_swap_ok_cancel(), "discard");
|
||||
erase_tab_confirm->add_button(TTR("Discard"), DisplayServer::get_singleton()->get_swap_cancel_ok(), "discard");
|
||||
erase_tab_confirm->connect("confirmed", callable_mp(this, &ScriptEditor::_close_current_tab));
|
||||
erase_tab_confirm->connect("custom_action", callable_mp(this, &ScriptEditor::_close_discard_current_tab));
|
||||
add_child(erase_tab_confirm);
|
||||
@ -3200,7 +3200,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
|
||||
disk_changed->connect("confirmed", callable_mp(this, &ScriptEditor::_reload_scripts));
|
||||
disk_changed->get_ok()->set_text(TTR("Reload"));
|
||||
|
||||
disk_changed->add_button(TTR("Resave"), !DisplayServer::get_singleton()->get_swap_ok_cancel(), "resave");
|
||||
disk_changed->add_button(TTR("Resave"), !DisplayServer::get_singleton()->get_swap_cancel_ok(), "resave");
|
||||
disk_changed->connect("custom_action", callable_mp(this, &ScriptEditor::_resave_scripts));
|
||||
}
|
||||
|
||||
|
@ -669,7 +669,7 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) {
|
||||
disk_changed->connect("confirmed", callable_mp(this, &ShaderEditor::_reload_shader_from_disk));
|
||||
disk_changed->get_ok()->set_text(TTR("Reload"));
|
||||
|
||||
disk_changed->add_button(TTR("Resave"), !DisplayServer::get_singleton()->get_swap_ok_cancel(), "resave");
|
||||
disk_changed->add_button(TTR("Resave"), !DisplayServer::get_singleton()->get_swap_cancel_ok(), "resave");
|
||||
disk_changed->connect("custom_action", callable_mp(this, &ShaderEditor::save_external_data));
|
||||
|
||||
add_child(disk_changed);
|
||||
|
@ -1248,7 +1248,7 @@ ProjectExportDialog::ProjectExportDialog() {
|
||||
|
||||
get_cancel()->set_text(TTR("Close"));
|
||||
get_ok()->set_text(TTR("Export PCK/Zip"));
|
||||
export_button = add_button(TTR("Export Project"), !DisplayServer::get_singleton()->get_swap_ok_cancel(), "export");
|
||||
export_button = add_button(TTR("Export Project"), !DisplayServer::get_singleton()->get_swap_cancel_ok(), "export");
|
||||
export_button->connect("pressed", callable_mp(this, &ProjectExportDialog::_export_project));
|
||||
// Disable initially before we select a valid preset
|
||||
export_button->set_disabled(true);
|
||||
@ -1263,7 +1263,7 @@ ProjectExportDialog::ProjectExportDialog() {
|
||||
export_all_dialog->add_button(TTR("Release"), true, "release");
|
||||
export_all_dialog->connect("custom_action", callable_mp(this, &ProjectExportDialog::_export_all_dialog_action));
|
||||
|
||||
export_all_button = add_button(TTR("Export All"), !DisplayServer::get_singleton()->get_swap_ok_cancel(), "export");
|
||||
export_all_button = add_button(TTR("Export All"), !DisplayServer::get_singleton()->get_swap_cancel_ok(), "export");
|
||||
export_all_button->connect("pressed", callable_mp(this, &ProjectExportDialog::_export_all_dialog));
|
||||
export_all_button->set_disabled(true);
|
||||
|
||||
|
@ -288,7 +288,7 @@ public:
|
||||
virtual CursorShape cursor_get_shape() const override;
|
||||
virtual void cursor_set_custom_image(const RES &p_cursor, CursorShape p_shape = CURSOR_ARROW, const Vector2 &p_hotspot = Vector2()) override;
|
||||
|
||||
virtual bool get_swap_ok_cancel() override;
|
||||
virtual bool get_swap_cancel_ok() override;
|
||||
|
||||
virtual int keyboard_get_layout_count() const override;
|
||||
virtual int keyboard_get_current_layout() const override;
|
||||
|
@ -2913,8 +2913,8 @@ void DisplayServerOSX::window_set_ime_position(const Point2i &p_pos, WindowID p_
|
||||
wd.im_position = p_pos;
|
||||
}
|
||||
|
||||
bool DisplayServerOSX::get_swap_ok_cancel() {
|
||||
return true;
|
||||
bool DisplayServerOSX::get_swap_cancel_ok() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void DisplayServerOSX::cursor_set_shape(CursorShape p_shape) {
|
||||
|
@ -245,7 +245,7 @@ public:
|
||||
|
||||
void run();
|
||||
|
||||
virtual bool get_swap_ok_cancel() { return true; }
|
||||
virtual bool get_swap_cancel_ok() { return true; }
|
||||
|
||||
void input_event(const Ref<InputEvent> &p_event);
|
||||
|
||||
|
@ -1367,7 +1367,7 @@ void DisplayServerWindows::cursor_set_custom_image(const RES &p_cursor, CursorSh
|
||||
}
|
||||
}
|
||||
|
||||
bool DisplayServerWindows::get_swap_ok_cancel() {
|
||||
bool DisplayServerWindows::get_swap_cancel_ok() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -520,7 +520,7 @@ public:
|
||||
virtual CursorShape cursor_get_shape() const;
|
||||
virtual void cursor_set_custom_image(const RES &p_cursor, CursorShape p_shape = CURSOR_ARROW, const Vector2 &p_hotspot = Vector2());
|
||||
|
||||
virtual bool get_swap_ok_cancel();
|
||||
virtual bool get_swap_cancel_ok();
|
||||
|
||||
virtual void enable_for_stealing_focus(OS::ProcessID pid);
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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<InputEvent> &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);
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -238,7 +238,7 @@ void DisplayServer::cursor_set_custom_image(const RES &p_cursor, CursorShape p_s
|
||||
WARN_PRINT("Custom cursor shape not supported by this display server.");
|
||||
}
|
||||
|
||||
bool DisplayServer::get_swap_ok_cancel() {
|
||||
bool DisplayServer::get_swap_cancel_ok() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -464,7 +464,7 @@ void DisplayServer::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("cursor_get_shape"), &DisplayServer::cursor_get_shape);
|
||||
ClassDB::bind_method(D_METHOD("cursor_set_custom_image", "cursor", "shape", "hotspot"), &DisplayServer::cursor_set_custom_image, DEFVAL(CURSOR_ARROW), DEFVAL(Vector2()));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_swap_ok_cancel"), &DisplayServer::get_swap_ok_cancel);
|
||||
ClassDB::bind_method(D_METHOD("get_swap_cancel_ok"), &DisplayServer::get_swap_cancel_ok);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("enable_for_stealing_focus", "process_id"), &DisplayServer::enable_for_stealing_focus);
|
||||
|
||||
|
@ -318,7 +318,7 @@ public:
|
||||
virtual CursorShape cursor_get_shape() const;
|
||||
virtual void cursor_set_custom_image(const RES &p_cursor, CursorShape p_shape = CURSOR_ARROW, const Vector2 &p_hotspot = Vector2());
|
||||
|
||||
virtual bool get_swap_ok_cancel();
|
||||
virtual bool get_swap_cancel_ok();
|
||||
|
||||
virtual void enable_for_stealing_focus(OS::ProcessID pid);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user