summaryrefslogtreecommitdiff
path: root/core/os
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2019-02-06 15:57:06 +0200
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2019-08-26 16:45:49 +0300
commitdb6d4352ea528e925c69ee94f6fb9bc0942719ec (patch)
tree864bb7a3b90ea000ec0b1881f670f4596133aadd /core/os
parent4b53fdb25d545b0a2fc73f6a46775ced586994b7 (diff)
[macOS] Add methods to modify global and dock menus. Add ability to open multiple editor/project manager instances, recent/favourite project list to project manager dock menu and opened scene list to editor dock menu.
Diffstat (limited to 'core/os')
-rw-r--r--core/os/main_loop.cpp8
-rw-r--r--core/os/main_loop.h1
-rw-r--r--core/os/os.h5
3 files changed, 14 insertions, 0 deletions
diff --git a/core/os/main_loop.cpp b/core/os/main_loop.cpp
index 9946ced2f3..eca3b2a7f4 100644
--- a/core/os/main_loop.cpp
+++ b/core/os/main_loop.cpp
@@ -49,6 +49,8 @@ void MainLoop::_bind_methods() {
BIND_VMETHOD(MethodInfo("_drop_files", PropertyInfo(Variant::POOL_STRING_ARRAY, "files"), PropertyInfo(Variant::INT, "from_screen")));
BIND_VMETHOD(MethodInfo("_finalize"));
+ BIND_VMETHOD(MethodInfo("_global_menu_action", PropertyInfo(Variant::NIL, "id"), PropertyInfo(Variant::NIL, "meta")));
+
BIND_CONSTANT(NOTIFICATION_WM_MOUSE_ENTER);
BIND_CONSTANT(NOTIFICATION_WM_MOUSE_EXIT);
BIND_CONSTANT(NOTIFICATION_WM_FOCUS_IN);
@@ -115,6 +117,12 @@ void MainLoop::drop_files(const Vector<String> &p_files, int p_from_screen) {
get_script_instance()->call("_drop_files", p_files, p_from_screen);
}
+void MainLoop::global_menu_action(const Variant &p_id, const Variant &p_meta) {
+
+ if (get_script_instance())
+ get_script_instance()->call("_global_menu_action", p_id, p_meta);
+}
+
void MainLoop::finish() {
if (get_script_instance()) {
diff --git a/core/os/main_loop.h b/core/os/main_loop.h
index 6ddaf5bee7..54e61fd2fa 100644
--- a/core/os/main_loop.h
+++ b/core/os/main_loop.h
@@ -71,6 +71,7 @@ public:
virtual void finish();
virtual void drop_files(const Vector<String> &p_files, int p_from_screen = 0);
+ virtual void global_menu_action(const Variant &p_id, const Variant &p_meta);
void set_init_script(const Ref<Script> &p_init_script);
diff --git a/core/os/os.h b/core/os/os.h
index e627773d88..9b46b43081 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -143,6 +143,11 @@ public:
static OS *get_singleton();
+ virtual void global_menu_add_item(const String &p_menu, const String &p_label, const Variant &p_signal, const Variant &p_meta){};
+ virtual void global_menu_add_separator(const String &p_menu){};
+ virtual void global_menu_remove_item(const String &p_menu, int p_idx){};
+ virtual void global_menu_clear(const String &p_menu){};
+
void print_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, Logger::ErrorType p_type = Logger::ERR_ERROR);
void print(const char *p_format, ...) _PRINTF_FORMAT_ATTRIBUTE_2_3;
void printerr(const char *p_format, ...) _PRINTF_FORMAT_ATTRIBUTE_2_3;