]> git.saurik.com Git - wxWidgets.git/blob - include/wx/osx/frame.h
Use wxAnyButton's DoGetBestSize for toggle buttons
[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 void OnSize(wxSizeEvent& event);
63
64 // Toolbar
65 #if wxUSE_TOOLBAR
66 virtual wxToolBar* CreateToolBar(long style = -1,
67 wxWindowID id = -1,
68 const wxString& name = wxToolBarNameStr);
69
70 virtual void SetToolBar(wxToolBar *toolbar);
71 #endif // wxUSE_TOOLBAR
72
73 // Status bar
74 #if wxUSE_STATUSBAR
75 virtual wxStatusBar* OnCreateStatusBar(int number = 1,
76 long style = wxSTB_DEFAULT_STYLE,
77 wxWindowID id = 0,
78 const wxString& name = wxStatusLineNameStr);
79 #endif // wxUSE_STATUSBAR
80
81 // called by wxWindow whenever it gets focus
82 void SetLastFocus(wxWindow *win) { m_winLastFocused = win; }
83 wxWindow *GetLastFocus() const { return m_winLastFocused; }
84
85 void PositionBars();
86
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_