Added alert() functionality for OS X
This commit is contained in:
parent
842e7bfc2f
commit
072da51f20
2 changed files with 18 additions and 0 deletions
|
@ -142,6 +142,8 @@ public:
|
||||||
|
|
||||||
virtual String get_name();
|
virtual String get_name();
|
||||||
|
|
||||||
|
virtual void alert(const String& p_alert, const String& p_title="ALERT!");
|
||||||
|
|
||||||
virtual void set_cursor_shape(CursorShape p_shape);
|
virtual void set_cursor_shape(CursorShape p_shape);
|
||||||
|
|
||||||
virtual void set_mouse_show(bool p_show);
|
virtual void set_mouse_show(bool p_show);
|
||||||
|
|
|
@ -1209,6 +1209,22 @@ String OS_OSX::get_name() {
|
||||||
return "OSX";
|
return "OSX";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OS_OSX::alert(const String& p_alert, const String& p_title) {
|
||||||
|
// Set OS X-compliant variables
|
||||||
|
NSAlert *window = [[NSAlert alloc] init];
|
||||||
|
NSString *ns_title = [NSString stringWithUTF8String:p_title.utf8().get_data()];
|
||||||
|
NSString *ns_alert = [NSString stringWithUTF8String:p_alert.utf8().get_data()];
|
||||||
|
|
||||||
|
[window addButtonWithTitle:@"OK"];
|
||||||
|
[window setMessageText:ns_title];
|
||||||
|
[window setInformativeText:ns_alert];
|
||||||
|
[window setAlertStyle:NSWarningAlertStyle];
|
||||||
|
|
||||||
|
// Display it, then release
|
||||||
|
[window runModal];
|
||||||
|
[window release];
|
||||||
|
}
|
||||||
|
|
||||||
void OS_OSX::set_cursor_shape(CursorShape p_shape) {
|
void OS_OSX::set_cursor_shape(CursorShape p_shape) {
|
||||||
|
|
||||||
if (cursor_shape==p_shape)
|
if (cursor_shape==p_shape)
|
||||||
|
|
Loading…
Reference in a new issue