| 1 |
#if defined(Hiro_ProgressBar) |
| 2 |
|
| 3 |
@implementation CocoaProgressBar |
| 4 |
|
| 5 |
-(id) initWith:(hiro::mProgressBar&)progressBarReference { |
| 6 |
if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 0)]) { |
| 7 |
progressBar = &progressBarReference; |
| 8 |
|
| 9 |
[self setIndeterminate:NO]; |
| 10 |
[self setMinValue:0.0]; |
| 11 |
[self setMaxValue:100.0]; |
| 12 |
} |
| 13 |
return self; |
| 14 |
} |
| 15 |
|
| 16 |
@end |
| 17 |
|
| 18 |
namespace hiro { |
| 19 |
|
| 20 |
auto pProgressBar::construct() -> void { |
| 21 |
cocoaView = cocoaProgressBar = [[CocoaProgressBar alloc] initWith:self()]; |
| 22 |
pWidget::construct(); |
| 23 |
|
| 24 |
setPosition(state().position); |
| 25 |
} |
| 26 |
|
| 27 |
auto pProgressBar::destruct() -> void { |
| 28 |
[cocoaView removeFromSuperview]; |
| 29 |
} |
| 30 |
|
| 31 |
auto pProgressBar::minimumSize() const -> Size { |
| 32 |
return {0, 12}; |
| 33 |
} |
| 34 |
|
| 35 |
auto pProgressBar::setPosition(u32 position) -> void { |
| 36 |
[(CocoaProgressBar*)cocoaView setDoubleValue:position]; |
| 37 |
} |
| 38 |
|
| 39 |
} |
| 40 |
|
| 41 |
#endif |