window.hpp 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #if defined(Hiro_Window)
  2. @interface CocoaWindow : NSWindow <NSWindowDelegate> {
  3. @public
  4. hiro::mWindow* window;
  5. NSMenu* menuBar;
  6. NSMenu* rootMenu;
  7. NSMenuItem* disableGatekeeper;
  8. NSTextField* statusBar;
  9. }
  10. -(id) initWith:(hiro::mWindow&)window;
  11. -(BOOL) canBecomeKeyWindow;
  12. -(BOOL) canBecomeMainWindow;
  13. -(void) windowDidBecomeMain:(NSNotification*)notification;
  14. -(void) windowDidMove:(NSNotification*)notification;
  15. -(void) windowDidResize:(NSNotification*)notification;
  16. -(BOOL) windowShouldClose:(id)sender;
  17. -(NSDragOperation) draggingEntered:(id<NSDraggingInfo>)sender;
  18. -(BOOL) performDragOperation:(id<NSDraggingInfo>)sender;
  19. -(NSMenu*) menuBar;
  20. -(void) menuAbout;
  21. -(void) menuPreferences;
  22. -(void) menuDisableGatekeeperAutoRearm;
  23. -(void) menuQuit;
  24. -(NSTextField*) statusBar;
  25. @end
  26. namespace hiro {
  27. struct pWindow : pObject {
  28. Declare(Window, Object)
  29. auto append(sMenuBar menuBar) -> void;
  30. auto append(sSizable sizable) -> void;
  31. auto append(sStatusBar statusBar) -> void;
  32. auto focused() const -> bool override;
  33. auto frameMargin() const -> Geometry;
  34. auto handle() const -> uintptr_t;
  35. auto monitor() const -> uint;
  36. auto remove(sMenuBar menuBar) -> void;
  37. auto remove(sSizable sizable) -> void;
  38. auto remove(sStatusBar statusBar) -> void;
  39. auto setBackgroundColor(Color color) -> void;
  40. auto setDismissable(bool dismissable) -> void;
  41. auto setDroppable(bool droppable) -> void;
  42. auto setFocused() -> void override;
  43. auto setFullScreen(bool fullScreen) -> void;
  44. auto setGeometry(Geometry geometry) -> void;
  45. auto setMaximized(bool maximized) -> void;
  46. auto setMaximumSize(Size size) -> void;
  47. auto setMinimized(bool minimized) -> void;
  48. auto setMinimumSize(Size size) -> void;
  49. auto setModal(bool modal) -> void;
  50. auto setResizable(bool resizable) -> void;
  51. auto setTitle(const string& text) -> void;
  52. auto setVisible(bool visible) -> void;
  53. auto moveEvent() -> void;
  54. auto sizeEvent() -> void;
  55. auto statusBarHeight() -> uint;
  56. auto statusBarReposition() -> void;
  57. auto _append(mWidget& widget) -> void;
  58. auto _geometry() -> Geometry;
  59. CocoaWindow* cocoaWindow = nullptr;
  60. Geometry windowedGeometry;
  61. };
  62. }
  63. #endif