X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3e4f8ee25683fe9c7ec6e8272608124e332700ac..2884838a3c63fc196077ae0353cab3b5c8c5e6d7:/src/generic/treectlg.cpp diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 9284957c8e..68e2b73bdb 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -1858,8 +1858,6 @@ void wxGenericTreeCtrl::DoSelectItem(const wxTreeItemId& itemId, parent = GetItemParent( parent ); } - EnsureVisible( itemId ); - // ctrl press if (unselect_others) { @@ -1891,6 +1889,11 @@ void wxGenericTreeCtrl::DoSelectItem(const wxTreeItemId& itemId, RefreshLine( m_current ); } + // This can cause idle processing to select the root + // if no item is selected, so it must be after the + // selection is set + EnsureVisible( itemId ); + event.SetEventType(wxEVT_COMMAND_TREE_SEL_CHANGED); GetEventHandler()->ProcessEvent( event ); } @@ -2330,7 +2333,15 @@ void wxGenericTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level wxTRANSPARENT_PEN; wxColour colText; - if ( item->IsSelected() ) + if ( item->IsSelected() +#ifdef __WXMAC__ + // On wxMac, if the tree doesn't have the focus we draw an empty + // rectangle, so we want to make sure that the text is visible + // against the normal background, not the highlightbackground, so + // don't use the highlight text colour unless we have the focus. + && m_hasFocus +#endif + ) { colText = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT); } @@ -2838,7 +2849,7 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event ) } } -wxTreeItemId wxGenericTreeCtrl::DoHitTest(const wxPoint& point, int& flags) +wxTreeItemId wxGenericTreeCtrl::DoTreeHitTest(const wxPoint& point, int& flags) { // JACS: removed wxYieldIfNeeded() because it can cause the window // to be deleted from under us if a close window event is pending @@ -3082,7 +3093,7 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) wxTreeEvent nevent( command, GetId() ); nevent.m_item = m_current; nevent.SetEventObject(this); - nevent.SetPoint(pt); + nevent.SetPoint(CalcScrolledPosition(pt)); // by default the dragging is not supported, the user code must // explicitly allow the event for it to take place @@ -3147,7 +3158,7 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) wxTreeEvent eventEndDrag(wxEVT_COMMAND_TREE_END_DRAG, GetId()); eventEndDrag.m_item = item; - eventEndDrag.m_pointDrag = pt; + eventEndDrag.m_pointDrag = CalcScrolledPosition(pt); eventEndDrag.SetEventObject(this); (void)GetEventHandler()->ProcessEvent(eventEndDrag); @@ -3507,7 +3518,7 @@ void wxGenericTreeCtrl::Thaw() { wxCHECK_RET( m_freezeCount > 0, _T("thawing unfrozen tree control?") ); - if ( !--m_freezeCount ) + if ( --m_freezeCount == 0 ) { Refresh(); }