MFC Grid manual

CPaintHelper Class Reference

Helper that implements the most frequent painting routines. More...

#include <Dapfor/GUI/PaintHelper.h>

List of all members.


Public Types

enum  EnSide { Left = 0x01, Top = 0x02, Bottom = 0x04, Right = 0x08 }
 Rectangle side. More...

Static Public Member Functions

static void DrawBackground (CRect cellRc, COLORREF color, const CPaintContext &paintContext)
 Paints background of a cell.
static void DrawMouseTrackSelection (CRect cellRc, CColorBlend color, COLORREF borderColor, const CPaintContext &paintContext)
 Paints a part of the rectangle, selected by the mouse with pressed left button in a cell.
static void DrawText (const TString &text, COLORREF color, const CRect &textRc, UINT style, const CPaintInfo &paintInfo, const CPaintContext &paintContext)
 Paints text in a cell.
static void DrawSelectionFrame (const CGridCell &cell, COLORREF frameColor, const CPaintContext &paintContext)
 Paints a part of selection around selected lines.
static void DrawFocus (const CGridCell &cell, COLORREF color, const CPaintContext &paintContext)
 Paints a part of focused frame around a focused line.
static void DrawCollapseExpandIcon (const CGridCell &cell, COLORREF color, const CPaintContext &paintContext)
 Paints +/- icons in a cell.
static void DrawHierarchicalLines (const CGridCell &cell, COLORREF color, const CPaintContext &paintContext)
 Paints hierarchical lines in a cell.
static void DrawDropPosition (const CGridCell &cell, COLORREF color, const CPaintContext &paintContext)
 Paints a flat separator between two grid lines which indicates where a clipboard content should be inserted.
static void DrawDropParentPosition (const CGridCell &cell, COLORREF color, const CPaintContext &paintContext)
 Paints a hierarchical cursor that indicates the parent to which a clipboard content should be attached.
static void DrawVerticalLines (const CGridCell &cell, COLORREF color, const CPaintContext &paintContext)
 Paints vertical lines between columns.
static void DrawHorizontalLines (const CGridCell &cell, COLORREF color, const CPaintContext &paintContext)
 Paints horizontal lines between rows.
static void DrawImage (const CGridCell &cell, const CPaintContext &paintContext, const CRect &rc, COLORREF backcolor, bool transparent)
 Paints an icon in a cell.
static bool IsLastLevelItem (HITEM item)
 Indicates whether a specified visible handle is the last for its parent.
static bool CanShowExpandOrCollapseIcon (const CGridLine &line, const CPaintContext &paintContext)
 Indicates whether a line has underlying visible children that can be collapsed or expanded.
static CColorBlend GetSelectionColorBlend (const CGridCell &cell, const CPaintContext &paintContext, UINT paintFilter)
 Gets the result of blending of background and selection colors.
static CColorBlend GetFocusedRowColorBlend (const CGridCell &cell, const CPaintContext &paintContext, UINT paintFilter)
 Gets the result of blending of background and focused item colors.
static CColorBlend GetSortedColumnColorBlend (const CGridCell &cell, const CPaintContext &paintContext, UINT paintFilter)
 Gets the result of blending of background and sorted column colors.
static CColorBlend GetHighlightForeColorBlend (const CGridCell &cell, const CPaintContext &paintContext, UINT paintFilter)
 Gets the result of blending of foreground and highlighted item colors.
static CColorBlend GetHighlightBackColorBlend (const CGridCell &cell, const CPaintContext &paintContext, UINT paintFilter)
 Gets the result of blending of background and highlighted item colors.
static COLORREF GetResultingBackColor (CGridCell &cell, const CPaintContext &paintContext, UINT paintFilter)
 Gets resulting background color after blending with highlighting, sorting, selection and focusing colors.
static COLORREF GetResultingTextColor (CGridCell &cell, const CPaintContext &paintContext, UINT paintFilter)
 Gets resulting text color after blending with highlighting, sorting, selection and focusing colors.
static CRect GetCellPaintableRectangle (CGridCell &cell, const CPaintContext &paintContext, UINT paintFilter)
 Gets a rectangle inside of the cell, available to painting.

Detailed Description

Helper that implements the most frequent painting routines.

Version:
1.0.0.0 Initial version

Member Enumeration Documentation

enum EnSide

Rectangle side.

Enumerator:
Left  top
Top  left
Bottom  bottom
Right  right


Member Function Documentation

void DrawBackground ( CRect  cellRc,
COLORREF  color,
const CPaintContext paintContext 
) [static]

Paints background of a cell.

Parameters:
[in] cellRc Rectangle that should be filled.
[in] color Color, the rectangle is filled with.
[in] paintContext Nested information to perform painting.

void DrawMouseTrackSelection ( CRect  cellRc,
CColorBlend  cb,
COLORREF  borderColor,
const CPaintContext paintContext 
) [static]

Paints a part of the rectangle, selected by the mouse with pressed left button in a cell.

Parameters:
[in] cellRc Cell bounds.
[in] cb Color of a mouse selection with a transparency coefficient.
[in] borderColor Color of a frame around a mouse selection.
[in] paintContext Nested information to perform painting.

void DrawText ( const TString &  text,
COLORREF  color,
const CRect &  textRc,
UINT  style,
const CPaintInfo paintInfo,
const CPaintContext paintContext 
) [static]

Paints text in a cell.

Parameters:
[in] text Text to be painted.
[in] color Text color.
[in] textRc Maximal text bounds.
[in] style Text painting style passed to CDC::DrawText function.
[in] paintInfo Font and metrics to adjust text drawing.
[in] paintContext Nested information to perform painting.

void DrawSelectionFrame ( const CGridCell cell,
COLORREF  frameColor,
const CPaintContext paintContext 
) [static]

Paints a part of selection around selected lines.

Parameters:
[in] cell Cell in CGrid
[in] frameColor Color of a selection frame
[in] paintContext Nested information to perform painting.

void DrawFocus ( const CGridCell cell,
COLORREF  color,
const CPaintContext paintContext 
) [static]

Paints a part of focused frame around a focused line.

Parameters:
[in] cell Cell in CGrid
[in] color Frame color of a focused item.
[in] paintContext Nested information to perform painting.

void DrawCollapseExpandIcon ( const CGridCell cell,
COLORREF  color,
const CPaintContext paintContext 
) [static]

Paints +/- icons in a cell.

Parameters:
[in] cell Cell in CGrid
[in] color Color that is applied to paint icons.
[in] paintContext Nested information to perform painting.

void DrawHierarchicalLines ( const CGridCell cell,
COLORREF  color,
const CPaintContext paintContext 
) [static]

Paints hierarchical lines in a cell.

Parameters:
[in] cell Cell in CGrid
[in] color Color that is applied to paint icons.
[in] paintContext Nested information to perform painting.

void DrawDropPosition ( const CGridCell cell,
COLORREF  color,
const CPaintContext paintContext 
) [static]

Paints a flat separator between two grid lines which indicates where a clipboard content should be inserted.

Parameters:
[in] cell Cell in CGrid
[in] color Color that is applied to paint a separator between two lines.
[in] paintContext Nested information to perform painting.

void DrawDropParentPosition ( const CGridCell cell,
COLORREF  color,
const CPaintContext paintContext 
) [static]

Paints a hierarchical cursor that indicates the parent to which a clipboard content should be attached.

Parameters:
[in] cell Cell in CGrid
[in] color Color that is applied to paint a hierarchical cursor.
[in] paintContext Nested information to perform painting.

void DrawVerticalLines ( const CGridCell cell,
COLORREF  color,
const CPaintContext paintContext 
) [static]

Paints vertical lines between columns.

Parameters:
[in] cell Cell in CGrid
[in] color Color that is applied to paint a vertical line between two columns.
[in] paintContext Nested information to perform painting.

void DrawHorizontalLines ( const CGridCell cell,
COLORREF  color,
const CPaintContext paintContext 
) [static]

Paints horizontal lines between rows.

Parameters:
[in] cell Cell in CGrid
[in] color Color that is applied to paint a horizontal line between two lines.
[in] paintContext Nested information to perform painting.

void DrawImage ( const CGridCell cell,
const CPaintContext paintContext,
const CRect &  imageRc,
COLORREF  colorMask,
bool  transparent 
) [static]

Paints an icon in a cell.

Parameters:
[in] cell Cell in CGrid
[in] paintContext Nested information to perform painting.
[in] imageRc Image bounds. If an image size is different to the bounds, the icon will be stretched to a specified rectangle.
[in] colorMask Color mask.
[in] transparent Indicates whether the color specified in the colorMask is excluded from painting.

bool IsLastLevelItem ( HITEM  item  )  [static]

Indicates whether a specified visible handle is the last for its parent.

Parameters:
[in] item Item handle
Returns:
true if the item is the last in its parent. Otherwise false.

bool CanShowExpandOrCollapseIcon ( const CGridLine line,
const CPaintContext paintContext 
) [static]

Indicates whether a line has underlying visible children that can be collapsed or expanded.

Indicates whether a collapse/expand icon can be displayed. If the item has no children or all children are filtered, the icon can't be shown.

Parameters:
[in] line Grid line
[in] paintContext Nested information to perform painting.
Returns:
True if the icon can be shown. Otherwise false.

CColorBlend GetSelectionColorBlend ( const CGridCell cell,
const CPaintContext paintContext,
UINT  paintFilter 
) [static]

Gets the result of blending of background and selection colors.

Parameters:
[in] cell Cell in CGrid
[in] paintContext Nested information to perform painting.
[in] paintFilter Paint filter. The colors are merged only if paintFilter contains GUI::drawSelection flag.

CColorBlend GetFocusedRowColorBlend ( const CGridCell cell,
const CPaintContext paintContext,
UINT  paintFilter 
) [static]

Gets the result of blending of background and focused item colors.

Parameters:
[in] cell Cell in CGrid
[in] paintContext Nested information to perform painting.
[in] paintFilter Paint filter. The colors are merged only if paintFilter contains GUI::drawFocusedRow flag.

CColorBlend GetSortedColumnColorBlend ( const CGridCell cell,
const CPaintContext paintContext,
UINT  paintFilter 
) [static]

Gets the result of blending of background and sorted column colors.

Parameters:
[in] cell Cell in CGrid
[in] paintContext Nested information to perform painting.
[in] paintFilter Paint filter. The colors are merged only if paintFilter contains GUI::drawColumnSort flag.

CColorBlend GetHighlightForeColorBlend ( const CGridCell cell,
const CPaintContext paintContext,
UINT  paintFilter 
) [static]

Gets the result of blending of foreground and highlighted item colors.

Parameters:
[in] cell Cell in CGrid
[in] paintContext Nested information to perform painting.
[in] paintFilter Paint filter. The colors are merged only if paintFilter contains GUI::drawHighlight flag.

CColorBlend GetHighlightBackColorBlend ( const CGridCell cell,
const CPaintContext paintContext,
UINT  paintFilter 
) [static]

Gets the result of blending of background and highlighted item colors.

Parameters:
[in] cell Cell in CGrid
[in] paintContext Nested information to perform painting.
[in] paintFilter Paint filter. The colors are merged only if paintFilter contains GUI::drawHighlight flag.

COLORREF GetResultingBackColor ( CGridCell cell,
const CPaintContext paintContext,
UINT  paintFilter 
) [static]

Gets resulting background color after blending with highlighting, sorting, selection and focusing colors.

Blend selected rows

Column sort

Blend color of the focused row

COLORREF GetResultingTextColor ( CGridCell cell,
const CPaintContext paintContext,
UINT  paintFilter 
) [static]

Gets resulting text color after blending with highlighting, sorting, selection and focusing colors.

Blend selected rows

Column sort

Blend color of the focused row