git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26010 
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
     bool SortItems( wxListCtrlCompare fn, long data );
     bool Update( long item );
 
     bool SortItems( wxListCtrlCompare fn, long data );
     bool Update( long item );
 
-    // returns true if it is a virtual list control
-    bool IsVirtual() const { return (GetWindowStyle() & wxLC_VIRTUAL) != 0; }
+    // are we in report mode?
+    bool InReportView() const { return HasFlag(wxLC_REPORT); }
+
+    // are we in virtual report mode?
+    bool IsVirtual() const { return HasFlag(wxLC_VIRTUAL); }
+
+    // do we have a header window?
+    bool HasHeader() const
+        { return InReportView() && !HasFlag(wxLC_NO_HEADER); }
 
     // refresh items selectively (only useful for virtual list controls)
     void RefreshItem(long item);
 
     // refresh items selectively (only useful for virtual list controls)
     void RefreshItem(long item);
 
     void SetImageList(wxImageList *imageList, int which) ;
     void AssignImageList(wxImageList *imageList, int which) ;
 
     void SetImageList(wxImageList *imageList, int which) ;
     void AssignImageList(wxImageList *imageList, int which) ;
 
-    // returns true if it is a virtual list control
-    bool IsVirtual() const { return (GetWindowStyle() & wxLC_VIRTUAL) != 0; }
+    // are we in report mode?
+    bool InReportView() const { return HasFlag(wxLC_REPORT); }
+
+    // are we in virtual report mode?
+    bool IsVirtual() const { return HasFlag(wxLC_VIRTUAL); }
 
     // refresh items selectively (only useful for virtual list controls)
     void RefreshItem(long item);
 
     // refresh items selectively (only useful for virtual list controls)
     void RefreshItem(long item);
 
 
     // do we have a header window?
     bool HasHeader() const
 
     // do we have a header window?
     bool HasHeader() const
-        { return HasFlag(wxLC_REPORT) && !HasFlag(wxLC_NO_HEADER); }
+        { return InReportView() && !HasFlag(wxLC_NO_HEADER); }
 
     void HighlightAll( bool on );
 
 
     void HighlightAll( bool on );
 
 
 bool wxListLineData::Highlight( bool on )
 {
 
 bool wxListLineData::Highlight( bool on )
 {
-    wxCHECK_MSG( !m_owner->IsVirtual(), FALSE, _T("unexpected call to Highlight") );
+    wxCHECK_MSG( !IsVirtual(), FALSE, _T("unexpected call to Highlight") );
 
     if ( on == m_highlighted )
         return FALSE;
 
     if ( on == m_highlighted )
         return FALSE;
 
 wxCoord wxListMainWindow::GetLineY(size_t line) const
 {
 
 wxCoord wxListMainWindow::GetLineY(size_t line) const
 {
-    wxASSERT_MSG( HasFlag(wxLC_REPORT), _T("only works in report mode") );
+    wxASSERT_MSG( InReportView(), _T("only works in report mode") );
 
     return LINE_SPACING + line*GetLineHeight();
 }
 
     return LINE_SPACING + line*GetLineHeight();
 }
 
 void wxListMainWindow::RefreshLine( size_t line )
 {
 
 void wxListMainWindow::RefreshLine( size_t line )
 {
-    if ( HasFlag(wxLC_REPORT) )
     {
         size_t visibleFrom, visibleTo;
         GetVisibleLinesRange(&visibleFrom, &visibleTo);
     {
         size_t visibleFrom, visibleTo;
         GetVisibleLinesRange(&visibleFrom, &visibleTo);
 
     wxASSERT_MSG( lineTo < GetItemCount(), _T("invalid line range") );
 
 
     wxASSERT_MSG( lineTo < GetItemCount(), _T("invalid line range") );
 
-    if ( HasFlag(wxLC_REPORT) )
     {
         size_t visibleFrom, visibleTo;
         GetVisibleLinesRange(&visibleFrom, &visibleTo);
     {
         size_t visibleFrom, visibleTo;
         GetVisibleLinesRange(&visibleFrom, &visibleTo);
 
 void wxListMainWindow::RefreshAfter( size_t lineFrom )
 {
 
 void wxListMainWindow::RefreshAfter( size_t lineFrom )
 {
-    if ( HasFlag(wxLC_REPORT) )
     {
         size_t visibleFrom, visibleTo;
         GetVisibleLinesRange(&visibleFrom, &visibleTo);
     {
         size_t visibleFrom, visibleTo;
         GetVisibleLinesRange(&visibleFrom, &visibleTo);
-    if ( HasFlag(wxLC_REPORT) )
     {
         int lineHeight = GetLineHeight();
 
     {
         int lineHeight = GetLineHeight();
 
     size_t count = GetItemCount(),
            current;
 
     size_t count = GetItemCount(),
            current;
 
-    if ( HasFlag(wxLC_REPORT) )
     {
         current = y / GetLineHeight();
         if ( current < count )
     {
         current = y / GetLineHeight();
         if ( current < count )
     int view_x = SCROLL_UNIT_X*GetScrollPos( wxHORIZONTAL );
     int view_y = hLine*GetScrollPos( wxVERTICAL );
 
     int view_x = SCROLL_UNIT_X*GetScrollPos( wxHORIZONTAL );
     int view_y = hLine*GetScrollPos( wxVERTICAL );
 
-    if ( HasFlag(wxLC_REPORT) )
     {
         // the next we need the range of lines shown it might be different, so
         // recalculate it
     {
         // the next we need the range of lines shown it might be different, so
         // recalculate it
-                int steps = HasFlag(wxLC_REPORT) ? m_linesPerPage - 1 : m_current % m_linesPerPage;
+                int steps = InReportView() ? m_linesPerPage - 1 : m_current % m_linesPerPage;
 
                 int index = m_current - steps;
                 if (index < 0)
 
                 int index = m_current - steps;
                 if (index < 0)
-                int steps = HasFlag(wxLC_REPORT)
+                int steps = InReportView()
                                ? m_linesPerPage - 1
                                : m_linesPerPage - (m_current % m_linesPerPage) - 1;
 
                                ? m_linesPerPage - 1
                                : m_linesPerPage - (m_current % m_linesPerPage) - 1;
 
-            if ( !HasFlag(wxLC_REPORT) )
             {
                 int index = m_current - m_linesPerPage;
                 if (index < 0)
             {
                 int index = m_current - m_linesPerPage;
                 if (index < 0)
-            if ( !HasFlag(wxLC_REPORT) )
             {
                 size_t index = m_current + m_linesPerPage;
 
             {
                 size_t index = m_current + m_linesPerPage;
 
     {
         m_small_image_list->Draw( index, *dc, x, y, wxIMAGELIST_DRAW_TRANSPARENT );
     }
     {
         m_small_image_list->Draw( index, *dc, x, y, wxIMAGELIST_DRAW_TRANSPARENT );
     }
-    else if ( HasFlag(wxLC_REPORT) && (m_small_image_list))
+    else if ( InReportView() && (m_small_image_list))
     {
         m_small_image_list->Draw( index, *dc, x, y, wxIMAGELIST_DRAW_TRANSPARENT );
     }
     {
         m_small_image_list->Draw( index, *dc, x, y, wxIMAGELIST_DRAW_TRANSPARENT );
     }
     {
         m_small_image_list->GetSize( index, width, height );
     }
     {
         m_small_image_list->GetSize( index, width, height );
     }
-    else if ( HasFlag(wxLC_REPORT) && m_small_image_list )
+    else if ( InReportView() && m_small_image_list )
     {
         m_small_image_list->GetSize( index, width, height );
     }
     {
         m_small_image_list->GetSize( index, width, height );
     }
     wxCHECK_RET( col >= 0 && col < GetColumnCount(),
                  _T("invalid column index") );
 
     wxCHECK_RET( col >= 0 && col < GetColumnCount(),
                  _T("invalid column index") );
 
-    wxCHECK_RET( HasFlag(wxLC_REPORT),
+    wxCHECK_RET( InReportView(),
                  _T("SetColumnWidth() can only be called in report mode.") );
 
     m_dirty = TRUE;
                  _T("SetColumnWidth() can only be called in report mode.") );
 
     m_dirty = TRUE;
 
     const int lineHeight = GetLineHeight();
 
 
     const int lineHeight = GetLineHeight();
 
-    if ( HasFlag(wxLC_REPORT) )
     {
         // all lines have the same height and we scroll one line per step
         int entireHeight = count*lineHeight + LINE_SPACING;
     {
         // all lines have the same height and we scroll one line per step
         int entireHeight = count*lineHeight + LINE_SPACING;
 
     size_t count = GetItemCount();
 
 
     size_t count = GetItemCount();
 
-    if ( HasFlag(wxLC_REPORT) )
     {
         size_t current = y / GetLineHeight();
         if ( current < count )
     {
         size_t current = y / GetLineHeight();
         if ( current < count )
     // this is unused variable
     int mode = 0;
     #endif
     // this is unused variable
     int mode = 0;
     #endif
-    if ( HasFlag(wxLC_REPORT) )
     {
         #if 0
         // this is unused variable
     {
         #if 0
         // this is unused variable
 void wxListMainWindow::InsertColumn( long col, wxListItem &item )
 {
     m_dirty = TRUE;
 void wxListMainWindow::InsertColumn( long col, wxListItem &item )
 {
     m_dirty = TRUE;
-    if ( HasFlag(wxLC_REPORT) )
     {
         if (item.m_width == wxLIST_AUTOSIZE_USEHEADER)
             item.m_width = GetTextLength( item.m_text );
     {
         if (item.m_width == wxLIST_AUTOSIZE_USEHEADER)
             item.m_width = GetTextLength( item.m_text );
 
 void wxListMainWindow::GetVisibleLinesRange(size_t *from, size_t *to)
 {
 
 void wxListMainWindow::GetVisibleLinesRange(size_t *from, size_t *to)
 {
-    wxASSERT_MSG( HasFlag(wxLC_REPORT), _T("this is for report mode only") );
+    wxASSERT_MSG( InReportView(), _T("this is for report mode only") );
 
     if ( m_lineFrom == (size_t)-1 )
     {
 
     if ( m_lineFrom == (size_t)-1 )
     {
 
             m_headerWin->SetSize(m_headerWin->GetSize().x, m_headerHeight);
 
 
             m_headerWin->SetSize(m_headerWin->GetSize().x, m_headerHeight);
 
-            if ( HasFlag(wxLC_REPORT) && !HasFlag(wxLC_NO_HEADER) )
                 ResizeReportView(TRUE);
         }
     }
                 ResizeReportView(TRUE);
         }
     }
 
     m_mainWin = new wxListMainWindow( this, -1, wxPoint(0,0), size, style );
 
 
     m_mainWin = new wxListMainWindow( this, -1, wxPoint(0,0), size, style );
 
-    if ( HasFlag(wxLC_REPORT) )
         m_mainWin->DeleteEverything();
 
         // has the header visibility changed?
         m_mainWin->DeleteEverything();
 
         // has the header visibility changed?
-        bool hasHeader = HasFlag(wxLC_REPORT) && !HasFlag(wxLC_NO_HEADER),
-             willHaveHeader = (flag & wxLC_REPORT) && !(flag & wxLC_NO_HEADER);
+        bool hasHeader = HasHeader();
+        bool willHaveHeader = (flag & wxLC_REPORT) && !(flag & wxLC_NO_HEADER);
 
         if ( hasHeader != willHaveHeader )
         {
 
         if ( hasHeader != willHaveHeader )
         {
 
 
     // for comctl32.dll v 4.70+ we want to have this attribute because it's
     // prettier (and also because wxGTK does it like this)
 
     // for comctl32.dll v 4.70+ we want to have this attribute because it's
     // prettier (and also because wxGTK does it like this)
-    if ( HasFlag(wxLC_REPORT) && wxTheApp->GetComCtl32Version() >= 470 )
+    if ( InReportView() && wxTheApp->GetComCtl32Version() >= 470 )
     {
         ::SendMessage(GetHwnd(), LVM_SETEXTENDEDLISTVIEWSTYLE,
                       0, LVS_EX_FULLROWSELECT);
     {
         ::SendMessage(GetHwnd(), LVM_SETEXTENDEDLISTVIEWSTYLE,
                       0, LVS_EX_FULLROWSELECT);
     // Reset the device origin since it may have been set
     dc.SetDeviceOrigin(0, 0);
 
     // Reset the device origin since it may have been set
     dc.SetDeviceOrigin(0, 0);
 
-    bool drawHRules = ((GetWindowStyle() & wxLC_HRULES) != 0);
-    bool drawVRules = ((GetWindowStyle() & wxLC_VRULES) != 0);
+    bool drawHRules = HasFlag(wxLC_HRULES);
+    bool drawVRules = HasFlag(wxLC_VRULES);
-    if (!drawHRules && !drawVRules)
-        return;
-    if ((GetWindowStyle() & wxLC_REPORT) == 0)
+    if (!InReportView() || !drawHRules && !drawVRules)
         return;
 
     wxPen pen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT), 1, wxSOLID);
         return;
 
     wxPen pen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT), 1, wxSOLID);
     if (info.m_mask & wxLIST_MASK_TEXT)
     {
         lvItem.mask |= LVIF_TEXT;
     if (info.m_mask & wxLIST_MASK_TEXT)
     {
         lvItem.mask |= LVIF_TEXT;
-        if ( ctrl->GetWindowStyleFlag() & wxLC_USER_TEXT )
+        if ( ctrl->HasFlag(wxLC_USER_TEXT) )
         {
             lvItem.pszText = LPSTR_TEXTCALLBACK;
         }
         {
             lvItem.pszText = LPSTR_TEXTCALLBACK;
         }