2015-12-30 06:41:46 +00:00
|
|
|
#if defined(Hiro_ProgressBar)
|
|
|
|
|
2013-03-15 13:11:33 +00:00
|
|
|
@implementation CocoaProgressBar : NSProgressIndicator
|
|
|
|
|
2015-12-30 06:41:46 +00:00
|
|
|
-(id) initWith:(hiro::mProgressBar&)progressBarReference {
|
2013-03-15 13:11:33 +00:00
|
|
|
if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 0)]) {
|
|
|
|
progressBar = &progressBarReference;
|
|
|
|
|
|
|
|
[self setIndeterminate:NO];
|
|
|
|
[self setMinValue:0.0];
|
|
|
|
[self setMaxValue:100.0];
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
2015-12-30 06:41:46 +00:00
|
|
|
namespace hiro {
|
2013-03-15 13:11:33 +00:00
|
|
|
|
2015-12-30 06:41:46 +00:00
|
|
|
auto pProgressBar::construct() -> void {
|
2013-03-15 13:11:33 +00:00
|
|
|
@autoreleasepool {
|
2015-12-30 06:41:46 +00:00
|
|
|
cocoaView = cocoaProgressBar = [[CocoaProgressBar alloc] initWith:self()];
|
|
|
|
pWidget::construct();
|
|
|
|
|
|
|
|
setPosition(state().position);
|
2013-03-15 13:11:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-30 06:41:46 +00:00
|
|
|
auto pProgressBar::destruct() -> void {
|
2013-03-15 13:11:33 +00:00
|
|
|
@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 pProgressBar::minimumSize() const -> Size {
|
|
|
|
return {0, 12};
|
|
|
|
}
|
|
|
|
|
|
|
|
auto pProgressBar::setPosition(uint position) -> void {
|
2013-03-15 13:11:33 +00:00
|
|
|
@autoreleasepool {
|
2015-12-30 06:41:46 +00:00
|
|
|
[cocoaView setDoubleValue:position];
|
2013-03-15 13:11:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2015-12-30 06:41:46 +00:00
|
|
|
|
|
|
|
#endif
|