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