X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4aefa363efc2b256668fe90e3a20984b69cac89e..fb6261e9ba8b162347135a9174afbc81244b10cc:/src/generic/listctrl.cpp diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 3fc7d41a6a..12a4d8d42e 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -1231,7 +1231,8 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) // do *not* use the listctrl colour for headers - one day we will have a // function to set it separately - dc.SetTextForeground( *wxBLACK ); + //dc.SetTextForeground( *wxBLACK ); + dc.SetTextForeground(wxSystemSettings::GetSystemColour( wxSYS_COLOUR_WINDOWTEXT )); int x = 1; // left of the header rect const int y = 1; // top @@ -1297,12 +1298,12 @@ void wxListHeaderWindow::OnMouse( wxMouseEvent &event ) { // we want to work with logical coords #if wxUSE_GENERIC_LIST_EXTENSIONS - int x, y; - m_owner->CalcUnscrolledPosition(event.GetX(), event.GetY(), &x, &y); + int x; + m_owner->CalcUnscrolledPosition(event.GetX(), 0, &x, NULL); #else // !wxUSE_GENERIC_LIST_EXTENSIONS int x = event.GetX(); - int y = event.GetY(); #endif // wxUSE_GENERIC_LIST_EXTENSIONS + int y = event.GetY(); if (m_isDragging) { @@ -1625,6 +1626,13 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) if (m_mode & wxLC_REPORT) { + wxPen pen(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DLIGHT), 1, wxSOLID); + dc.SetPen(pen); + dc.SetBrush(* wxTRANSPARENT_BRUSH); + + wxSize clientSize = GetClientSize(); + wxRect itemRect; + int lineSpacing = 0; wxListLineData *line = &m_lines[0]; int dummy = 0; @@ -1635,10 +1643,35 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) size_t i_to = y_s / lineSpacing + m_visibleLines+2; if (i_to >= m_lines.GetCount()) i_to = m_lines.GetCount(); - for (size_t i = y_s / lineSpacing; i < i_to; i++) + size_t i; + for (i = y_s / lineSpacing; i < i_to; i++) { m_lines[i].Draw( &dc ); + // Draw horizontal rule if required + if (GetWindowStyle() & wxLC_HRULES) + dc.DrawLine(0, i*lineSpacing, clientSize.x, i*lineSpacing); } + + // Draw last horizontal rule + if ((i > (size_t) (y_s / lineSpacing)) && (GetWindowStyle() & wxLC_HRULES)) + dc.DrawLine(0, i*lineSpacing, clientSize.x, i*lineSpacing); + + // Draw vertical rules if required + if ((GetWindowStyle() & wxLC_VRULES) && (GetItemCount() > 0)) + { + int col = 0; + wxRect firstItemRect; + wxRect lastItemRect; + GetItemRect(0, firstItemRect); + GetItemRect(GetItemCount() - 1, lastItemRect); + int x = firstItemRect.GetX(); + for (col = 0; col < GetColumnCount(); col++) + { + int colWidth = GetColumnWidth(col); + x += colWidth ; + dc.DrawLine(x, firstItemRect.GetY() - 1, x, lastItemRect.GetBottom() + 1); + } + } } else { @@ -1703,7 +1736,7 @@ void wxListMainWindow::DeleteLine( wxListLineData *line ) void wxListMainWindow::EditLabel( long item ) { - wxCHECK_RET( ((size_t)item < m_lines.GetCount()), + wxCHECK_RET( ((size_t)item < m_lines.GetCount()), wxT("wrong index in wxListCtrl::Edit()") ); m_currentEdit = &m_lines[(size_t)item]; @@ -1768,6 +1801,7 @@ void wxListMainWindow::OnRenameAccept() void wxListMainWindow::OnMouse( wxMouseEvent &event ) { + event.SetEventObject( GetParent() ); if (GetParent()->GetEventHandler()->ProcessEvent( event)) return; if (!m_current) return; @@ -1887,7 +1921,7 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event ) else if (event.ShiftDown()) { size_t j; - + m_current = line; int numOfCurrent = -1; @@ -2095,7 +2129,7 @@ void wxListMainWindow::OnChar( wxKeyEvent &event ) if (index != wxNOT_FOUND) { index -= steps; - if (index < 0) index = 0; + if (index < 0) index = 0; OnArrowChar( &m_lines[index], event.ShiftDown() ); } break; @@ -2116,7 +2150,7 @@ void wxListMainWindow::OnChar( wxKeyEvent &event ) if (index != wxNOT_FOUND) { index += steps; - if ((size_t)index >= m_lines.GetCount()) + if ((size_t)index >= m_lines.GetCount()) index = m_lines.GetCount()-1; OnArrowChar( &m_lines[index], event.ShiftDown() ); } @@ -2144,7 +2178,7 @@ void wxListMainWindow::OnChar( wxKeyEvent &event ) if (index != wxNOT_FOUND) { index += m_visibleLines; - if ((size_t)index >= m_lines.GetCount()) + if ((size_t)index >= m_lines.GetCount()) index = m_lines.GetCount()-1; OnArrowChar( &m_lines[index], event.ShiftDown() ); } @@ -2381,7 +2415,7 @@ void wxListMainWindow::SetColumnWidth( int col, int width ) wxClientDC dc(this); dc.SetFont( GetFont() ); int max = 10; - + for (size_t i = 0; i < m_lines.GetCount(); i++) { wxListLineData *line = &m_lines[i]; @@ -2880,7 +2914,7 @@ long wxListMainWindow::FindItem(long start, const wxString& str, bool WXUNUSED(p long pos = start; wxString tmp = str; if (pos < 0) pos = 0; - for (size_t i = pos; i < m_lines.GetCount(); i++) + for (size_t i = (size_t)pos; i < m_lines.GetCount(); i++) { wxListLineData *line = &m_lines[i]; wxString s = ""; @@ -2895,7 +2929,7 @@ long wxListMainWindow::FindItem(long start, long data) { long pos = start; if (pos < 0) pos = 0; - for (size_t i = pos; i < m_lines.GetCount(); i++) + for (size_t i = (size_t)pos; i < m_lines.GetCount(); i++) { wxListLineData *line = &m_lines[i]; wxListItem item; @@ -2954,6 +2988,7 @@ void wxListMainWindow::InsertItem( wxListItem &item ) else { m_lines.Add( line ); + item.m_itemId = m_lines.GetCount(); } }