frame.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/cocoa/frame.h
  3. // Purpose: wxFrame class
  4. // Author: David Elliott
  5. // Modified by:
  6. // Created: 2003/03/16
  7. // Copyright: (c) 2003 David Elliott
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_COCOA_FRAME_H_
  11. #define _WX_COCOA_FRAME_H_
  12. class WXDLLIMPEXP_FWD_CORE wxMenuBar;
  13. class WXDLLIMPEXP_FWD_CORE wxStatusBar;
  14. class WXDLLIMPEXP_CORE wxFrame: public wxFrameBase
  15. {
  16. DECLARE_EVENT_TABLE()
  17. DECLARE_DYNAMIC_CLASS(wxFrame)
  18. // ------------------------------------------------------------------------
  19. // initialization
  20. // ------------------------------------------------------------------------
  21. public:
  22. wxFrame() { Init(); }
  23. wxFrame(wxWindow *parent,
  24. wxWindowID winid,
  25. const wxString& title,
  26. const wxPoint& pos = wxDefaultPosition,
  27. const wxSize& size = wxDefaultSize,
  28. long style = wxDEFAULT_FRAME_STYLE,
  29. const wxString& name = wxFrameNameStr)
  30. {
  31. Init();
  32. Create(parent, winid, title, pos, size, style, name);
  33. }
  34. virtual ~wxFrame();
  35. bool Create(wxWindow *parent,
  36. wxWindowID winid,
  37. const wxString& title,
  38. const wxPoint& pos = wxDefaultPosition,
  39. const wxSize& size = wxDefaultSize,
  40. long style = wxDEFAULT_FRAME_STYLE,
  41. const wxString& name = wxFrameNameStr);
  42. protected:
  43. void Init();
  44. // ------------------------------------------------------------------------
  45. // Cocoa specifics
  46. // ------------------------------------------------------------------------
  47. public:
  48. virtual wxMenuBar* GetAppMenuBar(wxCocoaNSWindow *win);
  49. // Returns the NSView for non-client drawing
  50. virtual WX_NSView GetNonClientNSView();
  51. // Helper function to position status/tool bars
  52. // Also called by native toolbar to force a size update
  53. void UpdateFrameNSView();
  54. virtual void CocoaDelegate_wxMenuItemAction(WX_NSMenuItem menuItem);
  55. virtual bool CocoaDelegate_validateMenuItem(WX_NSMenuItem menuItem);
  56. protected:
  57. virtual void CocoaSetWxWindowSize(int width, int height);
  58. virtual void CocoaReplaceView(WX_NSView oldView, WX_NSView newView);
  59. // frameNSView is used whenever a statusbar/generic toolbar are present
  60. WX_NSView m_frameNSView;
  61. // ------------------------------------------------------------------------
  62. // Implementation
  63. // ------------------------------------------------------------------------
  64. public:
  65. virtual void AttachMenuBar(wxMenuBar *mbar);
  66. virtual void DetachMenuBar();
  67. virtual void SetMenuBar(wxMenuBar *menubar);
  68. // implementation only from now on
  69. // -------------------------------
  70. // override some more virtuals
  71. // get the origin of the client area (which may be different from (0, 0)
  72. // if the frame has a toolbar) in client coordinates
  73. virtual wxPoint GetClientAreaOrigin() const;
  74. // create the main status bar by calling OnCreateStatusBar()
  75. virtual wxStatusBar* CreateStatusBar(int number = 1,
  76. long style = wxSTB_DEFAULT_STYLE,
  77. wxWindowID winid = 0,
  78. const wxString& name =
  79. wxStatusLineNameStr);
  80. // sets the main status bar
  81. void SetStatusBar(wxStatusBar *statBar);
  82. #if wxUSE_TOOLBAR
  83. // create main toolbar bycalling OnCreateToolBar()
  84. virtual wxToolBar* CreateToolBar(long style = -1,
  85. wxWindowID winid = wxID_ANY,
  86. const wxString& name = wxToolBarNameStr);
  87. // sets the main tool bar
  88. virtual void SetToolBar(wxToolBar *toolbar);
  89. #endif //wxUSE_TOOLBAR
  90. protected:
  91. void PositionStatusBar();
  92. };
  93. #endif // _WX_COCOA_FRAME_H_