moved EnableCloseButton() from wxialog to wxTLW
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12427 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
3cc2aa562f
commit
a91cf80c60
@ -70,9 +70,6 @@ public:
|
||||
// returns TRUE if we're in a modal loop
|
||||
bool IsModalShowing() const;
|
||||
|
||||
// wxMSW only: remove the "Close" button from the dialog
|
||||
bool EnableCloseButton(bool enable = TRUE);
|
||||
|
||||
// implementation only from now on
|
||||
// -------------------------------
|
||||
|
||||
|
@ -62,6 +62,10 @@ public:
|
||||
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
|
||||
virtual bool IsFullScreen() const { return m_fsIsShowing; }
|
||||
|
||||
// wxMSW only: EnableCloseButton(FALSE) may be used to remove the "Close"
|
||||
// button from the title bar
|
||||
bool EnableCloseButton(bool enable = TRUE);
|
||||
|
||||
// implementation from now on
|
||||
// --------------------------
|
||||
|
||||
|
@ -127,38 +127,6 @@ bool wxDialog::Create(wxWindow *parent,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxDialog::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/enabling the close title bar button
|
||||
if ( !::EnableMenuItem(hmenu, SC_CLOSE,
|
||||
MF_BYCOMMAND | (enable ? MF_ENABLED : MF_GRAYED)) )
|
||||
{
|
||||
wxLogLastError(_T("EnableMenuItem(SC_CLOSE)"));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// update appearance immediately
|
||||
if ( !::DrawMenuBar(GetHwnd()) )
|
||||
{
|
||||
wxLogLastError(_T("DrawMenuBar"));
|
||||
}
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxDialog::SetModal(bool flag)
|
||||
{
|
||||
if ( flag )
|
||||
|
@ -601,3 +601,36 @@ void wxTopLevelWindowMSW::SetIcon(const wxIcon& icon)
|
||||
}
|
||||
#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)) )
|
||||
{
|
||||
wxLogLastError(_T("EnableMenuItem(SC_CLOSE)"));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// update appearance immediately
|
||||
if ( !::DrawMenuBar(GetHwnd()) )
|
||||
{
|
||||
wxLogLastError(_T("DrawMenuBar"));
|
||||
}
|
||||
#endif // !__WXMICROWIN__
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user