#9591: Item state (icons) for wxTreeCtrl on any platform
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54267 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -106,6 +106,25 @@ wxTreeCtrlBase::~wxTreeCtrlBase()
|
||||
delete m_imageListState;
|
||||
}
|
||||
|
||||
void wxTreeCtrlBase::SetItemState(const wxTreeItemId& item, int state)
|
||||
{
|
||||
if ( state == wxTREE_ITEMSTATE_NEXT )
|
||||
{
|
||||
state = GetItemState(item) + 1;
|
||||
if ( m_imageListState && state >= m_imageListState->GetImageCount() )
|
||||
state = 0;
|
||||
}
|
||||
else if ( state == wxTREE_ITEMSTATE_PREV )
|
||||
{
|
||||
state = GetItemState(item) - 1;
|
||||
if ( state == -1 )
|
||||
state = m_imageListState ? m_imageListState->GetImageCount() - 1 : 0;
|
||||
}
|
||||
// else: wxTREE_ITEMSTATE_NONE depending on platform
|
||||
|
||||
DoSetItemState(item, state);
|
||||
}
|
||||
|
||||
static void
|
||||
wxGetBestTreeSize(const wxTreeCtrlBase* treeCtrl, wxTreeItemId id, wxSize& size)
|
||||
{
|
||||
@@ -240,4 +259,3 @@ bool wxTreeCtrlBase::IsEmpty() const
|
||||
}
|
||||
|
||||
#endif // wxUSE_TREECTRL
|
||||
|
||||
|
||||
Reference in New Issue
Block a user