2008-03-08 13:52:38 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: brush.h
|
2008-03-10 15:24:38 +00:00
|
|
|
// Purpose: interface of wxBrush
|
2008-03-08 13:52:38 +00:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxBrush
|
|
|
|
@wxheader{brush.h}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
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.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@library{wxcore}
|
|
|
|
@category{gdi}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@stdobjects
|
2008-03-10 15:24:38 +00:00
|
|
|
::Objects:, ::wxNullBrush, ::Pointers:, ::wxBLUE_BRUSH, ::wxGREEN_BRUSH,
|
|
|
|
::wxWHITE_BRUSH, ::wxBLACK_BRUSH, ::wxGREY_BRUSH, ::wxMEDIUM_GREY_BRUSH, ::wxLIGHT_GREY_BRUSH, ::wxTRANSPARENT_BRUSH, ::wxCYAN_BRUSH, ::wxRED_BRUSH,
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-10 15:24:38 +00:00
|
|
|
@see wxBrushList, wxDC, wxDC::SetBrush
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
class wxBrush : public wxGDIObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Copy constructor, uses @ref overview_trefcount "reference counting".
|
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param colour
|
2008-03-09 12:33:59 +00:00
|
|
|
Colour object.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param colourName
|
2008-03-09 12:33:59 +00:00
|
|
|
Colour name. The name will be looked up in the colour database.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param style
|
2008-03-09 12:33:59 +00:00
|
|
|
One of:
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
wxTRANSPARENT
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
Transparent (no fill).
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
wxSOLID
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
Solid.
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
wxSTIPPLE
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
Uses a bitmap as a stipple.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wxBDIAGONAL_HATCH
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Backward diagonal hatch.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wxCROSSDIAG_HATCH
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Cross-diagonal hatch.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wxFDIAGONAL_HATCH
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
Forward diagonal hatch.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wxCROSS_HATCH
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Cross hatch.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wxHORIZONTAL_HATCH
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Horizontal hatch.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wxVERTICAL_HATCH
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Vertical hatch.
|
|
|
|
@param brush
|
|
|
|
Pointer or reference to a brush to copy.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param stippleBitmap
|
2008-03-09 12:33:59 +00:00
|
|
|
A bitmap to use for stippling.
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
@remarks If a stipple brush is created, the brush style will be set to
|
2008-03-09 12:33:59 +00:00
|
|
|
wxSTIPPLE.
|
2008-03-08 13:52:38 +00:00
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see wxBrushList, wxColour, wxColourDatabase
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
wxBrush();
|
2008-03-08 14:43:31 +00:00
|
|
|
wxBrush(const wxColour& colour, int style = wxSOLID);
|
|
|
|
wxBrush(const wxString& colourName, int style);
|
|
|
|
wxBrush(const wxBitmap& stippleBitmap);
|
|
|
|
wxBrush(const wxBrush& brush);
|
2008-03-08 13:52:38 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor.
|
|
|
|
See @ref overview_refcountdestruct "reference-counted object destruction" for
|
|
|
|
more info.
|
|
|
|
|
|
|
|
@remarks Although all remaining brushes are deleted when the application
|
2008-03-09 12:33:59 +00:00
|
|
|
exits, the application should try to clean up all
|
|
|
|
brushes itself. This is because wxWidgets cannot know
|
|
|
|
if a pointer to the brush object is stored in an
|
|
|
|
application data structure, and there is a risk of
|
|
|
|
double deletion.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
~wxBrush();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns a reference to the brush colour.
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see SetColour()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxColour GetColour() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets a pointer to the stipple bitmap. If the brush does not have a wxSTIPPLE
|
|
|
|
style,
|
|
|
|
this bitmap may be non-@NULL but uninitialised (@ref wxBitmap::isok
|
|
|
|
wxBitmap:IsOk returns @false).
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see SetStipple()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxBitmap* GetStipple() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the brush style, one of:
|
|
|
|
|
|
|
|
@b wxTRANSPARENT
|
|
|
|
|
|
|
|
Transparent (no fill).
|
|
|
|
|
|
|
|
@b wxSOLID
|
|
|
|
|
|
|
|
Solid.
|
|
|
|
|
|
|
|
@b wxBDIAGONAL_HATCH
|
|
|
|
|
|
|
|
Backward diagonal hatch.
|
|
|
|
|
|
|
|
@b wxCROSSDIAG_HATCH
|
|
|
|
|
|
|
|
Cross-diagonal hatch.
|
|
|
|
|
|
|
|
@b wxFDIAGONAL_HATCH
|
|
|
|
|
|
|
|
Forward diagonal hatch.
|
|
|
|
|
|
|
|
@b wxCROSS_HATCH
|
|
|
|
|
|
|
|
Cross hatch.
|
|
|
|
|
|
|
|
@b wxHORIZONTAL_HATCH
|
|
|
|
|
|
|
|
Horizontal hatch.
|
|
|
|
|
|
|
|
@b wxVERTICAL_HATCH
|
|
|
|
|
|
|
|
Vertical hatch.
|
|
|
|
|
|
|
|
@b wxSTIPPLE
|
|
|
|
|
|
|
|
Stippled using a bitmap.
|
|
|
|
|
|
|
|
@b wxSTIPPLE_MASK_OPAQUE
|
|
|
|
|
|
|
|
Stippled using a bitmap's mask.
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see SetStyle(), SetColour(), SetStipple()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
int GetStyle() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the style of the brush is any of hatched fills.
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see GetStyle()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool IsHatch() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the brush is initialised. It will return @false if the default
|
|
|
|
constructor has been used (for example, the brush is a member of a class, or
|
|
|
|
@NULL has been assigned to it).
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool IsOk() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Sets the brush colour using red, green and blue values.
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see GetColour()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void SetColour(wxColour& colour);
|
2008-03-08 14:43:31 +00:00
|
|
|
void SetColour(const wxString& colourName);
|
|
|
|
void SetColour(unsigned char red, unsigned char green,
|
|
|
|
unsigned char blue);
|
2008-03-08 13:52:38 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the stipple bitmap.
|
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param bitmap
|
2008-03-09 12:33:59 +00:00
|
|
|
The bitmap to use for stippling.
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
@remarks The style will be set to wxSTIPPLE, unless the bitmap has a mask
|
2008-03-09 12:33:59 +00:00
|
|
|
associated to it, in which case the style will be set
|
|
|
|
to wxSTIPPLE_MASK_OPAQUE.
|
2008-03-08 13:52:38 +00:00
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see wxBitmap
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void SetStipple(const wxBitmap& bitmap);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the brush style.
|
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param style
|
2008-03-09 12:33:59 +00:00
|
|
|
One of:
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
wxTRANSPARENT
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
Transparent (no fill).
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
wxSOLID
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
Solid.
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
wxBDIAGONAL_HATCH
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
Backward diagonal hatch.
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
wxCROSSDIAG_HATCH
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Cross-diagonal hatch.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wxFDIAGONAL_HATCH
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forward diagonal hatch.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wxCROSS_HATCH
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Cross hatch.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wxHORIZONTAL_HATCH
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Horizontal hatch.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wxVERTICAL_HATCH
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Vertical hatch.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wxSTIPPLE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Stippled using a bitmap.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wxSTIPPLE_MASK_OPAQUE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Stippled using a bitmap's mask.
|
|
|
|
|
|
|
|
@see GetStyle()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void SetStyle(int style);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Inequality operator.
|
|
|
|
See @ref overview_refcountequality "reference-counted object comparison" for
|
|
|
|
more info.
|
|
|
|
*/
|
|
|
|
bool operator !=(const wxBrush& brush);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Assignment operator, using @ref overview_trefcount "reference counting".
|
|
|
|
*/
|
|
|
|
wxBrush operator =(const wxBrush& brush);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Equality operator.
|
|
|
|
See @ref overview_refcountequality "reference-counted object comparison" for
|
|
|
|
more info.
|
|
|
|
*/
|
|
|
|
bool operator ==(const wxBrush& brush);
|
|
|
|
};
|
2008-03-10 15:24:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
FIXME
|
|
|
|
*/
|
|
|
|
wxBrush Objects:
|
|
|
|
;
|
|
|
|
|
|
|
|
/**
|
|
|
|
FIXME
|
|
|
|
*/
|
|
|
|
wxBrush wxNullBrush;
|
|
|
|
|
|
|
|
/**
|
|
|
|
FIXME
|
|
|
|
*/
|
|
|
|
wxBrush Pointers:
|
|
|
|
;
|
|
|
|
|
|
|
|
/**
|
|
|
|
FIXME
|
|
|
|
*/
|
|
|
|
wxBrush wxBLUE_BRUSH;
|
|
|
|
|
|
|
|
/**
|
|
|
|
FIXME
|
|
|
|
*/
|
|
|
|
wxBrush wxGREEN_BRUSH;
|
|
|
|
|
|
|
|
/**
|
|
|
|
FIXME
|
|
|
|
*/
|
|
|
|
wxBrush wxWHITE_BRUSH;
|
|
|
|
|
|
|
|
/**
|
|
|
|
FIXME
|
|
|
|
*/
|
|
|
|
wxBrush wxBLACK_BRUSH;
|
|
|
|
|
|
|
|
/**
|
|
|
|
FIXME
|
|
|
|
*/
|
|
|
|
wxBrush wxGREY_BRUSH;
|
|
|
|
|
|
|
|
/**
|
|
|
|
FIXME
|
|
|
|
*/
|
|
|
|
wxBrush wxMEDIUM_GREY_BRUSH;
|
|
|
|
|
|
|
|
/**
|
|
|
|
FIXME
|
|
|
|
*/
|
|
|
|
wxBrush wxLIGHT_GREY_BRUSH;
|
|
|
|
|
|
|
|
/**
|
|
|
|
FIXME
|
|
|
|
*/
|
|
|
|
wxBrush wxTRANSPARENT_BRUSH;
|
|
|
|
|
|
|
|
/**
|
|
|
|
FIXME
|
|
|
|
*/
|
|
|
|
wxBrush wxCYAN_BRUSH;
|
|
|
|
|
|
|
|
/**
|
|
|
|
FIXME
|
|
|
|
*/
|
|
|
|
wxBrush wxRED_BRUSH;
|
|
|
|
|
|
|
|
|