frame.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/osx/frame.h
  3. // Purpose: wxFrame class
  4. // Author: Stefan Csomor
  5. // Modified by:
  6. // Created: 1998-01-01
  7. // Copyright: (c) Stefan Csomor
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_FRAME_H_
  11. #define _WX_FRAME_H_
  12. #include "wx/toolbar.h"
  13. #include "wx/accel.h"
  14. #include "wx/icon.h"
  15. class WXDLLIMPEXP_FWD_CORE wxMacToolTip ;
  16. class WXDLLIMPEXP_CORE wxFrame: public wxFrameBase
  17. {
  18. public:
  19. // construction
  20. wxFrame() { Init(); }
  21. wxFrame(wxWindow *parent,
  22. wxWindowID id,
  23. const wxString& title,
  24. const wxPoint& pos = wxDefaultPosition,
  25. const wxSize& size = wxDefaultSize,
  26. long style = wxDEFAULT_FRAME_STYLE,
  27. const wxString& name = wxFrameNameStr)
  28. {
  29. Init();
  30. Create(parent, id, title, pos, size, style, name);
  31. }
  32. bool Create(wxWindow *parent,
  33. wxWindowID id,
  34. const wxString& title,
  35. const wxPoint& pos = wxDefaultPosition,
  36. const wxSize& size = wxDefaultSize,
  37. long style = wxDEFAULT_FRAME_STYLE,
  38. const wxString& name = wxFrameNameStr);
  39. virtual ~wxFrame();
  40. // implementation only from now on
  41. // -------------------------------
  42. // get the origin of the client area (which may be different from (0, 0)
  43. // if the frame has a toolbar) in client coordinates
  44. virtual wxPoint GetClientAreaOrigin() const;
  45. // override some more virtuals
  46. virtual bool Enable(bool enable = true) ;
  47. // event handlers
  48. void OnActivate(wxActivateEvent& event);
  49. void OnSysColourChanged(wxSysColourChangedEvent& event);
  50. // Toolbar
  51. #if wxUSE_TOOLBAR
  52. virtual wxToolBar* CreateToolBar(long style = -1,
  53. wxWindowID id = -1,
  54. const wxString& name = wxToolBarNameStr);
  55. virtual void SetToolBar(wxToolBar *toolbar);
  56. #endif // wxUSE_TOOLBAR
  57. // Status bar
  58. #if wxUSE_STATUSBAR
  59. virtual wxStatusBar* OnCreateStatusBar(int number = 1,
  60. long style = wxSTB_DEFAULT_STYLE,
  61. wxWindowID id = 0,
  62. const wxString& name = wxStatusLineNameStr);
  63. #endif // wxUSE_STATUSBAR
  64. // called by wxWindow whenever it gets focus
  65. void SetLastFocus(wxWindow *win) { m_winLastFocused = win; }
  66. wxWindow *GetLastFocus() const { return m_winLastFocused; }
  67. void PositionBars();
  68. // internal response to size events
  69. virtual void MacOnInternalSize() { PositionBars(); }
  70. protected:
  71. // common part of all ctors
  72. void Init();
  73. #if wxUSE_TOOLBAR
  74. virtual void PositionToolBar();
  75. #endif
  76. #if wxUSE_STATUSBAR
  77. virtual void PositionStatusBar();
  78. #endif
  79. // override base class virtuals
  80. virtual void DoGetClientSize(int *width, int *height) const;
  81. virtual void DoSetClientSize(int width, int height);
  82. #if wxUSE_MENUS
  83. virtual void DetachMenuBar();
  84. virtual void AttachMenuBar(wxMenuBar *menubar);
  85. #endif
  86. // the last focused child: we restore focus to it on activation
  87. wxWindow *m_winLastFocused;
  88. virtual bool MacIsChildOfClientArea( const wxWindow* child ) const ;
  89. DECLARE_EVENT_TABLE()
  90. DECLARE_DYNAMIC_CLASS(wxFrame)
  91. };
  92. #endif
  93. // _WX_FRAME_H_