]>
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 MR |
20 | WXDLLEXPORT_DATA(extern const wxChar) wxFrameNameStr[]; |
21 | WXDLLEXPORT_DATA(extern const wxChar) wxToolBarNameStr[]; | |
8cf73271 SC |
22 | |
23 | class WXDLLEXPORT wxMenuBar; | |
24 | class WXDLLEXPORT wxStatusBar; | |
25 | class WXDLLEXPORT wxMacToolTip ; | |
26 | ||
27 | class WXDLLEXPORT wxFrame: public wxFrameBase | |
28 | { | |
29 | public: | |
30 | // construction | |
31 | wxFrame() { Init(); } | |
32 | wxFrame(wxWindow *parent, | |
33 | wxWindowID id, | |
34 | const wxString& title, | |
35 | const wxPoint& pos = wxDefaultPosition, | |
36 | const wxSize& size = wxDefaultSize, | |
37 | long style = wxDEFAULT_FRAME_STYLE, | |
38 | const wxString& name = wxFrameNameStr) | |
39 | { | |
40 | Init(); | |
41 | ||
42 | Create(parent, id, title, pos, size, style, name); | |
43 | } | |
44 | ||
45 | bool Create(wxWindow *parent, | |
46 | wxWindowID id, | |
47 | const wxString& title, | |
48 | const wxPoint& pos = wxDefaultPosition, | |
49 | const wxSize& size = wxDefaultSize, | |
50 | long style = wxDEFAULT_FRAME_STYLE, | |
51 | const wxString& name = wxFrameNameStr); | |
52 | ||
53 | virtual ~wxFrame(); | |
54 | ||
55 | // implementation only from now on | |
56 | // ------------------------------- | |
57 | ||
e56d2520 SC |
58 | // get the origin of the client area (which may be different from (0, 0) |
59 | // if the frame has a toolbar) in client coordinates | |
60 | virtual wxPoint GetClientAreaOrigin() const; | |
61 | ||
8cf73271 SC |
62 | // override some more virtuals |
63 | virtual bool Enable(bool enable = TRUE) ; | |
64 | ||
8cf73271 SC |
65 | // event handlers |
66 | void OnActivate(wxActivateEvent& event); | |
67 | void OnSysColourChanged(wxSysColourChangedEvent& 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 | ||
e56d2520 | 75 | virtual void SetToolBar(wxToolBar *toolbar); |
8cf73271 SC |
76 | #endif // wxUSE_TOOLBAR |
77 | ||
78 | // Status bar | |
79 | #if wxUSE_STATUSBAR | |
80 | virtual wxStatusBar* OnCreateStatusBar(int number = 1, | |
81 | long style = wxST_SIZEGRIP, | |
82 | wxWindowID id = 0, | |
83 | const wxString& name = wxStatusLineNameStr); | |
8cf73271 SC |
84 | #endif // wxUSE_STATUSBAR |
85 | ||
86 | // tooltip management | |
87 | #if wxUSE_TOOLTIPS | |
88 | wxMacToolTip* GetToolTipCtrl() const { return m_hwndToolTip; } | |
89 | void SetToolTipCtrl(wxMacToolTip *tt) { m_hwndToolTip = tt; } | |
90 | wxMacToolTip* m_hwndToolTip ; | |
91 | #endif // tooltips | |
92 | ||
93 | // called by wxWindow whenever it gets focus | |
94 | void SetLastFocus(wxWindow *win) { m_winLastFocused = win; } | |
95 | wxWindow *GetLastFocus() const { return m_winLastFocused; } | |
96 | ||
6f02a879 VZ |
97 | void PositionBars(); |
98 | ||
8cf73271 SC |
99 | protected: |
100 | // common part of all ctors | |
101 | void Init(); | |
102 | ||
6f02a879 VZ |
103 | #if wxUSE_TOOLBAR |
104 | virtual void PositionToolBar(); | |
105 | #endif | |
106 | #if wxUSE_STATUSBAR | |
107 | virtual void PositionStatusBar(); | |
108 | #endif | |
109 | ||
8cf73271 SC |
110 | // override base class virtuals |
111 | virtual void DoGetClientSize(int *width, int *height) const; | |
112 | virtual void DoSetClientSize(int width, int height); | |
113 | ||
114 | virtual void DetachMenuBar(); | |
115 | virtual void AttachMenuBar(wxMenuBar *menubar); | |
116 | ||
117 | protected: | |
118 | // the last focused child: we restore focus to it on activation | |
119 | wxWindow *m_winLastFocused; | |
120 | ||
78df41df SC |
121 | virtual bool MacIsChildOfClientArea( const wxWindow* child ) const ; |
122 | ||
8cf73271 SC |
123 | private: |
124 | DECLARE_EVENT_TABLE() | |
125 | DECLARE_DYNAMIC_CLASS(wxFrame) | |
126 | }; | |
127 | ||
128 | #endif | |
129 | // _WX_FRAME_H_ |