fix bug in generic wxTreeCtrl: calling SelectItem(true) on an already selected item shouldn't toggle its selection (see #10830)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60910 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-06-06 14:15:06 +00:00
parent 80f624ec0c
commit 756c98b02e
2 changed files with 102 additions and 13 deletions

View File

@@ -2146,15 +2146,16 @@ void wxGenericTreeCtrl::DoSelectItem(const wxTreeItemId& itemId,
void wxGenericTreeCtrl::SelectItem(const wxTreeItemId& itemId, bool select)
{
wxGenericTreeItem * const item = (wxGenericTreeItem*) itemId.m_pItem;
wxCHECK_RET( item, wxT("SelectItem(): invalid tree item") );
if ( select )
{
DoSelectItem(itemId, !HasFlag(wxTR_MULTIPLE));
if ( !item->IsSelected() )
DoSelectItem(itemId, !HasFlag(wxTR_MULTIPLE));
}
else // deselect
{
wxGenericTreeItem *item = (wxGenericTreeItem*) itemId.m_pItem;
wxCHECK_RET( item, wxT("SelectItem(): invalid tree item") );
wxTreeEvent event(wxEVT_COMMAND_TREE_SEL_CHANGING, this, item);
if ( GetEventHandler()->ProcessEvent( event ) && !event.IsAllowed() )
return;