status-bar.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #if defined(Hiro_StatusBar)
  2. namespace hiro {
  3. auto pStatusBar::construct() -> void {
  4. }
  5. auto pStatusBar::destruct() -> void {
  6. }
  7. auto pStatusBar::setEnabled(bool enabled) -> void {
  8. @autoreleasepool {
  9. if(auto parent = _parent()) {
  10. [[parent->cocoaWindow statusBar] setEnabled:enabled];
  11. }
  12. }
  13. }
  14. auto pStatusBar::setFont(const Font& font) -> void {
  15. @autoreleasepool {
  16. if(auto parent = _parent()) {
  17. [[parent->cocoaWindow statusBar] setFont:pFont::create(font)];
  18. }
  19. }
  20. }
  21. auto pStatusBar::setText(const string& text) -> void {
  22. @autoreleasepool {
  23. if(auto parent = _parent()) {
  24. [[parent->cocoaWindow statusBar] setStringValue:[NSString stringWithUTF8String:state().text]];
  25. }
  26. }
  27. }
  28. auto pStatusBar::setVisible(bool visible) -> void {
  29. @autoreleasepool {
  30. if(auto parent = _parent()) {
  31. [[parent->cocoaWindow statusBar] setHidden:!visible];
  32. parent->setGeometry(parent->state().geometry);
  33. }
  34. }
  35. }
  36. auto pStatusBar::_parent() -> maybe<pWindow&> {
  37. if(auto parent = self().parentWindow()) {
  38. if(auto self = parent->self()) return *self;
  39. }
  40. return nothing;
  41. }
  42. }
  43. #endif