X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/208458a7f59c7ba95a795597548fc8ae4be655cc..3e822cd8d0bdf04cd2c7a3dddff61dcc211f7439:/src/generic/listctrl.cpp diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 3608f7e033..c7821beb30 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -341,6 +341,9 @@ public: void SetImage( int image ) { SetImage(0, image); } int GetImage() const { return GetImage(0); } + void SetImage( int index, int image ); + int GetImage( int index ) const; + bool HasImage() const { return GetImage() != -1; } bool HasText() const { return !GetText(0).empty(); } @@ -390,11 +393,6 @@ private: // draw the text on the DC with the correct justification; also add an // ellipsis if the text is too large to fit in the current width void DrawTextFormatted(wxDC *dc, const wxString &text, int col, int x, int y, int width); - - // these are only used by GetImage/SetImage above, we don't support images - // with subitems at the public API level yet - void SetImage( int index, int image ); - int GetImage( int index ) const; }; WX_DECLARE_EXPORTED_OBJARRAY(wxListLineData, wxListLineDataArray); @@ -522,8 +520,6 @@ public: virtual ~wxListMainWindow(); - wxWindow *GetMainWindowOfCompositeControl() { return GetParent(); } - bool HasFlag(int flag) const { return m_parent->HasFlag(flag); } // return true if this is a virtual list control @@ -782,6 +778,8 @@ public: wxListTextCtrl* m_textctrl; protected: + wxWindow *GetMainWindowOfCompositeControl() { return GetParent(); } + // the total count of items in a virtual list control size_t m_countVirt; @@ -1685,8 +1683,6 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) PrepareDC( dc ); AdjustDC( dc ); - dc.BeginDrawing(); - dc.SetFont( GetFont() ); // width and height of the entire header window @@ -1796,8 +1792,6 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) x += wCol; } - - dc.EndDrawing(); } void wxListHeaderWindow::DrawCurrent() @@ -2226,7 +2220,7 @@ void wxListMainWindow::CacheLineData(size_t line) for ( size_t col = 0; col < countCol; col++ ) { ld->SetText(col, listctrl->OnGetItemText(line, col)); - ld->SetImage(listctrl->OnGetItemColumnImage(line, col)); + ld->SetImage(col, listctrl->OnGetItemColumnImage(line, col)); } ld->SetAttr(listctrl->OnGetItemAttr(line)); @@ -2570,7 +2564,7 @@ void wxListMainWindow::Thaw() { wxCHECK_RET( m_freezeCount > 0, _T("thawing unfrozen list control?") ); - if ( !--m_freezeCount ) + if ( --m_freezeCount == 0 ) Refresh(); } @@ -2593,8 +2587,6 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) int dev_x, dev_y; CalcScrolledPosition( 0, 0, &dev_x, &dev_y ); - dc.BeginDrawing(); - dc.SetFont( GetFont() ); if ( InReportView() ) @@ -2702,8 +2694,6 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) } } #endif - - dc.EndDrawing(); } void wxListMainWindow::HighlightAll( bool on ) @@ -4683,10 +4673,10 @@ void wxGenericListCtrl::CalculateAndSetHeaderHeight() { m_headerHeight = h; - m_headerWin->SetSize(m_headerWin->GetSize().x, m_headerHeight); - if ( HasHeader() ) ResizeReportView(true); + else //why is this needed if it doesn't have a header? + m_headerWin->SetSize(m_headerWin->GetSize().x, m_headerHeight); } } } @@ -5301,7 +5291,12 @@ void wxGenericListCtrl::ResizeReportView(bool showHeader) if ( showHeader ) { m_headerWin->SetSize( 0, 0, cw, m_headerHeight ); - m_mainWin->SetSize( 0, m_headerHeight + 1, cw, ch - m_headerHeight - 1 ); + if(ch > m_headerHeight) + m_mainWin->SetSize( 0, m_headerHeight + 1, + cw, ch - m_headerHeight - 1 ); + else + m_mainWin->SetSize( 0, m_headerHeight + 1, + cw, 0); } else // no header window { @@ -5480,7 +5475,7 @@ int wxGenericListCtrl::OnGetItemColumnImage(long item, long column) const return OnGetItemImage(item); return -1; - +} wxListItemAttr * wxGenericListCtrl::OnGetItemAttr(long WXUNUSED_UNLESS_DEBUG(item)) const @@ -5540,7 +5535,6 @@ void wxGenericListCtrl::Refresh(bool eraseBackground, const wxRect *rect) rectHeader.Offset(-x, -y); m_headerWin->Refresh(eraseBackground, &rectHeader); } - } // Refresh the main window