]>
Commit | Line | Data |
---|---|---|
8cf73271 SC |
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 | |
65571936 | 9 | // Licence: wxWindows licence |
8cf73271 SC |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_FRAME_H_ | |
13 | #define _WX_FRAME_H_ | |
14 | ||
8cf73271 SC |
15 | #include "wx/window.h" |
16 | #include "wx/toolbar.h" | |
17 | #include "wx/accel.h" | |
18 | #include "wx/icon.h" | |
19 | ||
63ec432b | 20 | WXDLLEXPORT_DATA(extern const wxChar) wxToolBarNameStr[]; |
8cf73271 SC |
21 | |
22 | class WXDLLEXPORT wxMenuBar; | |
23 | class WXDLLEXPORT wxStatusBar; | |
24 | class WXDLLEXPORT wxMacToolTip ; | |
25 | ||
26 | class WXDLLEXPORT 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 | ||
e56d2520 SC |
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 | ||
8cf73271 SC |
61 | // override some more virtuals |
62 | virtual bool Enable(bool enable = TRUE) ; | |
63 | ||
8cf73271 SC |
64 | // event handlers |
65 | void OnActivate(wxActivateEvent& event); | |
66 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
67 | ||
68 | // Toolbar | |
69 | #if wxUSE_TOOLBAR | |
70 | virtual wxToolBar* CreateToolBar(long style = -1, | |
71 | wxWindowID id = -1, | |
72 | const wxString& name = wxToolBarNameStr); | |
73 | ||
e56d2520 | 74 | virtual void SetToolBar(wxToolBar *toolbar); |
8cf73271 SC |
75 | #endif // wxUSE_TOOLBAR |
76 | ||
77 | // Status bar | |
78 | #if wxUSE_STATUSBAR | |
79 | virtual wxStatusBar* OnCreateStatusBar(int number = 1, | |
80 | long style = wxST_SIZEGRIP, | |
81 | wxWindowID id = 0, | |
82 | const wxString& name = wxStatusLineNameStr); | |
8cf73271 SC |
83 | #endif // wxUSE_STATUSBAR |
84 | ||
8cf73271 SC |
85 | // called by wxWindow whenever it gets focus |
86 | void SetLastFocus(wxWindow *win) { m_winLastFocused = win; } | |
87 | wxWindow *GetLastFocus() const { return m_winLastFocused; } | |
88 | ||
6f02a879 VZ |
89 | void PositionBars(); |
90 | ||
8cf73271 SC |
91 | protected: |
92 | // common part of all ctors | |
93 | void Init(); | |
94 | ||
6f02a879 VZ |
95 | #if wxUSE_TOOLBAR |
96 | virtual void PositionToolBar(); | |
97 | #endif | |
98 | #if wxUSE_STATUSBAR | |
99 | virtual void PositionStatusBar(); | |
100 | #endif | |
101 | ||
8cf73271 SC |
102 | // override base class virtuals |
103 | virtual void DoGetClientSize(int *width, int *height) const; | |
104 | virtual void DoSetClientSize(int width, int height); | |
105 | ||
106 | virtual void DetachMenuBar(); | |
107 | virtual void AttachMenuBar(wxMenuBar *menubar); | |
108 | ||
109 | protected: | |
110 | // the last focused child: we restore focus to it on activation | |
111 | wxWindow *m_winLastFocused; | |
112 | ||
78df41df SC |
113 | virtual bool MacIsChildOfClientArea( const wxWindow* child ) const ; |
114 | ||
8cf73271 SC |
115 | private: |
116 | DECLARE_EVENT_TABLE() | |
117 | DECLARE_DYNAMIC_CLASS(wxFrame) | |
118 | }; | |
119 | ||
120 | #endif | |
121 | // _WX_FRAME_H_ |