CGridListCtrlEx
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CGridRowTraitText Class Reference

CGridRowTraitText provides customization text and background at row-level. More...

Inheritance diagram for CGridRowTraitText:
CGridRowTrait CGridRowTraitXP

Public Member Functions

 CGridRowTraitText ()
 CGridRowTraitText - Constructor.
 
virtual void OnCustomDraw (CGridListCtrlEx &owner, NMLVCUSTOMDRAW *pLVCD, LRESULT *pResult)
 Overrides the custom draw handler, to allow custom coloring of rows. More...
 
void SetRowColor (COLORREF textColor, COLORREF backColor)
 Sets the same row coloring for all rows. More...
 
void SetAltRowColor (COLORREF textColor, COLORREF backColor)
 Activates alternate row coloring. More...
 
void SetInvertCellSelection (bool bValue)
 Should focus-cell in a selected row have the selection-color removed. More...
 
bool GetInvertCellSelection () const
 Get whether focus-cell in a selected row should have the selection-color removed. More...
 

Protected Member Functions

virtual bool UpdateTextColor (int nRow, COLORREF &textColor)
 Changes the text color if one is specified. More...
 
virtual bool UpdateBackColor (int nRow, COLORREF &backColor)
 Changes the background color if one is specified. More...
 
virtual void Accept (CGridRowTraitVisitor &visitor)
 Accept Visitor Pattern.
 

Protected Attributes

COLORREF m_TextColor
 Text color to use for this row.
 
COLORREF m_BackColor
 Background color to use for this row.
 
COLORREF m_AltTextColor
 Alternate text color to use for every second row.
 
COLORREF m_AltBackColor
 Alternate background color to use for every second row.
 
bool m_InvertCellSelection
 When cell has focus in column, then the selection color is removed.
 

Detailed Description

CGridRowTraitText provides customization text and background at row-level.

Member Function Documentation

bool CGridRowTraitText::GetInvertCellSelection ( ) const

Get whether focus-cell in a selected row should have the selection-color removed.

Returns
Enabled / Disabled
void CGridRowTraitText::OnCustomDraw ( CGridListCtrlEx owner,
NMLVCUSTOMDRAW *  pLVCD,
LRESULT *  pResult 
)
virtual

Overrides the custom draw handler, to allow custom coloring of rows.

  • Focus rectangle display
  • Use font size to increase row-height, but keep cell font-size
  • Alternate row coloring
Parameters
ownerThe list control drawing
pLVCDPointer to NMLVCUSTOMDRAW structure
pResultModification to the drawing stage (CDRF_NEWFONT, etc.)

Reimplemented from CGridRowTrait.

Reimplemented in CGridRowTraitXP.

void CGridRowTraitText::SetAltRowColor ( COLORREF  textColor,
COLORREF  backColor 
)

Activates alternate row coloring.

Parameters
backColorThe background color to use for every second row
textColorThe text color to use for every second row
void CGridRowTraitText::SetInvertCellSelection ( bool  bValue)

Should focus-cell in a selected row have the selection-color removed.

Parameters
bValueEnabled / Disabled
void CGridRowTraitText::SetRowColor ( COLORREF  textColor,
COLORREF  backColor 
)

Sets the same row coloring for all rows.

Parameters
backColorThe background color to use for all rows
textColorThe text color to use for all rows
bool CGridRowTraitText::UpdateBackColor ( int  nRow,
COLORREF &  backColor 
)
protectedvirtual

Changes the background color if one is specified.

Parameters
nRowThe index of the row
backColorCurrent background color
Returns
New background color was specified (true / false)
bool CGridRowTraitText::UpdateTextColor ( int  nRow,
COLORREF &  textColor 
)
protectedvirtual

Changes the text color if one is specified.

Parameters
nRowThe index of the row
textColorCurrent text color
Returns
New text color was specified (true / false)