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

CGridColumnTraitHyperLink that can launch a link using the web-browser. More...

Inheritance diagram for CGridColumnTraitHyperLink:
CGridColumnTraitImage CGridColumnTraitText CGridColumnTrait

Public Member Functions

 CGridColumnTraitHyperLink ()
 CGridColumnTraitHyperLink - Constructor.
 
void SetLinkColor (COLORREF linkColor)
 Set the standard link color. More...
 
COLORREF GetLinkColor () const
 Get the standard link color. More...
 
void SetLinkColorHot (COLORREF linkColor)
 Set the link color when mouse is over the cell. More...
 
COLORREF GetLinkColorHot () const
 Get the link color when mouse is over the cell. More...
 
void SetShellOperation (const CString &strShellOperation)
 Set the ShellExecute file operation to perform on the file-specifier. More...
 
CString GetShellOperation () const
 Get the ShellExecute file operation to perform on the file-specifier. More...
 
void SetShellApplication (const CString &strShellAppliction)
 Set the ShellExecute application to use to launch the file specifier. More...
 
CString GetShellApplication () const
 Get the ShellExecute application to use to launch the file specifier. More...
 
void SetShellFilePrefix (const CString &strShellFilePrefix)
 Set the file specifier prefix for the ShellExecute operation (Ex. More...
 
CString GetShellFilePrefix () const
 Get the file specifier prefix for the ShellExecute operation. More...
 
void SetShellFileSuffix (const CString &strShellFileSuffix)
 Set the file specifier suffix for the ShellExecute operation. More...
 
CString GetShellFileSuffix () const
 Get the file specifier suffix for the ShellExecute operation. More...
 
void SetShellShowCommand (INT nShellShowCommand)
 Set the show window flags for the ShellExecute operation. More...
 
INT GetShellShowCommand () const
 Get the show window flags for the ShellExecute operation. More...
 
- Public Member Functions inherited from CGridColumnTraitImage
 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.
 
ColumnStateGetColumnState ()
 
BOOL HasMetaFlag (DWORD flag)
 
void SetMetaFlag (DWORD flag, bool enable)
 

Protected Member Functions

virtual bool UpdateTextColor (NMLVCUSTOMDRAW *pLVCD, COLORREF &textColor)
 Changes the text color if one is specified. More...
 
virtual bool UpdateTextFont (NMLVCUSTOMDRAW *pLVCD, LOGFONT &textFont)
 Specifies af the font color if one is specified. More...
 
virtual CWnd * OnEditBegin (CGridListCtrlEx &owner, int nRow, int nCol)
 Overrides OnEditBegin() to launch ShellExecute when starting editor. 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 int OnClickEditStart (CGridListCtrlEx &owner, int nRow, int nCol, CPoint pt, bool bDblClick)
 Checks if the mouse click should start the cell editor (OnEditBegin) Validates that the click was on the text-link within the label-part. More...
 
virtual void OnShellExecute (CGridListCtrlEx &owner, int nRow, int nCol, const CString &cellText)
 Performs the ShellExecute operation on the given file specifier. More...
 
virtual CRect GetTextRect (CGridListCtrlEx &owner, int nRow, int nCol, const CString &cellText)
 Returns dimensions of the cell text clicked. More...
 
- Protected Member Functions inherited from CGridColumnTraitImage
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 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 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

COLORREF m_LinkColor
 Standard link Color.
 
COLORREF m_LinkColorHot
 Hot link color (mouse over)
 
CString m_ShellOperation
 ShellExecute operation (Ex. "open")
 
CString m_ShellApplication
 ShellExecute application (If blank it launches cell text with default application)
 
CString m_ShellFilePrefix
 ShellExecute file specifier prefix.
 
CString m_ShellFileSuffix
 ShellExecute file specifier suffix.
 
INT m_ShellShowCommand
 ShellExecute show application flags (Ex. SW_SHOWNORMAL)
 
- Protected Attributes inherited from CGridColumnTraitImage
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
 

Additional Inherited Members

- Static Public Member Functions inherited from CGridColumnTraitImage
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...
 

Detailed Description

CGridColumnTraitHyperLink that can launch a link using the web-browser.

Member Function Documentation

COLORREF CGridColumnTraitHyperLink::GetLinkColor ( ) const

Get the standard link color.

Returns
Link RGB Colors
COLORREF CGridColumnTraitHyperLink::GetLinkColorHot ( ) const

Get the link color when mouse is over the cell.

Returns
Link RGB Colors
CString CGridColumnTraitHyperLink::GetShellApplication ( ) const

Get the ShellExecute application to use to launch the file specifier.

Returns
Application path
CString CGridColumnTraitHyperLink::GetShellFilePrefix ( ) const

Get the file specifier prefix for the ShellExecute operation.

Returns
Prefix to insert infront of the filename specifier
CString CGridColumnTraitHyperLink::GetShellFileSuffix ( ) const

Get the file specifier suffix for the ShellExecute operation.

Returns
Suffix to append after the filename specifier
CString CGridColumnTraitHyperLink::GetShellOperation ( ) const

Get the ShellExecute file operation to perform on the file-specifier.

Returns
Link Action Name
INT CGridColumnTraitHyperLink::GetShellShowCommand ( ) const

Get the show window flags for the ShellExecute operation.

Returns
Show Command Flags
CRect CGridColumnTraitHyperLink::GetTextRect ( CGridListCtrlEx owner,
int  nRow,
int  nCol,
const CString &  cellText 
)
protectedvirtual

Returns dimensions of the cell text clicked.

Parameters
ownerThe list control being clicked
nRowThe index of the row
nColThe index of the column
cellTextThe contents of the cell clicked
Returns
The dimensions of the cell text
int CGridColumnTraitHyperLink::OnClickEditStart ( CGridListCtrlEx owner,
int  nRow,
int  nCol,
CPoint  pt,
bool  bDblClick 
)
protectedvirtual

Checks if the mouse click should start the cell editor (OnEditBegin) Validates that the click was on the text-link within the label-part.

Parameters
ownerThe list control being clicked
nRowThe index of the row
nColThe index of the column
ptThe position clicked, in client coordinates.
bDblClickWhether the position was double clicked
Returns
How should the cell editor be started (0 = No editor, 1 = Start Editor, 2 = Start Editor and block click-event)

Reimplemented from CGridColumnTraitImage.

CWnd * CGridColumnTraitHyperLink::OnEditBegin ( CGridListCtrlEx owner,
int  nRow,
int  nCol 
)
protectedvirtual

Overrides OnEditBegin() to launch ShellExecute when starting editor.

Parameters
ownerThe list control starting edit
nRowThe index of the row for the cell to edit
nColThe index of the column for the cell to edit
Returns
Pointer to the cell editor to use (NULL if cell edit is not possible)

Reimplemented from CGridColumnTraitImage.

virtual CWnd* CGridColumnTraitHyperLink::OnEditBegin ( CGridListCtrlEx owner,
int  nRow,
int  nCol,
CPoint  pt 
)
inlineprotectedvirtual

Overrides OnEditBegin() to allow special handling when clicking image or checkbox.

Parameters
ownerThe list control starting edit
nRowThe index of the row for the cell to edit
nColThe index of the column for the cell to edit
ptThe position clicked, in client coordinates.
Returns
Pointer to the cell editor to use (NULL if cell edit is not possible)

Reimplemented from CGridColumnTraitImage.

void CGridColumnTraitHyperLink::OnShellExecute ( CGridListCtrlEx owner,
int  nRow,
int  nCol,
const CString &  cellText 
)
protectedvirtual

Performs the ShellExecute operation on the given file specifier.

Parameters
ownerThe list control starting edit
nRowThe index of the row for the cell to edit
nColThe index of the column for the cell to edit
cellTextThe contents of the cell clicked
void CGridColumnTraitHyperLink::SetLinkColor ( COLORREF  linkColor)

Set the standard link color.

Parameters
linkColorLink RGB Colors
void CGridColumnTraitHyperLink::SetLinkColorHot ( COLORREF  linkColor)

Set the link color when mouse is over the cell.

Parameters
linkColorLink RGB Colors
void CGridColumnTraitHyperLink::SetShellApplication ( const CString &  strShellAppliction)

Set the ShellExecute application to use to launch the file specifier.

Parameters
strShellApplictionApplication path (If blank then it just uses the default handler for the file type)
void CGridColumnTraitHyperLink::SetShellFilePrefix ( const CString &  strShellFilePrefix)

Set the file specifier prefix for the ShellExecute operation (Ex.

protocol details like 'mailto:' or 'http://')

Parameters
strShellFilePrefixPrefix to insert infront of the file-sepecifier
void CGridColumnTraitHyperLink::SetShellFileSuffix ( const CString &  strShellFileSuffix)

Set the file specifier suffix for the ShellExecute operation.

Parameters
strShellFileSuffixFile operation to perform on the file-specifier
void CGridColumnTraitHyperLink::SetShellOperation ( const CString &  strShellOperation)

Set the ShellExecute file operation to perform on the file-specifier.

Parameters
strShellOperationLink Action Name
void CGridColumnTraitHyperLink::SetShellShowCommand ( INT  nShellShowCommand)

Set the show window flags for the ShellExecute operation.

Parameters
nShellShowCommandShow Command Flags
bool CGridColumnTraitHyperLink::UpdateTextColor ( NMLVCUSTOMDRAW *  pLVCD,
COLORREF &  textColor 
)
protectedvirtual

Changes the text color if one is specified.

Parameters
pLVCDPointer to NMLVCUSTOMDRAW structure
textColorCurrent text color
Returns
New text color was specified (true / false)

Reimplemented from CGridColumnTraitText.

bool CGridColumnTraitHyperLink::UpdateTextFont ( NMLVCUSTOMDRAW *  pLVCD,
LOGFONT &  textFont 
)
protectedvirtual

Specifies af the font color if one is specified.

Parameters
pLVCDPointer to NMLVCUSTOMDRAW structure
textFontNew font specification
Returns
New font was specified (true / false)

Reimplemented from CGridColumnTraitText.