wxMessageBox off the main thread lost result code.
[wxWidgets.git] / include / wx / osx / frame.h
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
11 #ifndef _WX_FRAME_H_
12 #define _WX_FRAME_H_
13
14 #include "wx/toolbar.h"
15 #include "wx/accel.h"
16 #include "wx/icon.h"
17
18 class WXDLLIMPEXP_FWD_CORE wxMacToolTip ;
19
20 class WXDLLIMPEXP_CORE wxFrame: public wxFrameBase
21 {
22 public:
23 // construction
24 wxFrame() { Init(); }
25 wxFrame(wxWindow *parent,
26 wxWindowID id,
27 const wxString& title,
28 const wxPoint& pos = wxDefaultPosition,
29 const wxSize& size = wxDefaultSize,
30 long style = wxDEFAULT_FRAME_STYLE,
31 const wxString& name = wxFrameNameStr)
32 {
33 Init();
34
35 Create(parent, id, title, pos, size, style, name);
36 }
37
38 bool Create(wxWindow *parent,
39 wxWindowID id,
40 const wxString& title,
41 const wxPoint& pos = wxDefaultPosition,
42 const wxSize& size = wxDefaultSize,
43 long style = wxDEFAULT_FRAME_STYLE,
44 const wxString& name = wxFrameNameStr);
45
46 virtual ~wxFrame();
47
48 // implementation only from now on
49 // -------------------------------
50
51 // get the origin of the client area (which may be different from (0, 0)
52 // if the frame has a toolbar) in client coordinates
53 virtual wxPoint GetClientAreaOrigin() const;
54
55 // override some more virtuals
56 virtual bool Enable(bool enable = true) ;
57
58 // event handlers
59 void OnActivate(wxActivateEvent& event);
60 void OnSysColourChanged(wxSysColourChangedEvent& event);
61
62 // Toolbar
63 #if wxUSE_TOOLBAR
64 virtual wxToolBar* CreateToolBar(long style = -1,
65 wxWindowID id = -1,
66 const wxString& name = wxToolBarNameStr);
67
68 virtual void SetToolBar(wxToolBar *toolbar);
69 #endif // wxUSE_TOOLBAR
70
71 // Status bar
72 #if wxUSE_STATUSBAR
73 virtual wxStatusBar* OnCreateStatusBar(int number = 1,
74 long style = wxSTB_DEFAULT_STYLE,
75 wxWindowID id = 0,
76 const wxString& name = wxStatusLineNameStr);
77 #endif // wxUSE_STATUSBAR
78
79 // called by wxWindow whenever it gets focus
80 void SetLastFocus(wxWindow *win) { m_winLastFocused = win; }
81 wxWindow *GetLastFocus() const { return m_winLastFocused; }
82
83 void PositionBars();
84
85 // internal response to size events
86 virtual void MacOnInternalSize() { PositionBars(); }
87
88 protected:
89 // common part of all ctors
90 void Init();
91
92 #if wxUSE_TOOLBAR
93 virtual void PositionToolBar();
94 #endif
95 #if wxUSE_STATUSBAR
96 virtual void PositionStatusBar();
97 #endif
98
99 // override base class virtuals
100 virtual void DoGetClientSize(int *width, int *height) const;
101 virtual void DoSetClientSize(int width, int height);
102
103 #if wxUSE_MENUS
104 virtual void DetachMenuBar();
105 virtual void AttachMenuBar(wxMenuBar *menubar);
106 #endif
107
108 // the last focused child: we restore focus to it on activation
109 wxWindow *m_winLastFocused;
110
111 virtual bool MacIsChildOfClientArea( const wxWindow* child ) const ;
112
113 DECLARE_EVENT_TABLE()
114 DECLARE_DYNAMIC_CLASS(wxFrame)
115 };
116
117 #endif
118 // _WX_FRAME_H_