// and passing CW_USEDEFAULT to MoveWindow() results in resizing the
// window to (0, 0) size which breaks quite a lot of things, e.g. the
// sizer calculation in wxSizer::Fit()
- if ( w == CW_USEDEFAULT )
+ if ( w == (int)CW_USEDEFAULT )
{
// the exact number doesn't matter, the dialog will be resized
// again soon anyhow but it should be big enough to allow
h = 100;
}
- if ( x == CW_USEDEFAULT )
+ if ( x == (int)CW_USEDEFAULT )
{
// well, where should we put it? maybe centre it on screen?
x =
}
#endif // __WIN95__
}
+
+bool wxTopLevelWindowMSW::EnableCloseButton(bool enable)
+{
+#ifndef __WXMICROWIN__
+ // get system (a.k.a. window) menu
+ HMENU hmenu = ::GetSystemMenu(GetHwnd(), FALSE /* get it */);
+ if ( !hmenu )
+ {
+ wxLogLastError(_T("GetSystemMenu"));
+
+ return FALSE;
+ }
+
+ // enabling/disabling the close item from it also automatically
+ // disables/enables the close title bar button
+ if ( ::EnableMenuItem(hmenu, SC_CLOSE,
+ MF_BYCOMMAND |
+ (enable ? MF_ENABLED : MF_GRAYED)) == -1 )
+ {
+ wxLogLastError(_T("EnableMenuItem(SC_CLOSE)"));
+
+ return FALSE;
+ }
+
+ // update appearance immediately
+ if ( !::DrawMenuBar(GetHwnd()) )
+ {
+ wxLogLastError(_T("DrawMenuBar"));
+ }
+#endif // !__WXMICROWIN__
+
+ return TRUE;
+}
+