X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0208334d5d57849d7e46b9997cd8ef39daf39d2d..a38b83c353cce75329b2c53c0eaa4ad0f500ccf1:/src/generic/listctrl.cpp?ds=inline diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 6ee97c89f6..95ede00501 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -537,14 +537,25 @@ void wxListLineData::DoDraw( wxPaintDC *dc, bool hilight, bool paintBG ) wxNode *node = m_items.First(); while (node) { - wxListItemData *info = (wxListItemData*)node->Data(); - dc->SetClippingRegion( info->GetX(), info->GetY(), info->GetWidth()-3, info->GetHeight() ); - info->GetText( s ); + wxListItemData *item = (wxListItemData*)node->Data(); + dc->SetClippingRegion( item->GetX(), item->GetY(), item->GetWidth()-3, item->GetHeight() ); + int x = item->GetX(); + if (item->HasImage()) + { + int y = 0; + m_owner->DrawImage( item->GetImage(), dc, x, item->GetY() ); + m_owner->GetImageSize( item->GetImage(), x, y ); + x += item->GetX() + 5; + } + if (item->HasText()) + { + item->GetText( s ); if (hilight) dc->SetTextForeground( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_HIGHLIGHTTEXT ) ); else - dc->SetTextForeground( * info->GetColour() ); - dc->DrawText( s, info->GetX()+2, info->GetY() ); + dc->SetTextForeground( *item->GetColour() ); + dc->DrawText( s, x, item->GetY() ); + } dc->DestroyClippingRegion(); node = node->Next(); } @@ -663,6 +674,7 @@ wxListHeaderWindow::wxListHeaderWindow( wxWindow *win, wxWindowID id, wxListMain // m_currentCursor = wxSTANDARD_CURSOR; m_currentCursor = (wxCursor *) NULL; m_resizeCursor = new wxCursor( wxCURSOR_SIZEWE ); + m_isDraging = FALSE; } void wxListHeaderWindow::DoDrawRect( wxPaintDC *dc, int x, int y, int w, int h ) @@ -693,7 +705,7 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) dc.BeginDrawing(); - dc.SetFont( wxSystemSettings::GetSystemFont( wxSYS_SYSTEM_FONT ) ); + dc.SetFont( *GetFont() ); int w = 0; int h = 0; @@ -702,6 +714,7 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) GetClientSize( &w, &h ); dc.SetTextForeground( *wxBLACK ); + if (m_foregroundColour.Ok()) dc.SetTextForeground( m_foregroundColour ); x = 1; y = 1; @@ -744,7 +757,7 @@ void wxListHeaderWindow::DrawCurrent() dc.SetLogicalFunction( wxCOPY ); dc.SetPen( wxNullPen ); - dc.SetBrush( wxNullBrush ); + dc.SetBrush( wxNullBrush ); } void wxListHeaderWindow::OnMouse( wxMouseEvent &event ) @@ -758,7 +771,6 @@ void wxListHeaderWindow::OnMouse( wxMouseEvent &event ) { // wxScreenDC::EndDrawingOnTop(); ReleaseMouse(); - wxYield(); // for debugging m_isDraging = FALSE; m_owner->SetColumnWidth( m_column, m_currentX-m_minX ); } @@ -911,7 +923,6 @@ wxListMainWindow::wxListMainWindow( void ) m_current = (wxListLineData *) NULL; m_visibleLines = 0; m_hilightBrush = (wxBrush *) NULL; - m_myFont = (wxFont *) NULL; m_xScroll = 0; m_yScroll = 0; m_dirty = TRUE; @@ -944,7 +955,6 @@ wxListMainWindow::wxListMainWindow( wxWindow *parent, wxWindowID id, m_small_spacing = 30; m_normal_spacing = 40; // AllowDoubleClick( TRUE ); - m_myFont = wxNORMAL_FONT; m_hasFocus = FALSE; m_dragCount = 0; m_isCreated = FALSE; @@ -978,7 +988,6 @@ wxListMainWindow::~wxListMainWindow( void ) if (m_hilightBrush) delete m_hilightBrush; delete m_renameTimer; // if (m_hilightColour) delete m_hilightColour; -// if (m_myFont) delete m_myFont; // delete m_text; } @@ -1011,8 +1020,7 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) dc.BeginDrawing(); -// dc.SetFont( *m_myFont ); - dc.SetFont( wxSystemSettings::GetSystemFont( wxSYS_SYSTEM_FONT ) ); + dc.SetFont( *GetFont() ); wxNode *node = m_lines.First(); while (node) @@ -1488,11 +1496,6 @@ void wxListMainWindow::OnSize( wxSizeEvent &WXUNUSED(event) ) */ } -wxFont *wxListMainWindow::GetMyFont( void ) -{ - return m_myFont; -} - void wxListMainWindow::DrawImage( int index, wxPaintDC *dc, int x, int y ) { if ((m_mode & wxLC_ICON) && (m_normal_image_list)) @@ -1504,6 +1507,11 @@ void wxListMainWindow::DrawImage( int index, wxPaintDC *dc, int x, int y ) { m_small_image_list->Draw( index, *dc, x, y, wxIMAGELIST_DRAW_TRANSPARENT ); } + if ((m_mode & wxLC_REPORT) && (m_small_image_list)) + { + m_small_image_list->Draw( index, *dc, x, y, wxIMAGELIST_DRAW_TRANSPARENT ); + return; + } } void wxListMainWindow::GetImageSize( int index, int &width, int &height ) @@ -1518,6 +1526,11 @@ void wxListMainWindow::GetImageSize( int index, int &width, int &height ) m_small_image_list->GetSize( index, width, height ); return; } + if ((m_mode & wxLC_REPORT) && (m_small_image_list)) + { + m_small_image_list->GetSize( index, width, height ); + return; + } width = 0; height = 0; } @@ -1802,7 +1815,7 @@ int wxListMainWindow::GetSelectedItemCount( void ) if (line->IsHilighted()) ret++; node = node->Next(); } - return 0; + return ret; } void wxListMainWindow::SetMode( long mode ) @@ -1832,7 +1845,7 @@ long wxListMainWindow::GetMode( void ) const void wxListMainWindow::CalculatePositions( void ) { wxPaintDC dc( this ); - dc.SetFont( wxSystemSettings::GetSystemFont( wxSYS_SYSTEM_FONT ) ); + dc.SetFont( *GetFont() ); int iconSpacing = 0; if (m_mode & wxLC_ICON) iconSpacing = m_normal_spacing; @@ -2670,4 +2683,24 @@ void wxListCtrl::OnIdle( wxIdleEvent &WXUNUSED(event) ) m_mainWin->Refresh(); } +void wxListCtrl::SetBackgroundColour( const wxColour &colour ) +{ + m_mainWin->SetBackgroundColour( colour ); + m_headerWin->SetBackgroundColour( colour ); + m_mainWin->m_dirty = TRUE; +} + +void wxListCtrl::SetForegroundColour( const wxColour &colour ) +{ + m_mainWin->SetForegroundColour( colour ); + m_headerWin->SetForegroundColour( colour ); + m_mainWin->m_dirty = TRUE; +} + +void wxListCtrl::SetFont( const wxFont &font ) +{ + m_mainWin->SetFont( font ); + m_headerWin->SetFont( font ); + m_mainWin->m_dirty = TRUE; +}