diff options
| author | Pietro Gagliardi <[email protected]> | 2014-07-17 12:02:39 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-07-17 12:02:39 -0400 |
| commit | e4b379f84a8cb3699c8580f30af88d56be180a4d (patch) | |
| tree | fda8dd32de19246504cc857af7f26bb2ffcf3418 /redo/controls_darwin.m | |
| parent | 659bc03f171d8639eefa47e5d37abe7af81e5534 (diff) | |
Added button click events to the Mac OS X backend.
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]; |
