-
Notifications
You must be signed in to change notification settings - Fork 17
/
slider.m
46 lines (37 loc) · 1.23 KB
/
slider.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#import "slider.h"
#include "_cgo_export.h"
@implementation SliderHandler
-(void) sliderValueChanged:(id) sender
{
onSliderValueChanged([self goSliderID]);
}
@end
SliderPtr Slider_New(int goSliderID, int x, int y, int w, int h) {
id nsSlider = [[[NSSlider alloc] initWithFrame:NSMakeRect(x, y, w, h)] autorelease];
SliderHandler* handler = [[SliderHandler alloc] init];
[handler setGoSliderID:goSliderID];
[handler autorelease];
[nsSlider setTarget:handler];
[nsSlider setAction:@selector(sliderValueChanged:)];
return (SliderPtr)nsSlider;
}
void Slider_SetMaximumValue(SliderPtr sliderPtr, double val) {
NSSlider* slider = (NSSlider*)sliderPtr;
[slider setMaxValue:val];
}
void Slider_SetMinimumValue(SliderPtr sliderPtr, double val) {
NSSlider* slider = (NSSlider*)sliderPtr;
[slider setMinValue:val];
}
void Slider_SetValue(SliderPtr sliderPtr, double val) {
NSSlider* slider = (NSSlider*)sliderPtr;
[slider setDoubleValue:val];
}
double Slider_Value(SliderPtr sliderPtr) {
NSSlider* slider = (NSSlider*)sliderPtr;
return slider.doubleValue;
}
void Slider_SetSliderType(SliderPtr sliderPtr, int sliderType) {
NSSlider* slider = (NSSlider*)sliderPtr;
[slider setSliderType:sliderType];
}