mirror of
https://github.com/Airr/nim-cocoa.git
synced 2025-05-10 02:32:08 +00:00
30 lines
675 B
Objective-C
30 lines
675 B
Objective-C
#import <Cocoa/Cocoa.h>
|
|
|
|
#import "col.h"
|
|
|
|
@implementation RadioButton
|
|
|
|
@synthesize buttonAction;
|
|
|
|
|
|
- (void) click:(id)sender {
|
|
buttonAction(sender);
|
|
}
|
|
@end
|
|
|
|
id createRadioButton(id parent, const char* caption, int l, int t, int w, int h, ACTION func){
|
|
NSButton *self = [[[RadioButton alloc] initWithFrame:NSMakeRect( l, t, w, h )] autorelease];
|
|
[self setButtonType: NSButtonTypeRadio];
|
|
[self setBezelStyle: 0];
|
|
[self setTitle: [NSString stringWithUTF8String:caption]];
|
|
[self setTarget: self];
|
|
|
|
if (func) {
|
|
[self setButtonAction:func];
|
|
[self setAction: @selector(click:)];
|
|
}
|
|
|
|
addToParent(parent, self);
|
|
|
|
return self;
|
|
} |