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