// 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 );
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;
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();
}
void wxListMainWindow::RefreshLine( size_t line )
{
- if ( HasFlag(wxLC_REPORT) )
+ if ( InReportView() )
{
size_t visibleFrom, visibleTo;
GetVisibleLinesRange(&visibleFrom, &visibleTo);
wxASSERT_MSG( lineTo < GetItemCount(), _T("invalid line range") );
- if ( HasFlag(wxLC_REPORT) )
+ if ( InReportView() )
{
size_t visibleFrom, visibleTo;
GetVisibleLinesRange(&visibleFrom, &visibleTo);
void wxListMainWindow::RefreshAfter( size_t lineFrom )
{
- if ( HasFlag(wxLC_REPORT) )
+ if ( InReportView() )
{
size_t visibleFrom, visibleTo;
GetVisibleLinesRange(&visibleFrom, &visibleTo);
dc.SetFont( GetFont() );
- if ( HasFlag(wxLC_REPORT) )
+ if ( InReportView() )
{
int lineHeight = GetLineHeight();
size_t count = GetItemCount(),
current;
- if ( HasFlag(wxLC_REPORT) )
+ if ( InReportView() )
{
current = y / GetLineHeight();
if ( current < count )
int view_x = SCROLL_UNIT_X*GetScrollPos( wxHORIZONTAL );
int view_y = hLine*GetScrollPos( wxVERTICAL );
- if ( HasFlag(wxLC_REPORT) )
+ if ( InReportView() )
{
// the next we need the range of lines shown it might be different, so
// recalculate it
case WXK_PRIOR:
{
- 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)
case WXK_NEXT:
{
- int steps = HasFlag(wxLC_REPORT)
+ int steps = InReportView()
? m_linesPerPage - 1
: m_linesPerPage - (m_current % m_linesPerPage) - 1;
break;
case WXK_LEFT:
- if ( !HasFlag(wxLC_REPORT) )
+ if ( !InReportView() )
{
int index = m_current - m_linesPerPage;
if (index < 0)
break;
case WXK_RIGHT:
- if ( !HasFlag(wxLC_REPORT) )
+ if ( !InReportView() )
{
size_t index = m_current + m_linesPerPage;
{
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->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 );
}
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;
const int lineHeight = GetLineHeight();
- if ( HasFlag(wxLC_REPORT) )
+ if ( InReportView() )
{
// all lines have the same height and we scroll one line per step
int entireHeight = count*lineHeight + LINE_SPACING;
size_t count = GetItemCount();
- if ( HasFlag(wxLC_REPORT) )
+ if ( InReportView() )
{
size_t current = y / GetLineHeight();
if ( current < count )
// this is unused variable
int mode = 0;
#endif
- if ( HasFlag(wxLC_REPORT) )
+ if ( InReportView() )
{
#if 0
// this is unused variable
void wxListMainWindow::InsertColumn( long col, wxListItem &item )
{
m_dirty = TRUE;
- if ( HasFlag(wxLC_REPORT) )
+ if ( InReportView() )
{
if (item.m_width == wxLIST_AUTOSIZE_USEHEADER)
item.m_width = GetTextLength( item.m_text );
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 )
{
m_headerWin->SetSize(m_headerWin->GetSize().x, m_headerHeight);
- if ( HasFlag(wxLC_REPORT) && !HasFlag(wxLC_NO_HEADER) )
+ if ( HasHeader() )
ResizeReportView(TRUE);
}
}
m_mainWin = new wxListMainWindow( this, -1, wxPoint(0,0), size, style );
- if ( HasFlag(wxLC_REPORT) )
+ if ( InReportView() )
{
CreateHeaderWindow();
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 )
{
// 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);
// 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);
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;
}