-
Notifications
You must be signed in to change notification settings - Fork 3
/
notifier.mm
18 lines (16 loc) · 919 Bytes
/
notifier.mm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/**
--------------------------------------------------------------------------------
- Module : notifier.mm
- Description : A micro wrapper for the embedded OS-X notification center.
- Author : Tim Zaman, 20-NOV-2015
--------------------------------------------------------------------------------
*/
#include "notifier.h"
#include <NSUserNotification.h>
void Notifier::notifyMM(std::string title, std::string message) {
NSUserNotification *userNotification = [[[NSUserNotification alloc] init] autorelease];
userNotification.title = [NSString stringWithCString:title.c_str() encoding:[NSString defaultCStringEncoding]];
userNotification.informativeText = [NSString stringWithCString:message.c_str() encoding:[NSString defaultCStringEncoding]];
NSUserNotificationCenter* center = [NSUserNotificationCenter defaultUserNotificationCenter];
[center deliverNotification:userNotification];
}