]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/cocoa/frame.h | |
3 | // Purpose: wxFrame class | |
4 | // Author: David Elliott | |
5 | // Modified by: | |
6 | // Created: 2003/03/16 | |
7 | // Copyright: (c) 2003 David Elliott | |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_COCOA_FRAME_H_ | |
12 | #define _WX_COCOA_FRAME_H_ | |
13 | ||
14 | class WXDLLIMPEXP_FWD_CORE wxMenuBar; | |
15 | class WXDLLIMPEXP_FWD_CORE wxStatusBar; | |
16 | ||
17 | class WXDLLIMPEXP_CORE wxFrame: public wxFrameBase | |
18 | { | |
19 | DECLARE_EVENT_TABLE() | |
20 | DECLARE_DYNAMIC_CLASS(wxFrame) | |
21 | // ------------------------------------------------------------------------ | |
22 | // initialization | |
23 | // ------------------------------------------------------------------------ | |
24 | public: | |
25 | wxFrame() { Init(); } | |
26 | wxFrame(wxWindow *parent, | |
27 | wxWindowID winid, | |
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 | Create(parent, winid, title, pos, size, style, name); | |
36 | } | |
37 | ||
38 | virtual ~wxFrame(); | |
39 | ||
40 | bool Create(wxWindow *parent, | |
41 | wxWindowID winid, | |
42 | const wxString& title, | |
43 | const wxPoint& pos = wxDefaultPosition, | |
44 | const wxSize& size = wxDefaultSize, | |
45 | long style = wxDEFAULT_FRAME_STYLE, | |
46 | const wxString& name = wxFrameNameStr); | |
47 | protected: | |
48 | void Init(); | |
49 | // ------------------------------------------------------------------------ | |
50 | // Cocoa specifics | |
51 | // ------------------------------------------------------------------------ | |
52 | public: | |
53 | virtual wxMenuBar* GetAppMenuBar(wxCocoaNSWindow *win); | |
54 | // Returns the NSView for non-client drawing | |
55 | virtual WX_NSView GetNonClientNSView(); | |
56 | ||
57 | // Helper function to position status/tool bars | |
58 | // Also called by native toolbar to force a size update | |
59 | void UpdateFrameNSView(); | |
60 | ||
61 | virtual void CocoaDelegate_wxMenuItemAction(WX_NSMenuItem menuItem); | |
62 | virtual bool CocoaDelegate_validateMenuItem(WX_NSMenuItem menuItem); | |
63 | protected: | |
64 | virtual void CocoaSetWxWindowSize(int width, int height); | |
65 | ||
66 | virtual void CocoaReplaceView(WX_NSView oldView, WX_NSView newView); | |
67 | // frameNSView is used whenever a statusbar/generic toolbar are present | |
68 | WX_NSView m_frameNSView; | |
69 | // ------------------------------------------------------------------------ | |
70 | // Implementation | |
71 | // ------------------------------------------------------------------------ | |
72 | public: | |
73 | virtual void AttachMenuBar(wxMenuBar *mbar); | |
74 | virtual void DetachMenuBar(); | |
75 | virtual void SetMenuBar(wxMenuBar *menubar); | |
76 | ||
77 | // implementation only from now on | |
78 | // ------------------------------- | |
79 | ||
80 | // override some more virtuals | |
81 | ||
82 | // get the origin of the client area (which may be different from (0, 0) | |
83 | // if the frame has a toolbar) in client coordinates | |
84 | virtual wxPoint GetClientAreaOrigin() const; | |
85 | ||
86 | // create the main status bar by calling OnCreateStatusBar() | |
87 | virtual wxStatusBar* CreateStatusBar(int number = 1, | |
88 | long style = wxSTB_DEFAULT_STYLE, | |
89 | wxWindowID winid = 0, | |
90 | const wxString& name = | |
91 | wxStatusLineNameStr); | |
92 | // sets the main status bar | |
93 | void SetStatusBar(wxStatusBar *statBar); | |
94 | #if wxUSE_TOOLBAR | |
95 | // create main toolbar bycalling OnCreateToolBar() | |
96 | virtual wxToolBar* CreateToolBar(long style = -1, | |
97 | wxWindowID winid = wxID_ANY, | |
98 | const wxString& name = wxToolBarNameStr); | |
99 | // sets the main tool bar | |
100 | virtual void SetToolBar(wxToolBar *toolbar); | |
101 | #endif //wxUSE_TOOLBAR | |
102 | protected: | |
103 | void PositionStatusBar(); | |
104 | }; | |
105 | ||
106 | #endif // _WX_COCOA_FRAME_H_ |