Add wxMenuItem::IsCheck() and IsRadio() accessors.

The latter will be convenient to use in the upcoming changes to wxOSX radio
items management code and add the former for the symmetry.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74542 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2013-07-16 14:10:20 +00:00
parent 75f9a95448
commit e3f4ca2e1e
2 changed files with 27 additions and 1 deletions

View File

@ -82,7 +82,13 @@ public:
void SetKind(wxItemKind kind) { m_kind = kind; }
bool IsSeparator() const { return m_kind == wxITEM_SEPARATOR; }
virtual void SetCheckable(bool checkable) { m_kind = checkable ? wxITEM_CHECK : wxITEM_NORMAL; }
bool IsCheck() const { return m_kind == wxITEM_CHECK; }
bool IsRadio() const { return m_kind == wxITEM_RADIO; }
virtual void SetCheckable(bool checkable)
{ m_kind = checkable ? wxITEM_CHECK : wxITEM_NORMAL; }
// Notice that this doesn't quite match SetCheckable().
bool IsCheckable() const
{ return m_kind == wxITEM_CHECK || m_kind == wxITEM_RADIO; }

View File

@ -268,8 +268,21 @@ public:
*/
//@{
/**
Returns @true if the item is a check item.
Unlike IsCheckable() this doesn't return @true for the radio buttons.
@since 2.9.5
*/
bool IsCheck() const;
/**
Returns @true if the item is checkable.
Notice that the radio buttons are considered to be checkable as well,
so this method returns @true for them too. Use IsCheck() if you want to
test for the check items only.
*/
bool IsCheckable() const;
@ -283,6 +296,13 @@ public:
*/
virtual bool IsEnabled() const;
/**
Returns @true if the item is a radio button.
@since 2.9.5
*/
bool IsRadio() const;
/**
Returns @true if the item is a separator.
*/