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