wxBrush: wxObject

A brush is a drawing tool for filling in areas. It is used for painting the background of rectangles, ellipses, etc. It has a colour and a style - the style may be wxSOLID (normal) or wxTRANSPARENT (the brush isn't used). On a monochrome display, the default behaviour is to show all brushes as white. If you wish the policy to be `all non-white colours are black', as with pens, uncomment the piece of code documented in SetBrush in wx_dc.cc. Alternatively, set the Colour member of the device context to TRUE, and select appropriate colours.

Do not initialize objects on the stack before the program commences, since other required structures may not have been set up yet. Instead, define global pointers to objects and create them in OnInit or when required.

An application may wish to create brushes with different characteristics dynamically, and there is the consequent danger that a large number of duplicate brushes will be created. Therefore an application may wish to get a pointer to a brush by using the global list of brushes wxTheBrushList, and calling the member function FindOrCreateBrush. See the entry for the wxBrushList class.

wxBrush::wxBrush

voidwxBrush

voidwxBrushwxColour &colour, int style

voidwxBrushchar *colour_name, int style

Constructs a brush: uninitialized, initialized with an RGB colour and a style, or initialized using a colour name and a style. If the named colour form is used, an appropriate wxColour structure is found in the colour database.

wxBrush::wxBrush

voidwxBrush

Destructor, destroying the brush. Note that brushes should very rarely be deleted since windows may contain pointers to them. All brushes will be deleted when the application terminates.

wxBrush::GetColour

wxColour&GetColour

Returns a reference to the brush colour.

wxBrush::GetStyle

intGetStyle

Returns the brush style (wxSOLID or wxTRANSPARENT).

wxBrush::SetColour

voidSetColourwxColour &colour

voidSetColourchar *colour_name

voidSetColourint red, int green, int blue

The brush's colour is changed to the given colour.

wxBrush::SetStyle

voidSetStyleint style

Sets the brush style (wxSOLID or wxTRANSPARENT).