MFC Grid manual

ICellPaintFormat Class Reference

Interface to paint a cell in CGrid. More...

#include <Dapfor/GUI/ICellPaintFormat.h>

Inheritance diagram for ICellPaintFormat:

CCellPaintFormat CProgressCellPaintFormat

List of all members.


Public Member Functions

virtual ~ICellPaintFormat ()
 virtual destructor
virtual ICellPaintFormatClone () const =0
 Gets a clone of a format.
Painting
virtual void DrawCell (CGridCell &cell, const CPaintContext &paintContext, UINT paintFilter) const =0
 Paints a cell in CGrid.
virtual COLORREF GetBackColor (CGridCell &cell, const CPaintContext &paintContext, UINT paintFilter) const =0
 Gets an effective background color of a cell after blending.
virtual COLORREF GetForeColor (CGridCell &cell, const CPaintContext &paintContext, UINT paintFilter) const =0
 Gets an effective foreground color of a cell after blending.
Cell dimensions
virtual int GetOptimalCellWidth (CGridCell &cell, const CPaintContext &paintContext, UINT paintFilter) const =0
 Gets an optimal width of a cell.
virtual CRect GetImageRect (CGridCell &cell, const CPaintContext &paintContext, UINT paintFilter) const =0
 Gets the rectangle, occupied by the icon painted in a cell.
virtual CRect GetTextRect (CGridCell &cell, const CPaintContext &paintContext, UINT paintFilter) const =0
 Gets cell bounds where a text can be drawn.
Serialization
virtual BOOL IsSerializableType () const
 Indicates whether an object of a class that implements ICellPaintFormat can be serialized.
virtual CString GetFormatName () const
 Gets a format name.
virtual void Serialize (CArchive &ar)
 Serializes an object to the archive.

Detailed Description

Interface to paint a cell in CGrid.

This format paints the following elements: background, text, icons, selection, focus, +/- signs for unrolling and rolling up the hierarchy. Moreover, when embedded controls are used, a part of painting can be handed over to those controls. GUI library provides a number of those interface implementations that can be used to paint a grid cell. It is also possible to implement a personal format that allows to totally redefine painting in the grid. From a practical point of view it is reasonable to redefine ICellPaintFormat for radically new data presentation in the grid. In most cases where it is required to just change text or background colors, forbid selection or focus painting and also customize a font or highlighting for each cell the easiest way is to redefine ICustomDraw interface that is the central point for passing all information necessary for painting.

Version:
1.0.0 Initial version

Member Function Documentation

void DrawCell ( CGridCell cell,
const CPaintContext paintContext,
UINT  paintFilter 
) const [pure virtual]

Paints a cell in CGrid.

Parameters:
[in] cell Cell related information
[in] paintContext Contains common information like device context, header, grid etc.
[in] paintFilter Set of painting operations, defined in PaintFilter enumeration.

Implemented in CCellPaintFormat, and CProgressCellPaintFormat.

COLORREF GetBackColor ( CGridCell cell,
const CPaintContext paintContext,
UINT  paintFilter 
) const [pure virtual]

Gets an effective background color of a cell after blending.

Parameters:
[in] cell Cell related information
[in] paintContext Contains common information like device context, header, grid etc.
[in] paintFilter Set of painting operations, defined in PaintFilter enumeration.
Returns:
Resulting background color after alpha-blend operations

Implemented in CCellPaintFormat.

COLORREF GetForeColor ( CGridCell cell,
const CPaintContext paintContext,
UINT  paintFilter 
) const [pure virtual]

Gets an effective foreground color of a cell after blending.

Parameters:
[in] cell Cell related information
[in] paintContext Contains common information like device context, header, grid etc.
[in] paintFilter Set of painting operations, defined in PaintFilter enumeration.
Returns:
Resulting foreground color after alpha-blend operations

Implemented in CCellPaintFormat.

int GetOptimalCellWidth ( CGridCell cell,
const CPaintContext paintContext,
UINT  paintFilter 
) const [pure virtual]

Gets an optimal width of a cell.

Parameters:
[in] cell Cell related information
[in] paintContext Contains common information like device context, header, grid etc.
[in] paintFilter Set of painting operations, defined in PaintFilter enumeration.
Returns:
Optimal width of the cell

Implemented in CCellPaintFormat.

CRect GetImageRect ( CGridCell cell,
const CPaintContext paintContext,
UINT  paintFilter 
) const [pure virtual]

Gets the rectangle, occupied by the icon painted in a cell.

Parameters:
[in] cell Cell related information
[in] paintContext Contains common information like device context, header, grid etc.
[in] paintFilter Set of painting operations, defined in PaintFilter enumeration.
Returns:
Rectangle occupied by the icon

Implemented in CCellPaintFormat.

CRect GetTextRect ( CGridCell cell,
const CPaintContext paintContext,
UINT  paintFilter 
) const [pure virtual]

Gets cell bounds where a text can be drawn.

Parameters:
[in] cell Cell related information
[in] paintContext Contains common information like device context, header, grid etc.
[in] paintFilter Set of painting operations, defined in PaintFilter enumeration.
Returns:
Rectangle which can be used for text painting in the cell

Implemented in CCellPaintFormat.

ICellPaintFormat * Clone (  )  const [pure virtual]

Gets a clone of a format.

Returns:
Deep copy of the object.

Implemented in CCellPaintFormat.

BOOL IsSerializableType (  )  const [virtual]

Indicates whether an object of a class that implements ICellPaintFormat can be serialized.

Returns:
True if the object is serializable

CString GetFormatName (  )  const [virtual]

Gets a format name.

Returns:
Format name

void Serialize ( CArchive &  ar  )  [virtual]

Serializes an object to the archive.

Parameters:
[in] ar Archive to serialize an object.