diff options
Diffstat (limited to 'redo/controls_darwin.m')
| -rw-r--r-- | redo/controls_darwin.m | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/redo/controls_darwin.m b/redo/controls_darwin.m index a21ac0f..d8e0e51 100644 --- a/redo/controls_darwin.m +++ b/redo/controls_darwin.m @@ -22,6 +22,21 @@ void parent(id control, id parentid, BOOL floating) [toNSView(control) release]; } +@interface goControlDelegate : NSObject { +@public + void *gocontrol; +} +@end + +@implementation goControlDelegate + +- (IBAction)buttonClicked:(id)sender +{ + buttonClicked(self->gocontrol); +} + +@end + id newButton(char *text) { NSButton *b; @@ -36,6 +51,16 @@ id newButton(char *text) return b; } +void buttonSetDelegate(id button, void *b) +{ + goControlDelegate *d; + + d = [goControlDelegate new]; + d->gocontrol = b; + [toNSButton(button) setTarget:d]; + [toNSButton(button) setAction:@selector(buttonClicked:)]; +} + const char *buttonText(id button) { return [[toNSButton(button) title] UTF8String]; |
