2015-12-30 06:41:46 +00:00
|
|
|
#if defined(Hiro_VerticalSlider)
|
|
|
|
|
2013-03-15 13:11:33 +00:00
|
|
|
@implementation CocoaVerticalSlider : NSSlider
|
|
|
|
|
2015-12-30 06:41:46 +00:00
|
|
|
-(id) initWith:(hiro::mVerticalSlider&)verticalSliderReference {
|
2013-03-15 13:11:33 +00:00
|
|
|
if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 1)]) {
|
|
|
|
verticalSlider = &verticalSliderReference;
|
|
|
|
|
|
|
|
[self setTarget:self];
|
|
|
|
[self setAction:@selector(activate:)];
|
|
|
|
[self setMinValue:0];
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2013-03-21 12:59:01 +00:00
|
|
|
-(IBAction) activate:(id)sender {
|
2013-03-15 13:11:33 +00:00
|
|
|
verticalSlider->state.position = [self doubleValue];
|
2015-12-30 06:41:46 +00:00
|
|
|
verticalSlider->doChange();
|
2013-03-15 13:11:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
2015-12-30 06:41:46 +00:00
|
|
|
namespace hiro {
|
|
|
|
|
|
|
|
auto pVerticalSlider::construct() -> void {
|
|
|
|
@autoreleasepool {
|
|
|
|
cocoaView = cocoaVerticalSlider = [[CocoaVerticalSlider alloc] initWith:self()];
|
|
|
|
pWidget::construct();
|
|
|
|
|
|
|
|
setLength(state().length);
|
|
|
|
setPosition(state().position);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
auto pVerticalSlider::destruct() -> void {
|
|
|
|
@autoreleasepool {
|
2016-01-07 08:14:33 +00:00
|
|
|
[cocoaView removeFromSuperview];
|
2015-12-30 06:41:46 +00:00
|
|
|
[cocoaView release];
|
|
|
|
}
|
|
|
|
}
|
2013-03-15 13:11:33 +00:00
|
|
|
|
2015-12-30 06:41:46 +00:00
|
|
|
auto pVerticalSlider::minimumSize() const -> Size {
|
2013-04-09 13:31:46 +00:00
|
|
|
return {20, 48};
|
2013-03-15 13:11:33 +00:00
|
|
|
}
|
|
|
|
|
2015-12-30 06:41:46 +00:00
|
|
|
auto pVerticalSlider::setGeometry(Geometry geometry) -> void {
|
2013-04-09 13:31:46 +00:00
|
|
|
pWidget::setGeometry({
|
2015-12-30 06:41:46 +00:00
|
|
|
geometry.x(), geometry.y() - 2,
|
|
|
|
geometry.width(), geometry.height() + 4
|
2013-04-09 13:31:46 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2015-12-30 06:41:46 +00:00
|
|
|
auto pVerticalSlider::setLength(uint length) -> void {
|
2013-03-15 13:11:33 +00:00
|
|
|
@autoreleasepool {
|
|
|
|
[cocoaView setMaxValue:length];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-30 06:41:46 +00:00
|
|
|
auto pVerticalSlider::setPosition(uint position) -> void {
|
2013-03-15 13:11:33 +00:00
|
|
|
@autoreleasepool {
|
|
|
|
[cocoaView setDoubleValue:position];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-12-30 06:41:46 +00:00
|
|
|
#endif
|