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

CGridListCtrlGroups extends the CGridListCtrlEx with grouping. More...

Inheritance diagram for CGridListCtrlGroups:
CGridListCtrlEx

Public Member Functions

 CGridListCtrlGroups ()
 Constructor.
 
virtual LRESULT InsertGroupHeader (int nIndex, int nGroupId, const CString &strHeader, DWORD dwState=0, DWORD dwAlign=0)
 Inserts a group into the list view control. More...
 
virtual CString GetGroupHeader (int nGroupId)
 Retrieves the group header title of a group. More...
 
virtual int GetRowGroupId (int nRow)
 Retrieves the group id of a row. More...
 
virtual BOOL SetRowGroupId (int nRow, int nGroupId)
 Moves a row into a group. More...
 
virtual int GroupHitTest (const CPoint &point)
 Find the group-id below the given point. More...
 
virtual int FixRowGroupId (int nRow)
 Finds the matching group-id for the row, based on current grouping If it cannot find a group-id, then it creates a new group. More...
 
virtual BOOL GetGroupIds (CSimpleArray< int > &groupIds)
 Find all registered group-ids. More...
 
virtual BOOL GroupByColumn (int nCol)
 Create a group for each unique values within a column. More...
 
virtual BOOL DeleteEntireGroup (int nGroupId)
 Removes the group and all the rows part of the group. More...
 
virtual BOOL FilterByCellText (int nCol, const CString &strNeedle, const CString &strGroupName)
 Create a group that contains all rows where column matches the provided text. More...
 
virtual BOOL IsGroupStateEnabled ()
 Checks if it is possible to modify the collapse state of a group. More...
 
virtual void CheckEntireGroup (int nGroupId, bool bChecked)
 Update the checkbox of the label column (first column) More...
 
virtual void SetSortSecondaryGroupView (int nEnable)
 Configure whether sorting on secondary column is allowed when grouped by primary column. More...
 
virtual bool SortColumn (int nCol, bool bAscending)
 Changes the row sorting in regard to the specified column. More...
 
virtual BOOL HasGroupState (int nGroupId, DWORD dwState)
 Checks whether a group has a certain state. More...
 
virtual BOOL SetGroupState (int nGroupId, DWORD dwState)
 Updates the state of a group. More...
 
virtual BOOL CollapseAllGroups ()
 Collapse all groups.
 
virtual BOOL ExpandAllGroups ()
 Expand all groups.
 
virtual BOOL SetGroupFooter (int nGroupId, const CString &strFooter, DWORD dwAlign=0)
 Update the description text of the group footer. More...
 
virtual BOOL SetGroupTask (int nGroupId, const CString &strTask)
 Update the task link of the group header. More...
 
virtual BOOL SetGroupSubtitle (int nGroupId, const CString &strSubtitle)
 Update the subtitle in the group header. More...
 
virtual BOOL SetGroupTitleImage (int nGroupId, int nImage, const CString &strTopDesc, const CString &strBottomDesc)
 Update the image icon in the group header together with top and bottom description. More...
 
virtual bool OnDisplayCellGroup (int nRow, int nCol, int &nGroupId)
 Override this method to provide the group a cell belongs to. More...
 
- Public Member Functions inherited from CGridListCtrlEx
virtual ~CGridListCtrlEx ()
 Destructor.
 
LRESULT EnableVisualStyles (bool bValue)
 Activate visual style for the list control (Vista Theme) More...
 
bool UsingVisualStyle () const
 
virtual CFont * GetCellFont ()
 Retrieves the font used to draw cells in the list control. More...
 
virtual void SetCellMargin (double margin)
 Takes the current font and increases the font with the given margin multiplier. More...
 
void SetEmptyMarkupText (const CString &strText)
 Update the markup text displayed when the list control is empty. More...
 
void SetTooltipMaxWidth (int width)
 
int GetTooltipMaxWidth () const
 
int GetFocusRow () const
 Retrieve row with the LVIS_FOCUSED state flag set. More...
 
void SetFocusRow (int nRow)
 Sets LVIS_FOCUSED state flag for the specified row. More...
 
bool IsRowSelected (int nRow) const
 Checks if the LVIS_SELECTED state flag set for the specified row. More...
 
BOOL SelectRow (int nRow, bool bSelect)
 Sets the LVIS_SELECTED state flag for the specified row. More...
 
virtual CGridRowTraitGetRowTrait (int nRow)
 Retrieves the row trait for the specified row. More...
 
virtual void SetDefaultRowTrait (CGridRowTrait *pRowTrait)
 Sets the default row trait used by default for drawing rows. More...
 
const CHeaderCtrl * GetHeaderCtrl () const
 Retrieves the header control of a list control. More...
 
CHeaderCtrl * GetHeaderCtrl ()
 
int GetColumnCount () const
 Retrieves the number of columns from the header control. More...
 
int GetColumnData (int nCol) const
 The column version of GetItemData(), one can specify an unique identifier when using InsertColumn() More...
 
int GetColumnOrder (int nCol) const
 Get column position in the CHeaderCtrl's display order array. More...
 
CString GetColumnHeading (int nCol) const
 Retrieve column title of a column in the list control NOTE! It will only return the first 255 characters of the header. More...
 
virtual BOOL EnsureColumnVisible (int nCol, bool bPartialOK)
 Scrolls the view, so the column becomes visible. More...
 
virtual BOOL SetColumnWidthAuto (int nCol=-1, bool bIncludeHeader=false)
 Resizes the width of a column according the contents of the cells below. More...
 
virtual void SetSortArrow (int nCol, bool bAscending)
 Puts a sort-icon in the column header of the specified column. More...
 
virtual BOOL ShowColumn (int nCol, bool bShow)
 Changes the visible state of column. More...
 
virtual bool IsColumnVisible (int nCol)
 Retrieves the column visible state from the column trait. More...
 
virtual bool IsColumnResizable (int nCol)
 Checks if a column is allowed to be resized. More...
 
virtual bool IsColumnAlwaysVisible (int nCol)
 Checks if a column is fixed to be always visible. More...
 
virtual bool IsColumnAlwaysHidden (int nCol)
 Checks if a column is fixed to be always hidden. More...
 
virtual int GetFirstVisibleColumn ()
 Retrieves the column index of the first visible column. More...
 
virtual int InsertHiddenLabelColumn ()
 Inserts the label column (first column) with invisible state The label column behaves differently from the rest of the columns, and to get the uniform look, then it should be hidden away. More...
 
virtual int InsertColumnTrait (int nCol, const CString &strColumnHeading, int nFormat=LVCFMT_LEFT, int nWidth=-1, int nSubItem=-1, CGridColumnTrait *pTrait=NULL)
 Inserts a new column in the list control, and gives the option to customize the column using a trait. More...
 
virtual CGridColumnTraitGetColumnTrait (int nCol)
 Retrieves the column trait for the entire column. More...
 
virtual int GetColumnTraitSize () const
 Retrieves the number of column traits registered. More...
 
UINT CellHitTest (const CPoint &pt, int &nRow, int &nCol) const
 Replicates the SubItemHitTest() but in a const version. More...
 
BOOL GetCellRect (int nRow, int nCol, int nCode, CRect &rect)
 Improved version of GetSubItemRect(). More...
 
int GetFocusCell () const
 
virtual void SetFocusCell (int nCol, bool bRedraw=false)
 Changes the focus cell. More...
 
virtual CWnd * EditCell (int nRow, int nCol)
 Starts the edit of a cell and sends a message to the parent window. More...
 
virtual CWnd * EditCell (int nRow, int nCol, CPoint pt)
 Starts the edit of a cell and sends a message to the parent window. More...
 
bool IsCellEditorOpen () const
 Checks if the cell value editor is open for a cell. More...
 
bool IsCellCallback (int nRow, int nCol) const
 Checks if the current cell is using callback to retrieve its text value. More...
 
int GetCellImage (int nRow, int nCol) const
 Retrieves the icon index of the specified cell. More...
 
BOOL SetCellImage (int nRow, int nCol, int nImageId)
 Sets the icon of the specified cell. More...
 
virtual CGridColumnTraitGetCellColumnTrait (int nRow, int nCol)
 Retrieves the column trait of a specified cell. More...
 
virtual void SetupColumnConfig (CViewConfigSectionProfiles *pColumnConfig, bool bConfigOwner=true)
 Sets the interface for handling state persistence for the list control. More...
 
virtual void LoadState (CViewConfigSection &config)
 Loads and applies the column configuration for the list control. More...
 
virtual void SaveState (CViewConfigSection &config)
 Saves the column configuration of the list control. More...
 
virtual void LoadColumnState (int nConfigCol, int nOwnerCol, CViewConfigSection &config)
 Loads the column state of a single column. More...
 
virtual void SaveColumnState (int nConfigCol, int nOwnerCol, CViewConfigSection &config)
 Saves the column state of a single column. More...
 
virtual bool HasColumnEditor (int nCol, CString &strTitle)
 Is there a column configuration editor available for this column ? More...
 
virtual void OpenColumnEditor (int nCol)
 Open the column configuration editor for the column (If one available) More...
 
virtual bool HasColumnPicker (CString &strTitle)
 Is there a column picker available that can add / remove columns. More...
 
virtual void OpenColumnPicker ()
 Open the column picker for the list control.
 
virtual bool HasColumnDefaultState (CString &strTitle)
 Has the ability to reset the column configuration to its default configuration. More...
 
virtual void ResetColumnDefaultState ()
 Reset the column configuration to its default configuration.
 
virtual CString HasColumnProfiles (CSimpleArray< CString > &profiles, CString &strTitle)
 Can switch between multiple column configurations. More...
 
virtual void SwichColumnProfile (const CString &strProfile)
 Switch to different column configurations profile. More...
 
virtual void OnSaveStateColumnPick ()
 Called after a column has been added / removed.
 
virtual void OnSaveStateColumnResize ()
 Called after a column has been resized.
 
virtual void OnSaveStateKillFocus ()
 Called when the list control looses focus to another control.
 
virtual void OnDisplayCellItem (LVITEM &lvi)
 Override this method to provide text string and image index when drawing cells. More...
 
virtual bool OnDisplayCellText (int nRow, int nCol, CString &strResult)
 Override this method to provide text string when drawing cells Only called when using LPSTR_TEXTCALLBACK with CListCtrl::SetItemText() More...
 
virtual bool OnDisplayCellImage (int nRow, int nCol, int &nImageId)
 Override this method to provide icon index when drawing cells Only called when using I_IMAGECALLBACK with SetCellImage() More...
 
virtual bool OnDisplayCellTooltip (const CPoint &point) const
 Override this method if wanting to specify whether a tooltip is available. More...
 
virtual bool OnDisplayColumnTooltip (int nCol, CString &strResult) const
 Override this method to display a custom tooltip text when holding the mouse over a column header. More...
 
virtual bool OnDisplayCellTooltip (int nRow, int nCol, CString &strResult)
 Override this method to display a custom tooltip text when holding the mouse over a cell. More...
 
virtual bool OnDisplayCellColor (NMLVCUSTOMDRAW *pLVCD)
 Override this method to change the colors used for drawing a cell. More...
 
virtual bool OnDisplayCellColor (int nRow, int nCol, COLORREF &textColor, COLORREF &backColor)
 Override this method to change the colors used for drawing a cell. More...
 
virtual bool OnDisplayCellFont (NMLVCUSTOMDRAW *pLVCD, LOGFONT &font)
 Override this method to change the font used for drawing a cell. More...
 
virtual bool OnDisplayCellFont (int nRow, int nCol, LOGFONT &font)
 Override this method to change the font used for drawing a cell. More...
 
virtual bool OnDisplayRowColor (int nRow, COLORREF &textColor, COLORREF &backColor)
 Override this method to change the color used for drawing a row. More...
 
virtual bool OnDisplayRowFont (int nRow, LOGFONT &font)
 Override this method to change the font used for drawing a row. More...
 
virtual void OnDisplayDragOverRow (int nRow)
 Override this method to react to mouse over event during drag drop. More...
 
virtual bool OnDisplayToClipboard (CString &strResult, bool includeHeader=true)
 Override this method to control what is placed in the global clipboard. More...
 
virtual bool OnDisplayToClipboard (int nRow, CString &strResult)
 Override this method to control what to place in the clipboard for a single row. More...
 
virtual bool OnDisplayToClipboard (int nRow, int nCol, CString &strResult)
 Override this method to control what to place in the clipboard for a single cell. More...
 
virtual bool OnDisplayToDragDrop (CString &strResult)
 Override this method to control what data is selected for drag drop operation. More...
 
virtual bool OnOwnerDataDisplayCheckbox (int nRow)
 Override this method to display checkbox state for LVS_OWNERDATA (virtual list). More...
 
virtual void OnOwnerDataToggleCheckBox (int nRow, bool bChecked)
 Override this method to react to check box being toggled for LVS_OWNERDATA (virtual list). More...
 
virtual int OnKeyboardSearch (int nCol, int nStartRow, const CString &strSearch)
 Override this method to optimize the keyboard search for LVS_OWNERDATA (virtual list) More...
 

Protected Member Functions

virtual void OnContextMenuGrid (CWnd *pWnd, CPoint point)
 Override this method to change the context menu when activating context menu in client area with no rows. More...
 
virtual void OnContextMenuHeader (CWnd *pWnd, CPoint point, int nCol)
 Override this method to change the context menu when activating context menu for the column headers. More...
 
virtual void OnContextMenuGroup (CWnd *pWnd, CPoint point, int nGroupId)
 Override this method to change the context menu when activating context menu for the group headers. More...
 
virtual void OnContextMenuCell (CWnd *pWnd, CPoint point, int nRow, int nCol)
 Override this method to change the context menu when activating context menu for a single cell. More...
 
virtual BOOL OnDropSelf (COleDataObject *pDataObject, DROPEFFECT dropEffect, CPoint point)
 Called by the framework when a drop operation is to occur, where the origin is the CGridListCtrlEx itself. More...
 
virtual bool MoveSelectedRows (int nGroupId)
 Moves the selected rows to the specified group. More...
 
virtual bool OnFilterSingleCellText (int nRow, int nFilterCol, const CString &strNeedle)
 Check if row-item should be included in the filter-group, that matches the needle. More...
 
virtual afx_msg void OnContextMenu (CWnd *, CPoint point)
 WM_CONTEXTMENU message handler to show popup menu when mouse right click is used (or SHIFT+F10 on the keyboard) More...
 
virtual afx_msg BOOL OnGroupTaskClick (NMHDR *pNMHDR, LRESULT *pResult)
 LVN_LINKCLICK message handler called when a group task link is clicked. More...
 
virtual afx_msg void OnLButtonDblClk (UINT nFlags, CPoint point)
 The framework calls this member function when the user double-clicks the left mouse button. More...
 
virtual afx_msg BOOL OnGetDispInfo (NMHDR *pNMHDR, LRESULT *pResult)
 LVN_GETDISPINFO message handler, which is called when details are needed for an item that specifies callback. More...
 
virtual afx_msg BOOL OnGetEmptyMarkup (NMHDR *pNMHDR, LRESULT *pResult)
 LVN_GETEMPTYMARKUP message handler to show markup text when the list control is empty. More...
 
virtual afx_msg void OnDestroy ()
 Notify that the window has been destroyed.
 
virtual afx_msg void OnPaint ()
 WM_PAINT message handler called when needing to redraw list control. More...
 
virtual afx_msg LRESULT OnRemoveAllGroups (WPARAM wParam, LPARAM lParam)
 LVM_REMOVEALLGROUPS message handler to ensure that group by column is updated. More...
 
virtual afx_msg BOOL OnHeaderEndDrag (UINT, NMHDR *pNmhdr, LRESULT *pResult)
 HDN_ENDDRAG message handler called after a column have been dragged, but before the column order has been updated. More...
 
 DECLARE_MESSAGE_MAP ()
 
- Protected Member Functions inherited from CGridListCtrlEx
virtual void InsertColumnTrait (int nCol, CGridColumnTrait *pTrait)
 Internal maintenance function for the column trait container. More...
 
virtual void DeleteColumnTrait (int nCol)
 Internal maintenance function for the column trait container. More...
 
int InternalColumnPicker (CMenu &menu, UINT offset)
 Internal method to add all available columns to the context menu. More...
 
int InternalColumnProfileSwitcher (CMenu &menu, UINT offset, CSimpleArray< CString > &profiles)
 Internal method to add all available column profiles to the context menu. More...
 
virtual void MoveFocusCell (bool bMoveRight)
 Shifts the cell focus left or right in the same row. More...
 
virtual BOOL RegisterDropTarget ()
 Registers the CListCtrl as a valid OLE drag drop target. More...
 
virtual DROPEFFECT DoDragDrop (COleDataSource &oleDataSource, COleDropSource *pDropSource=NULL, DWORD dropEffects=DROPEFFECT_COPY|DROPEFFECT_MOVE|DROPEFFECT_LINK, LPCRECT lpRectStartDrag=NULL)
 Takes the contents of the selected rows, and starts a drag-drop operation. More...
 
virtual DROPEFFECT OnDragEnter (COleDataObject *pDataObject, DWORD dwKeyState, CPoint point)
 Called by the framework when the cursor is first dragged into the window. More...
 
virtual DROPEFFECT OnDragOver (COleDataObject *pDataObject, DWORD dwKeyState, CPoint point)
 Called by the framework when the cursor is dragged over the window. More...
 
virtual SCODE OnDragGiveFeedback (DROPEFFECT dropEffect)
 Called by the framework during drag-drop operation, and allows one to give visual feedback to the end user during a drag-and-drop operation. More...
 
virtual void OnDragLeave ()
 Called by the framework when the cursor leaves the window while a dragging operation is in effect.
 
virtual BOOL OnDrop (COleDataObject *pDataObject, DROPEFFECT dropEffect, CPoint point)
 Called by the framework when a drop operation is to occur. More...
 
virtual BOOL OnDropExternal (COleDataObject *pDataObject, DROPEFFECT dropEffect, CPoint point)
 Called by the framework when a drop operation is to occur, where the origin is an external source. More...
 
virtual void OnCustomDrawRow (int nRow, NMLVCUSTOMDRAW *pLVCD, LRESULT *pResult)
 Performs custom drawing of the CListCtrl using CGridRowTrait. More...
 
virtual void OnCustomDrawCell (int nRow, int nCol, NMLVCUSTOMDRAW *pLVCD, LRESULT *pResult)
 Performs custom drawing of the CListCtrl using CGridColumnTrait. More...
 
virtual int OnClickEditStart (int nRow, int nCol, CPoint pt, bool bDblClick)
 Override this method to control whether cell edit should be started when clicked with the mouse. More...
 
virtual CWnd * OnEditBegin (int nRow, int nCol)
 Override this method to control whether cell editing is allowed for a cell. More...
 
virtual CWnd * OnEditBegin (int nRow, int nCol, CPoint pt)
 Override this method to control whether cell editing is allowed for a cell. More...
 
virtual bool OnEditComplete (int nRow, int nCol, CWnd *pEditor, LV_DISPINFO *pLVDI)
 Override this method to validate the new value after a cell edit. More...
 
virtual void OnContextMenuKeyboard (CWnd *pWnd, CPoint point)
 Override this method to change the context menu when using the keyboard shortcut SHIFT+F10. More...
 
virtual void OnCreateStyle ()
 Configures the initial style of the list control when the it is created.
 
virtual void OnCopyToClipboard ()
 Copies the contents of the selected rows into the global clipboard.
 
virtual void PreSubclassWindow ()
 Normally used for subclassing controls, but here used to configure initial style when list control is created. More...
 
virtual int OnToolHitTest (CPoint point, TOOLINFO *pTI) const
 Called by the MFC framework during mouse over to detemine whether a point is in the bounding rectangle of the specified tool. More...
 
virtual afx_msg int OnCreate (LPCREATESTRUCT lpCreateStruct)
 WM_CREATE message handler. More...
 
virtual afx_msg LRESULT OnDeleteColumn (WPARAM wParam, LPARAM lParam)
 LVM_DELETECOLUMN message handler to ensure the column trait container is updated when columns are removed. More...
 
virtual afx_msg LRESULT OnInsertColumn (WPARAM wParam, LPARAM lParam)
 LVM_INSERTCOLUMN message handler to ensure the column trait container is updated when columns are inserted. More...
 
virtual afx_msg BOOL OnItemClick (NMHDR *pNMHDR, LRESULT *pResult)
 NM_CLICK message handler called when left-clicking in a cell. More...
 
virtual afx_msg BOOL OnItemDblClick (NMHDR *pNMHDR, LRESULT *pResult)
 NM_DBLCLK message handler called when double-clicking in a cell. More...
 
virtual afx_msg void OnChar (UINT nChar, UINT nRepCnt, UINT nFlags)
 WM_CHAR message handler for performing keyboard search with subitems. More...
 
virtual afx_msg void OnKeyDown (UINT nChar, UINT nRepCnt, UINT nFlags)
 WM_KEYDOWN message handler for performing keyboard navigation. More...
 
virtual afx_msg void OnLButtonDown (UINT nFlags, CPoint point)
 WM_LBUTTONDOWN message handler called when the user presses the left mouse button while the cursor is in the client area of a window. More...
 
virtual afx_msg void OnRButtonDown (UINT nFlags, CPoint point)
 WM_RBUTTONDOWN message handler called when the user presses the right mouse button while the cursor is in the client area of a window. More...
 
virtual afx_msg void OnCustomDraw (NMHDR *pNMHDR, LRESULT *pResult)
 Performs custom drawing of the CListCtrl. More...
 
virtual afx_msg LRESULT OnSetColumnWidth (WPARAM wParam, LPARAM lParam)
 LVM_SETCOLUMNWIDTH message handler called when wanting to resize a column. More...
 
virtual afx_msg BOOL OnHeaderDividerDblClick (UINT, NMHDR *pNMHDR, LRESULT *pResult)
 HDN_DIVIDERDBLCLICK message handler called when double clicking the divider in the columns of the CHeaderCtrl. More...
 
virtual afx_msg BOOL OnHeaderBeginResize (UINT, NMHDR *pNmhdr, LRESULT *pResult)
 HDN_BEGINTRACK message handler called when resizing columns. More...
 
virtual afx_msg BOOL OnHeaderBeginDrag (UINT, NMHDR *pNMHDR, LRESULT *pResult)
 HDN_BEGINDRAG message handler called when about to move a column to a new position. More...
 
virtual afx_msg BOOL OnHeaderEndResize (UINT, NMHDR *pNMHDR, LRESULT *pResult)
 HDN_ENDTRACK message handler called after column resize. More...
 
virtual afx_msg BOOL OnHeaderItemChanging (UINT, NMHDR *pNMHDR, LRESULT *pResult)
 HDN_ITEMCHANGING message handler called during column resize. More...
 
virtual afx_msg BOOL OnHeaderClick (NMHDR *pNMHDR, LRESULT *pResult)
 LVN_COLUMNCLICK message handler called when clicking a column header. More...
 
virtual afx_msg BOOL OnToolNeedText (UINT, NMHDR *pNMHDR, LRESULT *pResult)
 TTN_NEEDTEXT message handler called when the tooltip timer fires. More...
 
virtual afx_msg BOOL OnBeginLabelEdit (NMHDR *pNMHDR, LRESULT *pResult)
 LVN_BEGINLABELEDIT message handler called when start editing a cell. More...
 
virtual afx_msg BOOL OnEndLabelEdit (NMHDR *pNMHDR, LRESULT *pResult)
 LVN_ENDLABELEDIT message handler called when completed a cell edit. More...
 
virtual afx_msg BOOL OnOwnerDataFindItem (NMHDR *pNMHDR, LRESULT *pResult)
 LVN_ODFINDITEM message handler for performing keyboard search when LVS_OWNERDATA (virtual list) More...
 
virtual afx_msg void OnHScroll (UINT nSBCode, UINT nPos, CScrollBar *pScrollBar)
 WM_HSCROLL message handler called when scrolling in the list control. More...
 
virtual afx_msg void OnVScroll (UINT nSBCode, UINT nPos, CScrollBar *pScrollBar)
 WM_VSCROLL message handler called when scrolling in the list control. More...
 
virtual afx_msg void OnSetFocus (CWnd *pOldWnd)
 WM_SETFOCUS message handler called when list control is receiving focus from other control. More...
 
virtual afx_msg void OnKillFocus (CWnd *pNewWnd)
 WM_KILLFOCUS message handler called when list control is loosing focus to other control. More...
 
virtual afx_msg LRESULT OnCopy (WPARAM wParam, LPARAM lParam)
 WM_COPY message handler. More...
 
virtual afx_msg LRESULT OnSetFont (WPARAM wParam, LPARAM lParam)
 WM_SETFONT message handler. More...
 
virtual afx_msg BOOL OnBeginDrag (NMHDR *pNMHDR, LRESULT *pResult)
 LVN_BEGINDRAG message handler called when performing left-click drag. More...
 
virtual afx_msg BOOL OnItemChanged (NMHDR *pNMHDR, LRESULT *pResult)
 LVN_ITEMCHANGED message handler called when a row changes state When using LVS_OWNERDATA style, this only gets called for single item state change. More...
 
 DECLARE_MESSAGE_MAP ()
 

Protected Attributes

int m_GroupCol
 Rows are grouped according to this column.
 
int m_GroupSort
 Groups are sorted (-1 = Unsorted, 1 = Ascending, 0 = Descending)
 
int m_SortSecondaryGroupView
 When grouped by primary column, then allow sort of secondary column (0 = Always group, 1 = Allow sort, 2 = Fix sort for xp)
 
CString m_GroupFilterText
 Filter rows by putting them in visible filter-group.
 
- Protected Attributes inherited from CGridListCtrlEx
CSimpleArray< CGridColumnTrait * > m_ColumnTraits
 Column traits registered (One for each column)
 
CViewConfigSectionProfilesm_pColumnConfig
 Column state persistence.
 
bool m_bConfigOwner
 Column state persistence object is freed by destructor.
 
CGridRowTraitm_pDefaultRowTrait
 Default row trait used for special row drawing.
 
int m_FocusCell
 Column currently having focus (-1 means entire row)
 
CString m_LastSearchString
 Last search criteria for keyboard search.
 
CTime m_LastSearchTime
 Time of last search attempt for keyboard search.
 
int m_LastSearchCell
 Last column used in keyboard search.
 
int m_LastSearchRow
 Last row matched in keyboard search.
 
int m_RepeatSearchCount
 How many times the same search have been repeated (same key pressed)
 
int m_SortCol
 Rows are sorted according to this column.
 
bool m_Ascending
 Rows are sorted ascending / descending.
 
CWnd * m_pEditor
 Cell value editor currently in use.
 
bool m_UsingVisualStyle
 Vista Style has been enabled (alpha blend)
 
int m_TooltipMaxWidth
 Whether tooltips should be split in multiple lines.
 
CFont m_GridFont
 Original font of the the list control.
 
CFont m_CellFont
 Current font to draw rows.
 
double m_Margin
 Current margin between original font and cell font.
 
CString m_EmptyMarkupText
 Text to display when list control is empty.
 
bool m_InvalidateMarkupText
 Ensure that the empty markup text is cleared properly.
 
COleDropTargetWnd< CGridListCtrlEx > * m_pOleDropTarget
 Maintains OLE drag drop target.
 

Additional Inherited Members

- Static Public Member Functions inherited from CGridListCtrlEx
static bool CheckOSVersion (WORD requestOS)
 Checks if the current OS version against the requested OS version. More...
 

Detailed Description

CGridListCtrlGroups extends the CGridListCtrlEx with grouping.

This can be used to put rows into category groups.

Placed in its own file as all features requires _WIN32_WINNT >= 0x0501

Member Function Documentation

void CGridListCtrlGroups::CheckEntireGroup ( int  nGroupId,
bool  bChecked 
)
virtual

Update the checkbox of the label column (first column)

Parameters
nGroupIdID of the group
bCheckedThe new check box state
BOOL CGridListCtrlGroups::DeleteEntireGroup ( int  nGroupId)
virtual

Removes the group and all the rows part of the group.

Parameters
nGroupIdID of the group
Returns
Succeeded in removing the entire group
BOOL CGridListCtrlGroups::FilterByCellText ( int  nCol,
const CString &  strNeedle,
const CString &  strGroupName 
)
virtual

Create a group that contains all rows where column matches the provided text.

Parameters
nColThe index of the column
strNeedleThe string filter
strGroupNameThe group filter name
Returns
Succeeded in creating the filter group with visible rows
int CGridListCtrlGroups::FixRowGroupId ( int  nRow)
virtual

Finds the matching group-id for the row, based on current grouping If it cannot find a group-id, then it creates a new group.

Parameters
nRowThe index of the row
Returns
ID of the group
CString CGridListCtrlGroups::GetGroupHeader ( int  nGroupId)
virtual

Retrieves the group header title of a group.

Parameters
nGroupIdID of the group
Returns
Group header title
BOOL CGridListCtrlGroups::GetGroupIds ( CSimpleArray< int > &  groupIds)
virtual

Find all registered group-ids.

Parameters
groupIdsArray of group-ids found
Returns
Succeeded in finding groups
int CGridListCtrlGroups::GetRowGroupId ( int  nRow)
virtual

Retrieves the group id of a row.

Parameters
nRowThe index of the row
Returns
ID of the group
BOOL CGridListCtrlGroups::GroupByColumn ( int  nCol)
virtual

Create a group for each unique values within a column.

Parameters
nColThe index of the column
Returns
Succeeded in creating the group
int CGridListCtrlGroups::GroupHitTest ( const CPoint &  point)
virtual

Find the group-id below the given point.

Parameters
pointMouse position
Returns
ID of the group
BOOL CGridListCtrlGroups::HasGroupState ( int  nGroupId,
DWORD  dwState 
)
virtual

Checks whether a group has a certain state.

Parameters
nGroupIdID of the group
dwStateSpecifies the state to check
Returns
The group has the state (true / false)
OnGetEmptyMarkup LRESULT CGridListCtrlGroups::InsertGroupHeader ( int  nIndex,
int  nGroupId,
const CString &  strHeader,
DWORD  dwState = 0,
DWORD  dwAlign = 0 
)
virtual

Inserts a group into the list view control.

Parameters
nIndexThe insert position of the group
nGroupIdID of the new group
strHeaderThe group header title
dwStateSpecifies the state of the group when inserted
dwAlignIndicates the alignment of the header or footer text for the group
Returns
Returns the index of the item that the group was added to, or -1 if the operation failed.
BOOL CGridListCtrlGroups::IsGroupStateEnabled ( )
virtual

Checks if it is possible to modify the collapse state of a group.

This is only possible in Windows Vista.

Returns
Groups can be collapsed (true / false)
bool CGridListCtrlGroups::MoveSelectedRows ( int  nDropGroupId)
protectedvirtual

Moves the selected rows to the specified group.

Parameters
nDropGroupIdMoved the selected rows to this group
Returns
Was rows rearranged ? (true / false)

Reimplemented from CGridListCtrlEx.

void CGridListCtrlGroups::OnContextMenu ( CWnd *  pWnd,
CPoint  point 
)
protectedvirtual

WM_CONTEXTMENU message handler to show popup menu when mouse right click is used (or SHIFT+F10 on the keyboard)

Parameters
pWndHandle to the window in which the user right clicked the mouse
pointPosition of the cursor, in screen coordinates, at the time of the mouse click.

Reimplemented from CGridListCtrlEx.

void CGridListCtrlGroups::OnContextMenuCell ( CWnd *  pWnd,
CPoint  point,
int  nRow,
int  nCol 
)
protectedvirtual

Override this method to change the context menu when activating context menu for a single cell.

Parameters
pWndHandle to the window in which the user right clicked the mouse
pointPosition of the cursor, in screen coordinates, at the time of the mouse click.
nRowThe index of the row
nColThe index of the column

Reimplemented from CGridListCtrlEx.

void CGridListCtrlGroups::OnContextMenuGrid ( CWnd *  pWnd,
CPoint  point 
)
protectedvirtual

Override this method to change the context menu when activating context menu in client area with no rows.

Parameters
pWndHandle to the window in which the user right clicked the mouse
pointPosition of the cursor, in screen coordinates, at the time of the mouse click.

Reimplemented from CGridListCtrlEx.

void CGridListCtrlGroups::OnContextMenuGroup ( CWnd *  pWnd,
CPoint  point,
int  nGroupId 
)
protectedvirtual

Override this method to change the context menu when activating context menu for the group headers.

Parameters
pWndHandle to the window in which the user right clicked the mouse
pointPosition of the cursor, in screen coordinates, at the time of the mouse click.
nGroupIdID of the group
void CGridListCtrlGroups::OnContextMenuHeader ( CWnd *  pWnd,
CPoint  point,
int  nCol 
)
protectedvirtual

Override this method to change the context menu when activating context menu for the column headers.

Parameters
pWndHandle to the window in which the user right clicked the mouse
pointPosition of the cursor, in screen coordinates, at the time of the mouse click.
nColThe index of the column

Reimplemented from CGridListCtrlEx.

bool CGridListCtrlGroups::OnDisplayCellGroup ( int  nRow,
int  nCol,
int &  nGroupId 
)
virtual

Override this method to provide the group a cell belongs to.

Parameters
nRowThe index of the row
nColThe index of the column
nGroupIdText string to display in the cell
Returns
True if the cell belongs to a group
BOOL CGridListCtrlGroups::OnDropSelf ( COleDataObject *  pDataObject,
DROPEFFECT  dropEffect,
CPoint  point 
)
protectedvirtual

Called by the framework when a drop operation is to occur, where the origin is the CGridListCtrlEx itself.

Parameters
pDataObjectPoints to the data object containing the data that can be dropped
dropEffectThe effect that the user chose for the drop operation (DROPEFFECT_COPY, DROPEFFECT_MOVE, DROPEFFECT_LINK)
pointContains the current location of the cursor in client coordinates.
Returns
Nonzero if the drop is successful; otherwise 0

Reimplemented from CGridListCtrlEx.

bool CGridListCtrlGroups::OnFilterSingleCellText ( int  nRow,
int  nFilterCol,
const CString &  strNeedle 
)
protectedvirtual

Check if row-item should be included in the filter-group, that matches the needle.

Parameters
nRowThe index of the row
nFilterColThe index of the column
strNeedleThe string filter
Returns
Row matches the filter ? (true / false)
BOOL CGridListCtrlGroups::OnGetDispInfo ( NMHDR *  pNMHDR,
LRESULT *  pResult 
)
protectedvirtual

LVN_GETDISPINFO message handler, which is called when details are needed for an item that specifies callback.

  • Cell-Group, when item is using I_GROUPIDCALLBACK
Parameters
pNMHDRPointer to an NMLVDISPINFO structure
pResultNot used
Returns
Is final message handler (Return FALSE to continue routing the message)

Reimplemented from CGridListCtrlEx.

BOOL CGridListCtrlGroups::OnGetEmptyMarkup ( NMHDR *  pNMHDR,
LRESULT *  pResult 
)
protectedvirtual

LVN_GETEMPTYMARKUP message handler to show markup text when the list control is empty.

Parameters
pNMHDRPointer to NMLVEMPTYMARKUP structure
pResultNot used
Returns
Is final message handler (Return FALSE to continue routing the message)
BOOL CGridListCtrlGroups::OnGroupTaskClick ( NMHDR *  pNMHDR,
LRESULT *  pResult 
)
protectedvirtual

LVN_LINKCLICK message handler called when a group task link is clicked.

Parameters
pNMHDRPointer to NMLVLINK structure
pResultNot used
Returns
Is final message handler (Return FALSE to continue routing the message)
BOOL CGridListCtrlGroups::OnHeaderEndDrag ( UINT  id,
NMHDR *  pNMHDR,
LRESULT *  pResult 
)
protectedvirtual

HDN_ENDDRAG message handler called after a column have been dragged, but before the column order has been updated.

Used to dirty cached col id

Parameters
idNot used
pNMHDRPointer to an NMHEADER structure with information about the column just resized
pResultIf the owner is performing external (manual) drag-and-drop management, it must be set to FALSE
Returns
Is final message handler (Return FALSE to continue routing the message)

Reimplemented from CGridListCtrlEx.

void CGridListCtrlGroups::OnLButtonDblClk ( UINT  nFlags,
CPoint  point 
)
protectedvirtual

The framework calls this member function when the user double-clicks the left mouse button.

Used to expand and collapse groups when group header is clicked.

Parameters
nFlagsIndicates whether various virtual keys are down (MK_CONTROL, MK_SHIFT, etc.)
pointSpecifies the x- and y-coordinate of the cursor relative to the upper-left corner of the window.

Reimplemented from CGridListCtrlEx.

void CGridListCtrlGroups::OnPaint ( )
protectedvirtual

WM_PAINT message handler called when needing to redraw list control.

Used to display text when the list control is empty

Reimplemented from CGridListCtrlEx.

LRESULT CGridListCtrlGroups::OnRemoveAllGroups ( WPARAM  wParam,
LPARAM  lParam 
)
protectedvirtual

LVM_REMOVEALLGROUPS message handler to ensure that group by column is updated.

Parameters
wParamNot used
lParamNot used
Returns
Not used
BOOL CGridListCtrlGroups::SetGroupFooter ( int  nGroupId,
const CString &  strFooter,
DWORD  dwAlign = 0 
)
virtual

Update the description text of the group footer.

Parameters
nGroupIdID of the group
strFooterThe footer description text
dwAlignIndicates the alignment of the footer text for the group
Returns
Succeeded in updating the group footer
BOOL CGridListCtrlGroups::SetGroupState ( int  nGroupId,
DWORD  dwState 
)
virtual

Updates the state of a group.

Parameters
nGroupIdID of the group
dwStateSpecifies the new state of the group
Returns
The group state was updated (true / false)
BOOL CGridListCtrlGroups::SetGroupSubtitle ( int  nGroupId,
const CString &  strSubtitle 
)
virtual

Update the subtitle in the group header.

Parameters
nGroupIdID of the group
strSubtitleThe subtitle description text
Returns
Succeeded in updating the group subtitle
BOOL CGridListCtrlGroups::SetGroupTask ( int  nGroupId,
const CString &  strTask 
)
virtual

Update the task link of the group header.

Parameters
nGroupIdID of the group
strTaskThe task description text
Returns
Succeeded in updating the group task
BOOL CGridListCtrlGroups::SetGroupTitleImage ( int  nGroupId,
int  nImage,
const CString &  strTopDesc,
const CString &  strBottomDesc 
)
virtual

Update the image icon in the group header together with top and bottom description.

Microsoft encourage people not to use this functionality.

Parameters
nGroupIdID of the group
nImageIndex of the title image in the control imagelist.
strTopDescDescription text placed oppposite of the image
strBottomDescDescription text placed below the top description
Returns
Succeeded in updating the group image
BOOL CGridListCtrlGroups::SetRowGroupId ( int  nRow,
int  nGroupId 
)
virtual

Moves a row into a group.

Parameters
nRowThe index of the row
nGroupIdID of the group
Returns
Nonzero if successful; otherwise zero
void CGridListCtrlGroups::SetSortSecondaryGroupView ( int  nEnable)
virtual

Configure whether sorting on secondary column is allowed when grouped by primary column.

Parameters
nEnable0 = Group on sort, 1 = Allow sort, 2 = Fix sort for WinXP
bool CGridListCtrlGroups::SortColumn ( int  nCol,
bool  bAscending 
)
virtual

Changes the row sorting in regard to the specified column.

Parameters
nColThe index of the column
bAscendingShould the arrow be up or down
Returns
True / false depending on whether sort is possible

Reimplemented from CGridListCtrlEx.