mirror of
https://github.com/Airr/nim-cocoa.git
synced 2024-11-24 09:45:30 +00:00
Started work on being able to call some Cocoa built-in methods
This commit is contained in:
parent
7d2dc9b9c7
commit
08342e5372
@ -168,3 +168,16 @@ void addToParent(id parent, id child) {
|
||||
void setToolTip(id widget, const char *tooltip) {
|
||||
[widget setToolTip: [NSString stringWithUTF8String: tooltip]];
|
||||
}
|
||||
|
||||
void eventAction(id widget, EVENT_ACTION callback) {
|
||||
[widget setEventAction: callback];
|
||||
}
|
||||
|
||||
void setSystemAction(id widget, const char *Title, const char *actionName) {
|
||||
SEL selector = NSSelectorFromString(NSSTR(actionName));
|
||||
id menuItem = [widget itemWithTitle: NSSTR(Title)];
|
||||
NSLog(@"%d",[menuItem respondsToSelector: selector]);
|
||||
if (selector) {
|
||||
[menuItem setAction: @selector(selector)];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user