X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c0f09a2e88168989a36c53e95ed225e2cf3f9ff0..f1d93f0beeec9d88f8a225aa35a9ccc163dcdb15:/src/generic/listctrl.cpp diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index ada740b307..8e7857291f 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -25,6 +25,11 @@ #include "wx/generic/imaglist.h" #include "wx/dynarray.h" +#ifdef __WXGTK__ +#include +#include "wx/gtk/win_gtk.h" +#endif + #ifndef wxUSE_GENERIC_LIST_EXTENSIONS #define wxUSE_GENERIC_LIST_EXTENSIONS 1 #endif @@ -763,6 +768,8 @@ void wxListLineData::CalculateSize( wxDC *dc, int spacing ) m_bound_all.height = lh; node = node->Next(); } + m_bound_label.width = m_bound_all.width; + m_bound_label.height = m_bound_all.height; break; } } @@ -1190,6 +1197,15 @@ wxListHeaderWindow::~wxListHeaderWindow( void ) void wxListHeaderWindow::DoDrawRect( wxDC *dc, int x, int y, int w, int h ) { +#ifdef __WXGTK__ + GtkStateType state = GTK_STATE_NORMAL; + if (!m_parent->IsEnabled()) state = GTK_STATE_INSENSITIVE; + + x = dc->XLOG2DEV( x ); + + gtk_paint_box (m_wxwindow->style, GTK_PIZZA(m_wxwindow)->bin_window, state, GTK_SHADOW_OUT, + (GdkRectangle*) NULL, m_wxwindow, "button", x-1, y-1, w+2, h+2); +#else const int m_corner = 1; dc->SetBrush( *wxTRANSPARENT_BRUSH ); @@ -1209,6 +1225,7 @@ void wxListHeaderWindow::DoDrawRect( wxDC *dc, int x, int y, int w, int h ) dc->DrawRectangle( x, y, 1, h ); // left (outer) dc->DrawLine( x, y+h-1, x+1, y+h-1 ); dc->DrawLine( x+w-1, y, x+w-1, y+1 ); +#endif } // shift the DC origin to match the position of the main window horz @@ -1687,7 +1704,7 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) x += colWidth ; dc.DrawLine(x, firstItemRect.GetY() - 1, x, lastItemRect.GetBottom() + 1); } - } + } } else { @@ -3004,7 +3021,7 @@ void wxListMainWindow::InsertItem( wxListItem &item ) else { m_lines.Add( line ); - item.m_itemId = m_lines.GetCount(); + item.m_itemId = m_lines.GetCount()-1; } } @@ -3177,12 +3194,16 @@ wxListCtrl::wxListCtrl() m_imageListNormal = (wxImageList *) NULL; m_imageListSmall = (wxImageList *) NULL; m_imageListState = (wxImageList *) NULL; + m_ownsImageListNormal = m_ownsImageListSmall = m_ownsImageListState = FALSE; m_mainWin = (wxListMainWindow*) NULL; m_headerWin = (wxListHeaderWindow*) NULL; } wxListCtrl::~wxListCtrl() { + if (m_ownsImageListNormal) delete m_imageListNormal; + if (m_ownsImageListSmall) delete m_imageListSmall; + if (m_ownsImageListState) delete m_imageListState; } bool wxListCtrl::Create(wxWindow *parent, @@ -3196,6 +3217,7 @@ bool wxListCtrl::Create(wxWindow *parent, m_imageListNormal = (wxImageList *) NULL; m_imageListSmall = (wxImageList *) NULL; m_imageListState = (wxImageList *) NULL; + m_ownsImageListNormal = m_ownsImageListSmall = m_ownsImageListState = FALSE; m_mainWin = (wxListMainWindow*) NULL; m_headerWin = (wxListHeaderWindow*) NULL; @@ -3493,9 +3515,39 @@ wxImageList *wxListCtrl::GetImageList(int which) const void wxListCtrl::SetImageList( wxImageList *imageList, int which ) { + if ( which == wxIMAGE_LIST_NORMAL ) + { + if (m_ownsImageListNormal) delete m_imageListNormal; + m_imageListNormal = imageList; + m_ownsImageListNormal = FALSE; + } + else if ( which == wxIMAGE_LIST_SMALL ) + { + if (m_ownsImageListSmall) delete m_imageListSmall; + m_imageListSmall = imageList; + m_ownsImageListSmall = FALSE; + } + else if ( which == wxIMAGE_LIST_STATE ) + { + if (m_ownsImageListState) delete m_imageListState; + m_imageListState = imageList; + m_ownsImageListState = FALSE; + } + m_mainWin->SetImageList( imageList, which ); } +void wxListCtrl::AssignImageList(wxImageList *imageList, int which) +{ + SetImageList(imageList, which); + if ( which == wxIMAGE_LIST_NORMAL ) + m_ownsImageListNormal = TRUE; + else if ( which == wxIMAGE_LIST_SMALL ) + m_ownsImageListSmall = TRUE; + else if ( which == wxIMAGE_LIST_STATE ) + m_ownsImageListState = TRUE; +} + bool wxListCtrl::Arrange( int WXUNUSED(flag) ) { return 0;