1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: msw/toplevel.cpp
3 // Purpose: implements wxTopLevelWindow for MSW
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
9 // License: wxWindows license
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
21 #pragma implementation "toplevel.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
33 #include "wx/toplevel.h"
34 #include "wx/string.h"
38 #include "wx/control.h"
41 #include "wx/os2/private.h"
43 // ----------------------------------------------------------------------------
44 // stubs for missing functions under MicroWindows
45 // ----------------------------------------------------------------------------
48 // ----------------------------------------------------------------------------
50 // ----------------------------------------------------------------------------
52 // list of all frames and modeless dialogs
53 wxWindowList wxModelessWindows
;
55 // the name of the default wxWindows class
56 extern void wxAssociateWinWithHandle( HWND hWnd
59 bool wxTopLevelWindowOS2::m_sbInitialized
= FALSE
;
60 wxWindow
* wxTopLevelWindowOS2::m_spHiddenParent
= NULL
;
62 // ============================================================================
63 // wxTopLevelWindowOS2 implementation
64 // ============================================================================
66 BEGIN_EVENT_TABLE(wxTopLevelWindowOS2
, wxTopLevelWindowBase
)
67 EVT_ACTIVATE(wxTopLevelWindowOS2::OnActivate
)
70 // ============================================================================
71 // wxTopLevelWindowMSW implementation
72 // ============================================================================
75 MRESULT EXPENTRY
wxDlgProc( HWND
WXUNUSED(hWnd
)
77 ,MPARAM
WXUNUSED(wParam
)
78 ,MPARAM
WXUNUSED(lParam
)
85 // For this message, returning TRUE tells system to set focus to
86 // the first control in the dialog box, but we set the focus
87 // ourselves, however in OS/2 we must return true to enable the dialog
92 // For all the other ones, FALSE means that we didn't process the
95 return (MRESULT
)FALSE
;
99 // ----------------------------------------------------------------------------
100 // wxTopLevelWindowOS2 creation
101 // ----------------------------------------------------------------------------
103 void wxTopLevelWindowOS2::Init()
105 m_bIconized
= m_bMaximizeOnShow
= FALSE
;
108 // Unlike (almost?) all other windows, frames are created hidden
113 // Data to save/restore when calling ShowFullScreen
115 m_lFsOldWindowStyle
= 0;
116 m_bFsIsMaximized
= FALSE
;
117 m_bFsIsShowing
= FALSE
;
119 m_hFrame
= NULLHANDLE
;
120 memset(&m_vSwp
, 0, sizeof(SWP
));
121 memset(&m_vSwpClient
, 0, sizeof(SWP
));
122 m_pWinLastFocused
= (wxWindow
*)NULL
;
123 } // end of wxTopLevelWindowIOS2::Init
125 void wxTopLevelWindowOS2::OnActivate(
126 wxActivateEvent
& rEvent
129 if (rEvent
.GetActive())
132 // Restore focus to the child which was last focused
134 wxLogTrace(_T("focus"), _T("wxTLW %08x activated."), m_hWnd
);
136 wxWindow
* pParent
= m_pWinLastFocused
? m_pWinLastFocused
->GetParent()
143 wxSetFocusToChild( pParent
150 // Remember the last focused child if it is our child
152 m_pWinLastFocused
= FindFocus();
155 // So we NULL it out if it's a child from some other frame
157 wxWindow
* pWin
= m_pWinLastFocused
;
161 if (pWin
->IsTopLevel())
165 m_pWinLastFocused
= NULL
;
169 pWin
= pWin
->GetParent();
172 wxLogTrace(_T("focus"),
173 _T("wxTLW %08x deactivated, last focused: %08x."),
175 m_pWinLastFocused
? GetHwndOf(m_pWinLastFocused
)
179 } // end of wxTopLevelWindowOS2::OnActivate
181 WXDWORD
wxTopLevelWindowOS2::OS2GetStyle(
183 , WXDWORD
* pdwExflags
186 long lMsflags
= wxWindow::OS2GetStyle( (lStyle
& ~wxBORDER_MASK
) | wxBORDER_NONE
190 if (lStyle
== wxDEFAULT_FRAME_STYLE
)
191 lMsflags
|= FCF_SIZEBORDER
| FCF_TITLEBAR
| FCF_SYSMENU
|
192 FCF_MINMAX
| FCF_TASKLIST
;
195 if ((lStyle
& wxCAPTION
) == wxCAPTION
)
196 lMsflags
|= FCF_TASKLIST
;
198 lMsflags
|= FCF_NOMOVEWITHOWNER
;
200 if ((lStyle
& wxVSCROLL
) == wxVSCROLL
)
201 lMsflags
|= FCF_VERTSCROLL
;
202 if ((lStyle
& wxHSCROLL
) == wxHSCROLL
)
203 lMsflags
|= FCF_HORZSCROLL
;
204 if (lStyle
& wxMINIMIZE_BOX
)
205 lMsflags
|= FCF_MINBUTTON
;
206 if (lStyle
& wxMAXIMIZE_BOX
)
207 lMsflags
|= FCF_MAXBUTTON
;
208 if (lStyle
& wxTHICK_FRAME
)
209 lMsflags
|= FCF_DLGBORDER
;
210 if (lStyle
& wxSYSTEM_MENU
)
211 lMsflags
|= FCF_SYSMENU
;
212 if (lStyle
& wxCAPTION
)
213 lMsflags
|= FCF_TASKLIST
;
214 if (lStyle
& wxCLIP_CHILDREN
)
216 // Invalid for frame windows under PM
219 if (lStyle
& wxTINY_CAPTION_VERT
)
220 lMsflags
|= FCF_TASKLIST
;
221 if (lStyle
& wxTINY_CAPTION_HORIZ
)
222 lMsflags
|= FCF_TASKLIST
;
224 if ((lStyle
& wxTHICK_FRAME
) == 0)
225 lMsflags
|= FCF_BORDER
;
226 if (lStyle
& wxFRAME_TOOL_WINDOW
)
227 *pdwExflags
= kFrameToolWindow
;
229 if (lStyle
& wxSTAY_ON_TOP
)
230 lMsflags
|= FCF_SYSMODAL
;
233 } // end of wxTopLevelWindowOS2::OS2GetCreateWindowFlags
235 WXHWND
wxTopLevelWindowOS2::OS2GetParent() const
238 // For the frames without wxFRAME_FLOAT_ON_PARENT style we should use NULL
239 // parent HWND or it would be always on top of its parent which is not what
240 // we usually want (in fact, we only want it for frames with the
241 // wxFRAME_FLOAT_ON_PARENT flag)
245 if (HasFlag(wxFRAME_FLOAT_ON_PARENT
) )
247 pParent
= GetParent();
249 // this flag doesn't make sense then and will be ignored
250 wxASSERT_MSG( pParent
,
251 _T("wxFRAME_FLOAT_ON_PARENT but no parent?") );
253 else // don't float on parent, must not be owned
257 if (HasFlag(wxFRAME_NO_TASKBAR
) && !pParent
)
259 if (!m_spHiddenParent
)
261 m_spHiddenParent
= new wxTopLevelWindowOS2(NULL
, -1, _T(""));
264 // We shouldn't leave it in wxTopLevelWindows or we wouldn't
265 // terminate the app when the last user-created frame is deleted --
266 // see ~wxTopLevelWindowMSW
268 wxTopLevelWindows
.DeleteObject(m_spHiddenParent
);
270 pParent
= m_spHiddenParent
;
272 return pParent
? pParent
->GetHWND() : NULL
;
273 } // end of wxTopLevelWindowOS2::OS2GetParent
275 bool wxTopLevelWindowOS2::CreateDialog(
277 , const wxString
& rsTitle
278 , const wxPoint
& rPos
279 , const wxSize
& rSize
282 wxWindow
* pParent
= GetParent();
285 // For the dialogs without wxDIALOG_NO_PARENT style, use the top level
286 // app window as parent - this avoids creating modal dialogs without
289 if (!pParent
&& !(GetWindowStyleFlag() & wxDIALOG_NO_PARENT
))
291 pParent
= wxTheApp
->GetTopWindow();
296 // Don't use transient windows as parents, this is dangerous as it
297 // can lead to a crash if the parent is destroyed before the child
299 // also don't use the window which is currently hidden as then the
300 // dialog would be hidden as well
301 if ((pParent
->GetExtraStyle() & wxWS_EX_TRANSIENT
) ||
313 hWndOwner
= GetHwndOf(pParent
);
315 hWndOwner
= HWND_DESKTOP
;
317 hWndDlg
= ::WinLoadDlg( HWND_DESKTOP
321 ,(ULONG
)ulDlgTemplate
325 m_hWnd
= (WXHWND
) hWndDlg
;
329 wxFAIL_MSG(_("Did you forget to include wx/os2/wx.rc in your resources?"));
331 wxLogSysError(_("Can't create dialog using template '%ul'"), ulDlgTemplate
);
337 // Move the dialog to its initial position without forcing repainting
344 if (!OS2GetCreateWindowCoords( rPos
352 nX
= nWidth
= (int)CW_USEDEFAULT
;
356 // We can't use CW_USEDEFAULT here as we're not calling CreateWindow()
357 // and passing CW_USEDEFAULT to MoveWindow() results in resizing the
358 // window to (0, 0) size which breaks quite a lot of things, e.g. the
359 // sizer calculation in wxSizer::Fit()
361 if (nWidth
== (int)CW_USEDEFAULT
)
364 // The exact number doesn't matter, the dialog will be resized
365 // again soon anyhow but it should be big enough to allow
366 // calculation relying on "totalSize - clientSize > 0" work, i.e.
367 // at least greater than the title bar height
369 nWidth
= nHeight
= 100;
371 if (nX
== (int)CW_USEDEFAULT
)
374 // Centre it on the screen - what else can we do?
376 wxSize vSizeDpy
= wxGetDisplaySize();
378 nX
= (vSizeDpy
.x
- nWidth
) / 2;
379 nY
= (vSizeDpy
.y
- nHeight
) / 2;
381 m_backgroundColour
.Set(wxString("LIGHT GREY"));
383 LONG lColor
= (LONG
)m_backgroundColour
.GetPixel();
385 if (!::WinSetPresParam( m_hWnd
394 ::WinSetWindowPos( GetHwnd()
400 ,SWP_MOVE
| SWP_SIZE
| SWP_ZORDER
| SWP_SHOW
| SWP_ACTIVATE
402 ::WinQueryWindowPos(GetHwnd(), GetSwp());
406 } // end of wxTopLevelWindowOS2::CreateDialog
408 bool wxTopLevelWindowOS2::CreateFrame(
409 const wxString
& rsTitle
410 , const wxPoint
& rPos
411 , const wxSize
& rSize
415 WXDWORD lFlags
= OS2GetCreateWindowFlags(&lExflags
);
416 long lStyle
= GetWindowStyleFlag();
419 int nWidth
= rSize
.x
;
420 int nHeight
= rSize
.y
;
421 ULONG ulStyleFlags
= 0L;
424 wxWindow
* pParent
= GetParent();
430 hParent
= GetHwndOf(pParent
);
432 hParent
= HWND_DESKTOP
;
434 if ((lStyle
& wxMINIMIZE
) || (lStyle
& wxICONIZE
))
435 ulStyleFlags
|= WS_MINIMIZED
;
436 if (lStyle
& wxMAXIMIZE
)
437 ulStyleFlags
|= WS_MAXIMIZED
;
440 // Clear the visible flag, we always call show
442 ulStyleFlags
&= (unsigned long)~WS_VISIBLE
;
446 // Create the frame window: We break ranks with other ports now
447 // and instead of calling down into the base wxWindow class' OS2Create
448 // we do all our own stuff here. We will set the needed pieces
449 // of wxWindow manually, here.
452 hFrame
= ::WinCreateStdWindow( hParent
453 ,ulStyleFlags
// frame-window style
454 ,(PULONG
)&lFlags
// window style
455 ,(PSZ
)wxFrameClassName
// class name
456 ,(PSZ
)rsTitle
.c_str() // window title
457 ,0L // default client style
458 ,NULLHANDLE
// resource in executable file
460 ,&hClient
// receives client window handle
464 vError
= ::WinGetLastError(vHabmain
);
465 sError
= wxPMErrorToStr(vError
);
466 wxLogError("Error creating frame. Error: %s\n", sError
);
471 // wxWindow class' m_hWnd set here and needed associations
475 wxAssociateWinWithHandle(m_hWnd
, this);
476 wxAssociateWinWithHandle(m_hFrame
, this);
478 m_backgroundColour
.Set(wxString("MEDIUM GREY"));
480 LONG lColor
= (LONG
)m_backgroundColour
.GetPixel();
482 if (!::WinSetPresParam( m_hWnd
488 vError
= ::WinGetLastError(vHabmain
);
489 sError
= wxPMErrorToStr(vError
);
490 wxLogError("Error creating frame. Error: %s\n", sError
);
495 // Now need to subclass window. Instead of calling the SubClassWin in wxWindow
496 // we manually subclass here because we don't want to use the main wxWndProc
499 m_fnOldWndProc
= (WXFARPROC
) ::WinSubclassWindow(m_hFrame
, (PFNWP
)wxFrameMainWndProc
);
502 // Now size everything. If adding a menu the client will need to be resized.
507 nY
= pParent
->GetSize().y
- (nY
+ nHeight
);
513 ::WinQueryWindowRect(HWND_DESKTOP
, &vRect
);
514 nY
= vRect
.yTop
- (nY
+ nHeight
);
516 if (!::WinSetWindowPos( m_hFrame
522 ,SWP_SIZE
| SWP_MOVE
| SWP_ACTIVATE
| SWP_ZORDER
525 vError
= ::WinGetLastError(vHabmain
);
526 sError
= wxPMErrorToStr(vError
);
527 wxLogError("Error sizing frame. Error: %s\n", sError
);
530 lStyle
= ::WinQueryWindowULong( m_hWnd
533 lStyle
|= WS_CLIPCHILDREN
;
534 ::WinSetWindowULong( m_hWnd
539 } // end of wxTopLevelWindowOS2::CreateFrame
541 bool wxTopLevelWindowOS2::Create(
544 , const wxString
& rsTitle
545 , const wxPoint
& rPos
546 , const wxSize
& rSize
548 , const wxString
& rsName
555 m_windowStyle
= lStyle
;
557 m_windowId
= vId
== -1 ? NewControlId() : vId
;
558 wxTopLevelWindows
.Append(this);
560 pParent
->AddChild(this);
562 if (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG
)
565 // We have different dialog templates to allows creation of dialogs
566 // with & without captions under OS2indows, resizeable or not (but a
567 // resizeable dialog always has caption - otherwise it would look too
572 if (lStyle
& wxRESIZE_BORDER
)
573 ulDlgTemplate
= (ULONG
)kResizeableDialog
;
574 else if (lStyle
& wxCAPTION
)
575 ulDlgTemplate
= (ULONG
)kCaptionDialog
;
577 ulDlgTemplate
= (ULONG
)kNoCaptionDialog
;
578 return CreateDialog( ulDlgTemplate
586 return CreateFrame( rsTitle
591 } // end of wxTopLevelWindowOS2::Create
593 wxTopLevelWindowOS2::~wxTopLevelWindowOS2()
595 if (this == m_spHiddenParent
)
598 // Stop [infinite] recursion which would otherwise happen when we do
599 // "delete ms_hiddenParent" below -- and we're not interested in doing
600 // anything of the rest below for that window because the rest of
601 // wxWindows doesn't even know about it
606 if (wxModelessWindows
.Find(this))
607 wxModelessWindows
.DeleteObject(this);
610 // After destroying an owned window, Windows activates the next top level
611 // window in Z order but it may be different from our owner (to reproduce
612 // this simply Alt-TAB to another application and back before closing the
613 // owned frame) whereas we always want to yield activation to our parent
615 if (HasFlag(wxFRAME_FLOAT_ON_PARENT
))
617 wxWindow
* pParent
= GetParent();
621 ::WinSetWindowPos( GetHwndOf(pParent
)
630 // If this is the last top-level window, we're going to exit and we should
631 // delete ms_hiddenParent now to avoid leaking it
633 if (IsLastBeforeExit())
635 if (m_spHiddenParent
)
637 delete m_spHiddenParent
;
638 m_spHiddenParent
= NULL
;
641 } // end of wxTopLevelWindowOS2::~wxTopLevelWindowOS2
643 // ----------------------------------------------------------------------------
644 // wxTopLevelWindowOS2 client size
645 // ----------------------------------------------------------------------------
647 void wxTopLevelWindowOS2::DoSetClientSize(
653 // Call GetClientAreaOrigin() to take the toolbar into account
655 wxPoint vPt
= GetClientAreaOrigin();
660 wxWindow::DoSetClientSize( nWidth
663 } // end of wxTopLevelWindowOS2::DoSetClientSize
665 void wxTopLevelWindowOS2::DoGetClientSize(
670 wxWindow::DoGetClientSize( pnX
674 wxPoint vPt
= GetClientAreaOrigin();
681 } // end of wxTopLevelWindowOS2::DoGetClientSize
683 // ----------------------------------------------------------------------------
684 // wxTopLevelWindowOS2 showing
685 // ----------------------------------------------------------------------------
687 void wxTopLevelWindowOS2::DoShowWindow(
691 ::WinShowWindow(m_hFrame
, (BOOL
)(nShowCmd
& SWP_SHOW
));
694 // Need to artificially send a size event as wxApps often expect to do some
695 // final child control sizing
697 m_bIconized
= nShowCmd
== SWP_MINIMIZE
;
698 } // end of wxTopLevelWindowOS2::DoShowWindow
700 bool wxTopLevelWindowOS2::Show(
710 if (m_bMaximizeOnShow
)
712 nShowCmd
= SWP_MAXIMIZE
;
713 m_bMaximizeOnShow
= FALSE
;
724 DoShowWindow(nShowCmd
);
728 wxActivateEvent
vEvent(wxEVT_ACTIVATE
, TRUE
, m_windowId
);
730 ::WinQueryWindowPos(m_hFrame
, &vSwp
);
731 m_bIconized
= vSwp
.fl
& SWP_MINIMIZE
;
732 ::WinQueryWindowPos(m_hWnd
, &m_vSwpClient
);
733 ::WinSendMsg(m_hFrame
, WM_UPDATEFRAME
, (MPARAM
)~0, 0);
734 ::WinQueryWindowPos(m_hWnd
, &vSwp
);
735 ::WinEnableWindow(m_hFrame
, TRUE
);
738 // Deal with children
740 MoveChildren(m_vSwpClient
.cy
- vSwp
.cy
);
741 vEvent
.SetEventObject(this);
742 GetEventHandler()->ProcessEvent(vEvent
);
747 // Try to highlight the correct window (the parent)
751 HWND hWndParent
= GetHwndOf(GetParent());
753 ::WinQueryWindowPos(hWndParent
, &vSwp
);
754 m_bIconized
= vSwp
.fl
& SWP_MINIMIZE
;
755 ::WinEnableWindow(hWndParent
, TRUE
);
759 } // end of wxTopLevelWindowOS2::Show
761 // ----------------------------------------------------------------------------
762 // wxTopLevelWindowOS2 maximize/minimize
763 // ----------------------------------------------------------------------------
765 void wxTopLevelWindowOS2::Maximize(
772 // Just maximize it directly
774 DoShowWindow(bMaximize
? SWP_MAXIMIZE
: SWP_RESTORE
);
779 // We can't maximize the hidden frame because it shows it as well, so
780 // just remember that we should do it later in this case
782 m_bMaximizeOnShow
= TRUE
;
784 } // end of wxTopLevelWindowOS2::Maximize
786 bool wxTopLevelWindowOS2::IsMaximized() const
790 ::WinQueryWindowPos(m_hFrame
, (PSWP
)&m_vSwp
);
791 return (m_vSwp
.fl
& SWP_MAXIMIZE
);
792 } // end of wxTopLevelWindowOS2::IsMaximized
794 void wxTopLevelWindowOS2::Iconize(
798 DoShowWindow(bIconize
? SWP_MINIMIZE
: SWP_RESTORE
);
799 } // end of wxTopLevelWindowOS2::Iconize
801 bool wxTopLevelWindowOS2::IsIconized() const
803 // also update the current state
804 ::WinQueryWindowPos(m_hFrame
, (PSWP
)&m_vSwp
);
805 if (m_vSwp
.fl
& SWP_MINIMIZE
)
806 ((wxTopLevelWindow
*)this)->m_bIconized
= TRUE
;
808 ((wxTopLevelWindow
*)this)->m_bIconized
= FALSE
;
810 } // end of wxTopLevelWindowOS2::IsIconized
812 void wxTopLevelWindowOS2::Restore()
814 DoShowWindow(SWP_RESTORE
);
815 } // end of wxTopLevelWindowOS2::Restore
817 // generate an artificial resize event
818 void wxTopLevelWindowOS2::SendSizeEvent()
822 RECTL vRect
= wxGetWindowRect(GetHwnd());
824 (void)::WinPostMsg( m_hFrame
826 ,MPFROM2SHORT(vRect
.xRight
- vRect
.xLeft
, vRect
.yTop
- vRect
.yBottom
)
827 ,MPFROM2SHORT(vRect
.xRight
- vRect
.xLeft
, vRect
.yTop
- vRect
.yBottom
)
830 } // end of wxTopLevelWindowOS2::SendSizeEvent
832 // ----------------------------------------------------------------------------
833 // wxTopLevelWindowOS2 fullscreen
834 // ----------------------------------------------------------------------------
836 bool wxTopLevelWindowOS2::ShowFullScreen(
846 m_bFsIsShowing
= TRUE
;
850 // Zap the frame borders
854 // Save the 'normal' window lStyle
856 m_lFsOldWindowStyle
= ::WinQueryWindowULong( (HWND
)GetHWND()
861 // Save the old position, width & height, maximize state
863 m_vFsOldSize
= GetRect();
864 m_bFsIsMaximized
= IsMaximized();
867 // Decide which window lStyle flags to turn off
869 LONG lNewStyle
= m_lFsOldWindowStyle
;
872 if (lStyle
& wxFULLSCREEN_NOBORDER
)
873 lOffFlags
|= FCF_BORDER
;
874 if (lStyle
& wxFULLSCREEN_NOCAPTION
)
875 lOffFlags
|= (FCF_TASKLIST
| FCF_SYSMENU
);
877 lNewStyle
&= (~lOffFlags
);
880 // Change our window style to be compatible with full-screen mode
882 ::WinSetWindowULong( (HWND
)GetHWND()
888 // Resize to the size of the desktop
892 RECTL vRect
= wxGetWindowRect(HWND_DESKTOP
);
894 nWidth
= vRect
.xRight
- vRect
.xLeft
;
895 nHeight
= vRect
.yTop
- vRect
.yBottom
;
902 // Now flush the window style cache and actually go full-screen
904 ::WinSetWindowPos( m_hFrame
913 wxSizeEvent
vEvent( wxSize( nWidth
919 GetEventHandler()->ProcessEvent(vEvent
);
927 m_bFsIsShowing
= FALSE
;
928 Maximize(m_bFsIsMaximized
);
929 ::WinSetWindowULong( (HWND
)GetHWND()
933 ::WinSetWindowPos( m_hFrame
943 } // end of wxTopLevelWindowOS2::ShowFullScreen
945 // ----------------------------------------------------------------------------
946 // wxTopLevelWindowOS2 misc
947 // ----------------------------------------------------------------------------
949 void wxTopLevelWindowOS2::SetIcon(
953 SetIcons(wxIconBundle(rIcon
));
954 } // end of wxTopLevelWindowOS2::SetIcon
956 void wxTopLevelWindowOS2::SetIcons(
957 const wxIconBundle
& rIcons
963 wxTopLevelWindowBase::SetIcons(rIcons
);
965 const wxIcon
& vIcon
= rIcons
.GetIcon(wxSize(32, 32));
967 if (vIcon
.Ok() && vIcon
.GetWidth() == 32 && vIcon
.GetHeight() == 32)
969 ::WinSendMsg( m_hFrame
971 ,(MPARAM
)((HPOINTER
)vIcon
.GetHICON())
974 ::WinSendMsg( m_hFrame
980 } // end of wxTopLevelWindowOS2::SetIcon
982 bool wxTopLevelWindowOS2::EnableCloseButton(
987 // Get system (a.k.a. window) menu
989 HMENU hMenu
= ::WinWindowFromID(m_hFrame
, FID_SYSMENU
);
993 wxLogLastError(_T("GetSystemMenu"));
998 // Enabling/disabling the close item from it also automatically
999 // disables/enables the close title bar button
1002 (void)::WinSendMsg( hMenu
1004 ,MPFROM2SHORT(SC_CLOSE
, FALSE
)
1005 ,MPFROM2SHORT(MIA_DISABLED
, FALSE
)
1008 (void)::WinSendMsg( hMenu
1010 ,MPFROM2SHORT(SC_CLOSE
, FALSE
)
1011 ,MPFROM2SHORT(MIA_DISABLED
, MIA_DISABLED
)
1015 // Update appearance immediately
1017 ::WinSendMsg( m_hFrame
1023 } // end of wxTopLevelWindowOS2::EnableCloseButton