X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0cf3b5429a5729a8ed1da31ea2c133861090018a..732e46f552027022e4dc87d013918c9d45b0f772:/src/generic/treectlg.cpp diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 0018af55bd..89df6f6b19 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -415,7 +415,7 @@ void wxTreeTextCtrl::Finish() m_finished = true; - m_owner->SetFocus(); // This doesn't work. TODO. + m_owner->SetFocusIgnoringChildren(); } } @@ -758,9 +758,11 @@ void wxGenericTreeCtrl::Init() m_findTimer = NULL; + m_dropEffectAboveItem = false; + m_lastOnSame = false; -#ifdef __WXMAC_CARBON__ +#ifdef __WXMAC_CARBON__ m_normalFont.MacCreateThemeFont( kThemeViewsFont ) ; #else m_normalFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); @@ -1511,6 +1513,7 @@ void wxGenericTreeCtrl::ChildrenClosing(wxGenericTreeItem* item) m_select_me = item; } if (item != m_current && IsDescendantOf(item, m_current)) { + m_current->SetHilight( false ); m_current = NULL; m_select_me = item; } @@ -1585,7 +1588,7 @@ void wxGenericTreeCtrl::Delete(const wxTreeItemId& itemId) if (item == m_select_me) m_select_me = NULL; - + delete item; } @@ -2498,7 +2501,7 @@ void wxGenericTreeCtrl::DrawDropEffect(wxGenericTreeItem *item) { // draw a line under the drop target because the item will be // dropped there - DrawLine(item, true /* below */); + DrawLine(item, !m_dropEffectAboveItem ); } SetCursor(wxCURSOR_BULLSEYE); @@ -2652,6 +2655,14 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event ) } break; + case WXK_MENU: + { + wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_MENU, GetId() ); + event.m_item = m_current; + event.SetEventObject( this ); + GetEventHandler()->ProcessEvent( event ); + break; + } case ' ': case WXK_RETURN: if ( !event.HasModifiers() ) @@ -3093,7 +3104,7 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) CaptureMouse(); } } - else if ( event.Moving() ) + else if ( event.Dragging() ) { if ( item != m_dropTarget ) { @@ -3105,7 +3116,7 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) // highlight the current drop target if any DrawDropEffect(m_dropTarget); -#if defined( __WXMSW__ ) || defined(__WXMAC__) +#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXGTK20__) Update(); #else wxYieldIfNeeded(); @@ -3166,11 +3177,12 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) if ( event.RightDown() ) { + DoSelectItem(item, true, false); wxTreeEvent nevent(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, GetId()); nevent.m_item = item; nevent.m_pointDrag = CalcScrolledPosition(pt); nevent.SetEventObject(this); - GetEventHandler()->ProcessEvent(nevent); + event.Skip(!GetEventHandler()->ProcessEvent(nevent)); } else if ( event.LeftUp() ) { @@ -3552,4 +3564,27 @@ wxGenericTreeCtrl::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) #endif } +#if WXWIN_COMPATIBILITY_2_4 + +int wxGenericTreeCtrl::GetItemSelectedImage(const wxTreeItemId& item) const +{ + return GetItemImage(item, wxTreeItemIcon_Selected); +} + +void wxGenericTreeCtrl::SetItemSelectedImage(const wxTreeItemId& item, int image) +{ + SetItemImage(item, image, wxTreeItemIcon_Selected); +} + +#endif // WXWIN_COMPATIBILITY_2_4 + +#if WXWIN_COMPATIBILITY_2_2 + +wxTreeItemId wxGenericTreeCtrl::GetParent(const wxTreeItemId& item) const +{ + return GetItemParent( item ); +} + +#endif // WXWIN_COMPATIBILITY_2_2 + #endif // wxUSE_TREECTRL