X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3b656728ddadefa1c8ffd168695cb8818b8486ef..6d5a34485ba36dac14bc4bf7ab788dcad2b22b9a:/src/generic/treectlg.cpp diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 2065d971d1..3296a98094 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -261,12 +261,12 @@ private: // tree ctrl images for the normal, selected, expanded and // expanded+selected states - short m_images[wxTreeItemIcon_Max]; + int m_images[wxTreeItemIcon_Max]; wxCoord m_x; // (virtual) offset from top wxCoord m_y; // (virtual) offset from left - short m_width; // width of this item - unsigned char m_height; // height of this item + int m_width; // width of this item + int m_height; // height of this item // use bitfields to save size int m_isCollapsed :1; @@ -376,10 +376,11 @@ wxTreeTextCtrl::wxTreeTextCtrl(wxGenericTreeCtrl *owner, x += image_w; w -= image_w + 4; #ifdef __WXMAC__ + wxSize bs = DoGetBestSize() ; // edit control height - if ( h > 22 - 8 ) + if ( h > bs.y - 8 ) { - int diff = h - ( 22 - 8 ) ; + int diff = h - ( bs.y - 8 ) ; h -= diff ; y += diff / 2 ; } @@ -535,6 +536,8 @@ void wxGenericTreeItem::DeleteChildren(wxGenericTreeCtrl *tree) tree->SendDeleteEvent(child); child->DeleteChildren(tree); + if (child == tree->m_select_me) + tree->m_select_me = NULL; delete child; } @@ -764,7 +767,7 @@ void wxGenericTreeCtrl::Init() m_lastOnSame = false; -#if defined( __WXMAC__ ) && __WXMAC_CARBON__ +#ifdef __WXMAC_CARBON__ m_normalFont.MacCreateThemeFont( kThemeViewsFont ) ; #else m_normalFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); @@ -1567,6 +1570,10 @@ void wxGenericTreeCtrl::Delete(const wxTreeItemId& itemId) // and delete all of its children and the item itself now item->DeleteChildren(this); SendDeleteEvent(item); + + if (item == m_select_me) + m_select_me = NULL; + delete item; } @@ -3128,6 +3135,16 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) } else { + // If we got to this point, we are not dragging or moving the mouse. + // Because the code in carbon/toplevel.cpp will only set focus to the tree + // if we skip for EVT_LEFT_DOWN, we MUST skip this event here for focus to work. + // We skip even if we didn't hit an item because we still should + // restore focus to the tree control even if we didn't exactly hit an item. + if ( event.LeftDown() ) + { + event.Skip(); + } + // here we process only the messages which happen on tree items m_dragCount = 0;