You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
nim-cocoa/src/cocoa/widgets/checkbox.m

29 lines
632 B

#import <Cocoa/Cocoa.h>
#import "col.h"
id createCheckBox(id parent, const char* caption, int l, int t, int w, int h){
NSButton *self = [[[NSButton alloc] initWithFrame:NSMakeRect( l, t, w, h )] autorelease];
[self setButtonType:NSSwitchButton];
[self setBezelStyle: 0];
[self setTitle: [NSString stringWithUTF8String:caption]];
[self setTarget: self];
[[parent contentView] addSubview:self];
return self;
}
void SetState(id widget, bool state) {
if (state == TRUE) {
[widget setState: NSOnState];
}else{
[widget setState: NSOffState];
}
}
int State(id widget) {
return [widget state];
}