X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/847dfdb422c4d56bb56d3c92a9cd706ee2b45530..008a26557841f39519df1eeb3d32b1ea0910e91d:/src/generic/treectlg.cpp diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 00ba1e08ee..38b83bdd2d 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -820,6 +820,9 @@ bool wxGenericTreeCtrl::Create(wxWindow *parent, if (major < 10) style |= wxTR_ROW_LINES; #endif // __WXMAC__ +#ifdef __WXGTK20__ + style |= wxTR_NO_LINES; +#endif if ( !wxControl::Create( parent, id, pos, size, style|wxHSCROLL|wxVSCROLL, @@ -1395,10 +1398,12 @@ wxTreeItemId wxGenericTreeCtrl::FindItem(const wxTreeItemId& idParent, } // 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; @@ -1890,9 +1895,16 @@ void wxGenericTreeCtrl::SelectItem(const wxTreeItemId& itemId, bool select) { 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 ); } } @@ -2242,12 +2254,7 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc) 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), @@ -2585,6 +2592,14 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event ) event.CmdDown(), is_multiple, extended_select, unselect_others); + if (GetLayoutDirection() == wxLayout_RightToLeft) + { + if (event.GetKeyCode() == WXK_RIGHT) + event.m_keyCode = WXK_LEFT; + else if (event.GetKeyCode() == WXK_LEFT) + event.m_keyCode = WXK_RIGHT; + } + // + : Expand // - : Collaspe // * : Expand all/Collapse all