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