added wxRadioBox::IsItemEnabled/Shown() (for MSW only for now, other platforms to come); corrected Enable/Show() return values

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36288 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2005-11-29 19:26:38 +00:00
parent 2f1834d9f2
commit 3bfa7be977
6 changed files with 127 additions and 16 deletions

View File

@@ -410,7 +410,15 @@ bool wxRadioBox::Enable(int item, bool enable)
BOOL ret = ::EnableWindow((*m_radioButtons)[item], enable);
return (ret == 0) == enable;
return (ret == 0) != enable;
}
bool wxRadioBox::IsItemEnabled(int item) const
{
wxCHECK_MSG( IsValid(item), false,
wxT("invalid item in wxRadioBox::Enable()") );
return ::IsWindowEnabled((*m_radioButtons)[item]) != 0;
}
// Show a specific button
@@ -421,12 +429,27 @@ bool wxRadioBox::Show(int item, bool show)
BOOL ret = ::ShowWindow((*m_radioButtons)[item], show ? SW_SHOW : SW_HIDE);
bool changed = (ret != 0) == show;
if( changed )
bool changed = (ret != 0) != show;
if ( changed )
{
InvalidateBestSize();
}
return changed;
}
bool wxRadioBox::IsItemShown(int item) const
{
wxCHECK_MSG( IsValid(item), false,
wxT("invalid item in wxRadioBox::Enable()") );
// don't use IsWindowVisible() here because it would return false if the
// radiobox itself is hidden while we want to only return false if this
// button specifically is hidden
return (::GetWindowLong((*m_radioButtons)[item],
GWL_STYLE) & WS_VISIBLE) != 0;
}
WX_FORWARD_STD_METHODS_TO_SUBWINDOWS(wxRadioBox, wxStaticBox, m_radioButtons)
// ----------------------------------------------------------------------------