X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0326c494a9b12442a12a4c004dbf44fbda5387bf..a0b1b91fe6ea9ee743ca658cb427d64052a8f57b:/src/generic/treectlg.cpp diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 0984a23ed2..9a623fa386 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -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 ) { @@ -2282,34 +2305,26 @@ void wxGenericTreeCtrl::Edit( const wxTreeItemId& item ) m_imageListNormal->GetSize( image, image_w, image_h ); image_w += 4; } - else // !RightDown() && !LeftUp() ==> LeftDown() || LeftDClick() + else { wxFAIL_MSG(_T("you must create an image list to use images!")); } } x += image_w; w -= image_w + 4; // I don't know why +4 is needed - if ( flags & wxTREE_HITTEST_ONITEMBUTTON ) - { - // only toggle the item for a single click, double click on - // the button doesn't do anything (it toggles the item twice) - if ( event.LeftDown() ) - { - Toggle( item ); - } - - // don't select the item if the button was clicked - return; - } - wxClientDC dc(this); PrepareDC( dc ); x = dc.LogicalToDeviceX( x ); y = dc.LogicalToDeviceY( y ); - wxTreeTextCtrl *text = new wxTreeTextCtrl( - this, -1, &m_renameAccept, &m_renameRes, this, s, wxPoint(x-4,y-4), wxSize(w+11,h+8) ); + wxTreeTextCtrl *text = new wxTreeTextCtrl(this, -1, + &m_renameAccept, + &m_renameRes, + this, + s, + wxPoint(x-4,y-4), + wxSize(w+11,h+8)); text->SetFocus(); }