X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6359fa0e03f9954d6ee5d52bbc6d663ccffda9fc..081eb1b120c1bc9147582cff84de756b4a3a63af:/src/generic/treectlg.cpp?ds=sidebyside diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index c7155ed9a2..4669cdca44 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -298,23 +298,23 @@ void wxTreeTextCtrl::OnChar( wxKeyEvent &event ) { (*m_accept) = TRUE; (*m_res) = GetValue(); - + if (!wxPendingDelete.Member(this)) wxPendingDelete.Append(this); if ((*m_accept) && ((*m_res) != m_startValue)) m_owner->OnRenameAccept(); - + return; } if (event.m_keyCode == WXK_ESCAPE) { (*m_accept) = FALSE; (*m_res) = ""; - + if (!wxPendingDelete.Member(this)) wxPendingDelete.Append(this); - + return; } event.Skip(); @@ -331,7 +331,7 @@ void wxTreeTextCtrl::OnKeyUp( wxKeyEvent &event ) if (myPos.x + sx > parentSize.x) sx = parentSize.x - myPos.x; if (mySize.x > sx) sx = mySize.x; SetSize(sx, -1); - + event.Skip(); } @@ -632,7 +632,7 @@ void wxGenericTreeCtrl::Init() m_imageListNormal = m_imageListState = (wxImageList *) NULL; - m_ownsImageListNormal = + m_ownsImageListNormal = m_ownsImageListState = FALSE; m_dragCount = 0; @@ -818,6 +818,21 @@ void wxGenericTreeCtrl::SetItemFont(const wxTreeItemId& item, const wxFont& font RefreshLine(pItem); } +bool wxGenericTreeCtrl::SetFont( const wxFont &font ) +{ + wxScrolledWindow::SetFont(font); + + m_normalFont = font ; + m_boldFont = wxFont( m_normalFont.GetPointSize(), + m_normalFont.GetFamily(), + m_normalFont.GetStyle(), + wxBOLD, + m_normalFont.GetUnderlined()); + + return TRUE; +} + + // ----------------------------------------------------------------------------- // item status inquiries // ----------------------------------------------------------------------------- @@ -1770,7 +1785,15 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc) dc.SetBrush(wxBrush(colBg, wxSOLID)); } - dc.DrawRectangle( item->GetX()-2, item->GetY(), item->GetWidth()+2, total_h ); + if (item->IsSelected() && image != NO_IMAGE) + { + // If it's selected, and there's an image, then we should + // take care to leave the area under the image painted in the + // background colour. + dc.DrawRectangle( item->GetX() + image_w - 2, item->GetY(), item->GetWidth() - image_w + 2, total_h ); + } + else + dc.DrawRectangle( item->GetX()-2, item->GetY(), item->GetWidth()+2, total_h ); if ( image != NO_IMAGE ) { @@ -2203,7 +2226,9 @@ wxTreeItemId wxGenericTreeCtrl::HitTest(const wxPoint& point, int& flags) // We have to call this here because the label in // question might just have been added and no screen // update taken place. - if (m_dirty) wxYieldIfNeeded(); + // JACS: removed this because the yield can cause the window to be + // deleted from under us if a close window event is pending + // if (m_dirty) wxYieldIfNeeded(); wxClientDC dc(this); PrepareDC(dc); @@ -2227,7 +2252,7 @@ wxTreeItemId wxGenericTreeCtrl::HitTest(const wxPoint& point, int& flags) // get the bounding rectangle of the item (or of its label only) bool wxGenericTreeCtrl::GetBoundingRect(const wxTreeItemId& item, wxRect& rect, - bool textOnly) const + bool WXUNUSED(textOnly)) const { wxCHECK_MSG( item.IsOk(), FALSE, _T("invalid item in wxGenericTreeCtrl::GetBoundingRect") );