progress-bar.cpp 929 B

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