]>
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); |
42e69d6b | 45 | |
7c0ea335 VZ |
46 | // implementation only from now on |
47 | // ------------------------------- | |
16f6dfd8 | 48 | |
7c0ea335 | 49 | // event handlers |
7c0ea335 | 50 | void OnSysColourChanged(wxSysColourChangedEvent& event); |
16f6dfd8 | 51 | |
3a19e16d | 52 | // Toolbar |
d427503c | 53 | #if wxUSE_TOOLBAR |
f9dae779 | 54 | virtual wxToolBar* CreateToolBar(long style = -1, |
cbe874bd | 55 | wxWindowID id = wxID_ANY, |
3a19e16d | 56 | const wxString& name = wxToolBarNameStr); |
d427503c | 57 | #endif // wxUSE_TOOLBAR |
16f6dfd8 | 58 | |
3a19e16d | 59 | // Status bar |
7c0ea335 VZ |
60 | #if wxUSE_STATUSBAR |
61 | virtual wxStatusBar* OnCreateStatusBar(int number = 1, | |
c4c178c1 | 62 | long style = wxSTB_DEFAULT_STYLE, |
7c0ea335 VZ |
63 | wxWindowID id = 0, |
64 | const wxString& name = wxStatusLineNameStr); | |
3a19e16d | 65 | |
7c0ea335 VZ |
66 | // Hint to tell framework which status bar to use: the default is to use |
67 | // native one for the platforms which support it (Win32), the generic one | |
68 | // otherwise | |
16f6dfd8 | 69 | |
3a19e16d | 70 | // TODO: should this go into a wxFrameworkSettings class perhaps? |
7c0ea335 | 71 | static void UseNativeStatusBar(bool useNative) |
47b378bd | 72 | { m_useNativeStatusBar = useNative; } |
7c0ea335 | 73 | static bool UsesNativeStatusBar() |
47b378bd | 74 | { return m_useNativeStatusBar; } |
d427503c | 75 | #endif // wxUSE_STATUSBAR |
16f6dfd8 | 76 | |
7c0ea335 | 77 | // event handlers |
42e69d6b VZ |
78 | bool HandleSize(int x, int y, WXUINT flag); |
79 | bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); | |
42e69d6b | 80 | |
7c0ea335 | 81 | // tooltip management |
3a19e16d | 82 | #if wxUSE_TOOLTIPS |
a23fd0e1 VZ |
83 | WXHWND GetToolTipCtrl() const { return m_hwndToolTip; } |
84 | void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; } | |
3a19e16d VZ |
85 | #endif // tooltips |
86 | ||
0dba08dd | 87 | // override the base class function to handle iconized/maximized frames |
ecdc1183 | 88 | virtual void SendSizeEvent(int flags = 0); |
3cfcd50b | 89 | |
6c7afb74 | 90 | virtual wxPoint GetClientAreaOrigin() const; |
cbe874bd | 91 | |
b45c2fe5 PC |
92 | // override base class version to add menu bar accel processing |
93 | virtual bool MSWTranslateMessage(WXMSG *msg) | |
94 | { | |
95 | return MSWDoTranslateMessage(this, msg); | |
96 | } | |
97 | ||
98 | // window proc for the frames | |
99 | virtual WXLRESULT MSWWindowProc(WXUINT message, | |
100 | WXWPARAM wParam, | |
101 | WXLPARAM lParam); | |
102 | ||
51181d29 VZ |
103 | #if wxUSE_MENUS |
104 | // get the currently active menu: this is the same as the frame menu for | |
105 | // normal frames but is overridden by wxMDIParentFrame | |
106 | virtual WXHMENU MSWGetActiveMenu() const { return m_hMenu; } | |
95316a3f VZ |
107 | |
108 | // Look up the menu in the menu bar. | |
109 | virtual wxMenu* MSWFindMenuFromHMENU(WXHMENU hMenu); | |
51181d29 VZ |
110 | #endif // wxUSE_MENUS |
111 | ||
2bda0e17 | 112 | protected: |
7c0ea335 VZ |
113 | // common part of all ctors |
114 | void Init(); | |
115 | ||
a23fd0e1 VZ |
116 | // override base class virtuals |
117 | virtual void DoGetClientSize(int *width, int *height) const; | |
a23fd0e1 | 118 | virtual void DoSetClientSize(int width, int height); |
cc2b7472 | 119 | |
1e6feb95 | 120 | #if wxUSE_MENUS_NATIVE |
6522713c VZ |
121 | // perform MSW-specific action when menubar is changed |
122 | virtual void AttachMenuBar(wxMenuBar *menubar); | |
123 | ||
42e69d6b VZ |
124 | // a plug in for MDI frame classes which need to do something special when |
125 | // the menubar is set | |
126 | virtual void InternalSetMenuBar(); | |
1e6feb95 | 127 | #endif // wxUSE_MENUS_NATIVE |
42e69d6b | 128 | |
3a19e16d VZ |
129 | // propagate our state change to all child frames |
130 | void IconizeChildFrames(bool bIconize); | |
16f6dfd8 | 131 | |
1ac76609 VZ |
132 | // the real implementation of MSWTranslateMessage(), also used by |
133 | // wxMDIChildFrame | |
134 | bool MSWDoTranslateMessage(wxFrame *frame, WXMSG *msg); | |
42e69d6b | 135 | |
cbe874bd | 136 | virtual bool IsMDIChild() const { return false; } |
a23fd0e1 | 137 | |
77ffb593 | 138 | // get default (wxWidgets) icon for the frame |
82c9f85c | 139 | virtual WXHICON GetDefaultIcon() const; |
d427503c | 140 | |
b45c2fe5 PC |
141 | #if wxUSE_TOOLBAR |
142 | virtual void PositionToolBar(); | |
143 | #endif // wxUSE_TOOLBAR | |
144 | ||
d427503c | 145 | #if wxUSE_STATUSBAR |
b45c2fe5 PC |
146 | virtual void PositionStatusBar(); |
147 | ||
3a19e16d | 148 | static bool m_useNativeStatusBar; |
d427503c VZ |
149 | #endif // wxUSE_STATUSBAR |
150 | ||
cf8ff92f VZ |
151 | #if wxUSE_MENUS |
152 | // frame menu, NULL if none | |
153 | WXHMENU m_hMenu; | |
154 | #endif // wxUSE_MENUS | |
155 | ||
a23fd0e1 | 156 | private: |
3a19e16d VZ |
157 | #if wxUSE_TOOLTIPS |
158 | WXHWND m_hwndToolTip; | |
159 | #endif // tooltips | |
160 | ||
9327c3aa VZ |
161 | // used by IconizeChildFrames(), see comments there |
162 | bool m_wasMinimized; | |
163 | ||
3a19e16d | 164 | DECLARE_EVENT_TABLE() |
fc7a2a60 | 165 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxFrame) |
2bda0e17 KB |
166 | }; |
167 | ||
168 | #endif | |
bbcdf8bc | 169 | // _WX_FRAME_H_ |