Brush Class Reference

Class for control of a brush lifetime. More...

List of all members.

Public Types

 Static = COLOR_STATIC
 WINCE.
enum  SysColor { ,
  Static = COLOR_STATIC ,
  Static = COLOR_STATIC
}

Public Member Functions

 Brush (Canvas &canvas)
 Static Constructor returning a "NULL_BRUSH".
 Brush (Canvas &canvas, SysColor color)
 Constructor taking a Canvas and a syscolorbrush enum.
 Brush (Canvas &canvas, BitmapPtr bitmap)
 Constructor taking a Canvas and a COLORREF.
 Brush (Canvas &canvas, COLORREF color)
 Constructor taking a Canvas and a COLORREF.
HBRUSH getBrushHandle ()
 Returns the Handle to the brush.
CanvasgetCanvas ()
 Returns the Device Context of the brush.
 ~Brush ()
 Automatically restores the old brush and frees the given brush.


Detailed Description

Class for control of a brush lifetime.

Constructor takes a COLORREF which can be obtained by using e.g. the RGB macro.
Class ensures that your brush is released and the former one is reactivated.
Automatically resets back to the former used brush when object is destroyed.
The hdc parameter to the Constructor is the Device Context for the brush.
Related classes


Member Enumeration Documentation

enum SysColor

Enumerator:
Static  WINCE.
Static  WINCE.


Constructor & Destructor Documentation

Brush ( Canvas canvas,
COLORREF  color 
)

Constructor taking a Canvas and a COLORREF.

Build a COLORREF argument with windows.h's RGB( red, green, blue )

Brush ( Canvas canvas,
BitmapPtr  bitmap 
)

Constructor taking a Canvas and a COLORREF.

Build a COLORREF argument with windows.h's RGB( red, green, blue )

Brush ( Canvas canvas,
SysColor  color 
)

Constructor taking a Canvas and a syscolorbrush enum.

A syscolorbrush is one of the system brushes used to draw e.g. Buttons, Text, etc. Use this Constructor if you wish to use one of those cached brushes instead of creating your own

~Brush (  ) 

Automatically restores the old brush and frees the given brush.

Freeing the current brush and resetting back to the former brush. Note that the Pen object cannot have a longer lifetime than the Canvas it belongs to (given to the Constructor) since this will cause undefined behaviour.


Member Function Documentation

HBRUSH getBrushHandle (  ) 

Returns the Handle to the brush.

Returns the Handle to the brush

Canvas & getCanvas (  ) 

Returns the Device Context of the brush.

Normally the same as the "parent" object used to construct the Pen

Back to SmartWin website
SourceForge.net Logo