mirror of https://github.com/Airr/nim-cocoa.git
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.
30 lines
652 B
30 lines
652 B
#import <Cocoa/Cocoa.h>
|
|
#import "col.h"
|
|
|
|
@implementation CocoaSlider
|
|
{
|
|
|
|
}
|
|
@synthesize Value;
|
|
@synthesize sliderAction;
|
|
|
|
- (IBAction)onChanged:(id)sender{
|
|
self.Value = [sender intValue];
|
|
sliderAction(sender);
|
|
}
|
|
|
|
- (id) initWithFrame:(NSRect)rect callBack:(ACTION)func {
|
|
self = [super initWithFrame: rect];
|
|
[self setMinValue:0];
|
|
[self setMaxValue:100];
|
|
[self setAllowsTickMarkValuesOnly:NO];
|
|
[self setNumberOfTickMarks:0];
|
|
[self setTickMarkPosition:1];
|
|
[self setTarget:self];
|
|
if (func != NULL) {
|
|
[self setSliderAction: func];
|
|
[self setAction: @selector(onChanged:)];
|
|
}
|
|
return self;
|
|
}
|
|
@end
|
|
|