]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/listctrl.cpp
better docs for wxDataViewColumn
[wxWidgets.git] / src / generic / listctrl.cpp
index 837a2900445a771d20615fabd025697d2b3bd2f0..4d861ceb277663bec31ca1332f91d4bfb1b574ef 100644 (file)
@@ -24,7 +24,6 @@
 #if wxUSE_LISTCTRL
 
 #include "wx/listctrl.h"
-#include "wx/generic/private/listctrl.h"
 
 #if ((!defined(__WXMSW__) && !(defined(__WXMAC__) && wxOSX_USE_CARBON)) || defined(__WXUNIVERSAL__))
     // if we have a native version, its implementation file does all this
@@ -49,6 +48,7 @@
 
 #include "wx/imaglist.h"
 #include "wx/renderer.h"
+#include "wx/generic/private/listctrl.h"
 
 #ifdef __WXMAC__
     #include "wx/osx/private.h"
@@ -4188,8 +4188,11 @@ void wxListMainWindow::OnScroll(wxScrollWinEvent& event)
         wxGenericListCtrl* lc = GetListCtrl();
         wxCHECK_RET( lc, _T("no listctrl window?") );
 
-        lc->m_headerWin->Refresh();
-        lc->m_headerWin->Update();
+        if (lc->m_headerWin) // when we use wxLC_NO_HEADER, m_headerWin==NULL
+        {
+            lc->m_headerWin->Refresh();
+            lc->m_headerWin->Update();
+        }
     }
 }
 
@@ -4213,7 +4216,7 @@ void wxListMainWindow::GetVisibleLinesRange(size_t *from, size_t *to)
         size_t count = GetItemCount();
         if ( count )
         {
-            m_lineFrom = GetScrollPos(wxVERTICAL);
+            m_lineFrom = GetListCtrl()->GetScrollPos(wxVERTICAL);
 
             // this may happen if SetScrollbars() hadn't been called yet
             if ( m_lineFrom >= count )
@@ -4871,15 +4874,14 @@ long wxGenericListCtrl::InsertItem( long index, const wxString &label, int image
 
 long wxGenericListCtrl::InsertColumn( long col, wxListItem &item )
 {
-    wxCHECK_MSG( m_headerWin, -1, _T("can't add column in non report mode") );
+    wxCHECK_MSG( InReportView(), -1, _T("can't add column in non report mode") );
 
     m_mainWin->InsertColumn( col, item );
 
-    // if we hadn't had a header before but have one now
-    // then we need to relayout the window
-    // if ( GetColumnCount() == 1 && m_mainWin->HasHeader() )
-
-    m_headerWin->Refresh();
+    // NOTE: if wxLC_NO_HEADER was given, then we are in report view mode but
+    //       still have m_headerWin==NULL
+    if (m_headerWin)
+        m_headerWin->Refresh();
 
     return 0;
 }