]>
Commit | Line | Data |
---|---|---|
0e320a79 DW |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: frame.cpp | |
3 | // Purpose: wxFrame | |
f0a56ab0 | 4 | // Author: David Webster |
0e320a79 | 5 | // Modified by: |
29435d81 | 6 | // Created: 10/27/99 |
0e320a79 | 7 | // RCS-ID: $Id$ |
f0a56ab0 | 8 | // Copyright: (c) David Webster |
0e320a79 DW |
9 | // Licence: wxWindows licence |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
21802234 DW |
12 | // For compilers that support precompilation, includes "wx.h". |
13 | #include "wx/wxprec.h" | |
14 | ||
15 | #ifndef WX_PRECOMP | |
16 | #include "wx/setup.h" | |
17 | #include "wx/frame.h" | |
18 | #include "wx/menu.h" | |
19 | #include "wx/app.h" | |
20 | #include "wx/utils.h" | |
21 | #include "wx/dialog.h" | |
22 | #include "wx/settings.h" | |
23 | #include "wx/dcclient.h" | |
24 | #endif // WX_PRECOMP | |
25 | ||
26 | #include "wx/os2/private.h" | |
f38374d0 DW |
27 | |
28 | #if wxUSE_STATUSBAR | |
29 | #include "wx/statusbr.h" | |
ea51d98d | 30 | #include "wx/generic/statusbr.h" |
f38374d0 DW |
31 | #endif // wxUSE_STATUSBAR |
32 | ||
33 | #if wxUSE_TOOLBAR | |
34 | #include "wx/toolbar.h" | |
35 | #endif // wxUSE_TOOLBAR | |
36 | ||
0e320a79 | 37 | #include "wx/menuitem.h" |
21802234 | 38 | #include "wx/log.h" |
0e320a79 | 39 | |
f38374d0 DW |
40 | // ---------------------------------------------------------------------------- |
41 | // globals | |
42 | // ---------------------------------------------------------------------------- | |
43 | ||
21802234 DW |
44 | extern wxWindowList wxModelessWindows; |
45 | extern wxList WXDLLEXPORT wxPendingDelete; | |
46 | extern wxChar wxFrameClassName[]; | |
47 | extern wxMenu *wxCurrentPopupMenu; | |
0e320a79 | 48 | |
f38374d0 DW |
49 | // ---------------------------------------------------------------------------- |
50 | // event tables | |
51 | // ---------------------------------------------------------------------------- | |
52 | ||
f38374d0 DW |
53 | BEGIN_EVENT_TABLE(wxFrame, wxFrameBase) |
54 | EVT_ACTIVATE(wxFrame::OnActivate) | |
55 | EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged) | |
0e320a79 DW |
56 | END_EVENT_TABLE() |
57 | ||
58 | IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow) | |
0e320a79 | 59 | |
f38374d0 DW |
60 | // ============================================================================ |
61 | // implementation | |
62 | // ============================================================================ | |
0e320a79 | 63 | |
f38374d0 DW |
64 | // ---------------------------------------------------------------------------- |
65 | // static class members | |
66 | // ---------------------------------------------------------------------------- | |
0e320a79 | 67 | |
f38374d0 | 68 | #if wxUSE_NATIVE_STATUSBAR |
a885d89a | 69 | bool wxFrame::m_bUseNativeStatusBar = TRUE; |
f38374d0 | 70 | #else |
a885d89a | 71 | bool wxFrame::m_bUseNativeStatusBar = FALSE; |
f38374d0 | 72 | #endif |
0e320a79 | 73 | |
f38374d0 DW |
74 | // ---------------------------------------------------------------------------- |
75 | // creation/destruction | |
76 | // ---------------------------------------------------------------------------- | |
77 | ||
78 | void wxFrame::Init() | |
0e320a79 | 79 | { |
80d83cbc | 80 | m_bIconized = FALSE; |
f38374d0 | 81 | |
21802234 | 82 | #if wxUSE_TOOLTIPS |
a885d89a | 83 | m_hWndToolTip = 0; |
21802234 | 84 | #endif |
ea51d98d DW |
85 | // Data to save/restore when calling ShowFullScreen |
86 | m_lFsStyle = 0L; | |
87 | m_lFsOldWindowStyle = 0L; | |
88 | m_nFsStatusBarFields = 0; | |
89 | m_nFsStatusBarHeight = 0; | |
90 | m_nFsToolBarHeight = 0; | |
91 | m_bFsIsMaximized = FALSE; | |
92 | m_bFsIsShowing = FALSE; | |
64e0c5c6 DW |
93 | m_bIsShown = FALSE; |
94 | m_pWinLastFocused = (wxWindow *)NULL; | |
40bd6154 DW |
95 | |
96 | // | |
97 | // Initialize SWP's | |
98 | // | |
99 | memset(&m_vSwp, 0, sizeof(SWP)); | |
100 | memset(&m_vSwpClient, 0, sizeof(SWP)); | |
101 | memset(&m_vSwpTitleBar, 0, sizeof(SWP)); | |
102 | memset(&m_vSwpMenuBar, 0, sizeof(SWP)); | |
103 | memset(&m_vSwpHScroll, 0, sizeof(SWP)); | |
104 | memset(&m_vSwpVScroll, 0, sizeof(SWP)); | |
105 | memset(&m_vSwpStatusBar, 0, sizeof(SWP)); | |
106 | memset(&m_vSwpToolBar, 0, sizeof(SWP)); | |
ea51d98d DW |
107 | } // end of wxFrame::Init |
108 | ||
109 | bool wxFrame::Create( | |
110 | wxWindow* pParent | |
111 | , wxWindowID vId | |
112 | , const wxString& rsTitle | |
113 | , const wxPoint& rPos | |
114 | , const wxSize& rSize | |
a885d89a | 115 | , long lulStyle |
ea51d98d DW |
116 | , const wxString& rsName |
117 | ) | |
f38374d0 | 118 | { |
ea51d98d DW |
119 | int nX = rPos.x; |
120 | int nY = rPos.y; | |
121 | int nWidth = rSize.x; | |
122 | int nHeight = rSize.y; | |
ea51d98d DW |
123 | |
124 | SetName(rsName); | |
a885d89a | 125 | m_windowStyle = lulStyle; |
ea51d98d DW |
126 | m_frameMenuBar = NULL; |
127 | m_frameToolBar = NULL; | |
128 | m_frameStatusBar = NULL; | |
129 | ||
130 | SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE)); | |
131 | ||
132 | if (vId > -1 ) | |
133 | m_windowId = vId; | |
134 | else | |
135 | m_windowId = (int)NewControlId(); | |
136 | ||
80d83cbc | 137 | if (pParent) |
ea51d98d DW |
138 | pParent->AddChild(this); |
139 | ||
140 | m_bIconized = FALSE; | |
141 | ||
ea51d98d DW |
142 | if ((m_windowStyle & wxFRAME_FLOAT_ON_PARENT) == 0) |
143 | pParent = NULL; | |
144 | ||
145 | if (!pParent) | |
146 | wxTopLevelWindows.Append(this); | |
147 | ||
148 | OS2Create( m_windowId | |
149 | ,pParent | |
150 | ,wxFrameClassName | |
151 | ,this | |
152 | ,rsTitle | |
153 | ,nX | |
154 | ,nY | |
155 | ,nWidth | |
156 | ,nHeight | |
a885d89a | 157 | ,lulStyle |
ea51d98d DW |
158 | ); |
159 | ||
160 | wxModelessWindows.Append(this); | |
161 | return TRUE; | |
162 | } // end of wxFrame::Create | |
0e320a79 DW |
163 | |
164 | wxFrame::~wxFrame() | |
165 | { | |
ea51d98d DW |
166 | m_isBeingDeleted = TRUE; |
167 | wxTopLevelWindows.DeleteObject(this); | |
0e320a79 | 168 | |
ea51d98d | 169 | DeleteAllBars(); |
29435d81 | 170 | |
ea51d98d DW |
171 | if (wxTheApp && (wxTopLevelWindows.Number() == 0)) |
172 | { | |
173 | wxTheApp->SetTopWindow(NULL); | |
0e320a79 | 174 | |
ea51d98d DW |
175 | if (wxTheApp->GetExitOnFrameDelete()) |
176 | { | |
40bd6154 | 177 | ::WinPostMsg(m_hFrame, WM_QUIT, 0, 0); |
ea51d98d DW |
178 | } |
179 | } | |
180 | wxModelessWindows.DeleteObject(this); | |
181 | ||
182 | // | |
183 | // For some reason, wxWindows can activate another task altogether | |
184 | // when a frame is destroyed after a modal dialog has been invoked. | |
185 | // Try to bring the parent to the top. | |
186 | // | |
187 | // MT:Only do this if this frame is currently the active window, else weird | |
188 | // things start to happen. | |
189 | // | |
190 | if (wxGetActiveWindow() == this) | |
0e320a79 | 191 | { |
ea51d98d DW |
192 | if (GetParent() && GetParent()->GetHWND()) |
193 | { | |
ea51d98d DW |
194 | ::WinSetWindowPos( (HWND) GetParent()->GetHWND() |
195 | ,HWND_TOP | |
80d83cbc DW |
196 | ,0 |
197 | ,0 | |
198 | ,0 | |
199 | ,0 | |
200 | ,SWP_ZORDER | |
ea51d98d DW |
201 | ); |
202 | } | |
0e320a79 | 203 | } |
ea51d98d | 204 | } // end of wxFrame::~wxFrame |
0e320a79 | 205 | |
ea51d98d | 206 | // |
0e320a79 | 207 | // Get size *available for subwindows* i.e. excluding menu bar, toolbar etc. |
ea51d98d | 208 | // |
80d83cbc DW |
209 | void wxFrame::DoGetClientSize( |
210 | int* pX | |
211 | , int* pY | |
212 | ) const | |
0e320a79 | 213 | { |
80d83cbc | 214 | // |
a885d89a | 215 | // OS/2 PM's coordinates go from bottom-left not |
80d83cbc DW |
216 | // top-left thus the += instead of the -= |
217 | // | |
218 | RECTL vRect; | |
80d83cbc DW |
219 | |
220 | // | |
221 | // PM has no GetClientRect that inherantly knows about the client window | |
222 | // We have to explicitly go fetch it! | |
223 | // | |
40bd6154 | 224 | ::WinQueryWindowRect(GetHwnd(), &vRect); |
21802234 | 225 | |
f38374d0 | 226 | #if wxUSE_STATUSBAR |
80d83cbc DW |
227 | if ( GetStatusBar() ) |
228 | { | |
a885d89a | 229 | int nStatusX; |
80d83cbc DW |
230 | int nStatusY; |
231 | ||
232 | GetStatusBar()->GetClientSize( &nStatusX | |
233 | ,&nStatusY | |
234 | ); | |
235 | vRect.yBottom += nStatusY; | |
236 | } | |
f38374d0 | 237 | #endif // wxUSE_STATUSBAR |
21802234 | 238 | |
80d83cbc | 239 | wxPoint vPoint(GetClientAreaOrigin()); |
a885d89a DW |
240 | |
241 | vRect.yBottom += vPoint.y; | |
242 | vRect.xRight -= vPoint.x; | |
21802234 | 243 | |
80d83cbc DW |
244 | if (pX) |
245 | *pX = vRect.xRight; | |
246 | if (pY) | |
247 | *pY = vRect.yBottom; | |
248 | } // end of wxFrame::DoGetClientSize | |
0e320a79 | 249 | |
a885d89a | 250 | // |
0e320a79 DW |
251 | // Set the client size (i.e. leave the calculation of borders etc. |
252 | // to wxWindows) | |
80d83cbc DW |
253 | // |
254 | void wxFrame::DoSetClientSize( | |
255 | int nWidth | |
256 | , int nHeight | |
257 | ) | |
0e320a79 | 258 | { |
80d83cbc | 259 | HWND hWnd = GetHwnd(); |
80d83cbc | 260 | RECTL vRect; |
a7ef993c | 261 | RECTL vRect2; |
0e320a79 | 262 | |
40bd6154 | 263 | ::WinQueryWindowRect(GetHwnd(), &vRect); |
21802234 | 264 | |
40bd6154 | 265 | ::WinQueryWindowRect(m_hFrame, &vRect2); |
21802234 | 266 | |
80d83cbc DW |
267 | // |
268 | // Find the difference between the entire window (title bar and all) | |
269 | // and the client area; add this to the new client size to move the | |
270 | // window. Remember OS/2's backwards y coord system! | |
271 | // | |
272 | int nActualWidth = vRect2.xRight - vRect2.xLeft - vRect.xRight + nWidth; | |
273 | int nActualHeight = vRect2.yTop + vRect2.yTop - vRect.yTop + nHeight; | |
29435d81 | 274 | |
f38374d0 | 275 | #if wxUSE_STATUSBAR |
80d83cbc DW |
276 | if ( GetStatusBar() ) |
277 | { | |
278 | int nStatusX; | |
279 | int nStatusY; | |
280 | ||
281 | GetStatusBar()->GetClientSize( &nStatusX | |
282 | ,&nStatusY | |
283 | ); | |
284 | nActualHeight += nStatusY; | |
285 | } | |
f38374d0 | 286 | #endif // wxUSE_STATUSBAR |
29435d81 | 287 | |
80d83cbc DW |
288 | wxPoint vPoint(GetClientAreaOrigin()); |
289 | nActualWidth += vPoint.y; | |
290 | nActualHeight += vPoint.x; | |
291 | ||
292 | POINTL vPointl; | |
293 | ||
294 | vPointl.x = vRect2.xLeft; | |
64e0c5c6 | 295 | vPointl.y = vRect2.yTop; |
80d83cbc | 296 | |
64e0c5c6 | 297 | ::WinSetWindowPos( hWnd |
80d83cbc DW |
298 | ,HWND_TOP |
299 | ,vPointl.x | |
300 | ,vPointl.y | |
301 | ,nActualWidth | |
302 | ,nActualHeight | |
303 | ,SWP_MOVE | SWP_SIZE | SWP_SHOW | |
304 | ); | |
305 | ||
306 | wxSizeEvent vEvent( wxSize( nWidth | |
307 | ,nHeight | |
308 | ) | |
309 | ,m_windowId | |
310 | ); | |
311 | vEvent.SetEventObject(this); | |
312 | GetEventHandler()->ProcessEvent(vEvent); | |
313 | } // end of wxFrame::DoSetClientSize | |
314 | ||
315 | void wxFrame::DoGetSize( | |
316 | int* pWidth | |
317 | , int* pHeight | |
318 | ) const | |
319 | { | |
320 | RECTL vRect; | |
21802234 | 321 | |
40bd6154 | 322 | ::WinQueryWindowRect(m_hFrame, &vRect); |
80d83cbc DW |
323 | *pWidth = vRect.xRight - vRect.xLeft; |
324 | *pHeight = vRect.yTop - vRect.yBottom; | |
325 | } // end of wxFrame::DoGetSize | |
21802234 | 326 | |
80d83cbc DW |
327 | void wxFrame::DoGetPosition( |
328 | int* pX | |
329 | , int* pY | |
330 | ) const | |
331 | { | |
332 | RECTL vRect; | |
a885d89a | 333 | POINTL vPoint; |
29435d81 | 334 | |
40bd6154 | 335 | ::WinQueryWindowRect(m_hFrame, &vRect); |
80d83cbc | 336 | vPoint.x = vRect.xLeft; |
0e320a79 | 337 | |
80d83cbc DW |
338 | // |
339 | // OS/2 is backwards [WIN32 it is vRect.yTop] | |
340 | // | |
341 | vPoint.y = vRect.yBottom; | |
0e320a79 | 342 | |
80d83cbc DW |
343 | *pX = vPoint.x; |
344 | *pY = vPoint.y; | |
345 | } // end of wxFrame::DoGetPosition | |
0e320a79 | 346 | |
f38374d0 DW |
347 | // ---------------------------------------------------------------------------- |
348 | // variations around ::ShowWindow() | |
349 | // ---------------------------------------------------------------------------- | |
350 | ||
80d83cbc | 351 | void wxFrame::DoShowWindow( |
426d5745 | 352 | int bShowCmd |
80d83cbc | 353 | ) |
0e320a79 | 354 | { |
40bd6154 | 355 | ::WinShowWindow(m_hFrame, (BOOL)bShowCmd); |
64e0c5c6 | 356 | m_bIconized = bShowCmd == SWP_MINIMIZE; |
80d83cbc | 357 | } // end of wxFrame::DoShowWindow |
21802234 | 358 | |
80d83cbc DW |
359 | bool wxFrame::Show( |
360 | bool bShow | |
361 | ) | |
0e320a79 | 362 | { |
426d5745 DW |
363 | SWP vSwp; |
364 | ||
365 | DoShowWindow((int)bShow); | |
21802234 | 366 | |
80d83cbc | 367 | if (bShow) |
f38374d0 | 368 | { |
80d83cbc DW |
369 | wxActivateEvent vEvent(wxEVT_ACTIVATE, TRUE, m_windowId); |
370 | ||
40bd6154 | 371 | ::WinQueryWindowPos(m_hFrame, &vSwp); |
d8530167 | 372 | m_bIconized = vSwp.fl & SWP_MINIMIZE; |
40bd6154 | 373 | ::WinEnableWindow(m_hFrame, TRUE); |
80d83cbc DW |
374 | vEvent.SetEventObject(this); |
375 | GetEventHandler()->ProcessEvent(vEvent); | |
f38374d0 DW |
376 | } |
377 | else | |
378 | { | |
80d83cbc | 379 | // |
f38374d0 | 380 | // Try to highlight the correct window (the parent) |
80d83cbc DW |
381 | // |
382 | if (GetParent()) | |
f38374d0 | 383 | { |
80d83cbc DW |
384 | HWND hWndParent = GetHwndOf(GetParent()); |
385 | ||
426d5745 | 386 | ::WinQueryWindowPos(hWndParent, &vSwp); |
d8530167 | 387 | m_bIconized = vSwp.fl & SWP_MINIMIZE; |
f38374d0 | 388 | if (hWndParent) |
80d83cbc DW |
389 | ::WinSetWindowPos( hWndParent |
390 | ,HWND_TOP | |
426d5745 DW |
391 | ,vSwp.x |
392 | ,vSwp.y | |
393 | ,vSwp.cx | |
394 | ,vSwp.cy | |
395 | ,SWP_ZORDER | SWP_ACTIVATE | SWP_SHOW | SWP_MOVE | |
80d83cbc | 396 | ); |
a0606634 | 397 | ::WinEnableWindow(hWndParent, TRUE); |
f38374d0 DW |
398 | } |
399 | } | |
f38374d0 | 400 | return TRUE; |
80d83cbc | 401 | } // end of wxFrame::Show |
f38374d0 | 402 | |
80d83cbc DW |
403 | void wxFrame::Iconize( |
404 | bool bIconize | |
405 | ) | |
f38374d0 | 406 | { |
80d83cbc DW |
407 | DoShowWindow(bIconize ? SWP_MINIMIZE : SWP_RESTORE); |
408 | } // end of wxFrame::Iconize | |
0e320a79 | 409 | |
80d83cbc DW |
410 | void wxFrame::Maximize( |
411 | bool bMaximize) | |
0e320a79 | 412 | { |
80d83cbc DW |
413 | DoShowWindow(bMaximize ? SWP_MAXIMIZE : SWP_RESTORE); |
414 | } // end of wxFrame::Maximize | |
f38374d0 DW |
415 | |
416 | void wxFrame::Restore() | |
417 | { | |
80d83cbc DW |
418 | DoShowWindow(SWP_RESTORE); |
419 | } // end of wxFrame::Restore | |
0e320a79 DW |
420 | |
421 | bool wxFrame::IsIconized() const | |
422 | { | |
80d83cbc | 423 | SWP vSwp; |
80d83cbc | 424 | |
a885d89a DW |
425 | ::WinQueryWindowPos(GetHwnd(), &vSwp); |
426 | ||
80d83cbc DW |
427 | if (vSwp.fl & SWP_MINIMIZE) |
428 | ((wxFrame*)this)->m_bIconized = TRUE; | |
429 | else | |
430 | ((wxFrame*)this)->m_bIconized = FALSE; | |
431 | return m_bIconized; | |
432 | } // end of wxFrame::IsIconized | |
0e320a79 | 433 | |
21802234 DW |
434 | // Is it maximized? |
435 | bool wxFrame::IsMaximized() const | |
0e320a79 | 436 | { |
80d83cbc DW |
437 | SWP vSwp; |
438 | bool bIconic; | |
439 | ||
40bd6154 | 440 | ::WinQueryWindowPos(m_hFrame, &vSwp); |
80d83cbc DW |
441 | return (vSwp.fl & SWP_MAXIMIZE); |
442 | } // end of wxFrame::IsMaximized | |
0e320a79 | 443 | |
0fe536e3 DW |
444 | void wxFrame::SetIcon( |
445 | const wxIcon& rIcon | |
446 | ) | |
0e320a79 | 447 | { |
0fe536e3 | 448 | wxFrameBase::SetIcon(rIcon); |
f38374d0 | 449 | |
426d5745 | 450 | if ((m_icon.GetHICON()) != NULLHANDLE) |
f38374d0 | 451 | { |
40bd6154 | 452 | ::WinSendMsg( m_hFrame |
f23208ca | 453 | ,WM_SETICON |
426d5745 | 454 | ,(MPARAM)((HPOINTER)m_icon.GetHICON()) |
f23208ca DW |
455 | ,NULL |
456 | ); | |
40bd6154 | 457 | ::WinSendMsg( m_hFrame |
f23208ca DW |
458 | ,WM_UPDATEFRAME |
459 | ,(MPARAM)FCF_ICON | |
460 | ,(MPARAM)0 | |
461 | ); | |
f38374d0 | 462 | } |
0fe536e3 | 463 | } // end of wxFrame::SetIcon |
0e320a79 | 464 | |
21802234 | 465 | #if wxUSE_STATUSBAR |
0fe536e3 DW |
466 | wxStatusBar* wxFrame::OnCreateStatusBar( |
467 | int nNumber | |
a885d89a | 468 | , long lulStyle |
0fe536e3 DW |
469 | , wxWindowID vId |
470 | , const wxString& rName | |
471 | ) | |
0e320a79 | 472 | { |
0fe536e3 | 473 | wxStatusBar* pStatusBar = NULL; |
f6bcfd97 BP |
474 | SWP vSwp; |
475 | ERRORID vError; | |
476 | wxString sError; | |
477 | HWND hWnd; | |
0e320a79 | 478 | |
0fe536e3 | 479 | pStatusBar = wxFrameBase::OnCreateStatusBar( nNumber |
a885d89a | 480 | ,lulStyle |
0fe536e3 DW |
481 | ,vId |
482 | ,rName | |
483 | ); | |
f6bcfd97 BP |
484 | // |
485 | // The default parent set for the Statusbar is m_hWnd which, of course, | |
486 | // is the handle to the client window of the frame. We don't want that, | |
487 | // so we have to set the parent to actually be the Frame. | |
488 | // | |
489 | hWnd = pStatusBar->GetHWND(); | |
490 | if (!::WinSetParent(hWnd, m_hFrame, FALSE)) | |
491 | { | |
492 | vError = ::WinGetLastError(vHabmain); | |
493 | sError = wxPMErrorToStr(vError); | |
494 | wxLogError("Error setting parent for statusbar. Error: %s\n", sError); | |
495 | return NULL; | |
496 | } | |
497 | ||
498 | // | |
499 | // Also we need to reset it positioning to enable the SHOW attribute | |
500 | // | |
501 | if (!::WinQueryWindowPos((HWND)pStatusBar->GetHWND(), &vSwp)) | |
502 | { | |
503 | vError = ::WinGetLastError(vHabmain); | |
504 | sError = wxPMErrorToStr(vError); | |
505 | wxLogError("Error querying frame for statusbar position. Error: %s\n", sError); | |
506 | return NULL; | |
507 | } | |
508 | if (!::WinSetWindowPos( (HWND)pStatusBar->GetHWND() | |
509 | ,HWND_TOP | |
510 | ,vSwp.cx | |
511 | ,vSwp.cy | |
512 | ,vSwp.x | |
513 | ,vSwp.y | |
514 | ,SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_ZORDER | |
515 | )) | |
516 | { | |
517 | vError = ::WinGetLastError(vHabmain); | |
518 | sError = wxPMErrorToStr(vError); | |
519 | wxLogError("Error setting statusbar position. Error: %s\n", sError); | |
520 | return NULL; | |
521 | } | |
0fe536e3 DW |
522 | return pStatusBar; |
523 | } // end of wxFrame::OnCreateStatusBar | |
0e320a79 DW |
524 | |
525 | void wxFrame::PositionStatusBar() | |
526 | { | |
f6bcfd97 BP |
527 | SWP vSwp; |
528 | ERRORID vError; | |
529 | wxString sError; | |
530 | ||
0fe536e3 DW |
531 | // |
532 | // Native status bar positions itself | |
533 | // | |
534 | if (m_frameStatusBar) | |
f38374d0 | 535 | { |
a885d89a | 536 | int nWidth; |
0fe536e3 | 537 | int nHeight; |
a885d89a | 538 | int nStatbarWidth; |
0fe536e3 DW |
539 | int nStatbarHeight; |
540 | HWND hWndClient; | |
541 | RECTL vRect; | |
542 | ||
40bd6154 | 543 | ::WinQueryWindowRect(GetHwnd(), &vRect); |
0fe536e3 | 544 | nWidth = vRect.xRight - vRect.xLeft; |
a885d89a DW |
545 | nHeight = vRect.yTop - vRect.yBottom; |
546 | ||
0fe536e3 DW |
547 | m_frameStatusBar->GetSize( &nStatbarWidth |
548 | ,&nStatbarHeight | |
549 | ); | |
f38374d0 | 550 | |
0fe536e3 | 551 | // |
f38374d0 DW |
552 | // Since we wish the status bar to be directly under the client area, |
553 | // we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS. | |
0fe536e3 DW |
554 | // |
555 | m_frameStatusBar->SetSize( 0 | |
556 | ,nHeight | |
557 | ,nWidth | |
558 | ,nStatbarHeight | |
559 | ); | |
f6bcfd97 BP |
560 | if (!::WinQueryWindowPos(m_frameStatusBar->GetHWND(), &vSwp)) |
561 | { | |
562 | vError = ::WinGetLastError(vHabmain); | |
563 | sError = wxPMErrorToStr(vError); | |
564 | wxLogError("Error setting parent for submenu. Error: %s\n", sError); | |
565 | return; | |
566 | } | |
567 | if (!::WinSetWindowPos( m_frameStatusBar->GetHWND() | |
568 | ,HWND_TOP | |
569 | ,nStatbarWidth | |
570 | ,nStatbarHeight | |
571 | ,vSwp.x | |
572 | ,vSwp.y | |
573 | ,SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_ZORDER | |
574 | )) | |
575 | { | |
576 | vError = ::WinGetLastError(vHabmain); | |
577 | sError = wxPMErrorToStr(vError); | |
578 | wxLogError("Error setting parent for submenu. Error: %s\n", sError); | |
579 | return; | |
580 | } | |
f38374d0 | 581 | } |
0fe536e3 | 582 | } // end of wxFrame::PositionStatusBar |
21802234 | 583 | #endif // wxUSE_STATUSBAR |
0e320a79 | 584 | |
21802234 | 585 | void wxFrame::DetachMenuBar() |
0e320a79 | 586 | { |
21802234 | 587 | if (m_frameMenuBar) |
0e320a79 | 588 | { |
29435d81 | 589 | m_frameMenuBar->Detach(); |
0e320a79 | 590 | m_frameMenuBar = NULL; |
21802234 | 591 | } |
0fe536e3 | 592 | } // end of wxFrame::DetachMenuBar |
21802234 | 593 | |
0fe536e3 | 594 | void wxFrame::SetMenuBar( |
a885d89a | 595 | wxMenuBar* pMenuBar |
0fe536e3 | 596 | ) |
21802234 | 597 | { |
c3cea748 DW |
598 | ERRORID vError; |
599 | wxString sError; | |
dae16775 DW |
600 | HWND hClient = NULLHANDLE; |
601 | HWND hFrame = NULLHANDLE; | |
602 | HWND hTitlebar = NULLHANDLE; | |
603 | HWND hHScroll = NULLHANDLE; | |
604 | HWND hVScroll = NULLHANDLE; | |
605 | HWND hMenuBar = NULLHANDLE; | |
606 | SWP vSwp; | |
607 | SWP vSwpTitlebar; | |
608 | SWP vSwpVScroll; | |
609 | SWP vSwpHScroll; | |
610 | SWP vSwpMenu; | |
c3cea748 | 611 | |
0fe536e3 | 612 | if (!pMenuBar) |
21802234 DW |
613 | { |
614 | DetachMenuBar(); | |
29a99be3 | 615 | |
64e0c5c6 DW |
616 | // |
617 | // Actually remove the menu from the frame | |
618 | // | |
619 | m_hMenu = (WXHMENU)0; | |
620 | InternalSetMenuBar(); | |
29a99be3 | 621 | } |
64e0c5c6 | 622 | else // set new non NULL menu bar |
c3cea748 | 623 | { |
64e0c5c6 | 624 | m_frameMenuBar = NULL; |
c3cea748 | 625 | |
64e0c5c6 DW |
626 | // |
627 | // Can set a menubar several times. | |
628 | // TODO: how to prevent a memory leak if you have a currently-unattached | |
629 | // menubar? wxWindows assumes that the frame will delete the menu (otherwise | |
630 | // there are problems for MDI). | |
631 | // | |
632 | if (pMenuBar->GetHMenu()) | |
633 | { | |
634 | m_hMenu = pMenuBar->GetHMenu(); | |
635 | } | |
636 | else | |
637 | { | |
638 | pMenuBar->Detach(); | |
639 | m_hMenu = pMenuBar->Create(); | |
640 | if (!m_hMenu) | |
641 | return; | |
642 | } | |
643 | InternalSetMenuBar(); | |
644 | m_frameMenuBar = pMenuBar; | |
645 | pMenuBar->Attach(this); | |
c3cea748 | 646 | } |
dae16775 DW |
647 | |
648 | // | |
649 | // Now resize the client to fit the new frame | |
650 | // | |
40bd6154 DW |
651 | WinQueryWindowPos(m_hFrame, &vSwp); |
652 | hTitlebar = WinWindowFromID(m_hFrame, FID_TITLEBAR); | |
dae16775 | 653 | WinQueryWindowPos(hTitlebar, &vSwpTitlebar); |
40bd6154 | 654 | hHScroll = WinWindowFromID(m_hFrame, FID_HORZSCROLL); |
dae16775 | 655 | WinQueryWindowPos(hHScroll, &vSwpHScroll); |
40bd6154 | 656 | hVScroll = WinWindowFromID(m_hFrame, FID_VERTSCROLL); |
dae16775 | 657 | WinQueryWindowPos(hVScroll, &vSwpVScroll); |
40bd6154 | 658 | hMenuBar = WinWindowFromID(m_hFrame, FID_MENU); |
dae16775 | 659 | WinQueryWindowPos(hMenuBar, &vSwpMenu); |
40bd6154 | 660 | WinSetWindowPos( GetHwnd() |
dae16775 DW |
661 | ,HWND_TOP |
662 | ,SV_CXSIZEBORDER/2 | |
663 | ,(SV_CYSIZEBORDER/2) + vSwpHScroll.cy/2 | |
664 | ,vSwp.cx - ((SV_CXSIZEBORDER + 1) + vSwpVScroll.cx) | |
665 | ,vSwp.cy - ((SV_CYSIZEBORDER + 1) + vSwpTitlebar.cy + vSwpMenu.cy + vSwpHScroll.cy/2) | |
666 | ,SWP_SIZE | SWP_MOVE | |
667 | ); | |
0fe536e3 | 668 | } // end of wxFrame::SetMenuBar |
0e320a79 | 669 | |
21802234 | 670 | void wxFrame::InternalSetMenuBar() |
0e320a79 | 671 | { |
64e0c5c6 DW |
672 | ERRORID vError; |
673 | wxString sError; | |
674 | // | |
675 | // Set the parent and owner of the menubar to be the frame | |
676 | // | |
677 | if (!::WinSetParent(m_hMenu, m_hFrame, FALSE)) | |
678 | { | |
679 | vError = ::WinGetLastError(vHabmain); | |
680 | sError = wxPMErrorToStr(vError); | |
681 | wxLogError("Error setting parent for submenu. Error: %s\n", sError); | |
682 | } | |
683 | ||
684 | if (!::WinSetOwner(m_hMenu, m_hFrame)) | |
685 | { | |
686 | vError = ::WinGetLastError(vHabmain); | |
687 | sError = wxPMErrorToStr(vError); | |
688 | wxLogError("Error setting parent for submenu. Error: %s\n", sError); | |
689 | } | |
40bd6154 | 690 | WinSendMsg((HWND)m_hFrame, WM_UPDATEFRAME, (MPARAM)FCF_MENU, (MPARAM)0); |
0fe536e3 | 691 | } // end of wxFrame::InternalSetMenuBar |
0e320a79 | 692 | |
a885d89a DW |
693 | // |
694 | // Responds to colour changes, and passes event on to children | |
695 | // | |
696 | void wxFrame::OnSysColourChanged( | |
697 | wxSysColourChangedEvent& rEvent | |
698 | ) | |
0e320a79 DW |
699 | { |
700 | SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE)); | |
701 | Refresh(); | |
702 | ||
a885d89a | 703 | if (m_frameStatusBar) |
0e320a79 | 704 | { |
a885d89a DW |
705 | wxSysColourChangedEvent vEvent2; |
706 | ||
707 | vEvent2.SetEventObject(m_frameStatusBar); | |
708 | m_frameStatusBar->GetEventHandler()->ProcessEvent(vEvent2); | |
0e320a79 DW |
709 | } |
710 | ||
a885d89a | 711 | // |
0e320a79 | 712 | // Propagate the event to the non-top-level children |
a885d89a DW |
713 | // |
714 | wxWindow::OnSysColourChanged(rEvent); | |
715 | } // end of wxFrame::OnSysColourChanged | |
21802234 | 716 | |
542875a8 DW |
717 | // Pass TRUE to show full screen, FALSE to restore. |
718 | bool wxFrame::ShowFullScreen( | |
719 | bool bShow | |
720 | , long lStyle | |
721 | ) | |
722 | { | |
64e0c5c6 | 723 | if (bShow) |
542875a8 DW |
724 | { |
725 | if (IsFullScreen()) | |
726 | return FALSE; | |
727 | ||
64e0c5c6 DW |
728 | m_bFsIsShowing = TRUE; |
729 | m_lFsStyle = lStyle; | |
542875a8 | 730 | |
64e0c5c6 DW |
731 | wxToolBar* pTheToolBar = GetToolBar(); |
732 | wxStatusBar* pTheStatusBar = GetStatusBar(); | |
542875a8 | 733 | |
64e0c5c6 | 734 | int nDummyWidth; |
542875a8 | 735 | |
64e0c5c6 DW |
736 | if (pTheToolBar) |
737 | pTheToolBar->GetSize(&nDummyWidth, &m_nFsToolBarHeight); | |
738 | if (pTheStatusBar) | |
739 | pTheStatusBar->GetSize(&nDummyWidth, &m_nFsStatusBarHeight); | |
542875a8 | 740 | |
64e0c5c6 DW |
741 | // |
742 | // Zap the toolbar, menubar, and statusbar | |
743 | // | |
744 | if ((lStyle & wxFULLSCREEN_NOTOOLBAR) && pTheToolBar) | |
542875a8 | 745 | { |
64e0c5c6 DW |
746 | pTheToolBar->SetSize(-1,0); |
747 | pTheToolBar->Show(FALSE); | |
542875a8 DW |
748 | } |
749 | ||
64e0c5c6 DW |
750 | if (lStyle & wxFULLSCREEN_NOMENUBAR) |
751 | { | |
752 | ::WinSetParent(m_hMenu, m_hFrame, FALSE); | |
753 | ::WinSetOwner(m_hMenu, m_hFrame); | |
754 | ::WinSendMsg((HWND)m_hFrame, WM_UPDATEFRAME, (MPARAM)FCF_MENU, (MPARAM)0); | |
755 | } | |
542875a8 | 756 | |
64e0c5c6 | 757 | // |
542875a8 | 758 | // Save the number of fields in the statusbar |
64e0c5c6 DW |
759 | // |
760 | if ((lStyle & wxFULLSCREEN_NOSTATUSBAR) && pTheStatusBar) | |
542875a8 | 761 | { |
64e0c5c6 | 762 | m_nFsStatusBarFields = pTheStatusBar->GetFieldsCount(); |
542875a8 | 763 | SetStatusBar((wxStatusBar*) NULL); |
64e0c5c6 | 764 | delete pTheStatusBar; |
542875a8 DW |
765 | } |
766 | else | |
64e0c5c6 | 767 | m_nFsStatusBarFields = 0; |
542875a8 | 768 | |
64e0c5c6 DW |
769 | // |
770 | // Zap the frame borders | |
771 | // | |
542875a8 | 772 | |
64e0c5c6 DW |
773 | // |
774 | // Save the 'normal' window style | |
775 | // | |
776 | m_lFsOldWindowStyle = ::WinQueryWindowULong((HWND)GetHWND(), QWL_STYLE); | |
542875a8 | 777 | |
64e0c5c6 DW |
778 | // |
779 | // Save the old position, width & height, maximize state | |
780 | // | |
781 | m_vFsOldSize = GetRect(); | |
782 | m_bFsIsMaximized = IsMaximized(); | |
542875a8 | 783 | |
64e0c5c6 DW |
784 | // |
785 | // Decide which window style flags to turn off | |
786 | // | |
787 | LONG lNewStyle = m_lFsOldWindowStyle; | |
788 | LONG lOffFlags = 0; | |
542875a8 | 789 | |
64e0c5c6 DW |
790 | if (lStyle & wxFULLSCREEN_NOBORDER) |
791 | lOffFlags |= FCF_BORDER; | |
792 | if (lStyle & wxFULLSCREEN_NOCAPTION) | |
793 | lOffFlags |= (FCF_TASKLIST | FCF_SYSMENU); | |
542875a8 | 794 | |
64e0c5c6 | 795 | lNewStyle &= (~lOffFlags); |
542875a8 | 796 | |
64e0c5c6 DW |
797 | // |
798 | // Change our window style to be compatible with full-screen mode | |
799 | // | |
800 | ::WinSetWindowULong((HWND)GetHWND(), QWL_STYLE, (ULONG)lNewStyle); | |
542875a8 | 801 | |
64e0c5c6 DW |
802 | // |
803 | // Resize to the size of the desktop | |
804 | int nWidth; | |
805 | int nHeight; | |
542875a8 | 806 | |
64e0c5c6 | 807 | RECTL vRect; |
542875a8 | 808 | |
64e0c5c6 DW |
809 | ::WinQueryWindowRect(HWND_DESKTOP, &vRect); |
810 | nWidth = vRect.xRight - vRect.xLeft; | |
811 | // | |
812 | // Rmember OS/2 is backwards! | |
813 | // | |
814 | nHeight = vRect.yTop - vRect.yBottom; | |
542875a8 | 815 | |
64e0c5c6 DW |
816 | SetSize( nWidth |
817 | ,nHeight | |
818 | ); | |
542875a8 | 819 | |
64e0c5c6 DW |
820 | // |
821 | // Now flush the window style cache and actually go full-screen | |
822 | // | |
823 | ::WinSetWindowPos( (HWND) GetParent()->GetHWND() | |
824 | ,HWND_TOP | |
825 | ,0 | |
826 | ,0 | |
827 | ,nWidth | |
828 | ,nHeight | |
829 | ,SWP_SIZE | SWP_SHOW | |
830 | ); | |
831 | ||
832 | wxSizeEvent vEvent( wxSize( nWidth | |
833 | ,nHeight | |
834 | ) | |
835 | ,GetId() | |
836 | ); | |
542875a8 | 837 | |
64e0c5c6 | 838 | GetEventHandler()->ProcessEvent(vEvent); |
542875a8 DW |
839 | return TRUE; |
840 | } | |
841 | else | |
842 | { | |
843 | if (!IsFullScreen()) | |
844 | return FALSE; | |
845 | ||
64e0c5c6 | 846 | m_bFsIsShowing = FALSE; |
542875a8 | 847 | |
64e0c5c6 | 848 | wxToolBar* pTheToolBar = GetToolBar(); |
542875a8 | 849 | |
64e0c5c6 DW |
850 | // |
851 | // Restore the toolbar, menubar, and statusbar | |
852 | // | |
853 | if (pTheToolBar && (m_lFsStyle & wxFULLSCREEN_NOTOOLBAR)) | |
542875a8 | 854 | { |
64e0c5c6 DW |
855 | pTheToolBar->SetSize(-1, m_nFsToolBarHeight); |
856 | pTheToolBar->Show(TRUE); | |
542875a8 DW |
857 | } |
858 | ||
64e0c5c6 | 859 | if ((m_lFsStyle & wxFULLSCREEN_NOSTATUSBAR) && (m_nFsStatusBarFields > 0)) |
542875a8 | 860 | { |
64e0c5c6 | 861 | CreateStatusBar(m_nFsStatusBarFields); |
542875a8 DW |
862 | PositionStatusBar(); |
863 | } | |
864 | ||
64e0c5c6 DW |
865 | if ((m_lFsStyle & wxFULLSCREEN_NOMENUBAR) && (m_hMenu != 0)) |
866 | { | |
867 | ::WinSetParent(m_hMenu, m_hFrame, FALSE); | |
868 | ::WinSetOwner(m_hMenu, m_hFrame); | |
869 | ::WinSendMsg((HWND)m_hFrame, WM_UPDATEFRAME, (MPARAM)FCF_MENU, (MPARAM)0); | |
870 | } | |
871 | Maximize(m_bFsIsMaximized); | |
872 | ||
873 | ::WinSetWindowULong( (HWND)GetHWND() | |
874 | ,QWL_STYLE | |
875 | ,(ULONG)m_lFsOldWindowStyle | |
876 | ); | |
877 | ::WinSetWindowPos( (HWND) GetParent()->GetHWND() | |
878 | ,HWND_TOP | |
879 | ,m_vFsOldSize.x | |
880 | ,m_vFsOldSize.y | |
881 | ,m_vFsOldSize.width | |
882 | ,m_vFsOldSize.height | |
883 | ,SWP_SIZE | SWP_SHOW | |
884 | ); | |
542875a8 DW |
885 | return TRUE; |
886 | } | |
542875a8 DW |
887 | } // end of wxFrame::ShowFullScreen |
888 | ||
a885d89a DW |
889 | // |
890 | // Frame window | |
891 | // | |
892 | bool wxFrame::OS2Create( | |
893 | int nId | |
894 | , wxWindow* pParent | |
895 | , const wxChar* zWclass | |
896 | , wxWindow* pWxWin | |
897 | , const wxChar* zTitle | |
898 | , int nX | |
899 | , int nY | |
900 | , int nWidth | |
901 | , int nHeight | |
902 | , long ulStyle | |
903 | ) | |
21802234 | 904 | { |
f23208ca DW |
905 | ULONG ulCreateFlags = 0L; |
906 | ULONG ulStyleFlags = 0L; | |
914589c2 | 907 | ULONG ulExtraFlags = 0L; |
f23208ca DW |
908 | FRAMECDATA vFrameCtlData; |
909 | HWND hParent = NULLHANDLE; | |
910 | HWND hClient = NULLHANDLE; | |
dae16775 | 911 | HWND hFrame = NULLHANDLE; |
f23208ca DW |
912 | HWND hTitlebar = NULLHANDLE; |
913 | HWND hHScroll = NULLHANDLE; | |
914 | HWND hVScroll = NULLHANDLE; | |
b963e7d5 DW |
915 | SWP vSwp[10]; |
916 | RECTL vRect[10]; | |
40bd6154 | 917 | USHORT uCtlCount; |
a885d89a DW |
918 | |
919 | m_hDefaultIcon = (WXHICON) (wxSTD_FRAME_ICON ? wxSTD_FRAME_ICON : wxDEFAULT_FRAME_ICON); | |
a0606634 | 920 | |
f23208ca DW |
921 | if (pParent) |
922 | hParent = GetWinHwnd(pParent); | |
923 | else | |
924 | hParent = HWND_DESKTOP; | |
a885d89a | 925 | |
914589c2 | 926 | if (ulStyle == wxDEFAULT_FRAME_STYLE) |
f23208ca | 927 | ulCreateFlags = FCF_SIZEBORDER | FCF_TITLEBAR | FCF_SYSMENU | |
f6bcfd97 | 928 | FCF_MINMAX | FCF_TASKLIST; |
a885d89a | 929 | else |
a885d89a | 930 | { |
914589c2 | 931 | if ((ulStyle & wxCAPTION) == wxCAPTION) |
f23208ca | 932 | ulCreateFlags = FCF_TASKLIST; |
914589c2 | 933 | else |
f23208ca | 934 | ulCreateFlags = FCF_NOMOVEWITHOWNER; |
914589c2 | 935 | |
f6bcfd97 BP |
936 | if ((ulStyle & wxVSCROLL) == wxVSCROLL) |
937 | ulCreateFlags |= FCF_VERTSCROLL; | |
938 | if ((ulStyle & wxHSCROLL) == wxHSCROLL) | |
939 | ulCreateFlags |= FCF_HORZSCROLL; | |
914589c2 | 940 | if (ulStyle & wxMINIMIZE_BOX) |
f23208ca | 941 | ulCreateFlags |= FCF_MINBUTTON; |
914589c2 | 942 | if (ulStyle & wxMAXIMIZE_BOX) |
f23208ca | 943 | ulCreateFlags |= FCF_MAXBUTTON; |
914589c2 | 944 | if (ulStyle & wxTHICK_FRAME) |
f23208ca | 945 | ulCreateFlags |= FCF_DLGBORDER; |
914589c2 | 946 | if (ulStyle & wxSYSTEM_MENU) |
f23208ca | 947 | ulCreateFlags |= FCF_SYSMENU; |
914589c2 | 948 | if (ulStyle & wxCAPTION) |
f23208ca | 949 | ulCreateFlags |= FCF_TASKLIST; |
914589c2 DW |
950 | if (ulStyle & wxCLIP_CHILDREN) |
951 | { | |
952 | // Invalid for frame windows under PM | |
953 | } | |
a885d89a | 954 | |
914589c2 | 955 | if (ulStyle & wxTINY_CAPTION_VERT) |
f23208ca | 956 | ulCreateFlags |= FCF_TASKLIST; |
914589c2 | 957 | if (ulStyle & wxTINY_CAPTION_HORIZ) |
f23208ca DW |
958 | ulCreateFlags |= FCF_TASKLIST; |
959 | ||
914589c2 | 960 | if ((ulStyle & wxTHICK_FRAME) == 0) |
f23208ca | 961 | ulCreateFlags |= FCF_BORDER; |
914589c2 DW |
962 | if (ulStyle & wxFRAME_TOOL_WINDOW) |
963 | ulExtraFlags = kFrameToolWindow; | |
21802234 | 964 | |
914589c2 | 965 | if (ulStyle & wxSTAY_ON_TOP) |
f23208ca | 966 | ulCreateFlags |= FCF_SYSMODAL; |
914589c2 | 967 | } |
f23208ca DW |
968 | if ((ulStyle & wxMINIMIZE) || (ulStyle & wxICONIZE)) |
969 | ulStyleFlags |= WS_MINIMIZED; | |
970 | if (ulStyle & wxMAXIMIZE) | |
971 | ulStyleFlags |= WS_MAXIMIZED; | |
972 | ||
a885d89a DW |
973 | // |
974 | // Clear the visible flag, we always call show | |
975 | // | |
f23208ca | 976 | ulStyleFlags &= (unsigned long)~WS_VISIBLE; |
a885d89a | 977 | m_bIconized = FALSE; |
f23208ca DW |
978 | |
979 | // | |
980 | // Set the frame control block | |
981 | // | |
982 | vFrameCtlData.cb = sizeof(vFrameCtlData); | |
983 | vFrameCtlData.flCreateFlags = ulCreateFlags; | |
984 | vFrameCtlData.hmodResources = 0L; | |
985 | vFrameCtlData.idResources = 0; | |
986 | ||
987 | // | |
988 | // Create the frame window | |
989 | // | |
b963e7d5 DW |
990 | if ((m_hFrame = ::WinCreateWindow( hParent // Frame is parent |
991 | ,WC_FRAME // standard frame class | |
992 | ,(PSZ)zTitle // Window title | |
993 | ,0 // No styles | |
994 | ,0, 0, 0, 0 // Window position | |
995 | ,NULLHANDLE // Owner | |
996 | ,HWND_TOP // Sibling | |
997 | ,(ULONG)nId // ID | |
998 | ,(PVOID)&vFrameCtlData // Creation data | |
f6bcfd97 | 999 | ,NULL // Window Pres Params |
40bd6154 | 1000 | )) == 0L) |
a885d89a DW |
1001 | { |
1002 | return FALSE; | |
1003 | } | |
f23208ca | 1004 | |
40bd6154 DW |
1005 | if (!wxWindow::OS2Create( m_hFrame |
1006 | ,wxFrameClassName | |
b963e7d5 | 1007 | ,NULL |
40bd6154 DW |
1008 | ,0L |
1009 | ,0L | |
1010 | ,0L | |
1011 | ,0L | |
1012 | ,0L | |
64e0c5c6 | 1013 | ,m_hFrame |
40bd6154 DW |
1014 | ,HWND_TOP |
1015 | ,(unsigned long)FID_CLIENT | |
1016 | ,NULL | |
1017 | ,NULL | |
1018 | )) | |
f23208ca DW |
1019 | { |
1020 | return FALSE; | |
1021 | } | |
dae16775 | 1022 | |
f23208ca DW |
1023 | // |
1024 | // Now size everything. If adding a menu the client will need to be resized. | |
1025 | // | |
40bd6154 | 1026 | if (!::WinSetWindowPos( m_hFrame |
f23208ca DW |
1027 | ,HWND_TOP |
1028 | ,nX | |
1029 | ,nY | |
1030 | ,nWidth | |
1031 | ,nHeight | |
f6bcfd97 | 1032 | ,SWP_SIZE | SWP_MOVE | SWP_ACTIVATE | SWP_ZORDER |
f23208ca DW |
1033 | )) |
1034 | return FALSE; | |
1035 | ||
b963e7d5 | 1036 | uCtlCount = SHORT1FROMMP(::WinSendMsg(m_hFrame, WM_FORMATFRAME, (MPARAM)vSwp, (MPARAM)vRect)); |
40bd6154 DW |
1037 | for (int i = 0; i < uCtlCount; i++) |
1038 | { | |
b963e7d5 DW |
1039 | if (vSwp[i].hwnd == m_hFrame) |
1040 | memcpy(&m_vSwp, &vSwp[i], sizeof(SWP)); | |
1041 | else if (vSwp[i].hwnd == m_hVScroll) | |
1042 | memcpy(&m_vSwpVScroll, &vSwp[i], sizeof(SWP)); | |
1043 | else if (vSwp[i].hwnd == m_hHScroll) | |
1044 | memcpy(&m_vSwpVScroll, &vSwp[i], sizeof(SWP)); | |
1045 | else if (vSwp[i].hwnd == m_hTitleBar) | |
1046 | memcpy(&m_vSwpTitleBar, &vSwp[i], sizeof(SWP)); | |
40bd6154 | 1047 | } |
a885d89a DW |
1048 | return TRUE; |
1049 | } // end of wxFrame::OS2Create | |
0e320a79 | 1050 | |
a885d89a | 1051 | // |
0e320a79 DW |
1052 | // Default activation behaviour - set the focus for the first child |
1053 | // subwindow found. | |
a885d89a DW |
1054 | // |
1055 | void wxFrame::OnActivate( | |
1056 | wxActivateEvent& rEvent | |
1057 | ) | |
0e320a79 | 1058 | { |
a885d89a DW |
1059 | for (wxWindowList::Node* pNode = GetChildren().GetFirst(); |
1060 | pNode; | |
1061 | pNode = pNode->GetNext()) | |
0e320a79 | 1062 | { |
21802234 DW |
1063 | // FIXME all this is totally bogus - we need to do the same as wxPanel, |
1064 | // but how to do it without duplicating the code? | |
1065 | ||
1066 | // restore focus | |
a885d89a | 1067 | wxWindow* pChild = pNode->GetData(); |
21802234 | 1068 | |
a885d89a | 1069 | if (!pChild->IsTopLevel() |
21802234 | 1070 | #if wxUSE_TOOLBAR |
a885d89a | 1071 | && !wxDynamicCast(pChild, wxToolBar) |
21802234 DW |
1072 | #endif // wxUSE_TOOLBAR |
1073 | #if wxUSE_STATUSBAR | |
a885d89a | 1074 | && !wxDynamicCast(pChild, wxStatusBar) |
21802234 DW |
1075 | #endif // wxUSE_STATUSBAR |
1076 | ) | |
1077 | { | |
a885d89a | 1078 | pChild->SetFocus(); |
21802234 DW |
1079 | return; |
1080 | } | |
0e320a79 | 1081 | } |
a885d89a | 1082 | } // end of wxFrame::OnActivate |
0e320a79 | 1083 | |
f38374d0 DW |
1084 | // ---------------------------------------------------------------------------- |
1085 | // wxFrame size management: we exclude the areas taken by menu/status/toolbars | |
1086 | // from the client area, so the client area is what's really available for the | |
1087 | // frame contents | |
1088 | // ---------------------------------------------------------------------------- | |
0e320a79 DW |
1089 | |
1090 | // Checks if there is a toolbar, and returns the first free client position | |
1091 | wxPoint wxFrame::GetClientAreaOrigin() const | |
1092 | { | |
a885d89a DW |
1093 | wxPoint vPoint(0, 0); |
1094 | ||
0e320a79 DW |
1095 | if (GetToolBar()) |
1096 | { | |
a885d89a DW |
1097 | int nWidth; |
1098 | int nHeight; | |
1099 | ||
1100 | GetToolBar()->GetSize( &nWidth | |
1101 | ,&nHeight | |
1102 | ); | |
0e320a79 DW |
1103 | |
1104 | if (GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL) | |
1105 | { | |
a885d89a | 1106 | vPoint.x += nWidth; |
0e320a79 DW |
1107 | } |
1108 | else | |
1109 | { | |
a885d89a DW |
1110 | // PM is backwards from windows |
1111 | vPoint.y += nHeight; | |
0e320a79 DW |
1112 | } |
1113 | } | |
a885d89a DW |
1114 | return vPoint; |
1115 | } // end of wxFrame::GetClientAreaOrigin | |
0e320a79 | 1116 | |
f38374d0 DW |
1117 | // ---------------------------------------------------------------------------- |
1118 | // tool/status bar stuff | |
1119 | // ---------------------------------------------------------------------------- | |
1120 | ||
21802234 | 1121 | #if wxUSE_TOOLBAR |
f38374d0 | 1122 | |
a885d89a DW |
1123 | wxToolBar* wxFrame::CreateToolBar( |
1124 | long lStyle | |
1125 | , wxWindowID vId | |
1126 | , const wxString& rName | |
1127 | ) | |
0e320a79 | 1128 | { |
a885d89a DW |
1129 | if (wxFrameBase::CreateToolBar( lStyle |
1130 | ,vId | |
1131 | ,rName | |
1132 | )) | |
0e320a79 | 1133 | { |
0e320a79 | 1134 | PositionToolBar(); |
0e320a79 | 1135 | } |
f38374d0 | 1136 | return m_frameToolBar; |
a885d89a | 1137 | } // end of wxFrame::CreateToolBar |
0e320a79 DW |
1138 | |
1139 | void wxFrame::PositionToolBar() | |
1140 | { | |
a885d89a DW |
1141 | HWND hWndClient; |
1142 | RECTL vRect; | |
1143 | ||
40bd6154 | 1144 | ::WinQueryWindowRect(GetHwnd(), &vRect); |
0e320a79 | 1145 | |
f38374d0 | 1146 | #if wxUSE_STATUSBAR |
a885d89a | 1147 | if (GetStatusBar()) |
0e320a79 | 1148 | { |
a885d89a DW |
1149 | int nStatusX; |
1150 | int nStatusY; | |
1151 | ||
1152 | GetStatusBar()->GetClientSize( &nStatusX | |
1153 | ,&nStatusY | |
1154 | ); | |
1155 | // PM is backwards from windows | |
1156 | vRect.yBottom += nStatusY; | |
0e320a79 | 1157 | } |
f38374d0 | 1158 | #endif // wxUSE_STATUSBAR |
0e320a79 | 1159 | |
f38374d0 | 1160 | if ( GetToolBar() ) |
0e320a79 | 1161 | { |
a885d89a DW |
1162 | int nToolbarWidth; |
1163 | int nToolbarHeight; | |
1164 | ||
1165 | GetToolBar()->GetSize( &nToolbarWidth | |
1166 | ,&nToolbarHeight | |
1167 | ); | |
0e320a79 | 1168 | |
a885d89a | 1169 | if (GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL) |
0e320a79 | 1170 | { |
a885d89a | 1171 | nToolbarHeight = vRect.yBottom; |
0e320a79 DW |
1172 | } |
1173 | else | |
1174 | { | |
a885d89a | 1175 | nToolbarWidth = vRect.xRight; |
21802234 | 1176 | } |
f38374d0 | 1177 | |
a885d89a DW |
1178 | // |
1179 | // Use the 'real' PM position here | |
1180 | // | |
1181 | GetToolBar()->SetSize( 0 | |
1182 | ,0 | |
1183 | ,nToolbarWidth | |
1184 | ,nToolbarHeight | |
1185 | ,wxSIZE_NO_ADJUSTMENTS | |
1186 | ); | |
21802234 | 1187 | } |
a885d89a | 1188 | } // end of wxFrame::PositionToolBar |
21802234 DW |
1189 | #endif // wxUSE_TOOLBAR |
1190 | ||
f38374d0 DW |
1191 | // ---------------------------------------------------------------------------- |
1192 | // frame state (iconized/maximized/...) | |
1193 | // ---------------------------------------------------------------------------- | |
1194 | ||
a885d89a | 1195 | // |
21802234 DW |
1196 | // propagate our state change to all child frames: this allows us to emulate X |
1197 | // Windows behaviour where child frames float independently of the parent one | |
1198 | // on the desktop, but are iconized/restored with it | |
a885d89a DW |
1199 | // |
1200 | void wxFrame::IconizeChildFrames( | |
1201 | bool bIconize | |
1202 | ) | |
21802234 | 1203 | { |
a885d89a DW |
1204 | for (wxWindowList::Node* pNode = GetChildren().GetFirst(); |
1205 | pNode; | |
1206 | pNode = pNode->GetNext() ) | |
21802234 | 1207 | { |
a885d89a | 1208 | wxWindow* pWin = pNode->GetData(); |
21802234 | 1209 | |
a885d89a | 1210 | if (pWin->IsKindOf(CLASSINFO(wxFrame)) ) |
21802234 | 1211 | { |
a885d89a | 1212 | ((wxFrame *)pWin)->Iconize(bIconize); |
0e320a79 DW |
1213 | } |
1214 | } | |
a885d89a | 1215 | } // end of wxFrame::IconizeChildFrames |
0e320a79 | 1216 | |
21802234 DW |
1217 | // =========================================================================== |
1218 | // message processing | |
1219 | // =========================================================================== | |
1220 | ||
1221 | // --------------------------------------------------------------------------- | |
1222 | // preprocessing | |
1223 | // --------------------------------------------------------------------------- | |
a885d89a DW |
1224 | bool wxFrame::OS2TranslateMessage( |
1225 | WXMSG* pMsg | |
1226 | ) | |
21802234 | 1227 | { |
a885d89a | 1228 | // |
21802234 | 1229 | // try the menu bar accels |
a885d89a DW |
1230 | // |
1231 | wxMenuBar* pMenuBar = GetMenuBar(); | |
1232 | ||
1233 | if (!pMenuBar ) | |
21802234 DW |
1234 | return FALSE; |
1235 | ||
a885d89a | 1236 | const wxAcceleratorTable& rAcceleratorTable = pMenuBar->GetAccelTable(); |
f6bcfd97 | 1237 | return rAcceleratorTable.Translate(m_hFrame, pMsg); |
a885d89a | 1238 | } // end of wxFrame::OS2TranslateMessage |
21802234 DW |
1239 | |
1240 | // --------------------------------------------------------------------------- | |
1241 | // our private (non virtual) message handlers | |
1242 | // --------------------------------------------------------------------------- | |
21802234 DW |
1243 | bool wxFrame::HandlePaint() |
1244 | { | |
a885d89a DW |
1245 | RECTL vRect; |
1246 | ||
64e0c5c6 | 1247 | if (::WinQueryUpdateRect(GetHwnd(), &vRect)) |
29435d81 | 1248 | { |
a885d89a | 1249 | if (m_bIconized) |
29435d81 | 1250 | { |
a885d89a DW |
1251 | // |
1252 | // Icons in PM are the same as "pointers" | |
1253 | // | |
1254 | HPOINTER hIcon; | |
29435d81 | 1255 | |
a885d89a | 1256 | if (m_icon.Ok()) |
40bd6154 | 1257 | hIcon = (HPOINTER)::WinSendMsg(m_hFrame, WM_QUERYICON, 0L, 0L); |
a885d89a DW |
1258 | else |
1259 | hIcon = (HPOINTER)m_hDefaultIcon; | |
1260 | ||
1261 | // | |
21802234 DW |
1262 | // Hold a pointer to the dc so long as the OnPaint() message |
1263 | // is being processed | |
a885d89a DW |
1264 | // |
1265 | RECTL vRect2; | |
64e0c5c6 | 1266 | HPS hPs = ::WinBeginPaint(GetHwnd(), NULLHANDLE, &vRect2); |
29435d81 | 1267 | |
a885d89a | 1268 | // |
29435d81 | 1269 | // Erase background before painting or we get white background |
a885d89a DW |
1270 | // |
1271 | OS2DefWindowProc(WM_ERASEBACKGROUND, (MPARAM)hPs, (MPARAM)&vRect2); | |
29435d81 | 1272 | |
a885d89a | 1273 | if (hIcon) |
29435d81 | 1274 | { |
a885d89a DW |
1275 | HWND hWndClient; |
1276 | RECTL vRect3; | |
21802234 | 1277 | |
40bd6154 | 1278 | ::WinQueryWindowRect(GetHwnd(), &vRect3); |
29435d81 | 1279 | |
a885d89a DW |
1280 | static const int nIconWidth = 32; |
1281 | static const int nIconHeight = 32; | |
1282 | int nIconX = (int)((vRect3.xRight - nIconWidth)/2); | |
1283 | int nIconY = (int)((vRect3.yBottom + nIconHeight)/2); | |
29435d81 | 1284 | |
a885d89a | 1285 | ::WinDrawPointer(hPs, nIconX, nIconY, hIcon, DP_NORMAL); |
29435d81 | 1286 | } |
a885d89a | 1287 | ::WinEndPaint(hPs); |
29435d81 DW |
1288 | return TRUE; |
1289 | } | |
1290 | else | |
1291 | { | |
f6bcfd97 BP |
1292 | HPS hPS; |
1293 | RECTL vRect; | |
1294 | ||
1295 | hPS = WinBeginPaint(GetHwnd(), 0L, &vRect); | |
1296 | WinFillRect(hPS, &vRect, SYSCLR_WINDOW); | |
1297 | WinEndPaint(hPS); | |
1298 | ||
29435d81 DW |
1299 | return wxWindow::HandlePaint(); |
1300 | } | |
1301 | } | |
1302 | else | |
1303 | { | |
1304 | // nothing to paint - processed | |
1305 | return TRUE; | |
1306 | } | |
29435d81 | 1307 | return FALSE; |
a885d89a | 1308 | } // end of wxFrame::HandlePaint |
21802234 | 1309 | |
a885d89a DW |
1310 | bool wxFrame::HandleSize( |
1311 | int nX | |
1312 | , int nY | |
1313 | , WXUINT nId | |
1314 | ) | |
21802234 | 1315 | { |
a885d89a | 1316 | bool bProcessed = FALSE; |
21802234 | 1317 | |
a885d89a | 1318 | switch (nId) |
21802234 | 1319 | { |
a885d89a DW |
1320 | case kSizeNormal: |
1321 | // | |
1322 | // Only do it it if we were iconized before, otherwise resizing the | |
21802234 DW |
1323 | // parent frame has a curious side effect of bringing it under it's |
1324 | // children | |
a885d89a | 1325 | if (!m_bIconized ) |
21802234 DW |
1326 | break; |
1327 | ||
a885d89a | 1328 | // |
21802234 | 1329 | // restore all child frames too |
a885d89a | 1330 | // |
21802234 DW |
1331 | IconizeChildFrames(FALSE); |
1332 | ||
a885d89a | 1333 | // |
21802234 | 1334 | // fall through |
a885d89a | 1335 | // |
21802234 | 1336 | |
a885d89a DW |
1337 | case kSizeMax: |
1338 | m_bIconized = FALSE; | |
21802234 DW |
1339 | break; |
1340 | ||
a885d89a DW |
1341 | case kSizeMin: |
1342 | // | |
1343 | // Iconize all child frames too | |
1344 | // | |
21802234 | 1345 | IconizeChildFrames(TRUE); |
a885d89a | 1346 | m_bIconized = TRUE; |
21802234 DW |
1347 | break; |
1348 | } | |
f38374d0 | 1349 | |
a885d89a | 1350 | if (!m_bIconized) |
21802234 | 1351 | { |
a885d89a | 1352 | // |
29435d81 | 1353 | // forward WM_SIZE to status bar control |
a885d89a | 1354 | // |
f38374d0 DW |
1355 | #if wxUSE_NATIVE_STATUSBAR |
1356 | if (m_frameStatusBar && m_frameStatusBar->IsKindOf(CLASSINFO(wxStatusBar95))) | |
1357 | { | |
a885d89a DW |
1358 | wxSizeEvent vEvent( wxSize( nX |
1359 | ,nY | |
1360 | ) | |
1361 | ,m_frameStatusBar->GetId() | |
1362 | ); | |
f38374d0 | 1363 | |
a885d89a DW |
1364 | vEvent.SetEventObject(m_frameStatusBar); |
1365 | m_frameStatusBar->OnSize(vEvent); | |
f38374d0 DW |
1366 | } |
1367 | #endif // wxUSE_NATIVE_STATUSBAR | |
1368 | ||
21802234 DW |
1369 | PositionStatusBar(); |
1370 | PositionToolBar(); | |
a885d89a DW |
1371 | wxSizeEvent vEvent( wxSize( nX |
1372 | ,nY | |
1373 | ) | |
1374 | ,m_windowId | |
1375 | ); | |
21802234 | 1376 | |
a885d89a DW |
1377 | vEvent.SetEventObject(this); |
1378 | bProcessed = GetEventHandler()->ProcessEvent(vEvent); | |
21802234 | 1379 | } |
a885d89a DW |
1380 | return bProcessed; |
1381 | } // end of wxFrame::HandleSize | |
21802234 | 1382 | |
a885d89a DW |
1383 | bool wxFrame::HandleCommand( |
1384 | WXWORD nId | |
1385 | , WXWORD nCmd | |
1386 | , WXHWND hControl | |
1387 | ) | |
21802234 | 1388 | { |
a885d89a | 1389 | if (hControl) |
21802234 | 1390 | { |
a885d89a | 1391 | // |
21802234 | 1392 | // In case it's e.g. a toolbar. |
a885d89a DW |
1393 | // |
1394 | wxWindow* pWin = wxFindWinFromHandle(hControl); | |
1395 | ||
1396 | if (pWin) | |
1397 | return pWin->OS2Command( nCmd | |
1398 | ,nId | |
1399 | ); | |
21802234 DW |
1400 | } |
1401 | ||
a885d89a DW |
1402 | // |
1403 | // Handle here commands from menus and accelerators | |
1404 | // | |
1405 | if (nCmd == 0 || nCmd == 1) | |
21802234 | 1406 | { |
a885d89a | 1407 | if (wxCurrentPopupMenu) |
21802234 | 1408 | { |
a885d89a DW |
1409 | wxMenu* pPopupMenu = wxCurrentPopupMenu; |
1410 | ||
21802234 DW |
1411 | wxCurrentPopupMenu = NULL; |
1412 | ||
a885d89a DW |
1413 | return pPopupMenu->OS2Command( nCmd |
1414 | ,nId | |
1415 | ); | |
21802234 DW |
1416 | } |
1417 | ||
a885d89a | 1418 | if (ProcessCommand(nId)) |
21802234 DW |
1419 | { |
1420 | return TRUE; | |
1421 | } | |
1422 | } | |
21802234 | 1423 | return FALSE; |
a885d89a | 1424 | } // end of wxFrame::HandleCommand |
21802234 | 1425 | |
a885d89a DW |
1426 | bool wxFrame::HandleMenuSelect( |
1427 | WXWORD nItem | |
1428 | , WXWORD nFlags | |
1429 | , WXHMENU hMenu | |
1430 | ) | |
21802234 | 1431 | { |
a885d89a DW |
1432 | int nMenuItem; |
1433 | ||
1434 | if (nFlags == 0xFFFF && hMenu == 0) | |
21802234 | 1435 | { |
a885d89a DW |
1436 | // |
1437 | // Menu was removed from screen | |
1438 | // | |
1439 | nMenuItem = -1; | |
21802234 | 1440 | } |
a885d89a | 1441 | else if (!(nFlags & MIS_SUBMENU) && !(nFlags & MIS_SEPARATOR)) |
21802234 | 1442 | { |
a885d89a | 1443 | nMenuItem = nItem; |
21802234 | 1444 | } |
21802234 DW |
1445 | else |
1446 | { | |
a885d89a DW |
1447 | // |
1448 | // Don't give hints for separators (doesn't make sense) nor for the | |
21802234 | 1449 | // items opening popup menus (they don't have them anyhow) |
a885d89a | 1450 | // |
21802234 DW |
1451 | return FALSE; |
1452 | } | |
a885d89a | 1453 | wxMenuEvent vEvent(wxEVT_MENU_HIGHLIGHT, nMenuItem); |
21802234 | 1454 | |
a885d89a DW |
1455 | vEvent.SetEventObject(this); |
1456 | return GetEventHandler()->ProcessEvent(vEvent); | |
1457 | } // end of wxFrame::HandleMenuSelect | |
21802234 DW |
1458 | |
1459 | // --------------------------------------------------------------------------- | |
1460 | // the window proc for wxFrame | |
1461 | // --------------------------------------------------------------------------- | |
1462 | ||
a885d89a DW |
1463 | MRESULT wxFrame::OS2WindowProc( |
1464 | WXUINT uMessage | |
1465 | , WXWPARAM wParam | |
1466 | , WXLPARAM lParam | |
1467 | ) | |
21802234 | 1468 | { |
a885d89a DW |
1469 | MRESULT mRc = 0L; |
1470 | bool bProcessed = FALSE; | |
21802234 | 1471 | |
a885d89a | 1472 | switch (uMessage) |
21802234 DW |
1473 | { |
1474 | case WM_CLOSE: | |
a885d89a DW |
1475 | // |
1476 | // If we can't close, tell the system that we processed the | |
21802234 | 1477 | // message - otherwise it would close us |
a885d89a DW |
1478 | // |
1479 | bProcessed = !Close(); | |
21802234 DW |
1480 | break; |
1481 | ||
1482 | case WM_COMMAND: | |
1483 | { | |
a885d89a DW |
1484 | WORD wId; |
1485 | WORD wCmd; | |
1486 | WXHWND hWnd; | |
1487 | ||
1488 | UnpackCommand( (WXWPARAM)wParam | |
1489 | ,(WXLPARAM)lParam | |
1490 | ,&wId | |
1491 | ,&hWnd | |
1492 | ,&wCmd | |
1493 | ); | |
1494 | bProcessed = HandleCommand( wId | |
1495 | ,wCmd | |
1496 | ,(WXHWND)hWnd | |
1497 | ); | |
21802234 DW |
1498 | } |
1499 | break; | |
1500 | ||
1501 | case WM_MENUSELECT: | |
1502 | { | |
a885d89a DW |
1503 | WXWORD wItem; |
1504 | WXWORD wFlags; | |
1505 | WXHMENU hMenu; | |
1506 | ||
1507 | UnpackMenuSelect( wParam | |
1508 | ,lParam | |
1509 | ,&wItem | |
1510 | ,&wFlags | |
1511 | ,&hMenu | |
1512 | ); | |
1513 | bProcessed = HandleMenuSelect( wItem | |
1514 | ,wFlags | |
1515 | ,hMenu | |
1516 | ); | |
21802234 DW |
1517 | } |
1518 | break; | |
1519 | ||
1520 | case WM_PAINT: | |
a885d89a | 1521 | bProcessed = HandlePaint(); |
21802234 DW |
1522 | break; |
1523 | ||
40bd6154 DW |
1524 | case WM_ERASEBACKGROUND: |
1525 | // | |
1526 | // Return TRUE to request PM to paint the window background | |
1527 | // in SYSCLR_WINDOW. | |
1528 | // | |
b963e7d5 | 1529 | bProcessed = TRUE; |
40bd6154 DW |
1530 | mRc = (MRESULT)(TRUE); |
1531 | break; | |
1532 | ||
a885d89a | 1533 | case CM_QUERYDRAGIMAGE: |
21802234 | 1534 | { |
a885d89a DW |
1535 | HPOINTER hIcon; |
1536 | ||
1537 | if (m_icon.Ok()) | |
40bd6154 | 1538 | hIcon = (HPOINTER)::WinSendMsg(m_hFrame, WM_QUERYICON, 0L, 0L); |
a885d89a DW |
1539 | else |
1540 | hIcon = (HPOINTER)m_hDefaultIcon; | |
1541 | mRc = (MRESULT)hIcon; | |
1542 | bProcessed = mRc != 0; | |
21802234 DW |
1543 | } |
1544 | break; | |
1545 | ||
1546 | case WM_SIZE: | |
a885d89a | 1547 | bProcessed = HandleSize(LOWORD(lParam), HIWORD(lParam), (WXUINT)wParam); |
21802234 DW |
1548 | break; |
1549 | } | |
f38374d0 | 1550 | |
a885d89a DW |
1551 | if (!bProcessed ) |
1552 | mRc = wxWindow::OS2WindowProc( uMessage | |
1553 | ,wParam | |
1554 | ,lParam | |
1555 | ); | |
f38374d0 | 1556 | return (MRESULT)0; |
a885d89a | 1557 | } // wxFrame::OS2WindowProc |
21802234 | 1558 |