X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/be93a00bb4b661fd7d58c559f6736a2456f88acd..a7c8e710e944fc12a81a19d06fe415a92e86bb13:/src/generic/treectlg.cpp diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index d16901dee4..2b2808ae7b 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -368,7 +368,7 @@ void wxTreeTextCtrl::OnChar( wxKeyEvent &event ) if (!wxPendingDelete.Member(this)) wxPendingDelete.Append(this); - + m_finished = TRUE; m_owner->SetFocus(); // This doesn't work. TODO. @@ -424,7 +424,7 @@ void wxTreeTextCtrl::OnKillFocus( wxFocusEvent &event ) (*m_accept) = TRUE; (*m_res) = GetValue(); - + if ((*m_res) != m_startValue) m_owner->OnRenameAccept(); } @@ -716,7 +716,7 @@ bool wxGenericTreeCtrl::Create(wxWindow *parent, #ifdef __WXMAC__ int major,minor; wxGetOsVersion( &major, &minor ); - + if (style & wxTR_HAS_BUTTONS) style |= wxTR_MAC_BUTTONS; if (style & wxTR_HAS_BUTTONS) style &= ~wxTR_HAS_BUTTONS; style &= ~wxTR_LINES_AT_ROOT; @@ -741,9 +741,9 @@ bool wxGenericTreeCtrl::Create(wxWindow *parent, wxScrolledWindow::Create( parent, id, pos, size, style|wxHSCROLL|wxVSCROLL, name ); - // If the tree display has no buttons, but does have - // connecting lines, we can use a narrower layout. - // It may not be a good idea to force this... + // If the tree display has no buttons, but does have + // connecting lines, we can use a narrower layout. + // It may not be a good idea to force this... if (!HasButtons() && !HasFlag(wxTR_NO_LINES)) { m_indent= 10; @@ -754,7 +754,8 @@ bool wxGenericTreeCtrl::Create(wxWindow *parent, SetValidator( validator ); #endif - SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOX ) ); + SetForegroundColour( wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT) ); + SetBackgroundColour( wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX) ); // m_dottedPen = wxPen( "grey", 0, wxDOT ); too slow under XFree86 m_dottedPen = wxPen( wxT("grey"), 0, 0 ); @@ -766,7 +767,7 @@ wxGenericTreeCtrl::~wxGenericTreeCtrl() { delete m_hilightBrush; delete m_hilightUnfocusedBrush; - + if (m_arrowRight) delete m_arrowRight; if (m_arrowDown) delete m_arrowDown; @@ -789,13 +790,13 @@ size_t wxGenericTreeCtrl::GetCount() const void wxGenericTreeCtrl::SetIndent(unsigned int indent) { - m_indent = indent; + m_indent = (unsigned short) indent; m_dirty = TRUE; } void wxGenericTreeCtrl::SetSpacing(unsigned int spacing) { - m_spacing = spacing; + m_spacing = (unsigned short) spacing; m_dirty = TRUE; } @@ -2061,7 +2062,7 @@ void wxGenericTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level if (attr && attr->HasTextColour()) colText = attr->GetTextColour(); else - colText = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); + colText = GetForegroundColour(); } // prepare to draw @@ -2115,7 +2116,7 @@ void wxGenericTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level else if (HasFlag(wxTR_TWIST_BUTTONS)) { // draw the twisty button here - + if (HasFlag(wxTR_AQUA_BUTTONS)) { if (item->IsExpanded()) @@ -2895,7 +2896,10 @@ void wxGenericTreeCtrl::CalculateSize( wxGenericTreeItem *item, wxDC &dc ) wxCoord text_w = 0; wxCoord text_h = 0; - if (item->IsBold()) + wxTreeItemAttr *attr = item->GetAttributes(); + if ( attr && attr->HasFont() ) + dc.SetFont(attr->GetFont()); + else if ( item->IsBold() ) dc.SetFont(m_boldFont); dc.GetTextExtent( item->GetText(), &text_w, &text_h ); @@ -2992,17 +2996,15 @@ void wxGenericTreeCtrl::RefreshSubtree(wxGenericTreeItem *item) wxClientDC dc(this); PrepareDC(dc); - int cw = 0; - int ch = 0; - GetClientSize( &cw, &ch ); + wxRect client = GetClientRect(); wxRect rect; - rect.x = dc.LogicalToDeviceX( 0 ); - rect.width = cw; - rect.y = dc.LogicalToDeviceY( item->GetY() ); - rect.height = ch; + rect.x = dc.LogicalToDeviceX(-client.x); + rect.width = client.width; + rect.y = dc.LogicalToDeviceY(-client.y + item->GetY()); + rect.height = client.height; - Refresh( TRUE, &rect ); + Refresh(TRUE, &rect); AdjustMyScrollbars(); } @@ -3012,19 +3014,17 @@ void wxGenericTreeCtrl::RefreshLine( wxGenericTreeItem *item ) if (m_dirty) return; wxClientDC dc(this); - PrepareDC( dc ); + PrepareDC(dc); - int cw = 0; - int ch = 0; - GetClientSize( &cw, &ch ); + wxRect client = GetClientRect(); wxRect rect; - rect.x = dc.LogicalToDeviceX( 0 ); - rect.y = dc.LogicalToDeviceY( item->GetY() ); - rect.width = cw; + rect.x = dc.LogicalToDeviceX(-client.x); + rect.y = dc.LogicalToDeviceY(-client.y + item->GetY()); + rect.width = client.width; rect.height = GetLineHeight(item); //dc.GetCharHeight() + 6; - Refresh( TRUE, &rect ); + Refresh(TRUE, &rect); } void wxGenericTreeCtrl::RefreshSelected()