CGridListCtrlEx
|
CGridColumnTraitImage implements an image switcher (can mimic a checkbox) More...
Public Member Functions | |
CGridColumnTraitImage () | |
CGridColumnTraitImage - Constructor. | |
CGridColumnTraitImage (int nImageIndex, int nImageCount) | |
CGridColumnTraitImage - Constructor. More... | |
void | AddImageIndex (int nImageIdx) |
Adds image index to the list of images to switch between. More... | |
void | AddImageIndex (int nImageIdx, const CString &strImageText, bool bEditable=true) |
Adds image index to the list of images to switch between. More... | |
void | SetImageText (int nImageIdx, const CString &strImageText, bool bEditable=true) |
Updates the image text for the specified image index. More... | |
void | SetSortImageIndex (bool bValue) |
Should primary sorting be based on the image index (checkbox sorting) More... | |
bool | GetSortImageIndex () const |
Get whether primary sorting is based on image index (checkbox sorting) More... | |
void | SetToggleSelection (bool bValue) |
Should images (checkboxes) be flipped for all selected rows, when icon is clicked. More... | |
bool | GetToggleSelection () const |
Get whether images (checkboxes) should be flipped for all selected rows, when icon is clicked. More... | |
void | SetSingleClickEdit (bool bValue) |
Should cell editor be launched on first mouse-click, or should it wait for cell to have focus first. More... | |
bool | GetSingleClickEdit () const |
Get whether editor should be launched on first mouse-click. More... | |
void | SetIconClickBeginEdit (bool bValue) |
Configure whether the icon-click should trigger OnBeginEdit. More... | |
bool | GetIconClickBeginEdit () const |
Get whether mouse-click on icon, should also perform OnBeginEdit. More... | |
Public Member Functions inherited from CGridColumnTraitText | |
CGridColumnTraitText () | |
CGridColumnTraitText - Constructor. | |
virtual void | OnCustomDraw (CGridListCtrlEx &owner, NMLVCUSTOMDRAW *pLVCD, LRESULT *pResult) |
Overrides the custom draw handler, to allow custom coloring of cells with this column trait. More... | |
void | SetSortFormatNumber (bool bValue) |
Should cell values be compared as numbers when sorting. More... | |
Public Member Functions inherited from CGridColumnTrait | |
virtual | ~CGridColumnTrait () |
Destructor. | |
virtual void | OnInsertColumn (CGridListCtrlEx &owner, int nCol) |
Override OnInsertColumn() to provide your own special styling of the column, after column has been added. More... | |
virtual void | OnEditEnd () |
Override OnEditEnd() in case one need to change state after a cell-edit. | |
ColumnState & | GetColumnState () |
BOOL | HasMetaFlag (DWORD flag) |
void | SetMetaFlag (DWORD flag, bool enable) |
Static Public Member Functions | |
static int | AppendStateImages (CGridListCtrlEx &owner, CImageList &imagelist) |
Appends the checkbox state images to the list control image list. More... | |
static LRESULT | SendEndLabelEdit (CWnd &wndListCtrl, int nRow, int nCol, LV_DISPINFO &dispInfo) |
Send LV_DISPINFO structure as LVN_ENDLABELEDIT from CListCtrl to parent window. More... | |
Protected Member Functions | |
virtual int | OnSortRows (LPCTSTR pszLeftValue, LPCTSTR pszRightValue, bool bAscending) |
Compares two cell values according to specified sort order. More... | |
virtual int | OnSortRows (const LVITEM &leftItem, const LVITEM &rightItem, bool bAscending) |
Compares two cell values according to checkbox state. More... | |
virtual bool | IsCellReadOnly (CGridListCtrlEx &owner, int nRow, int nCol, CPoint pt) const |
Check if current image index blocks for editing of cell label. More... | |
virtual int | OnClickEditStart (CGridListCtrlEx &owner, int nRow, int nCol, CPoint pt, bool bDblClick) |
Checks if the mouse click should start the cell editor (OnEditBegin) Normally the cell needs to have focus first before cell editor can be started. More... | |
virtual CWnd * | OnEditBegin (CGridListCtrlEx &owner, int nRow, int nCol) |
Override OnEditBegin() to provide your own special cell-edit control. More... | |
virtual CWnd * | OnEditBegin (CGridListCtrlEx &owner, int nRow, int nCol, CPoint pt) |
Overrides OnEditBegin() to allow special handling when clicking image or checkbox. More... | |
virtual void | Accept (CGridColumnTraitVisitor &visitor) |
Accept Visitor Pattern. | |
virtual int | FlipImageIndex (CGridListCtrlEx &owner, int nRow, int nCol) |
Switch to the next image index. More... | |
virtual CWnd * | OnEditBeginImage (CGridListCtrlEx &owner, int nRow, int nCol) |
Reacts to clicking on the image, and allows all selected rows to be flipped. More... | |
virtual CWnd * | OnEditBeginCheckbox (CGridListCtrlEx &owner, int nRow, int nCol) |
Reacts to clicking on the checkbox, and allows all selected rows to be flipped. More... | |
Protected Member Functions inherited from CGridColumnTraitText | |
virtual bool | UpdateTextFont (NMLVCUSTOMDRAW *pLVCD, LOGFONT &textFont) |
Specifies af the font color if one is specified. More... | |
virtual bool | UpdateTextColor (NMLVCUSTOMDRAW *pLVCD, COLORREF &textColor) |
Changes the text color if one is specified. More... | |
virtual bool | UpdateBackColor (NMLVCUSTOMDRAW *pLVCD, COLORREF &backColor) |
Changes the background color if one is specified. More... | |
virtual int | GetCellFontHeight (CGridListCtrlEx &owner) |
Calculates the proper row-height according to font, which a cell value editor should fit in. More... | |
virtual CRect | GetCellEditRect (CGridListCtrlEx &owner, int nRow, int nCol) |
Returns the proper rectangle, which a cell value editor should fit in. More... | |
Protected Attributes | |
CSimpleMap< int, CString > | m_ImageCellText |
Fixed list of image items to switch between. | |
CSimpleMap< int, bool > | m_ImageCellEdit |
Fixed list of image items to switch between. | |
bool | m_SortImageIndex |
Should image be used as primary sort index ? | |
bool | m_ToggleSelection |
Should the image of all selected rows be flipped, when clicked ? | |
bool | m_SingleClickEdit |
Should it start editor on first click, instead of first waiting for cell to have focus first. | |
bool | m_IconClickBeginEdit |
Should it start editor when clicking the icon area ? | |
Protected Attributes inherited from CGridColumnTraitText | |
CFont * | m_pOldFont |
Backup of the original font while drawing with specified font. | |
COLORREF | m_OldTextColor |
Backup of the original text color while drawing with specified color. | |
COLORREF | m_OldBackColor |
Backup of the original background color while drawing with specified color. | |
COLORREF | m_TextColor |
Text color to use for this column. | |
COLORREF | m_BackColor |
Background color to use for this column. | |
bool | m_SortFormatNumber |
Column contains integers. | |
Protected Attributes inherited from CGridColumnTrait | |
ColumnState | m_ColumnState |
CGridColumnTraitImage implements an image switcher (can mimic a checkbox)
By adding checkbox state-images to the official imagelist using AppendStateImages(), then one can use this column trait as checkbox editor. To get/set the checkbox value of a cell use the methods GetCellImage()/SetCellImage() on CGridListCtrlEx
CGridColumnTraitImage::CGridColumnTraitImage | ( | int | nImageIndex, |
int | nImageCount | ||
) |
CGridColumnTraitImage - Constructor.
nImageIndex | The first index in list control imagelist |
nImageCount | The number of images to switch between in the imagelist |
void CGridColumnTraitImage::AddImageIndex | ( | int | nImageIdx | ) |
Adds image index to the list of images to switch between.
nImageIdx | The index of the image in the list control imagelist |
void CGridColumnTraitImage::AddImageIndex | ( | int | nImageIdx, |
const CString & | strImageText, | ||
bool | bEditable = true |
||
) |
Adds image index to the list of images to switch between.
nImageIdx | The index of the image in the list control imagelist |
strImageText | The associated cell text to the image |
bEditable | Is the cell editable when this image is displayed |
|
static |
Appends the checkbox state images to the list control image list.
owner | The list control adding column |
imagelist | The image list assigned to the list control |
|
protectedvirtual |
Switch to the next image index.
owner | The list control starting edit |
nRow | The index of the row for the cell to edit |
nCol | The index of the column for the cell to edit |
bool CGridColumnTraitImage::GetIconClickBeginEdit | ( | ) | const |
Get whether mouse-click on icon, should also perform OnBeginEdit.
bool CGridColumnTraitImage::GetSingleClickEdit | ( | ) | const |
Get whether editor should be launched on first mouse-click.
bool CGridColumnTraitImage::GetSortImageIndex | ( | ) | const |
Get whether primary sorting is based on image index (checkbox sorting)
bool CGridColumnTraitImage::GetToggleSelection | ( | ) | const |
Get whether images (checkboxes) should be flipped for all selected rows, when icon is clicked.
|
protectedvirtual |
Check if current image index blocks for editing of cell label.
owner | The list control starting edit |
nRow | The index of the row for the cell |
nCol | The index of the column for the cell |
pt | The position clicked, in client coordinates. |
Reimplemented from CGridColumnTrait.
|
protectedvirtual |
Checks if the mouse click should start the cell editor (OnEditBegin) Normally the cell needs to have focus first before cell editor can be started.
owner | The list control being clicked |
nRow | The index of the row |
nCol | The index of the column |
pt | The position clicked, in client coordinates. |
bDblClick | Whether the position was double clicked |
Reimplemented from CGridColumnTrait.
Reimplemented in CGridColumnTraitHyperLink.
|
inlineprotectedvirtual |
Override OnEditBegin() to provide your own special cell-edit control.
owner | The list control starting edit |
nRow | The index of the row for the cell to edit |
nCol | The index of the column for the cell to edit |
Reimplemented from CGridColumnTrait.
Reimplemented in CGridColumnTraitHyperLink, CGridColumnTraitCombo, CGridColumnTraitDateTime, and CGridColumnTraitEdit.
|
protectedvirtual |
Overrides OnEditBegin() to allow special handling when clicking image or checkbox.
owner | The list control starting edit |
nRow | The index of the row for the cell to edit |
nCol | The index of the column for the cell to edit |
pt | The position clicked, in client coordinates. |
Reimplemented from CGridColumnTrait.
Reimplemented in CGridColumnTraitHyperLink, CGridColumnTraitCombo, CGridColumnTraitDateTime, and CGridColumnTraitEdit.
|
protectedvirtual |
Reacts to clicking on the checkbox, and allows all selected rows to be flipped.
owner | The list control starting edit |
nRow | The index of the row for the cell to edit |
nCol | The index of the column for the cell to edit |
|
protectedvirtual |
Reacts to clicking on the image, and allows all selected rows to be flipped.
owner | The list control starting edit |
nRow | The index of the row for the cell to edit |
nCol | The index of the column for the cell to edit |
|
inlineprotectedvirtual |
Compares two cell values according to specified sort order.
pszLeftValue | Left cell value |
pszRightValue | Right cell value |
bAscending | Perform sorting in ascending or descending order |
Reimplemented from CGridColumnTraitText.
Reimplemented in CGridColumnTraitDateTime.
|
protectedvirtual |
Compares two cell values according to checkbox state.
leftItem | Left cell item |
rightItem | Right cell item |
bAscending | Perform sorting in ascending or descending order |
Reimplemented from CGridColumnTraitText.
Reimplemented in CGridColumnTraitDateTime.
|
static |
Send LV_DISPINFO structure as LVN_ENDLABELEDIT from CListCtrl to parent window.
wndListCtrl | The list control starting edit |
nRow | The index of the row |
nCol | The index of the column |
lvDispInfo | Specifies the properties of the new cell value |
void CGridColumnTraitImage::SetIconClickBeginEdit | ( | bool | bValue | ) |
Configure whether the icon-click should trigger OnBeginEdit.
bValue | Enabled / Disabled |
void CGridColumnTraitImage::SetImageText | ( | int | nImageIdx, |
const CString & | strImageText, | ||
bool | bEditable = true |
||
) |
Updates the image text for the specified image index.
nImageIdx | The index of the image in the list control imagelist |
strImageText | The associated cell text to the image |
bEditable | Is the cell editable when this image is displayed |
void CGridColumnTraitImage::SetSingleClickEdit | ( | bool | bValue | ) |
Should cell editor be launched on first mouse-click, or should it wait for cell to have focus first.
bValue | Enabled / Disabled |
void CGridColumnTraitImage::SetSortImageIndex | ( | bool | bValue | ) |
Should primary sorting be based on the image index (checkbox sorting)
bValue | Enabled / Disabled |
void CGridColumnTraitImage::SetToggleSelection | ( | bool | bValue | ) |
Should images (checkboxes) be flipped for all selected rows, when icon is clicked.
bValue | Enabled / Disabled |