]>
Commit | Line | Data |
---|---|---|
2bda0e17 | 1 | ///////////////////////////////////////////////////////////////////////////// |
a967ef9d VZ |
2 | // Name: src/msw/mdi.cpp |
3 | // Purpose: MDI classes for wxMSW | |
2bda0e17 KB |
4 | // Author: Julian Smart |
5 | // Modified by: | |
6 | // Created: 04/01/98 | |
7 | // RCS-ID: $Id$ | |
6c9a19aa | 8 | // Copyright: (c) Julian Smart |
65571936 | 9 | // Licence: wxWindows licence |
2bda0e17 KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
a23fd0e1 VZ |
12 | // =========================================================================== |
13 | // declarations | |
14 | // =========================================================================== | |
15 | ||
16 | // --------------------------------------------------------------------------- | |
17 | // headers | |
18 | // --------------------------------------------------------------------------- | |
19 | ||
14f355c2 | 20 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
a23fd0e1 | 21 | #pragma implementation "mdi.h" |
2bda0e17 KB |
22 | #endif |
23 | ||
24 | // For compilers that support precompilation, includes "wx.h". | |
25 | #include "wx/wxprec.h" | |
26 | ||
27 | #ifdef __BORLANDC__ | |
a23fd0e1 | 28 | #pragma hdrstop |
2bda0e17 KB |
29 | #endif |
30 | ||
efd17a1d | 31 | #if wxUSE_MDI && !defined(__WXUNIVERSAL__) |
b442f107 | 32 | |
2bda0e17 | 33 | #ifndef WX_PRECOMP |
a23fd0e1 VZ |
34 | #include "wx/setup.h" |
35 | #include "wx/frame.h" | |
36 | #include "wx/menu.h" | |
37 | #include "wx/app.h" | |
38 | #include "wx/utils.h" | |
39 | #include "wx/dialog.h" | |
7c0ea335 VZ |
40 | #if wxUSE_STATUSBAR |
41 | #include "wx/statusbr.h" | |
42 | #endif | |
a23fd0e1 | 43 | #include "wx/settings.h" |
0c589ad0 BM |
44 | #include "wx/intl.h" |
45 | #include "wx/log.h" | |
2bda0e17 KB |
46 | #endif |
47 | ||
48 | #include "wx/mdi.h" | |
49 | #include "wx/msw/private.h" | |
50 | ||
7c0ea335 | 51 | #if wxUSE_STATUSBAR && wxUSE_NATIVE_STATUSBAR |
3096bd2f | 52 | #include "wx/msw/statbr95.h" |
2bda0e17 KB |
53 | #endif |
54 | ||
7c0ea335 VZ |
55 | #if wxUSE_TOOLBAR |
56 | #include "wx/toolbar.h" | |
57 | #endif // wxUSE_TOOLBAR | |
58 | ||
2bda0e17 KB |
59 | #include <string.h> |
60 | ||
a23fd0e1 VZ |
61 | // --------------------------------------------------------------------------- |
62 | // global variables | |
63 | // --------------------------------------------------------------------------- | |
64 | ||
e1a6fc11 | 65 | extern wxMenu *wxCurrentPopupMenu; |
2bda0e17 | 66 | |
3ca6a5f0 | 67 | extern const wxChar *wxMDIFrameClassName; // from app.cpp |
2ffa221c | 68 | extern const wxChar *wxMDIChildFrameClassName; |
3ca6a5f0 | 69 | extern const wxChar *wxMDIChildFrameClassNameNoRedraw; |
c7527e3f | 70 | extern void wxAssociateWinWithHandle(HWND hWnd, wxWindow *win); |
ac6482e0 | 71 | extern void wxRemoveHandleAssociation(wxWindow *win); |
a23fd0e1 | 72 | |
42e69d6b VZ |
73 | static HWND invalidHandle = 0; |
74 | ||
a23fd0e1 VZ |
75 | // --------------------------------------------------------------------------- |
76 | // constants | |
77 | // --------------------------------------------------------------------------- | |
78 | ||
79 | static const int IDM_WINDOWTILE = 4001; | |
42e69d6b | 80 | static const int IDM_WINDOWTILEHOR = 4001; |
a23fd0e1 VZ |
81 | static const int IDM_WINDOWCASCADE = 4002; |
82 | static const int IDM_WINDOWICONS = 4003; | |
83 | static const int IDM_WINDOWNEXT = 4004; | |
42e69d6b | 84 | static const int IDM_WINDOWTILEVERT = 4005; |
4f3b37fd | 85 | static const int IDM_WINDOWPREV = 4006; |
a23fd0e1 VZ |
86 | |
87 | // This range gives a maximum of 500 MDI children. Should be enough :-) | |
88 | static const int wxFIRST_MDI_CHILD = 4100; | |
89 | static const int wxLAST_MDI_CHILD = 4600; | |
2bda0e17 KB |
90 | |
91 | // Status border dimensions | |
a23fd0e1 VZ |
92 | static const int wxTHICK_LINE_BORDER = 3; |
93 | static const int wxTHICK_LINE_WIDTH = 1; | |
2bda0e17 | 94 | |
42e69d6b VZ |
95 | // --------------------------------------------------------------------------- |
96 | // private functions | |
97 | // --------------------------------------------------------------------------- | |
98 | ||
99 | // set the MDI menus (by sending the WM_MDISETMENU message) and update the menu | |
100 | // of the parent of win (which is supposed to be the MDI client window) | |
101 | static void MDISetMenu(wxWindow *win, HMENU hmenuFrame, HMENU hmenuWindow); | |
102 | ||
103 | // insert the window menu (subMenu) into menu just before "Help" submenu or at | |
104 | // the very end if not found | |
105 | static void InsertWindowMenu(wxWindow *win, WXHMENU menu, HMENU subMenu); | |
106 | ||
df61c009 JS |
107 | // Remove the window menu |
108 | static void RemoveWindowMenu(wxWindow *win, WXHMENU menu); | |
109 | ||
42e69d6b VZ |
110 | // is this an id of an MDI child? |
111 | inline bool IsMdiCommandId(int id) | |
112 | { | |
113 | return (id >= wxFIRST_MDI_CHILD) && (id <= wxLAST_MDI_CHILD); | |
114 | } | |
115 | ||
4e152a23 | 116 | // unpack the parameters of WM_MDIACTIVATE message |
2917e920 BM |
117 | static void UnpackMDIActivate(WXWPARAM wParam, WXLPARAM lParam, |
118 | WXWORD *activate, WXHWND *hwndAct, WXHWND *hwndDeact); | |
42e69d6b | 119 | |
4e152a23 VZ |
120 | // return the HMENU of the MDI menu |
121 | static inline HMENU GetMDIWindowMenu(wxMDIParentFrame *frame) | |
122 | { | |
123 | wxMenu *menu = frame->GetWindowMenu(); | |
124 | return menu ? GetHmenuOf(menu) : 0; | |
125 | } | |
126 | ||
a23fd0e1 VZ |
127 | // =========================================================================== |
128 | // implementation | |
129 | // =========================================================================== | |
130 | ||
131 | // --------------------------------------------------------------------------- | |
132 | // wxWin macros | |
133 | // --------------------------------------------------------------------------- | |
2bda0e17 | 134 | |
225fe9d6 VZ |
135 | IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame) |
136 | IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame) | |
137 | IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow) | |
2bda0e17 KB |
138 | |
139 | BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame) | |
a23fd0e1 | 140 | EVT_SIZE(wxMDIParentFrame::OnSize) |
a23fd0e1 | 141 | EVT_SYS_COLOUR_CHANGED(wxMDIParentFrame::OnSysColourChanged) |
2bda0e17 KB |
142 | END_EVENT_TABLE() |
143 | ||
f6bcfd97 BP |
144 | BEGIN_EVENT_TABLE(wxMDIChildFrame, wxFrame) |
145 | EVT_IDLE(wxMDIChildFrame::OnIdle) | |
146 | END_EVENT_TABLE() | |
147 | ||
2bda0e17 | 148 | BEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow) |
a23fd0e1 | 149 | EVT_SCROLL(wxMDIClientWindow::OnScroll) |
2bda0e17 KB |
150 | END_EVENT_TABLE() |
151 | ||
42e69d6b VZ |
152 | // =========================================================================== |
153 | // wxMDIParentFrame: the frame which contains the client window which manages | |
154 | // the children | |
155 | // =========================================================================== | |
2bda0e17 | 156 | |
c2dcfdef | 157 | wxMDIParentFrame::wxMDIParentFrame() |
2bda0e17 KB |
158 | { |
159 | m_clientWindow = NULL; | |
160 | m_currentChild = NULL; | |
df61c009 | 161 | m_windowMenu = (wxMenu*) NULL; |
4f8090e0 | 162 | m_parentFrameActive = true; |
2bda0e17 KB |
163 | } |
164 | ||
165 | bool wxMDIParentFrame::Create(wxWindow *parent, | |
a23fd0e1 VZ |
166 | wxWindowID id, |
167 | const wxString& title, | |
168 | const wxPoint& pos, | |
169 | const wxSize& size, | |
170 | long style, | |
171 | const wxString& name) | |
2bda0e17 | 172 | { |
2bda0e17 KB |
173 | m_clientWindow = NULL; |
174 | m_currentChild = NULL; | |
df61c009 | 175 | |
3d8dea7e VZ |
176 | // this style can be used to prevent a window from having the standard MDI |
177 | // "Window" menu | |
178 | if ( style & wxFRAME_NO_WINDOW_MENU ) | |
179 | { | |
180 | m_windowMenu = (wxMenu *)NULL; | |
181 | } | |
182 | else // normal case: we have the window menu, so construct it | |
df61c009 | 183 | { |
df61c009 JS |
184 | m_windowMenu = new wxMenu; |
185 | ||
b0a2157c VZ |
186 | m_windowMenu->Append(IDM_WINDOWCASCADE, _("&Cascade")); |
187 | m_windowMenu->Append(IDM_WINDOWTILEHOR, _("Tile &Horizontally")); | |
188 | m_windowMenu->Append(IDM_WINDOWTILEVERT, _("Tile &Vertically")); | |
df61c009 | 189 | m_windowMenu->AppendSeparator(); |
b0a2157c VZ |
190 | m_windowMenu->Append(IDM_WINDOWICONS, _("&Arrange Icons")); |
191 | m_windowMenu->Append(IDM_WINDOWNEXT, _("&Next")); | |
4f3b37fd | 192 | m_windowMenu->Append(IDM_WINDOWPREV, _("&Previous")); |
df61c009 JS |
193 | } |
194 | ||
4f8090e0 | 195 | m_parentFrameActive = true; |
2bda0e17 KB |
196 | |
197 | if (!parent) | |
198 | wxTopLevelWindows.Append(this); | |
199 | ||
200 | SetName(name); | |
201 | m_windowStyle = style; | |
202 | ||
b225f659 VZ |
203 | if ( parent ) |
204 | parent->AddChild(this); | |
2bda0e17 | 205 | |
598ddd96 | 206 | if ( id != wxID_ANY ) |
2bda0e17 KB |
207 | m_windowId = id; |
208 | else | |
b225f659 | 209 | m_windowId = NewControlId(); |
2bda0e17 | 210 | |
912c192f VZ |
211 | WXDWORD exflags; |
212 | WXDWORD msflags = MSWGetCreateWindowFlags(&exflags); | |
ea723360 JS |
213 | msflags &= ~WS_VSCROLL; |
214 | msflags &= ~WS_HSCROLL; | |
2bda0e17 | 215 | |
b225f659 | 216 | if ( !wxWindow::MSWCreate(wxMDIFrameClassName, |
3ca6a5f0 | 217 | title, |
b225f659 VZ |
218 | pos, size, |
219 | msflags, | |
220 | exflags) ) | |
3ca6a5f0 | 221 | { |
4f8090e0 | 222 | return false; |
3ca6a5f0 | 223 | } |
2bda0e17 | 224 | |
f6bcfd97 | 225 | // unlike (almost?) all other windows, frames are created hidden |
4f8090e0 | 226 | m_isShown = false; |
f6bcfd97 | 227 | |
4f8090e0 | 228 | return true; |
2bda0e17 KB |
229 | } |
230 | ||
c2dcfdef | 231 | wxMDIParentFrame::~wxMDIParentFrame() |
2bda0e17 | 232 | { |
d1e44484 | 233 | // see comment in ~wxMDIChildFrame |
1904aa72 | 234 | #if wxUSE_TOOLBAR |
f048e32f | 235 | m_frameToolBar = NULL; |
1904aa72 | 236 | #endif |
67a99992 | 237 | #if wxUSE_STATUSBAR |
c0bcc480 | 238 | m_frameStatusBar = NULL; |
67a99992 | 239 | #endif // wxUSE_STATUSBAR |
f048e32f | 240 | |
d1e44484 VZ |
241 | DestroyChildren(); |
242 | ||
df61c009 JS |
243 | if (m_windowMenu) |
244 | { | |
245 | delete m_windowMenu; | |
246 | m_windowMenu = (wxMenu*) NULL; | |
247 | } | |
2bda0e17 | 248 | |
4e152a23 VZ |
249 | // the MDI frame menubar is not automatically deleted by Windows unlike for |
250 | // the normal frames | |
251 | if ( m_hMenu ) | |
252 | { | |
253 | ::DestroyMenu((HMENU)m_hMenu); | |
7c46a16b | 254 | m_hMenu = (WXHMENU)NULL; |
4e152a23 VZ |
255 | } |
256 | ||
42e69d6b VZ |
257 | if ( m_clientWindow ) |
258 | { | |
259 | if ( m_clientWindow->MSWGetOldWndProc() ) | |
260 | m_clientWindow->UnsubclassWin(); | |
2bda0e17 | 261 | |
42e69d6b VZ |
262 | m_clientWindow->SetHWND(0); |
263 | delete m_clientWindow; | |
264 | } | |
2bda0e17 KB |
265 | } |
266 | ||
1e6feb95 VZ |
267 | #if wxUSE_MENUS_NATIVE |
268 | ||
42e69d6b | 269 | void wxMDIParentFrame::InternalSetMenuBar() |
2bda0e17 | 270 | { |
4f8090e0 | 271 | m_parentFrameActive = true; |
2bda0e17 | 272 | |
4e152a23 | 273 | InsertWindowMenu(GetClientWindow(), m_hMenu, GetMDIWindowMenu(this)); |
2bda0e17 KB |
274 | } |
275 | ||
1e6feb95 VZ |
276 | #endif // wxUSE_MENUS_NATIVE |
277 | ||
df61c009 JS |
278 | void wxMDIParentFrame::SetWindowMenu(wxMenu* menu) |
279 | { | |
280 | if (m_windowMenu) | |
281 | { | |
282 | if (GetMenuBar()) | |
283 | { | |
284 | // Remove old window menu | |
285 | RemoveWindowMenu(GetClientWindow(), m_hMenu); | |
286 | } | |
287 | ||
288 | delete m_windowMenu; | |
289 | m_windowMenu = (wxMenu*) NULL; | |
290 | } | |
4e152a23 | 291 | |
df61c009 JS |
292 | if (menu) |
293 | { | |
294 | m_windowMenu = menu; | |
295 | if (GetMenuBar()) | |
b0a2157c VZ |
296 | { |
297 | InsertWindowMenu(GetClientWindow(), m_hMenu, | |
88c49a0f | 298 | GetHmenuOf(m_windowMenu)); |
b0a2157c | 299 | } |
df61c009 JS |
300 | } |
301 | } | |
302 | ||
6aca4628 CE |
303 | void wxMDIParentFrame::DoMenuUpdates(wxMenu* menu) |
304 | { | |
305 | wxMDIChildFrame *child = GetActiveChild(); | |
306 | if ( child ) | |
307 | { | |
308 | wxEvtHandler* source = child->GetEventHandler(); | |
309 | wxMenuBar* bar = child->GetMenuBar(); | |
310 | ||
311 | if (menu) | |
312 | { | |
313 | menu->UpdateUI(source); | |
314 | } | |
315 | else | |
316 | { | |
317 | if ( bar != NULL ) | |
318 | { | |
319 | int nCount = bar->GetMenuCount(); | |
320 | for (int n = 0; n < nCount; n++) | |
321 | bar->GetMenu(n)->UpdateUI(source); | |
322 | } | |
323 | } | |
324 | } | |
325 | else | |
326 | { | |
327 | wxFrameBase::DoMenuUpdates(menu); | |
328 | } | |
329 | } | |
330 | ||
a967ef9d | 331 | void wxMDIParentFrame::OnSize(wxSizeEvent&) |
2bda0e17 | 332 | { |
2bda0e17 | 333 | if ( GetClientWindow() ) |
42e69d6b VZ |
334 | { |
335 | int width, height; | |
336 | GetClientSize(&width, &height); | |
2bda0e17 | 337 | |
42e69d6b VZ |
338 | GetClientWindow()->SetSize(0, 0, width, height); |
339 | } | |
2bda0e17 KB |
340 | } |
341 | ||
2bda0e17 | 342 | // Returns the active MDI child window |
c2dcfdef | 343 | wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const |
2bda0e17 | 344 | { |
a23fd0e1 VZ |
345 | HWND hWnd = (HWND)::SendMessage(GetWinHwnd(GetClientWindow()), |
346 | WM_MDIGETACTIVE, 0, 0L); | |
347 | if ( hWnd == 0 ) | |
348 | return NULL; | |
349 | else | |
350 | return (wxMDIChildFrame *)wxFindWinFromHandle((WXHWND) hWnd); | |
2bda0e17 KB |
351 | } |
352 | ||
a23fd0e1 VZ |
353 | // Create the client window class (don't Create the window, just return a new |
354 | // class) | |
c2dcfdef | 355 | wxMDIClientWindow *wxMDIParentFrame::OnCreateClient() |
2bda0e17 | 356 | { |
a23fd0e1 | 357 | return new wxMDIClientWindow; |
2bda0e17 KB |
358 | } |
359 | ||
360 | // Responds to colour changes, and passes event on to children. | |
361 | void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event) | |
362 | { | |
363 | if ( m_clientWindow ) | |
364 | { | |
a756f210 | 365 | m_clientWindow->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE)); |
2bda0e17 KB |
366 | m_clientWindow->Refresh(); |
367 | } | |
2bda0e17 | 368 | |
42e69d6b | 369 | event.Skip(); |
2bda0e17 KB |
370 | } |
371 | ||
82c9f85c VZ |
372 | WXHICON wxMDIParentFrame::GetDefaultIcon() const |
373 | { | |
94826170 VZ |
374 | // we don't have any standard icons (any more) |
375 | return (WXHICON)0; | |
82c9f85c VZ |
376 | } |
377 | ||
42e69d6b | 378 | // --------------------------------------------------------------------------- |
2bda0e17 | 379 | // MDI operations |
42e69d6b VZ |
380 | // --------------------------------------------------------------------------- |
381 | ||
c2dcfdef | 382 | void wxMDIParentFrame::Cascade() |
2bda0e17 | 383 | { |
a23fd0e1 | 384 | ::SendMessage(GetWinHwnd(GetClientWindow()), WM_MDICASCADE, 0, 0); |
2bda0e17 KB |
385 | } |
386 | ||
0d97c090 | 387 | void wxMDIParentFrame::Tile(wxOrientation orient) |
2bda0e17 | 388 | { |
0d97c090 VZ |
389 | wxASSERT_MSG( orient == wxHORIZONTAL || orient == wxVERTICAL, |
390 | _T("invalid orientation value") ); | |
391 | ||
392 | ::SendMessage(GetWinHwnd(GetClientWindow()), WM_MDITILE, | |
393 | orient == wxHORIZONTAL ? MDITILE_HORIZONTAL | |
394 | : MDITILE_VERTICAL, 0); | |
2bda0e17 KB |
395 | } |
396 | ||
c2dcfdef | 397 | void wxMDIParentFrame::ArrangeIcons() |
2bda0e17 | 398 | { |
a23fd0e1 | 399 | ::SendMessage(GetWinHwnd(GetClientWindow()), WM_MDIICONARRANGE, 0, 0); |
2bda0e17 KB |
400 | } |
401 | ||
c2dcfdef | 402 | void wxMDIParentFrame::ActivateNext() |
2bda0e17 | 403 | { |
a23fd0e1 | 404 | ::SendMessage(GetWinHwnd(GetClientWindow()), WM_MDINEXT, 0, 0); |
2bda0e17 KB |
405 | } |
406 | ||
c2dcfdef | 407 | void wxMDIParentFrame::ActivatePrevious() |
2bda0e17 | 408 | { |
a23fd0e1 | 409 | ::SendMessage(GetWinHwnd(GetClientWindow()), WM_MDINEXT, 0, 1); |
2bda0e17 KB |
410 | } |
411 | ||
42e69d6b | 412 | // --------------------------------------------------------------------------- |
a23fd0e1 | 413 | // the MDI parent frame window proc |
42e69d6b VZ |
414 | // --------------------------------------------------------------------------- |
415 | ||
c140b7e7 | 416 | WXLRESULT wxMDIParentFrame::MSWWindowProc(WXUINT message, |
a23fd0e1 VZ |
417 | WXWPARAM wParam, |
418 | WXLPARAM lParam) | |
2bda0e17 | 419 | { |
c140b7e7 | 420 | WXLRESULT rc = 0; |
4f8090e0 | 421 | bool processed = false; |
2bda0e17 | 422 | |
a23fd0e1 VZ |
423 | switch ( message ) |
424 | { | |
42e69d6b VZ |
425 | case WM_ACTIVATE: |
426 | { | |
427 | WXWORD state, minimized; | |
428 | WXHWND hwnd; | |
429 | UnpackActivate(wParam, lParam, &state, &minimized, &hwnd); | |
430 | ||
431 | processed = HandleActivate(state, minimized != 0, hwnd); | |
432 | } | |
433 | break; | |
434 | ||
435 | case WM_COMMAND: | |
436 | { | |
437 | WXWORD id, cmd; | |
438 | WXHWND hwnd; | |
439 | UnpackCommand(wParam, lParam, &id, &hwnd, &cmd); | |
440 | ||
441 | (void)HandleCommand(id, cmd, hwnd); | |
442 | ||
443 | // even if the frame didn't process it, there is no need to try it | |
01ebf752 | 444 | // once again (i.e. call wxFrame::HandleCommand()) - we just did it, |
42e69d6b | 445 | // so pretend we processed the message anyhow |
4f8090e0 | 446 | processed = true; |
42e69d6b | 447 | } |
b3818fbe VZ |
448 | |
449 | // always pass this message DefFrameProc(), otherwise MDI menu | |
01ebf752 | 450 | // commands (and sys commands - more surprisingly!) won't work |
b3818fbe | 451 | MSWDefWindowProc(message, wParam, lParam); |
42e69d6b VZ |
452 | break; |
453 | ||
a23fd0e1 VZ |
454 | case WM_CREATE: |
455 | m_clientWindow = OnCreateClient(); | |
456 | // Uses own style for client style | |
457 | if ( !m_clientWindow->CreateClient(this, GetWindowStyleFlag()) ) | |
458 | { | |
459 | wxLogMessage(_("Failed to create MDI parent frame.")); | |
2bda0e17 | 460 | |
a23fd0e1 VZ |
461 | rc = -1; |
462 | } | |
2bda0e17 | 463 | |
4f8090e0 | 464 | processed = true; |
a23fd0e1 | 465 | break; |
2bda0e17 | 466 | |
a23fd0e1 | 467 | case WM_ERASEBKGND: |
4f8090e0 | 468 | processed = true; |
2bda0e17 | 469 | |
a23fd0e1 | 470 | // we erase background ourselves |
4f8090e0 | 471 | rc = true; |
a23fd0e1 VZ |
472 | break; |
473 | ||
474 | case WM_MENUSELECT: | |
475 | { | |
42e69d6b VZ |
476 | WXWORD item, flags; |
477 | WXHMENU hmenu; | |
478 | UnpackMenuSelect(wParam, lParam, &item, &flags, &hmenu); | |
479 | ||
a23fd0e1 VZ |
480 | if ( m_parentFrameActive ) |
481 | { | |
42e69d6b | 482 | processed = HandleMenuSelect(item, flags, hmenu); |
a23fd0e1 VZ |
483 | } |
484 | else if (m_currentChild) | |
485 | { | |
486 | processed = m_currentChild-> | |
42e69d6b | 487 | HandleMenuSelect(item, flags, hmenu); |
a23fd0e1 VZ |
488 | } |
489 | } | |
490 | break; | |
b3818fbe VZ |
491 | |
492 | case WM_SIZE: | |
31f658e4 CE |
493 | // though we don't (usually) resize the MDI client to exactly fit the |
494 | // client area we need to pass this one to DefFrameProc to allow the children to show | |
b3818fbe | 495 | break; |
a23fd0e1 | 496 | } |
2bda0e17 | 497 | |
a23fd0e1 VZ |
498 | if ( !processed ) |
499 | rc = wxFrame::MSWWindowProc(message, wParam, lParam); | |
2bda0e17 | 500 | |
a23fd0e1 | 501 | return rc; |
2bda0e17 KB |
502 | } |
503 | ||
42e69d6b | 504 | bool wxMDIParentFrame::HandleActivate(int state, bool minimized, WXHWND activate) |
2bda0e17 | 505 | { |
4f8090e0 | 506 | bool processed = false; |
a23fd0e1 | 507 | |
42e69d6b | 508 | if ( wxWindow::HandleActivate(state, minimized, activate) ) |
a23fd0e1 VZ |
509 | { |
510 | // already processed | |
4f8090e0 | 511 | processed = true; |
a23fd0e1 | 512 | } |
2bda0e17 KB |
513 | |
514 | // If this window is an MDI parent, we must also send an OnActivate message | |
515 | // to the current child. | |
42e69d6b | 516 | if ( (m_currentChild != NULL) && |
a23fd0e1 | 517 | ((state == WA_ACTIVE) || (state == WA_CLICKACTIVE)) ) |
c2dcfdef | 518 | { |
4f8090e0 | 519 | wxActivateEvent event(wxEVT_ACTIVATE, true, m_currentChild->GetId()); |
debe6624 | 520 | event.SetEventObject( m_currentChild ); |
a23fd0e1 | 521 | if ( m_currentChild->GetEventHandler()->ProcessEvent(event) ) |
4f8090e0 | 522 | processed = true; |
2bda0e17 | 523 | } |
a23fd0e1 VZ |
524 | |
525 | return processed; | |
2bda0e17 KB |
526 | } |
527 | ||
42e69d6b | 528 | bool wxMDIParentFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND hwnd) |
2bda0e17 | 529 | { |
2bda0e17 | 530 | // In case it's e.g. a toolbar. |
42e69d6b | 531 | if ( hwnd ) |
e1a6fc11 | 532 | { |
42e69d6b VZ |
533 | wxWindow *win = wxFindWinFromHandle(hwnd); |
534 | if ( win ) | |
535 | return win->MSWCommand(cmd, id); | |
e1a6fc11 JS |
536 | } |
537 | ||
42e69d6b VZ |
538 | // is it one of standard MDI commands? |
539 | WXWPARAM wParam = 0; | |
4f3b37fd | 540 | WXLPARAM lParam = 0; |
42e69d6b VZ |
541 | int msg; |
542 | switch ( id ) | |
2bda0e17 | 543 | { |
42e69d6b VZ |
544 | case IDM_WINDOWCASCADE: |
545 | msg = WM_MDICASCADE; | |
546 | wParam = MDITILE_SKIPDISABLED; | |
547 | break; | |
548 | ||
549 | case IDM_WINDOWTILEHOR: | |
550 | wParam |= MDITILE_HORIZONTAL; | |
551 | // fall through | |
552 | ||
553 | case IDM_WINDOWTILEVERT: | |
554 | if ( !wParam ) | |
555 | wParam = MDITILE_VERTICAL; | |
556 | msg = WM_MDITILE; | |
557 | wParam |= MDITILE_SKIPDISABLED; | |
558 | break; | |
559 | ||
560 | case IDM_WINDOWICONS: | |
561 | msg = WM_MDIICONARRANGE; | |
562 | break; | |
563 | ||
564 | case IDM_WINDOWNEXT: | |
565 | msg = WM_MDINEXT; | |
4f3b37fd JS |
566 | lParam = 0; // next child |
567 | break; | |
568 | ||
569 | case IDM_WINDOWPREV: | |
570 | msg = WM_MDINEXT; | |
571 | lParam = 1; // previous child | |
42e69d6b VZ |
572 | break; |
573 | ||
574 | default: | |
575 | msg = 0; | |
2bda0e17 | 576 | } |
c2dcfdef | 577 | |
42e69d6b | 578 | if ( msg ) |
2bda0e17 | 579 | { |
4f3b37fd | 580 | ::SendMessage(GetWinHwnd(GetClientWindow()), msg, wParam, lParam); |
42e69d6b | 581 | |
4f8090e0 | 582 | return true; |
2bda0e17 | 583 | } |
42e69d6b VZ |
584 | |
585 | // FIXME VZ: what does this test do?? | |
586 | if (id >= 0xF000) | |
2bda0e17 | 587 | { |
4f8090e0 | 588 | return false; // Get WndProc to call default proc |
2bda0e17 | 589 | } |
42e69d6b VZ |
590 | |
591 | if ( IsMdiCommandId(id) ) | |
2bda0e17 | 592 | { |
222ed1d6 | 593 | wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); |
42e69d6b | 594 | while ( node ) |
2bda0e17 | 595 | { |
d162a7ee | 596 | wxWindow *child = node->GetData(); |
42e69d6b | 597 | if ( child->GetHWND() ) |
2bda0e17 | 598 | { |
42e69d6b | 599 | long childId = wxGetWindowId(child->GetHWND()); |
48c12cb1 | 600 | if (childId == (long)id) |
42e69d6b VZ |
601 | { |
602 | ::SendMessage( GetWinHwnd(GetClientWindow()), | |
603 | WM_MDIACTIVATE, | |
604 | (WPARAM)child->GetHWND(), 0); | |
4f8090e0 | 605 | return true; |
42e69d6b | 606 | } |
2bda0e17 | 607 | } |
42e69d6b | 608 | node = node->GetNext(); |
2bda0e17 | 609 | } |
2bda0e17 | 610 | } |
42e69d6b | 611 | else if ( m_parentFrameActive ) |
2bda0e17 | 612 | { |
42e69d6b VZ |
613 | return ProcessCommand(id); |
614 | } | |
615 | else if ( m_currentChild ) | |
616 | { | |
617 | return m_currentChild->HandleCommand(id, cmd, hwnd); | |
618 | } | |
619 | else | |
620 | { | |
621 | // this shouldn't happen because it means that our messages are being | |
622 | // lost (they're not sent to the parent frame nor to the children) | |
f6bcfd97 | 623 | wxFAIL_MSG(wxT("MDI parent frame is not active, yet there is no active MDI child?")); |
2bda0e17 | 624 | } |
2bda0e17 | 625 | |
4f8090e0 | 626 | return false; |
2bda0e17 KB |
627 | } |
628 | ||
c140b7e7 | 629 | WXLRESULT wxMDIParentFrame::MSWDefWindowProc(WXUINT message, |
42e69d6b VZ |
630 | WXWPARAM wParam, |
631 | WXLPARAM lParam) | |
2bda0e17 | 632 | { |
c2dcfdef VZ |
633 | WXHWND clientWnd; |
634 | if ( GetClientWindow() ) | |
635 | clientWnd = GetClientWindow()->GetHWND(); | |
636 | else | |
637 | clientWnd = 0; | |
2bda0e17 | 638 | |
a23fd0e1 | 639 | return DefFrameProc(GetHwnd(), (HWND)clientWnd, message, wParam, lParam); |
2bda0e17 KB |
640 | } |
641 | ||
57a7b7c1 JS |
642 | bool wxMDIParentFrame::MSWTranslateMessage(WXMSG* msg) |
643 | { | |
a23fd0e1 | 644 | MSG *pMsg = (MSG *)msg; |
2bda0e17 | 645 | |
f6bcfd97 | 646 | // first let the current child get it |
a23fd0e1 VZ |
647 | if ( m_currentChild && m_currentChild->GetHWND() && |
648 | m_currentChild->MSWTranslateMessage(msg) ) | |
649 | { | |
4f8090e0 | 650 | return true; |
a23fd0e1 | 651 | } |
2bda0e17 | 652 | |
f6bcfd97 BP |
653 | // then try out accel table (will also check the menu accels) |
654 | if ( wxFrame::MSWTranslateMessage(msg) ) | |
a23fd0e1 | 655 | { |
4f8090e0 | 656 | return true; |
a23fd0e1 | 657 | } |
2bda0e17 | 658 | |
f6bcfd97 | 659 | // finally, check for MDI specific built in accel keys |
a23fd0e1 VZ |
660 | if ( pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN ) |
661 | { | |
662 | if ( ::TranslateMDISysAccel(GetWinHwnd(GetClientWindow()), pMsg)) | |
4f8090e0 | 663 | return true; |
a23fd0e1 | 664 | } |
57a7b7c1 | 665 | |
4f8090e0 | 666 | return false; |
2bda0e17 KB |
667 | } |
668 | ||
42e69d6b | 669 | // =========================================================================== |
a23fd0e1 | 670 | // wxMDIChildFrame |
42e69d6b | 671 | // =========================================================================== |
2bda0e17 | 672 | |
f6bcfd97 | 673 | void wxMDIChildFrame::Init() |
2bda0e17 | 674 | { |
4f8090e0 | 675 | m_needsResize = true; |
2596e9fb | 676 | m_needsInitialShow = true; |
2bda0e17 KB |
677 | } |
678 | ||
679 | bool wxMDIChildFrame::Create(wxMDIParentFrame *parent, | |
a23fd0e1 VZ |
680 | wxWindowID id, |
681 | const wxString& title, | |
682 | const wxPoint& pos, | |
683 | const wxSize& size, | |
684 | long style, | |
685 | const wxString& name) | |
2bda0e17 | 686 | { |
2bda0e17 KB |
687 | SetName(name); |
688 | ||
598ddd96 | 689 | if ( id != wxID_ANY ) |
2bda0e17 KB |
690 | m_windowId = id; |
691 | else | |
692 | m_windowId = (int)NewControlId(); | |
693 | ||
42e69d6b VZ |
694 | if ( parent ) |
695 | { | |
696 | parent->AddChild(this); | |
697 | } | |
2bda0e17 | 698 | |
2bda0e17 KB |
699 | int x = pos.x; |
700 | int y = pos.y; | |
701 | int width = size.x; | |
702 | int height = size.y; | |
703 | ||
704 | MDICREATESTRUCT mcs; | |
c2dcfdef | 705 | |
e441e1f4 VZ |
706 | mcs.szClass = style & wxFULL_REPAINT_ON_RESIZE |
707 | ? wxMDIChildFrameClassName | |
708 | : wxMDIChildFrameClassNameNoRedraw; | |
2bda0e17 KB |
709 | mcs.szTitle = title; |
710 | mcs.hOwner = wxGetInstance(); | |
598ddd96 | 711 | if (x != wxDefaultCoord) |
42e69d6b VZ |
712 | mcs.x = x; |
713 | else | |
714 | mcs.x = CW_USEDEFAULT; | |
2bda0e17 | 715 | |
598ddd96 | 716 | if (y != wxDefaultCoord) |
42e69d6b VZ |
717 | mcs.y = y; |
718 | else | |
719 | mcs.y = CW_USEDEFAULT; | |
2bda0e17 | 720 | |
598ddd96 | 721 | if (width != wxDefaultCoord) |
42e69d6b VZ |
722 | mcs.cx = width; |
723 | else | |
724 | mcs.cx = CW_USEDEFAULT; | |
2bda0e17 | 725 | |
598ddd96 | 726 | if (height != wxDefaultCoord) |
42e69d6b VZ |
727 | mcs.cy = height; |
728 | else | |
729 | mcs.cy = CW_USEDEFAULT; | |
2bda0e17 | 730 | |
2596e9fb | 731 | DWORD msflags = WS_OVERLAPPED | WS_CLIPCHILDREN; |
2bda0e17 KB |
732 | if (style & wxMINIMIZE_BOX) |
733 | msflags |= WS_MINIMIZEBOX; | |
734 | if (style & wxMAXIMIZE_BOX) | |
735 | msflags |= WS_MAXIMIZEBOX; | |
736 | if (style & wxTHICK_FRAME) | |
737 | msflags |= WS_THICKFRAME; | |
738 | if (style & wxSYSTEM_MENU) | |
739 | msflags |= WS_SYSMENU; | |
740 | if ((style & wxMINIMIZE) || (style & wxICONIZE)) | |
741 | msflags |= WS_MINIMIZE; | |
742 | if (style & wxMAXIMIZE) | |
743 | msflags |= WS_MAXIMIZE; | |
744 | if (style & wxCAPTION) | |
745 | msflags |= WS_CAPTION; | |
746 | ||
747 | mcs.style = msflags; | |
748 | ||
749 | mcs.lParam = 0; | |
750 | ||
b225f659 VZ |
751 | wxWindowCreationHook hook(this); |
752 | ||
3ca6a5f0 BP |
753 | m_hWnd = (WXHWND)::SendMessage(GetWinHwnd(parent->GetClientWindow()), |
754 | WM_MDICREATE, 0, (LONG)(LPSTR)&mcs); | |
2bda0e17 | 755 | |
c7527e3f | 756 | wxAssociateWinWithHandle((HWND) GetHWND(), this); |
2bda0e17 | 757 | |
4f8090e0 | 758 | return true; |
2bda0e17 KB |
759 | } |
760 | ||
c2dcfdef | 761 | wxMDIChildFrame::~wxMDIChildFrame() |
2bda0e17 | 762 | { |
d1e44484 VZ |
763 | // will be destroyed by DestroyChildren() but reset them before calling it |
764 | // to avoid using dangling pointers if a callback comes in the meanwhile | |
1904aa72 | 765 | #if wxUSE_TOOLBAR |
627a3091 | 766 | m_frameToolBar = NULL; |
1904aa72 | 767 | #endif |
67a99992 | 768 | #if wxUSE_STATUSBAR |
627a3091 | 769 | m_frameStatusBar = NULL; |
67a99992 | 770 | #endif // wxUSE_STATUSBAR |
627a3091 | 771 | |
d1e44484 VZ |
772 | DestroyChildren(); |
773 | ||
4e152a23 VZ |
774 | RemoveWindowMenu(NULL, m_hMenu); |
775 | ||
c2dcfdef | 776 | MSWDestroyWindow(); |
2bda0e17 KB |
777 | } |
778 | ||
2596e9fb VS |
779 | bool wxMDIChildFrame::Show(bool show) |
780 | { | |
781 | m_needsInitialShow = false; | |
782 | return wxFrame::Show(show); | |
783 | } | |
784 | ||
2bda0e17 | 785 | // Set the client size (i.e. leave the calculation of borders etc. |
77ffb593 | 786 | // to wxWidgets) |
cc2b7472 | 787 | void wxMDIChildFrame::DoSetClientSize(int width, int height) |
2bda0e17 | 788 | { |
b3818fbe | 789 | HWND hWnd = GetHwnd(); |
2bda0e17 KB |
790 | |
791 | RECT rect; | |
2de8030d | 792 | ::GetClientRect(hWnd, &rect); |
2bda0e17 KB |
793 | |
794 | RECT rect2; | |
795 | GetWindowRect(hWnd, &rect2); | |
796 | ||
797 | // Find the difference between the entire window (title bar and all) | |
798 | // and the client area; add this to the new client size to move the | |
799 | // window | |
800 | int actual_width = rect2.right - rect2.left - rect.right + width; | |
801 | int actual_height = rect2.bottom - rect2.top - rect.bottom + height; | |
802 | ||
67a99992 | 803 | #if wxUSE_STATUSBAR |
a2327a9f | 804 | if (GetStatusBar() && GetStatusBar()->IsShown()) |
2bda0e17 | 805 | { |
c2dcfdef VZ |
806 | int sx, sy; |
807 | GetStatusBar()->GetSize(&sx, &sy); | |
2bda0e17 KB |
808 | actual_height += sy; |
809 | } | |
67a99992 | 810 | #endif // wxUSE_STATUSBAR |
2bda0e17 KB |
811 | |
812 | POINT point; | |
813 | point.x = rect2.left; | |
814 | point.y = rect2.top; | |
815 | ||
816 | // If there's an MDI parent, must subtract the parent's top left corner | |
817 | // since MoveWindow moves relative to the parent | |
818 | wxMDIParentFrame *mdiParent = (wxMDIParentFrame *)GetParent(); | |
819 | ::ScreenToClient((HWND) mdiParent->GetClientWindow()->GetHWND(), &point); | |
820 | ||
4f8090e0 | 821 | MoveWindow(hWnd, point.x, point.y, actual_width, actual_height, (BOOL)true); |
debe6624 | 822 | |
5c519b6c WS |
823 | wxSize size(width, height); |
824 | wxSizeEvent event(size, m_windowId); | |
debe6624 | 825 | event.SetEventObject( this ); |
2bda0e17 | 826 | GetEventHandler()->ProcessEvent(event); |
2bda0e17 KB |
827 | } |
828 | ||
cc2b7472 | 829 | void wxMDIChildFrame::DoGetPosition(int *x, int *y) const |
2bda0e17 KB |
830 | { |
831 | RECT rect; | |
b3818fbe | 832 | GetWindowRect(GetHwnd(), &rect); |
2bda0e17 KB |
833 | POINT point; |
834 | point.x = rect.left; | |
835 | point.y = rect.top; | |
836 | ||
837 | // Since we now have the absolute screen coords, | |
838 | // if there's a parent we must subtract its top left corner | |
839 | wxMDIParentFrame *mdiParent = (wxMDIParentFrame *)GetParent(); | |
840 | ::ScreenToClient((HWND) mdiParent->GetClientWindow()->GetHWND(), &point); | |
841 | ||
1696dde5 JS |
842 | if (x) |
843 | *x = point.x; | |
844 | if (y) | |
845 | *y = point.y; | |
2bda0e17 KB |
846 | } |
847 | ||
42e69d6b | 848 | void wxMDIChildFrame::InternalSetMenuBar() |
2bda0e17 | 849 | { |
42e69d6b | 850 | wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent(); |
2bda0e17 | 851 | |
4e152a23 VZ |
852 | InsertWindowMenu(parent->GetClientWindow(), |
853 | m_hMenu, GetMDIWindowMenu(parent)); | |
2bda0e17 | 854 | |
4f8090e0 | 855 | parent->m_parentFrameActive = false; |
2bda0e17 KB |
856 | } |
857 | ||
82c9f85c VZ |
858 | WXHICON wxMDIChildFrame::GetDefaultIcon() const |
859 | { | |
94826170 VZ |
860 | // we don't have any standard icons (any more) |
861 | return (WXHICON)0; | |
82c9f85c VZ |
862 | } |
863 | ||
42e69d6b | 864 | // --------------------------------------------------------------------------- |
2bda0e17 | 865 | // MDI operations |
42e69d6b VZ |
866 | // --------------------------------------------------------------------------- |
867 | ||
9b73db3c | 868 | void wxMDIChildFrame::Maximize(bool maximize) |
2bda0e17 KB |
869 | { |
870 | wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent(); | |
871 | if ( parent && parent->GetClientWindow() ) | |
9b73db3c VZ |
872 | { |
873 | ::SendMessage(GetWinHwnd(parent->GetClientWindow()), | |
874 | maximize ? WM_MDIMAXIMIZE : WM_MDIRESTORE, | |
875 | (WPARAM)GetHwnd(), 0); | |
876 | } | |
2bda0e17 KB |
877 | } |
878 | ||
c2dcfdef | 879 | void wxMDIChildFrame::Restore() |
2bda0e17 KB |
880 | { |
881 | wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent(); | |
882 | if ( parent && parent->GetClientWindow() ) | |
9b73db3c VZ |
883 | { |
884 | ::SendMessage(GetWinHwnd(parent->GetClientWindow()), WM_MDIRESTORE, | |
885 | (WPARAM) GetHwnd(), 0); | |
886 | } | |
2bda0e17 KB |
887 | } |
888 | ||
c2dcfdef | 889 | void wxMDIChildFrame::Activate() |
2bda0e17 KB |
890 | { |
891 | wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent(); | |
892 | if ( parent && parent->GetClientWindow() ) | |
9b73db3c VZ |
893 | { |
894 | ::SendMessage(GetWinHwnd(parent->GetClientWindow()), WM_MDIACTIVATE, | |
895 | (WPARAM) GetHwnd(), 0); | |
896 | } | |
2bda0e17 KB |
897 | } |
898 | ||
42e69d6b VZ |
899 | // --------------------------------------------------------------------------- |
900 | // MDI window proc and message handlers | |
901 | // --------------------------------------------------------------------------- | |
902 | ||
c140b7e7 | 903 | WXLRESULT wxMDIChildFrame::MSWWindowProc(WXUINT message, |
42e69d6b VZ |
904 | WXWPARAM wParam, |
905 | WXLPARAM lParam) | |
906 | { | |
c140b7e7 | 907 | WXLRESULT rc = 0; |
4f8090e0 | 908 | bool processed = false; |
42e69d6b VZ |
909 | |
910 | switch ( message ) | |
911 | { | |
912 | case WM_COMMAND: | |
913 | { | |
914 | WORD id, cmd; | |
915 | WXHWND hwnd; | |
916 | UnpackCommand((WXWPARAM)wParam, (WXLPARAM)lParam, | |
917 | &id, &hwnd, &cmd); | |
918 | ||
919 | processed = HandleCommand(id, cmd, (WXHWND)hwnd); | |
920 | } | |
921 | break; | |
922 | ||
42e69d6b | 923 | case WM_GETMINMAXINFO: |
3ebcfb76 VZ |
924 | processed = HandleGetMinMaxInfo((MINMAXINFO *)lParam); |
925 | break; | |
42e69d6b VZ |
926 | |
927 | case WM_MDIACTIVATE: | |
928 | { | |
929 | WXWORD act; | |
930 | WXHWND hwndAct, hwndDeact; | |
931 | UnpackMDIActivate(wParam, lParam, &act, &hwndAct, &hwndDeact); | |
932 | ||
933 | processed = HandleMDIActivate(act, hwndAct, hwndDeact); | |
934 | } | |
b3818fbe VZ |
935 | // fall through |
936 | ||
937 | case WM_MOVE: | |
938 | // must pass WM_MOVE to DefMDIChildProc() to recalculate MDI client | |
939 | // scrollbars if necessary | |
940 | ||
941 | // fall through | |
942 | ||
943 | case WM_SIZE: | |
944 | // must pass WM_SIZE to DefMDIChildProc(), otherwise many weird | |
945 | // things happen | |
946 | MSWDefWindowProc(message, wParam, lParam); | |
42e69d6b VZ |
947 | break; |
948 | ||
b3818fbe VZ |
949 | case WM_SYSCOMMAND: |
950 | // DefMDIChildProc handles SC_{NEXT/PREV}WINDOW here, so pass it | |
951 | // the message (the base class version does not) | |
952 | return MSWDefWindowProc(message, wParam, lParam); | |
953 | ||
42e69d6b VZ |
954 | case WM_WINDOWPOSCHANGING: |
955 | processed = HandleWindowPosChanging((LPWINDOWPOS)lParam); | |
956 | break; | |
957 | } | |
958 | ||
959 | if ( !processed ) | |
960 | rc = wxFrame::MSWWindowProc(message, wParam, lParam); | |
961 | ||
962 | return rc; | |
963 | } | |
964 | ||
42e69d6b | 965 | bool wxMDIChildFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND hwnd) |
2bda0e17 | 966 | { |
2bda0e17 | 967 | // In case it's e.g. a toolbar. |
42e69d6b VZ |
968 | if ( hwnd ) |
969 | { | |
970 | wxWindow *win = wxFindWinFromHandle(hwnd); | |
971 | if (win) | |
972 | return win->MSWCommand(cmd, id); | |
973 | } | |
2bda0e17 | 974 | |
e1a6fc11 JS |
975 | if (wxCurrentPopupMenu) |
976 | { | |
977 | wxMenu *popupMenu = wxCurrentPopupMenu; | |
978 | wxCurrentPopupMenu = NULL; | |
979 | if (popupMenu->MSWCommand(cmd, id)) | |
4f8090e0 | 980 | return true; |
e1a6fc11 JS |
981 | } |
982 | ||
3ca6a5f0 | 983 | bool processed; |
dd60b9ec | 984 | if (GetMenuBar() && GetMenuBar()->FindItem(id)) |
2bda0e17 | 985 | { |
3ca6a5f0 | 986 | processed = ProcessCommand(id); |
2bda0e17 KB |
987 | } |
988 | else | |
3ca6a5f0 | 989 | { |
4f8090e0 | 990 | processed = false; |
3ca6a5f0 | 991 | } |
42e69d6b | 992 | |
3ca6a5f0 | 993 | return processed; |
2bda0e17 KB |
994 | } |
995 | ||
42e69d6b VZ |
996 | bool wxMDIChildFrame::HandleMDIActivate(long WXUNUSED(activate), |
997 | WXHWND hwndAct, | |
998 | WXHWND hwndDeact) | |
2bda0e17 | 999 | { |
42e69d6b | 1000 | wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent(); |
2bda0e17 | 1001 | |
42e69d6b | 1002 | HMENU menuToSet = 0; |
57a7b7c1 | 1003 | |
42e69d6b | 1004 | bool activated; |
57a7b7c1 | 1005 | |
42e69d6b VZ |
1006 | if ( m_hWnd == hwndAct ) |
1007 | { | |
4f8090e0 | 1008 | activated = true; |
42e69d6b | 1009 | parent->m_currentChild = this; |
2bda0e17 | 1010 | |
42e69d6b VZ |
1011 | HMENU child_menu = (HMENU)GetWinMenu(); |
1012 | if ( child_menu ) | |
1013 | { | |
4f8090e0 | 1014 | parent->m_parentFrameActive = false; |
2bda0e17 | 1015 | |
42e69d6b VZ |
1016 | menuToSet = child_menu; |
1017 | } | |
1018 | } | |
1019 | else if ( m_hWnd == hwndDeact ) | |
2bda0e17 | 1020 | { |
42e69d6b | 1021 | wxASSERT_MSG( parent->m_currentChild == this, |
223d09f6 | 1022 | wxT("can't deactivate MDI child which wasn't active!") ); |
42e69d6b | 1023 | |
4f8090e0 | 1024 | activated = false; |
42e69d6b | 1025 | parent->m_currentChild = NULL; |
2bda0e17 | 1026 | |
42e69d6b | 1027 | HMENU parent_menu = (HMENU)parent->GetWinMenu(); |
f4075804 VZ |
1028 | |
1029 | // activate the the parent menu only when there is no other child | |
1030 | // that has been activated | |
1031 | if ( parent_menu && !hwndAct ) | |
42e69d6b | 1032 | { |
4f8090e0 | 1033 | parent->m_parentFrameActive = true; |
42e69d6b VZ |
1034 | |
1035 | menuToSet = parent_menu; | |
1036 | } | |
1037 | } | |
1038 | else | |
1039 | { | |
18d2e170 | 1040 | // we have nothing to do with it |
4f8090e0 | 1041 | return false; |
2bda0e17 | 1042 | } |
debe6624 | 1043 | |
42e69d6b VZ |
1044 | if ( menuToSet ) |
1045 | { | |
4e152a23 VZ |
1046 | MDISetMenu(parent->GetClientWindow(), |
1047 | menuToSet, GetMDIWindowMenu(parent)); | |
42e69d6b VZ |
1048 | } |
1049 | ||
1050 | wxActivateEvent event(wxEVT_ACTIVATE, activated, m_windowId); | |
debe6624 | 1051 | event.SetEventObject( this ); |
2bda0e17 | 1052 | |
c03b48d7 GT |
1053 | ResetWindowStyle((void *)NULL); |
1054 | ||
42e69d6b VZ |
1055 | return GetEventHandler()->ProcessEvent(event); |
1056 | } | |
1057 | ||
1058 | bool wxMDIChildFrame::HandleWindowPosChanging(void *pos) | |
1059 | { | |
1060 | WINDOWPOS *lpPos = (WINDOWPOS *)pos; | |
1061 | #if defined(__WIN95__) | |
1062 | if (!(lpPos->flags & SWP_NOSIZE)) | |
2bda0e17 | 1063 | { |
42e69d6b | 1064 | RECT rectClient; |
b3818fbe VZ |
1065 | DWORD dwExStyle = ::GetWindowLong(GetHwnd(), GWL_EXSTYLE); |
1066 | DWORD dwStyle = ::GetWindowLong(GetHwnd(), GWL_STYLE); | |
42e69d6b VZ |
1067 | if (ResetWindowStyle((void *) & rectClient) && (dwStyle & WS_MAXIMIZE)) |
1068 | { | |
4f8090e0 | 1069 | ::AdjustWindowRectEx(&rectClient, dwStyle, false, dwExStyle); |
42e69d6b VZ |
1070 | lpPos->x = rectClient.left; |
1071 | lpPos->y = rectClient.top; | |
1072 | lpPos->cx = rectClient.right - rectClient.left; | |
1073 | lpPos->cy = rectClient.bottom - rectClient.top; | |
1074 | } | |
1904aa72 | 1075 | #if wxUSE_TOOLBAR |
42e69d6b | 1076 | wxMDIParentFrame* pFrameWnd = (wxMDIParentFrame *)GetParent(); |
a2327a9f | 1077 | if (pFrameWnd && pFrameWnd->GetToolBar() && pFrameWnd->GetToolBar()->IsShown()) |
42e69d6b VZ |
1078 | { |
1079 | pFrameWnd->GetToolBar()->Refresh(); | |
1080 | } | |
1904aa72 | 1081 | #endif |
42e69d6b VZ |
1082 | } |
1083 | #endif // Win95 | |
1084 | ||
4f8090e0 | 1085 | return false; |
42e69d6b VZ |
1086 | } |
1087 | ||
3ebcfb76 VZ |
1088 | bool wxMDIChildFrame::HandleGetMinMaxInfo(void *mmInfo) |
1089 | { | |
1090 | MINMAXINFO *info = (MINMAXINFO *)mmInfo; | |
1091 | ||
1092 | // let the default window proc calculate the size of MDI children | |
1093 | // frames because it is based on the size of the MDI client window, | |
1094 | // not on the values specified in wxWindow m_max variables | |
d9f9aa2d | 1095 | bool processed = MSWDefWindowProc(WM_GETMINMAXINFO, 0, (LPARAM)mmInfo) != 0; |
3ebcfb76 | 1096 | |
e7dda1ff VS |
1097 | int minWidth = GetMinWidth(), |
1098 | minHeight = GetMinHeight(); | |
1099 | ||
3ebcfb76 | 1100 | // but allow GetSizeHints() to set the min size |
e7dda1ff | 1101 | if ( minWidth != -1 ) |
3ebcfb76 | 1102 | { |
e7dda1ff | 1103 | info->ptMinTrackSize.x = minWidth; |
3ebcfb76 | 1104 | |
4f8090e0 | 1105 | processed = true; |
3ebcfb76 VZ |
1106 | } |
1107 | ||
e7dda1ff | 1108 | if ( minHeight != -1 ) |
3ebcfb76 | 1109 | { |
e7dda1ff | 1110 | info->ptMinTrackSize.y = minHeight; |
3ebcfb76 | 1111 | |
4f8090e0 | 1112 | processed = true; |
3ebcfb76 VZ |
1113 | } |
1114 | ||
4c9d78a4 | 1115 | return processed; |
3ebcfb76 VZ |
1116 | } |
1117 | ||
42e69d6b VZ |
1118 | // --------------------------------------------------------------------------- |
1119 | // MDI specific message translation/preprocessing | |
1120 | // --------------------------------------------------------------------------- | |
2bda0e17 | 1121 | |
c140b7e7 | 1122 | WXLRESULT wxMDIChildFrame::MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) |
42e69d6b VZ |
1123 | { |
1124 | return DefMDIChildProc(GetHwnd(), | |
1125 | (UINT)message, (WPARAM)wParam, (LPARAM)lParam); | |
1126 | } | |
1127 | ||
1128 | bool wxMDIChildFrame::MSWTranslateMessage(WXMSG* msg) | |
1129 | { | |
5a2762f0 | 1130 | return wxFrame::MSWTranslateMessage(msg); |
2bda0e17 KB |
1131 | } |
1132 | ||
42e69d6b VZ |
1133 | // --------------------------------------------------------------------------- |
1134 | // misc | |
1135 | // --------------------------------------------------------------------------- | |
1136 | ||
c2dcfdef | 1137 | void wxMDIChildFrame::MSWDestroyWindow() |
2bda0e17 | 1138 | { |
b3818fbe | 1139 | invalidHandle = GetHwnd(); |
2bda0e17 | 1140 | |
42e69d6b | 1141 | wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent(); |
2bda0e17 | 1142 | |
42e69d6b VZ |
1143 | // Must make sure this handle is invalidated (set to NULL) since all sorts |
1144 | // of things could happen after the child client is destroyed, but before | |
1145 | // the wxFrame is destroyed. | |
2bda0e17 | 1146 | |
42e69d6b | 1147 | HWND oldHandle = (HWND)GetHWND(); |
b3818fbe VZ |
1148 | SendMessage(GetWinHwnd(parent->GetClientWindow()), WM_MDIDESTROY, |
1149 | (WPARAM)oldHandle, 0); | |
18d2e170 JS |
1150 | |
1151 | if (parent->GetActiveChild() == (wxMDIChildFrame*) NULL) | |
1152 | ResetWindowStyle((void*) NULL); | |
1153 | ||
42e69d6b | 1154 | invalidHandle = 0; |
2bda0e17 | 1155 | |
42e69d6b VZ |
1156 | if (m_hMenu) |
1157 | { | |
1158 | ::DestroyMenu((HMENU) m_hMenu); | |
1159 | m_hMenu = 0; | |
1160 | } | |
ac6482e0 | 1161 | wxRemoveHandleAssociation(this); |
42e69d6b | 1162 | m_hWnd = 0; |
2bda0e17 KB |
1163 | } |
1164 | ||
42e69d6b VZ |
1165 | // Change the client window's extended style so we don't get a client edge |
1166 | // style when a child is maximised (a double border looks silly.) | |
2bda0e17 KB |
1167 | bool wxMDIChildFrame::ResetWindowStyle(void *vrect) |
1168 | { | |
1169 | #if defined(__WIN95__) | |
1170 | RECT *rect = (RECT *)vrect; | |
c2dcfdef VZ |
1171 | wxMDIParentFrame* pFrameWnd = (wxMDIParentFrame *)GetParent(); |
1172 | wxMDIChildFrame* pChild = pFrameWnd->GetActiveChild(); | |
1173 | if (!pChild || (pChild == this)) | |
1174 | { | |
47ca6bfb | 1175 | HWND hwndClient = GetWinHwnd(pFrameWnd->GetClientWindow()); |
8082a771 VZ |
1176 | DWORD dwStyle = ::GetWindowLong(hwndClient, GWL_EXSTYLE); |
1177 | ||
1178 | // we want to test whether there is a maximized child, so just set | |
1179 | // dwThisStyle to 0 if there is no child at all | |
1180 | DWORD dwThisStyle = pChild | |
1f3943e0 | 1181 | ? ::GetWindowLong(GetWinHwnd(pChild), GWL_STYLE) : 0; |
c2dcfdef | 1182 | DWORD dwNewStyle = dwStyle; |
8082a771 | 1183 | if ( dwThisStyle & WS_MAXIMIZE ) |
c2dcfdef VZ |
1184 | dwNewStyle &= ~(WS_EX_CLIENTEDGE); |
1185 | else | |
1186 | dwNewStyle |= WS_EX_CLIENTEDGE; | |
1187 | ||
1188 | if (dwStyle != dwNewStyle) | |
1189 | { | |
47ca6bfb VZ |
1190 | // force update of everything |
1191 | ::RedrawWindow(hwndClient, NULL, NULL, | |
1192 | RDW_INVALIDATE | RDW_ALLCHILDREN); | |
1193 | ::SetWindowLong(hwndClient, GWL_EXSTYLE, dwNewStyle); | |
1194 | ::SetWindowPos(hwndClient, NULL, 0, 0, 0, 0, | |
42e69d6b VZ |
1195 | SWP_FRAMECHANGED | SWP_NOACTIVATE | |
1196 | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | | |
1197 | SWP_NOCOPYBITS); | |
c2dcfdef | 1198 | if (rect) |
47ca6bfb | 1199 | ::GetClientRect(hwndClient, rect); |
2bda0e17 | 1200 | |
4f8090e0 | 1201 | return true; |
2bda0e17 | 1202 | } |
c2dcfdef | 1203 | } |
42e69d6b | 1204 | #endif // Win95 |
a23fd0e1 | 1205 | |
4f8090e0 | 1206 | return false; |
2bda0e17 KB |
1207 | } |
1208 | ||
42e69d6b VZ |
1209 | // =========================================================================== |
1210 | // wxMDIClientWindow: the window of predefined (by Windows) class which | |
1211 | // contains the child frames | |
1212 | // =========================================================================== | |
2bda0e17 | 1213 | |
debe6624 | 1214 | bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style) |
2bda0e17 | 1215 | { |
a756f210 | 1216 | m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE); |
2bda0e17 | 1217 | |
42e69d6b VZ |
1218 | CLIENTCREATESTRUCT ccs; |
1219 | m_windowStyle = style; | |
1220 | m_parent = parent; | |
c2dcfdef | 1221 | |
4e152a23 | 1222 | ccs.hWindowMenu = GetMDIWindowMenu(parent); |
42e69d6b | 1223 | ccs.idFirstChild = wxFIRST_MDI_CHILD; |
2bda0e17 | 1224 | |
5c44cd05 | 1225 | DWORD msStyle = MDIS_ALLCHILDSTYLES | WS_VISIBLE | WS_CHILD | |
b0766406 JS |
1226 | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; |
1227 | ||
42e69d6b VZ |
1228 | if ( style & wxHSCROLL ) |
1229 | msStyle |= WS_HSCROLL; | |
1230 | if ( style & wxVSCROLL ) | |
1231 | msStyle |= WS_VSCROLL; | |
2bda0e17 KB |
1232 | |
1233 | #if defined(__WIN95__) | |
42e69d6b | 1234 | DWORD exStyle = WS_EX_CLIENTEDGE; |
2bda0e17 | 1235 | #else |
42e69d6b | 1236 | DWORD exStyle = 0; |
2bda0e17 KB |
1237 | #endif |
1238 | ||
b225f659 | 1239 | wxWindowCreationHook hook(this); |
42e69d6b VZ |
1240 | m_hWnd = (WXHWND)::CreateWindowEx |
1241 | ( | |
1242 | exStyle, | |
223d09f6 | 1243 | wxT("MDICLIENT"), |
42e69d6b VZ |
1244 | NULL, |
1245 | msStyle, | |
1246 | 0, 0, 0, 0, | |
1247 | GetWinHwnd(parent), | |
1248 | NULL, | |
1249 | wxGetInstance(), | |
1250 | (LPSTR)(LPCLIENTCREATESTRUCT)&ccs); | |
1251 | if ( !m_hWnd ) | |
1252 | { | |
f6bcfd97 | 1253 | wxLogLastError(wxT("CreateWindowEx(MDI client)")); |
2bda0e17 | 1254 | |
4f8090e0 | 1255 | return false; |
42e69d6b | 1256 | } |
2bda0e17 | 1257 | |
42e69d6b | 1258 | SubclassWin(m_hWnd); |
2bda0e17 | 1259 | |
4f8090e0 | 1260 | return true; |
2bda0e17 KB |
1261 | } |
1262 | ||
1263 | // Explicitly call default scroll behaviour | |
1264 | void wxMDIClientWindow::OnScroll(wxScrollEvent& event) | |
1265 | { | |
1266 | // Note: for client windows, the scroll position is not set in | |
1267 | // WM_HSCROLL, WM_VSCROLL, so we can't easily determine what | |
1268 | // scroll position we're at. | |
1269 | // This makes it hard to paint patterns or bitmaps in the background, | |
1270 | // and have the client area scrollable as well. | |
1271 | ||
1272 | if ( event.GetOrientation() == wxHORIZONTAL ) | |
1273 | m_scrollX = event.GetPosition(); // Always returns zero! | |
1274 | else | |
1275 | m_scrollY = event.GetPosition(); // Always returns zero! | |
1276 | ||
42e69d6b VZ |
1277 | event.Skip(); |
1278 | } | |
1279 | ||
ec06b234 JS |
1280 | void wxMDIClientWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags) |
1281 | { | |
1282 | // Try to fix a problem whereby if you show an MDI child frame, then reposition the | |
1283 | // client area, you can end up with a non-refreshed portion in the client window | |
1284 | // (see OGL studio sample). So check if the position is changed and if so, | |
1285 | // redraw the MDI child frames. | |
1286 | ||
1287 | wxPoint oldPos = GetPosition(); | |
1288 | ||
1289 | wxWindow::DoSetSize(x, y, width, height, sizeFlags); | |
1290 | ||
1291 | wxPoint newPos = GetPosition(); | |
1292 | ||
1293 | if ((newPos.x != oldPos.x) || (newPos.y != oldPos.y)) | |
1294 | { | |
1295 | if (GetParent()) | |
1296 | { | |
222ed1d6 | 1297 | wxWindowList::compatibility_iterator node = GetParent()->GetChildren().GetFirst(); |
ec06b234 JS |
1298 | while (node) |
1299 | { | |
d162a7ee | 1300 | wxWindow *child = node->GetData(); |
ec06b234 JS |
1301 | if (child->IsKindOf(CLASSINFO(wxMDIChildFrame))) |
1302 | { | |
d162a7ee VZ |
1303 | ::RedrawWindow(GetHwndOf(child), |
1304 | NULL, | |
1305 | NULL, | |
1306 | RDW_FRAME | | |
1307 | RDW_ALLCHILDREN | | |
1308 | RDW_INVALIDATE); | |
ec06b234 | 1309 | } |
4f8090e0 | 1310 | node = node->GetNext(); |
ec06b234 JS |
1311 | } |
1312 | } | |
1313 | } | |
1314 | } | |
1315 | ||
f6bcfd97 BP |
1316 | void wxMDIChildFrame::OnIdle(wxIdleEvent& event) |
1317 | { | |
2596e9fb VS |
1318 | // wxMSW prior to 2.5.3 created MDI child frames as visible, which resulted |
1319 | // in flicker e.g. when the frame contained controls with non-trivial | |
1320 | // layout. Since 2.5.3, the frame is created hidden as all other top level | |
1321 | // windows. In order to maintain backward compatibility, the frame is shown | |
1322 | // in OnIdle, unless Show(false) was called by the programmer before. | |
1323 | if ( m_needsInitialShow ) | |
1324 | { | |
1325 | Show(true); | |
1326 | } | |
5c519b6c | 1327 | |
f6bcfd97 BP |
1328 | // MDI child frames get their WM_SIZE when they're constructed but at this |
1329 | // moment they don't have any children yet so all child windows will be | |
1330 | // positioned incorrectly when they are added later - to fix this, we | |
1331 | // generate an artificial size event here | |
1332 | if ( m_needsResize ) | |
1333 | { | |
4f8090e0 | 1334 | m_needsResize = false; // avoid any possibility of recursion |
f6bcfd97 BP |
1335 | |
1336 | SendSizeEvent(); | |
1337 | } | |
1338 | ||
1339 | event.Skip(); | |
1340 | } | |
1341 | ||
42e69d6b VZ |
1342 | // --------------------------------------------------------------------------- |
1343 | // non member functions | |
1344 | // --------------------------------------------------------------------------- | |
1345 | ||
1346 | static void MDISetMenu(wxWindow *win, HMENU hmenuFrame, HMENU hmenuWindow) | |
1347 | { | |
1348 | ::SendMessage(GetWinHwnd(win), WM_MDISETMENU, | |
1349 | #ifdef __WIN32__ | |
f6bcfd97 | 1350 | (WPARAM)hmenuFrame, (LPARAM)hmenuWindow |
42e69d6b | 1351 | #else |
f6bcfd97 | 1352 | 0, MAKELPARAM(hmenuFrame, hmenuWindow) |
42e69d6b | 1353 | #endif |
f6bcfd97 | 1354 | ); |
42e69d6b VZ |
1355 | |
1356 | // update menu bar of the parent window | |
1357 | wxWindow *parent = win->GetParent(); | |
223d09f6 | 1358 | wxCHECK_RET( parent, wxT("MDI client without parent frame? weird...") ); |
42e69d6b | 1359 | |
a967ef9d | 1360 | ::SendMessage(GetWinHwnd(win), WM_MDIREFRESHMENU, 0, 0L); |
788722ac | 1361 | |
42e69d6b VZ |
1362 | ::DrawMenuBar(GetWinHwnd(parent)); |
1363 | } | |
1364 | ||
1365 | static void InsertWindowMenu(wxWindow *win, WXHMENU menu, HMENU subMenu) | |
1366 | { | |
1367 | // Try to insert Window menu in front of Help, otherwise append it. | |
1368 | HMENU hmenu = (HMENU)menu; | |
df61c009 JS |
1369 | |
1370 | if (subMenu) | |
1371 | { | |
4e152a23 | 1372 | int N = GetMenuItemCount(hmenu); |
4f8090e0 | 1373 | bool success = false; |
4e152a23 | 1374 | for ( int i = 0; i < N; i++ ) |
42e69d6b | 1375 | { |
4e152a23 VZ |
1376 | wxChar buf[256]; |
1377 | int chars = GetMenuString(hmenu, i, buf, WXSIZEOF(buf), MF_BYPOSITION); | |
1378 | if ( chars == 0 ) | |
1379 | { | |
1380 | wxLogLastError(wxT("GetMenuString")); | |
42e69d6b | 1381 | |
4e152a23 VZ |
1382 | continue; |
1383 | } | |
1384 | ||
1385 | if ( wxStripMenuCodes(wxString(buf)).IsSameAs(_("Help")) ) | |
1386 | { | |
4f8090e0 | 1387 | success = true; |
4e152a23 VZ |
1388 | ::InsertMenu(hmenu, i, MF_BYPOSITION | MF_POPUP | MF_STRING, |
1389 | (UINT)subMenu, _("&Window")); | |
1390 | break; | |
1391 | } | |
42e69d6b VZ |
1392 | } |
1393 | ||
4e152a23 | 1394 | if ( !success ) |
42e69d6b | 1395 | { |
4e152a23 | 1396 | ::AppendMenu(hmenu, MF_POPUP, (UINT)subMenu, _("&Window")); |
42e69d6b VZ |
1397 | } |
1398 | } | |
1399 | ||
42e69d6b VZ |
1400 | MDISetMenu(win, hmenu, subMenu); |
1401 | } | |
1402 | ||
df61c009 JS |
1403 | static void RemoveWindowMenu(wxWindow *win, WXHMENU menu) |
1404 | { | |
4e152a23 VZ |
1405 | HMENU hMenu = (HMENU)menu; |
1406 | ||
1407 | if ( hMenu ) | |
df61c009 | 1408 | { |
4e152a23 VZ |
1409 | wxChar buf[1024]; |
1410 | ||
1411 | int N = ::GetMenuItemCount(hMenu); | |
1412 | for ( int i = 0; i < N; i++ ) | |
df61c009 | 1413 | { |
4e152a23 VZ |
1414 | if ( !::GetMenuString(hMenu, i, buf, WXSIZEOF(buf), MF_BYPOSITION) ) |
1415 | { | |
2c62b3c3 VZ |
1416 | // Ignore successful read of menu string with length 0 which |
1417 | // occurs, for example, for a maximized MDI childs system menu | |
1418 | if ( ::GetLastError() != 0 ) | |
1419 | { | |
1420 | wxLogLastError(wxT("GetMenuString")); | |
1421 | } | |
df61c009 | 1422 | |
4e152a23 VZ |
1423 | continue; |
1424 | } | |
df61c009 | 1425 | |
4e152a23 VZ |
1426 | if ( wxStrcmp(buf, _("&Window")) == 0 ) |
1427 | { | |
1428 | if ( !::RemoveMenu(hMenu, i, MF_BYPOSITION) ) | |
1429 | { | |
1430 | wxLogLastError(wxT("RemoveMenu")); | |
1431 | } | |
1432 | ||
1433 | break; | |
1434 | } | |
df61c009 JS |
1435 | } |
1436 | } | |
1437 | ||
4e152a23 VZ |
1438 | if ( win ) |
1439 | { | |
1440 | // we don't change the windows menu, but we update the main one | |
1441 | MDISetMenu(win, hMenu, NULL); | |
1442 | } | |
df61c009 JS |
1443 | } |
1444 | ||
2917e920 BM |
1445 | static void UnpackMDIActivate(WXWPARAM wParam, WXLPARAM lParam, |
1446 | WXWORD *activate, WXHWND *hwndAct, WXHWND *hwndDeact) | |
42e69d6b | 1447 | { |
4f8090e0 | 1448 | *activate = true; |
42e69d6b VZ |
1449 | *hwndAct = (WXHWND)lParam; |
1450 | *hwndDeact = (WXHWND)wParam; | |
2bda0e17 | 1451 | } |
b9f933ab | 1452 | |
efd17a1d | 1453 | #endif // wxUSE_MDI && !defined(__WXUNIVERSAL__) |
b9f933ab | 1454 |