Merge pull request #10254 from marcelofg55/master
Added notification const NOTIFICATION_WM_ABOUT
This commit is contained in:
commit
13f879587d
5 changed files with 29 additions and 2 deletions
|
@ -54,6 +54,8 @@ void MainLoop::_bind_methods() {
|
||||||
BIND_CONSTANT(NOTIFICATION_WM_QUIT_REQUEST);
|
BIND_CONSTANT(NOTIFICATION_WM_QUIT_REQUEST);
|
||||||
BIND_CONSTANT(NOTIFICATION_WM_UNFOCUS_REQUEST);
|
BIND_CONSTANT(NOTIFICATION_WM_UNFOCUS_REQUEST);
|
||||||
BIND_CONSTANT(NOTIFICATION_OS_MEMORY_WARNING);
|
BIND_CONSTANT(NOTIFICATION_OS_MEMORY_WARNING);
|
||||||
|
BIND_CONSTANT(NOTIFICATION_TRANSLATION_CHANGED);
|
||||||
|
BIND_CONSTANT(NOTIFICATION_WM_ABOUT);
|
||||||
};
|
};
|
||||||
|
|
||||||
void MainLoop::set_init_script(const Ref<Script> &p_init_script) {
|
void MainLoop::set_init_script(const Ref<Script> &p_init_script) {
|
||||||
|
|
|
@ -56,7 +56,11 @@ public:
|
||||||
NOTIFICATION_WM_GO_BACK_REQUEST = 7,
|
NOTIFICATION_WM_GO_BACK_REQUEST = 7,
|
||||||
NOTIFICATION_WM_UNFOCUS_REQUEST = 8,
|
NOTIFICATION_WM_UNFOCUS_REQUEST = 8,
|
||||||
NOTIFICATION_OS_MEMORY_WARNING = 9,
|
NOTIFICATION_OS_MEMORY_WARNING = 9,
|
||||||
NOTIFICATION_TRANSLATION_CHANGED = 10,
|
// Note: NOTIFICATION_TRANSLATION_CHANGED and NOTIFICATION_WM_ABOUT used to have id=10 and id=11 but these
|
||||||
|
// conflict with NOTIFICATION_ENTER_TREE (id=10) and NOTIFICATION_EXIT_TREE (id=11), so id=90 and id=91
|
||||||
|
// fixes this issue.
|
||||||
|
NOTIFICATION_TRANSLATION_CHANGED = 90,
|
||||||
|
NOTIFICATION_WM_ABOUT = 91,
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void input_event(const Ref<InputEvent> &p_event);
|
virtual void input_event(const Ref<InputEvent> &p_event);
|
||||||
|
|
|
@ -684,6 +684,8 @@ public:
|
||||||
|
|
||||||
void merge_from_scene() { _menu_option_confirm(FILE_IMPORT_SUBSCENE, false); }
|
void merge_from_scene() { _menu_option_confirm(FILE_IMPORT_SUBSCENE, false); }
|
||||||
|
|
||||||
|
void show_about() { _menu_option_confirm(HELP_ABOUT, false); }
|
||||||
|
|
||||||
static bool has_unsaved_changes() { return singleton->unsaved_cache; }
|
static bool has_unsaved_changes() { return singleton->unsaved_cache; }
|
||||||
|
|
||||||
static HBoxContainer *get_menu_hb() { return singleton->menu_hb; }
|
static HBoxContainer *get_menu_hb() { return singleton->menu_hb; }
|
||||||
|
|
|
@ -137,6 +137,11 @@ static bool mouse_down_control = false;
|
||||||
//_GodotInputMonitorChange();
|
//_GodotInputMonitorChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)showAbout:(id)sender {
|
||||||
|
if (OS_OSX::singleton->get_main_loop())
|
||||||
|
OS_OSX::singleton->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_ABOUT);
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface GodotWindowDelegate : NSObject {
|
@interface GodotWindowDelegate : NSObject {
|
||||||
|
@ -1902,7 +1907,7 @@ OS_OSX::OS_OSX() {
|
||||||
// Setup Apple menu
|
// Setup Apple menu
|
||||||
NSMenu *apple_menu = [[NSMenu alloc] initWithTitle:@""];
|
NSMenu *apple_menu = [[NSMenu alloc] initWithTitle:@""];
|
||||||
title = [NSString stringWithFormat:NSLocalizedString(@"About %@", nil), nsappname];
|
title = [NSString stringWithFormat:NSLocalizedString(@"About %@", nil), nsappname];
|
||||||
[apple_menu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
|
[apple_menu addItemWithTitle:title action:@selector(showAbout:) keyEquivalent:@""];
|
||||||
|
|
||||||
[apple_menu addItem:[NSMenuItem separatorItem]];
|
[apple_menu addItem:[NSMenuItem separatorItem]];
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
//#include "servers/spatial_sound_2d_server.h"
|
//#include "servers/spatial_sound_2d_server.h"
|
||||||
|
|
||||||
|
#include "editor/editor_node.h"
|
||||||
#include "io/marshalls.h"
|
#include "io/marshalls.h"
|
||||||
#include "io/resource_loader.h"
|
#include "io/resource_loader.h"
|
||||||
#include "scene/resources/material.h"
|
#include "scene/resources/material.h"
|
||||||
|
@ -626,6 +627,19 @@ void SceneTree::_notification(int p_notification) {
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
case NOTIFICATION_WM_ABOUT: {
|
||||||
|
|
||||||
|
#ifdef TOOLS_ENABLED
|
||||||
|
if (is_editor_hint()) {
|
||||||
|
EditorNode::get_singleton()->show_about();
|
||||||
|
} else {
|
||||||
|
#endif
|
||||||
|
get_root()->propagate_notification(p_notification);
|
||||||
|
#ifdef TOOLS_ENABLED
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
} break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue