]>
Commit | Line | Data |
---|---|---|
2bda0e17 | 1 | ///////////////////////////////////////////////////////////////////////////// |
7c0ea335 | 2 | // Name: wx/msw/frame.h |
0d53fc34 | 3 | // Purpose: wxFrame class |
2bda0e17 KB |
4 | // Author: Julian Smart |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
371a5b4e | 8 | // Copyright: (c) Julian Smart |
65571936 | 9 | // Licence: wxWindows licence |
2bda0e17 KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
bbcdf8bc JS |
12 | #ifndef _WX_FRAME_H_ |
13 | #define _WX_FRAME_H_ | |
2bda0e17 | 14 | |
53a2db12 | 15 | class WXDLLIMPEXP_CORE wxFrame : public wxFrameBase |
3a19e16d | 16 | { |
2bda0e17 | 17 | public: |
7c0ea335 | 18 | // construction |
0d53fc34 VS |
19 | wxFrame() { Init(); } |
20 | wxFrame(wxWindow *parent, | |
08b97268 WS |
21 | wxWindowID id, |
22 | const wxString& title, | |
23 | const wxPoint& pos = wxDefaultPosition, | |
24 | const wxSize& size = wxDefaultSize, | |
25 | long style = wxDEFAULT_FRAME_STYLE, | |
26 | const wxString& name = wxFrameNameStr) | |
3a19e16d | 27 | { |
7c0ea335 VZ |
28 | Init(); |
29 | ||
3a19e16d VZ |
30 | Create(parent, id, title, pos, size, style, name); |
31 | } | |
16f6dfd8 | 32 | |
3a19e16d VZ |
33 | bool Create(wxWindow *parent, |
34 | wxWindowID id, | |
35 | const wxString& title, | |
36 | const wxPoint& pos = wxDefaultPosition, | |
37 | const wxSize& size = wxDefaultSize, | |
38 | long style = wxDEFAULT_FRAME_STYLE, | |
39 | const wxString& name = wxFrameNameStr); | |
16f6dfd8 | 40 | |
0d53fc34 | 41 | virtual ~wxFrame(); |
16f6dfd8 | 42 | |
7c0ea335 | 43 | // implement base class pure virtuals |
a2327a9f | 44 | virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); |
82c9f85c | 45 | virtual void Raise(); |
42e69d6b | 46 | |
7c0ea335 VZ |
47 | // implementation only from now on |
48 | // ------------------------------- | |
16f6dfd8 | 49 | |
7c0ea335 | 50 | // event handlers |
7c0ea335 | 51 | void OnSysColourChanged(wxSysColourChangedEvent& event); |
16f6dfd8 | 52 | |
3a19e16d | 53 | // Toolbar |
d427503c | 54 | #if wxUSE_TOOLBAR |
f9dae779 | 55 | virtual wxToolBar* CreateToolBar(long style = -1, |
cbe874bd | 56 | wxWindowID id = wxID_ANY, |
3a19e16d | 57 | const wxString& name = wxToolBarNameStr); |
d427503c | 58 | #endif // wxUSE_TOOLBAR |
16f6dfd8 | 59 | |
3a19e16d | 60 | // Status bar |
7c0ea335 VZ |
61 | #if wxUSE_STATUSBAR |
62 | virtual wxStatusBar* OnCreateStatusBar(int number = 1, | |
63 | long style = wxST_SIZEGRIP, | |
64 | wxWindowID id = 0, | |
65 | const wxString& name = wxStatusLineNameStr); | |
3a19e16d | 66 | |
7c0ea335 VZ |
67 | // Hint to tell framework which status bar to use: the default is to use |
68 | // native one for the platforms which support it (Win32), the generic one | |
69 | // otherwise | |
16f6dfd8 | 70 | |
3a19e16d | 71 | // TODO: should this go into a wxFrameworkSettings class perhaps? |
7c0ea335 | 72 | static void UseNativeStatusBar(bool useNative) |
47b378bd | 73 | { m_useNativeStatusBar = useNative; } |
7c0ea335 | 74 | static bool UsesNativeStatusBar() |
47b378bd | 75 | { return m_useNativeStatusBar; } |
d427503c | 76 | #endif // wxUSE_STATUSBAR |
16f6dfd8 | 77 | |
7c0ea335 | 78 | // event handlers |
42e69d6b VZ |
79 | bool HandleSize(int x, int y, WXUINT flag); |
80 | bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); | |
81 | bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu); | |
ccef86c7 | 82 | bool HandleMenuLoop(const wxEventType& evtType, WXWORD isPopup); |
42e69d6b | 83 | |
7c0ea335 | 84 | // tooltip management |
3a19e16d | 85 | #if wxUSE_TOOLTIPS |
a23fd0e1 VZ |
86 | WXHWND GetToolTipCtrl() const { return m_hwndToolTip; } |
87 | void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; } | |
3a19e16d VZ |
88 | #endif // tooltips |
89 | ||
0dba08dd | 90 | // override the base class function to handle iconized/maximized frames |
ecdc1183 | 91 | virtual void SendSizeEvent(int flags = 0); |
3cfcd50b | 92 | |
6c7afb74 | 93 | virtual wxPoint GetClientAreaOrigin() const; |
cbe874bd | 94 | |
b45c2fe5 PC |
95 | // override base class version to add menu bar accel processing |
96 | virtual bool MSWTranslateMessage(WXMSG *msg) | |
97 | { | |
98 | return MSWDoTranslateMessage(this, msg); | |
99 | } | |
100 | ||
101 | // window proc for the frames | |
102 | virtual WXLRESULT MSWWindowProc(WXUINT message, | |
103 | WXWPARAM wParam, | |
104 | WXLPARAM lParam); | |
105 | ||
51181d29 VZ |
106 | #if wxUSE_MENUS |
107 | // get the currently active menu: this is the same as the frame menu for | |
108 | // normal frames but is overridden by wxMDIParentFrame | |
109 | virtual WXHMENU MSWGetActiveMenu() const { return m_hMenu; } | |
1483e5db VZ |
110 | |
111 | // find the item in our menu bar: this is again a hook for MDI frames | |
112 | virtual wxMenuItem *MSWFindMenuBarItem(WXWORD id); | |
51181d29 VZ |
113 | #endif // wxUSE_MENUS |
114 | ||
2bda0e17 | 115 | protected: |
7c0ea335 VZ |
116 | // common part of all ctors |
117 | void Init(); | |
118 | ||
a23fd0e1 VZ |
119 | // override base class virtuals |
120 | virtual void DoGetClientSize(int *width, int *height) const; | |
a23fd0e1 | 121 | virtual void DoSetClientSize(int width, int height); |
cc2b7472 | 122 | |
1e6feb95 | 123 | #if wxUSE_MENUS_NATIVE |
6522713c VZ |
124 | // perform MSW-specific action when menubar is changed |
125 | virtual void AttachMenuBar(wxMenuBar *menubar); | |
126 | ||
42e69d6b VZ |
127 | // a plug in for MDI frame classes which need to do something special when |
128 | // the menubar is set | |
129 | virtual void InternalSetMenuBar(); | |
1e6feb95 | 130 | #endif // wxUSE_MENUS_NATIVE |
42e69d6b | 131 | |
3a19e16d VZ |
132 | // propagate our state change to all child frames |
133 | void IconizeChildFrames(bool bIconize); | |
16f6dfd8 | 134 | |
1ac76609 VZ |
135 | // the real implementation of MSWTranslateMessage(), also used by |
136 | // wxMDIChildFrame | |
137 | bool MSWDoTranslateMessage(wxFrame *frame, WXMSG *msg); | |
42e69d6b | 138 | |
1ac76609 | 139 | // handle WM_INITMENUPOPUP message to generate wxEVT_MENU_OPEN |
92f1a59c | 140 | bool HandleInitMenuPopup(WXHMENU hMenu); |
e39af974 | 141 | |
cbe874bd | 142 | virtual bool IsMDIChild() const { return false; } |
a23fd0e1 | 143 | |
77ffb593 | 144 | // get default (wxWidgets) icon for the frame |
82c9f85c | 145 | virtual WXHICON GetDefaultIcon() const; |
d427503c | 146 | |
b45c2fe5 PC |
147 | #if wxUSE_TOOLBAR |
148 | virtual void PositionToolBar(); | |
149 | #endif // wxUSE_TOOLBAR | |
150 | ||
d427503c | 151 | #if wxUSE_STATUSBAR |
b45c2fe5 PC |
152 | virtual void PositionStatusBar(); |
153 | ||
3a19e16d | 154 | static bool m_useNativeStatusBar; |
d427503c VZ |
155 | #endif // wxUSE_STATUSBAR |
156 | ||
cf8ff92f VZ |
157 | #if wxUSE_MENUS |
158 | // frame menu, NULL if none | |
159 | WXHMENU m_hMenu; | |
160 | #endif // wxUSE_MENUS | |
161 | ||
a23fd0e1 | 162 | private: |
3a19e16d VZ |
163 | #if wxUSE_TOOLTIPS |
164 | WXHWND m_hwndToolTip; | |
165 | #endif // tooltips | |
166 | ||
9327c3aa VZ |
167 | // used by IconizeChildFrames(), see comments there |
168 | bool m_wasMinimized; | |
169 | ||
3a19e16d | 170 | DECLARE_EVENT_TABLE() |
fc7a2a60 | 171 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxFrame) |
2bda0e17 KB |
172 | }; |
173 | ||
174 | #endif | |
bbcdf8bc | 175 | // _WX_FRAME_H_ |