}
// and try all the items (stop when we get to the one we started from)
- while ( id != idParent && !GetItemText(id).Lower().StartsWith(prefix) )
+ while (id.IsOk() && id != idParent && !GetItemText(id).Lower().StartsWith(prefix) )
{
id = GetNext(id);
}
+ // If we haven't found the item, id.IsOk() will be false, as per
+ // documentation
}
return id;
{
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;
item->SetHilight(false);
RefreshLine(item);
+
+ event.SetEventType(wxEVT_COMMAND_TREE_SEL_CHANGED);
+ GetEventHandler()->ProcessEvent( event );
}
}
if ( image != NO_IMAGE )
{
-#ifdef __WXGTK__
- if (GetLayoutDirection() == wxLayout_RightToLeft)
- dc.SetClippingRegion( item->GetX()+image_w-2, item->GetY(), image_w-2, total_h );
- else
-#endif
- dc.SetClippingRegion( item->GetX(), item->GetY(), image_w-2, total_h );
+ dc.SetClippingRegion( item->GetX(), item->GetY(), image_w-2, total_h );
m_imageListNormal->Draw( image, dc,
item->GetX(),
item->GetY() +((total_h > image_h)?((total_h-image_h)/2):0),