2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: pen.h
|
2008-03-16 20:47:38 -04:00
|
|
|
// Purpose: interface of wxPen* classes
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
2010-07-13 09:29:13 -04:00
|
|
|
// Licence: wxWindows licence
|
2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2008-03-16 20:47:38 -04:00
|
|
|
/**
|
|
|
|
The possible styles for a wxPen.
|
2010-05-06 08:22:57 -04:00
|
|
|
|
|
|
|
Note that hatched pen styles are not supported by X11-based ports,
|
|
|
|
including wxGTK.
|
2008-03-16 20:47:38 -04:00
|
|
|
*/
|
|
|
|
enum wxPenStyle
|
|
|
|
{
|
2008-03-25 18:06:48 -04:00
|
|
|
wxPENSTYLE_INVALID = -1,
|
|
|
|
|
2008-03-16 20:47:38 -04:00
|
|
|
wxPENSTYLE_SOLID,
|
|
|
|
/**< Solid style. */
|
|
|
|
|
|
|
|
wxPENSTYLE_DOT,
|
|
|
|
/**< Dotted style. */
|
|
|
|
|
|
|
|
wxPENSTYLE_LONG_DASH,
|
|
|
|
/**< Long dashed style. */
|
|
|
|
|
|
|
|
wxPENSTYLE_SHORT_DASH,
|
|
|
|
/**< Short dashed style. */
|
|
|
|
|
|
|
|
wxPENSTYLE_DOT_DASH,
|
|
|
|
/**< Dot and dash style. */
|
|
|
|
|
|
|
|
wxPENSTYLE_USER_DASH,
|
|
|
|
/**< Use the user dashes: see wxPen::SetDashes. */
|
|
|
|
|
|
|
|
wxPENSTYLE_TRANSPARENT,
|
|
|
|
/**< No pen is used. */
|
|
|
|
|
|
|
|
wxPENSTYLE_STIPPLE_MASK_OPAQUE,
|
|
|
|
/**< @todo WHAT's this? */
|
|
|
|
|
|
|
|
wxPENSTYLE_STIPPLE_MASK,
|
|
|
|
/**< @todo WHAT's this? */
|
|
|
|
|
|
|
|
wxPENSTYLE_STIPPLE,
|
|
|
|
/**< Use the stipple bitmap. */
|
|
|
|
|
|
|
|
wxPENSTYLE_BDIAGONAL_HATCH,
|
|
|
|
/**< Backward diagonal hatch. */
|
|
|
|
|
|
|
|
wxPENSTYLE_CROSSDIAG_HATCH,
|
|
|
|
/**< Cross-diagonal hatch. */
|
|
|
|
|
|
|
|
wxPENSTYLE_FDIAGONAL_HATCH,
|
|
|
|
/**< Forward diagonal hatch. */
|
|
|
|
|
|
|
|
wxPENSTYLE_CROSS_HATCH,
|
|
|
|
/**< Cross hatch. */
|
|
|
|
|
|
|
|
wxPENSTYLE_HORIZONTAL_HATCH,
|
|
|
|
/**< Horizontal hatch. */
|
|
|
|
|
|
|
|
wxPENSTYLE_VERTICAL_HATCH,
|
|
|
|
/**< Vertical hatch. */
|
|
|
|
|
2012-06-30 19:41:15 -04:00
|
|
|
wxPENSTYLE_FIRST_HATCH,
|
|
|
|
/**< First of the hatch styles (inclusive). */
|
|
|
|
|
|
|
|
wxPENSTYLE_LAST_HATCH
|
|
|
|
/**< Last of the hatch styles (inclusive). */
|
2008-03-16 20:47:38 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
The possible join values of a wxPen.
|
|
|
|
|
|
|
|
@todo use wxPENJOIN_ prefix
|
|
|
|
*/
|
|
|
|
enum wxPenJoin
|
|
|
|
{
|
|
|
|
wxJOIN_INVALID = -1,
|
|
|
|
|
|
|
|
wxJOIN_BEVEL = 120,
|
|
|
|
wxJOIN_MITER,
|
|
|
|
wxJOIN_ROUND,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
The possible cap values of a wxPen.
|
|
|
|
|
|
|
|
@todo use wxPENCAP_ prefix
|
|
|
|
*/
|
|
|
|
enum wxPenCap
|
|
|
|
{
|
|
|
|
wxCAP_INVALID = -1,
|
|
|
|
|
|
|
|
wxCAP_ROUND = 130,
|
|
|
|
wxCAP_PROJECTING,
|
|
|
|
wxCAP_BUTT
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2017-05-03 13:20:45 -04:00
|
|
|
|
2017-05-02 05:02:37 -04:00
|
|
|
/**
|
|
|
|
@class wxPenInfo
|
|
|
|
|
|
|
|
This class is a helper used for wxPen creation using named parameter
|
2019-01-25 21:14:20 -05:00
|
|
|
idiom: it allows specifying various wxPen attributes using the chained
|
2017-05-02 05:02:37 -04:00
|
|
|
calls to its clearly named methods instead of passing them in the fixed
|
|
|
|
order to wxPen constructors.
|
|
|
|
|
2017-09-09 19:28:38 -04:00
|
|
|
For instance, to create a dotted blue pen with the given join style you
|
|
|
|
could do
|
2017-05-03 13:20:45 -04:00
|
|
|
@code
|
2017-09-09 19:28:38 -04:00
|
|
|
wxPen pen(wxPenInfo(*wxBLUE).Style(wxPENSTYLE_DOT).Join(wxJOIN_BEVEL));
|
2017-05-03 13:20:45 -04:00
|
|
|
@endcode
|
|
|
|
|
|
|
|
@since 3.1.1
|
2017-05-02 05:02:37 -04:00
|
|
|
*/
|
2017-09-09 19:28:38 -04:00
|
|
|
class wxPenInfo
|
2017-05-02 05:02:37 -04:00
|
|
|
{
|
|
|
|
public:
|
2017-09-09 19:28:38 -04:00
|
|
|
explicit wxPenInfo(const wxColour& colour = wxColour(),
|
|
|
|
int width = 1,
|
|
|
|
wxPenStyle style = wxPENSTYLE_SOLID);
|
2017-05-02 05:02:37 -04:00
|
|
|
|
|
|
|
wxPenInfo& Colour(const wxColour& col);
|
|
|
|
|
|
|
|
wxPenInfo& Width(int width);
|
|
|
|
|
|
|
|
wxPenInfo& Style(wxPenStyle style);
|
|
|
|
|
|
|
|
wxPenInfo& Stipple(const wxBitmap& stipple);
|
|
|
|
|
|
|
|
wxPenInfo& Dashes(int nb_dashes, const wxDash *dash);
|
|
|
|
|
|
|
|
wxPenInfo& Join(wxPenJoin join);
|
|
|
|
|
|
|
|
wxPenInfo& Cap(wxPenCap cap);
|
2019-07-31 19:39:37 -04:00
|
|
|
|
|
|
|
wxColour GetColour() const;
|
|
|
|
wxBitmap GetStipple() const;
|
|
|
|
wxPenStyle GetStyle() const;
|
|
|
|
wxPenJoin GetJoin() const;
|
|
|
|
wxPenCap GetCap() const;
|
|
|
|
int GetDashes(wxDash **ptr);
|
|
|
|
int GetDashCount() const;
|
|
|
|
wxDash* GetDash() const;
|
|
|
|
bool IsTransparent() const;
|
|
|
|
int GetWidth() const;
|
2017-05-02 05:02:37 -04:00
|
|
|
};
|
|
|
|
|
2008-03-16 20:47:38 -04:00
|
|
|
|
2017-05-03 13:20:45 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxPen
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
A pen is a drawing tool for drawing outlines. It is used for drawing
|
2008-03-16 20:47:38 -04:00
|
|
|
lines and painting the outline of rectangles, ellipses, etc.
|
|
|
|
It has a colour, a width and a style.
|
|
|
|
|
2008-04-06 12:19:04 -04:00
|
|
|
@note On a monochrome display, wxWidgets shows all non-white pens as black.
|
2008-03-16 20:47:38 -04:00
|
|
|
|
|
|
|
Do not initialize objects on the stack before the program commences,
|
|
|
|
since other required structures may not have been set up yet.
|
2008-04-06 08:52:58 -04:00
|
|
|
Instead, define global pointers to objects and create them in wxApp::OnInit()
|
2008-03-16 20:47:38 -04:00
|
|
|
or when required.
|
|
|
|
|
|
|
|
An application may wish to dynamically create pens with different characteristics,
|
|
|
|
and there is the consequent danger that a large number of duplicate pens will
|
|
|
|
be created. Therefore an application may wish to get a pointer to a pen by using
|
2008-04-06 08:52:58 -04:00
|
|
|
the global list of pens ::wxThePenList, and calling the member function
|
2008-03-16 20:47:38 -04:00
|
|
|
wxPenList::FindOrCreatePen().
|
2008-04-06 12:19:04 -04:00
|
|
|
See wxPenList for more info.
|
2008-03-16 20:47:38 -04:00
|
|
|
|
2008-04-06 08:52:58 -04:00
|
|
|
This class uses @ref overview_refcount "reference counting and copy-on-write" internally
|
|
|
|
so that assignments between two instances of this class are very cheap.
|
2008-03-16 20:47:38 -04:00
|
|
|
You can therefore use actual objects instead of pointers without efficiency problems.
|
|
|
|
If an instance of this class is changed it will create its own data internally
|
|
|
|
so that other instances, which previously shared the data using the reference
|
|
|
|
counting, are not affected.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
|
|
|
@category{gdi}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@stdobjects
|
2008-04-10 17:16:38 -04:00
|
|
|
@li ::wxNullPen
|
2009-02-04 11:30:27 -05:00
|
|
|
@li ::wxBLACK_DASHED_PEN
|
|
|
|
@li ::wxBLACK_PEN
|
|
|
|
@li ::wxBLUE_PEN
|
2008-04-10 17:16:38 -04:00
|
|
|
@li ::wxCYAN_PEN
|
|
|
|
@li ::wxGREEN_PEN
|
2009-05-09 08:40:09 -04:00
|
|
|
@li ::wxYELLOW_PEN
|
2008-04-10 17:16:38 -04:00
|
|
|
@li ::wxGREY_PEN
|
|
|
|
@li ::wxLIGHT_GREY_PEN
|
2009-02-04 11:30:27 -05:00
|
|
|
@li ::wxMEDIUM_GREY_PEN
|
|
|
|
@li ::wxRED_PEN
|
|
|
|
@li ::wxTRANSPARENT_PEN
|
|
|
|
@li ::wxWHITE_PEN
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-04-06 08:52:58 -04:00
|
|
|
@see wxPenList, wxDC, wxDC::SetPen()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxPen : public wxGDIObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2008-04-06 08:52:58 -04:00
|
|
|
Default constructor. The pen will be uninitialised, and IsOk() will return @false.
|
2008-03-16 20:47:38 -04:00
|
|
|
*/
|
|
|
|
wxPen();
|
|
|
|
|
2017-05-02 05:02:37 -04:00
|
|
|
/**
|
|
|
|
Creates a pen object using the specified pen description.
|
|
|
|
*/
|
|
|
|
wxPen(const wxPenInfo& info);
|
|
|
|
|
2008-03-16 20:47:38 -04:00
|
|
|
/**
|
|
|
|
Constructs a pen from a colour object, pen width and style.
|
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param colour
|
2008-03-09 08:33:59 -04:00
|
|
|
A colour object.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param width
|
2008-03-09 08:33:59 -04:00
|
|
|
Pen width. Under Windows, the pen width cannot be greater than 1 if
|
2009-02-04 11:49:32 -05:00
|
|
|
the style is @c wxPENSTYLE_DOT, @c wxPENSTYLE_LONG_DASH, @c wxPENSTYLE_SHORT_DASH,
|
|
|
|
@c wxPENSTYLE_DOT_DASH, or @c wxPENSTYLE_USER_DASH.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param style
|
2008-03-16 20:47:38 -04:00
|
|
|
The style may be one of the ::wxPenStyle values.
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@remarks Different versions of Windows and different versions of other
|
2008-11-21 19:21:10 -05:00
|
|
|
platforms support very different subsets of the styles above
|
|
|
|
so handle with care.
|
2008-03-16 20:47:38 -04:00
|
|
|
|
2008-04-06 08:52:58 -04:00
|
|
|
@see SetStyle(), SetColour(), SetWidth()
|
|
|
|
*/
|
|
|
|
wxPen(const wxColour& colour, int width = 1, wxPenStyle style = wxPENSTYLE_SOLID);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Constructs a stippled pen from a stipple bitmap and a width.
|
|
|
|
|
|
|
|
@param width
|
|
|
|
Pen width. Under Windows, the pen width cannot be greater than 1 if
|
2009-02-04 11:49:32 -05:00
|
|
|
the style is @c wxPENSTYLE_DOT, @c wxPENSTYLE_LONG_DASH, @c wxPENSTYLE_SHORT_DASH,
|
|
|
|
@c wxPENSTYLE_DOT_DASH, or @c wxPENSTYLE_USER_DASH.
|
2008-04-06 08:52:58 -04:00
|
|
|
@param stipple
|
|
|
|
A stipple bitmap.
|
|
|
|
|
2009-03-14 21:19:09 -04:00
|
|
|
@onlyfor{wxmsw,wxosx}
|
2008-11-10 16:33:25 -05:00
|
|
|
|
2008-04-06 08:52:58 -04:00
|
|
|
@see SetWidth(), SetStipple()
|
|
|
|
*/
|
|
|
|
wxPen(const wxBitmap& stipple, int width);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Copy constructor, uses @ref overview_refcount.
|
|
|
|
|
|
|
|
@param pen
|
|
|
|
A pointer or reference to a pen to copy.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
wxPen(const wxPen& pen);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor.
|
2008-04-06 08:52:58 -04:00
|
|
|
@see @ref overview_refcount_destruct "reference-counted object destruction"
|
2008-03-16 20:47:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@remarks Although all remaining pens are deleted when the application
|
2008-03-09 08:33:59 -04:00
|
|
|
exits, the application should try to clean up all pens
|
|
|
|
itself. This is because wxWidgets cannot know if a
|
|
|
|
pointer to the pen object is stored in an application
|
|
|
|
data structure, and there is a risk of double deletion.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual ~wxPen();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2009-02-04 11:49:32 -05:00
|
|
|
Returns the pen cap style, which may be one of @c wxCAP_ROUND,
|
|
|
|
@c wxCAP_PROJECTING and @c wxCAP_BUTT.
|
2008-04-06 08:52:58 -04:00
|
|
|
|
|
|
|
The default is @c wxCAP_ROUND.
|
2008-03-16 20:47:38 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetCap()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-28 12:47:58 -04:00
|
|
|
virtual wxPenCap GetCap() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns a reference to the pen colour.
|
2008-03-16 20:47:38 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetColour()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-28 12:47:58 -04:00
|
|
|
virtual wxColour GetColour() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2009-02-04 11:49:32 -05:00
|
|
|
Gets an array of dashes (defined as @c char in X, @c DWORD under Windows).
|
2008-03-09 08:33:59 -04:00
|
|
|
@a dashes is a pointer to the internal array. Do not deallocate or store this
|
2008-03-08 08:52:38 -05:00
|
|
|
pointer.
|
2008-04-06 08:52:58 -04:00
|
|
|
|
|
|
|
@return The number of dashes associated with this pen.
|
2008-03-16 20:47:38 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetDashes()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-28 12:47:58 -04:00
|
|
|
virtual int GetDashes(wxDash** dashes) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2009-02-04 11:49:32 -05:00
|
|
|
Returns the pen join style, which may be one of @c wxJOIN_BEVEL,
|
|
|
|
@c wxJOIN_ROUND and @c wxJOIN_MITER.
|
2008-04-06 08:52:58 -04:00
|
|
|
|
|
|
|
The default is @c wxJOIN_ROUND.
|
2008-03-16 20:47:38 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetJoin()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-28 12:47:58 -04:00
|
|
|
virtual wxPenJoin GetJoin() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets a pointer to the stipple bitmap.
|
2008-03-16 20:47:38 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetStipple()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-28 12:47:58 -04:00
|
|
|
virtual wxBitmap* GetStipple() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the pen style.
|
2008-03-16 20:47:38 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see wxPen(), SetStyle()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-28 12:47:58 -04:00
|
|
|
virtual wxPenStyle GetStyle() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the pen width.
|
2008-03-16 20:47:38 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetWidth()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-28 12:47:58 -04:00
|
|
|
virtual int GetWidth() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the pen is initialised.
|
2010-10-15 19:46:46 -04:00
|
|
|
|
|
|
|
Notice that an uninitialized pen object can't be queried for any pen
|
|
|
|
properties and all calls to the accessor methods on it will result in
|
|
|
|
an assert failure.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-13 07:09:56 -04:00
|
|
|
virtual bool IsOk() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2010-10-15 19:46:46 -04:00
|
|
|
/**
|
|
|
|
Returns @true if the pen is a valid non-transparent pen.
|
|
|
|
|
|
|
|
This method returns @true if the pen object is initialized and has a
|
|
|
|
non-transparent style. Notice that this should be used instead of
|
|
|
|
simply testing whether GetStyle() returns a style different from
|
|
|
|
wxPENSTYLE_TRANSPARENT if the pen may be invalid as GetStyle() would
|
|
|
|
assert in this case.
|
|
|
|
|
|
|
|
@see IsTransparent()
|
|
|
|
|
|
|
|
@since 2.9.2.
|
|
|
|
*/
|
|
|
|
bool IsNonTransparent() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the pen is transparent.
|
|
|
|
|
|
|
|
A transparent pen is simply a pen with wxPENSTYLE_TRANSPARENT style.
|
|
|
|
|
|
|
|
Notice that this function works even for non-initialized pens (for
|
|
|
|
which it returns @false) unlike tests of the form <code>GetStyle() ==
|
|
|
|
wxPENSTYLE_TRANSPARENT</code> which would assert if the pen is invalid.
|
|
|
|
|
|
|
|
@see IsNonTransparent()
|
|
|
|
|
|
|
|
@since 2.9.2.
|
|
|
|
*/
|
|
|
|
bool IsTransparent() const;
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2008-04-06 08:52:58 -04:00
|
|
|
Sets the pen cap style, which may be one of @c wxCAP_ROUND, @c wxCAP_PROJECTING
|
|
|
|
and @c wxCAP_BUTT. The default is @c wxCAP_ROUND.
|
2008-03-16 20:47:38 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetCap()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-28 12:47:58 -04:00
|
|
|
virtual void SetCap(wxPenCap capStyle);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
The pen's colour is changed to the given colour.
|
2008-03-16 20:47:38 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetColour()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-28 12:47:58 -04:00
|
|
|
virtual void SetColour(wxColour& colour);
|
|
|
|
virtual void SetColour(unsigned char red, unsigned char green, unsigned char blue);
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
2011-10-21 14:33:51 -04:00
|
|
|
Associates an array of dash values (defined as @c char in X, @c DWORD under
|
2008-04-06 08:52:58 -04:00
|
|
|
Windows) with the pen.
|
|
|
|
|
|
|
|
The array is not deallocated by wxPen, but neither must it be deallocated by
|
|
|
|
the calling application until the pen is deleted or this function is called
|
|
|
|
with a @NULL array.
|
2008-03-16 20:47:38 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetDashes()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-28 11:36:26 -04:00
|
|
|
virtual void SetDashes(int n, const wxDash* dash);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-04-06 08:52:58 -04:00
|
|
|
Sets the pen join style, which may be one of @c wxJOIN_BEVEL, @c wxJOIN_ROUND
|
|
|
|
and @c wxJOIN_MITER.
|
|
|
|
|
|
|
|
The default is @c wxJOIN_ROUND.
|
2008-03-16 20:47:38 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetJoin()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-28 12:47:58 -04:00
|
|
|
virtual void SetJoin(wxPenJoin join_style);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the bitmap for stippling.
|
2008-03-16 20:47:38 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetStipple()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-28 11:36:26 -04:00
|
|
|
virtual void SetStipple(const wxBitmap& stipple);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Set the pen style.
|
2008-03-16 20:47:38 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see wxPen()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-28 12:47:58 -04:00
|
|
|
virtual void SetStyle(wxPenStyle style);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the pen width.
|
2008-03-16 20:47:38 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetWidth()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-28 12:47:58 -04:00
|
|
|
virtual void SetWidth(int width);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Inequality operator.
|
2008-04-06 12:19:04 -04:00
|
|
|
|
2008-04-06 08:52:58 -04:00
|
|
|
See @ref overview_refcount_equality "reference-counted object comparison" for
|
2008-03-08 08:52:38 -05:00
|
|
|
more info.
|
|
|
|
*/
|
2008-10-27 17:26:54 -04:00
|
|
|
bool operator!=(const wxPen& pen) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-04-06 08:52:58 -04:00
|
|
|
Assignment operator, using @ref overview_refcount.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-28 11:36:26 -04:00
|
|
|
wxPen& operator=(const wxPen& pen);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Equality operator.
|
2008-04-06 12:19:04 -04:00
|
|
|
|
2008-04-06 08:52:58 -04:00
|
|
|
See @ref overview_refcount_equality "reference-counted object comparison" for
|
2008-03-08 08:52:38 -05:00
|
|
|
more info.
|
|
|
|
*/
|
2008-10-27 17:26:54 -04:00
|
|
|
bool operator==(const wxPen& pen) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|
|
|
|
/**
|
2008-03-28 12:47:58 -04:00
|
|
|
An empty pen.
|
2009-02-04 11:49:32 -05:00
|
|
|
wxPen::IsOk() always returns @false for this object.
|
2008-03-10 11:24:38 -04:00
|
|
|
*/
|
|
|
|
wxPen wxNullPen;
|
|
|
|
|
|
|
|
/**
|
2008-03-28 12:47:58 -04:00
|
|
|
Red pen.
|
2009-02-04 11:49:32 -05:00
|
|
|
Except for the color it has all standard attributes
|
|
|
|
(1-pixel width, @c wxPENSTYLE_SOLID and @c wxCAP_ROUND styles, etc...).
|
2008-03-10 11:24:38 -04:00
|
|
|
*/
|
2008-04-06 12:19:04 -04:00
|
|
|
wxPen* wxRED_PEN;
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2009-02-04 11:49:32 -05:00
|
|
|
/**
|
|
|
|
Blue pen.
|
|
|
|
Except for the color it has all standard attributes
|
|
|
|
(1-pixel width, @c wxPENSTYLE_SOLID and @c wxCAP_ROUND styles, etc...).
|
|
|
|
*/
|
|
|
|
wxPen* wxBLUE_PEN;
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
/**
|
2008-03-28 12:47:58 -04:00
|
|
|
Cyan pen.
|
2009-02-04 11:49:32 -05:00
|
|
|
Except for the color it has all standard attributes
|
|
|
|
(1-pixel width, @c wxPENSTYLE_SOLID and @c wxCAP_ROUND styles, etc...).
|
2008-03-10 11:24:38 -04:00
|
|
|
*/
|
2008-04-06 12:19:04 -04:00
|
|
|
wxPen* wxCYAN_PEN;
|
2008-03-10 11:24:38 -04:00
|
|
|
|
|
|
|
/**
|
2008-03-28 12:47:58 -04:00
|
|
|
Green pen.
|
2009-02-04 11:49:32 -05:00
|
|
|
Except for the color it has all standard attributes
|
|
|
|
(1-pixel width, @c wxPENSTYLE_SOLID and @c wxCAP_ROUND styles, etc...).
|
2008-03-10 11:24:38 -04:00
|
|
|
*/
|
2008-04-06 12:19:04 -04:00
|
|
|
wxPen* wxGREEN_PEN;
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2009-05-09 08:40:09 -04:00
|
|
|
/**
|
|
|
|
Yellow pen.
|
|
|
|
Except for the color it has all standard attributes
|
|
|
|
(1-pixel width, @c wxPENSTYLE_SOLID and @c wxCAP_ROUND styles, etc...).
|
|
|
|
*/
|
|
|
|
wxPen* wxYELLOW_PEN;
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
/**
|
2008-03-28 12:47:58 -04:00
|
|
|
Black pen.
|
2009-02-04 11:49:32 -05:00
|
|
|
Except for the color it has all standard attributes
|
|
|
|
(1-pixel width, @c wxPENSTYLE_SOLID and @c wxCAP_ROUND styles, etc...).
|
2008-03-10 11:24:38 -04:00
|
|
|
*/
|
2008-04-06 12:19:04 -04:00
|
|
|
wxPen* wxBLACK_PEN;
|
2008-03-10 11:24:38 -04:00
|
|
|
|
|
|
|
/**
|
2008-03-28 12:47:58 -04:00
|
|
|
White pen.
|
2009-02-04 11:49:32 -05:00
|
|
|
Except for the color it has all standard attributes
|
|
|
|
(1-pixel width, @c wxPENSTYLE_SOLID and @c wxCAP_ROUND styles, etc...).
|
2008-03-10 11:24:38 -04:00
|
|
|
*/
|
2008-04-06 12:19:04 -04:00
|
|
|
wxPen* wxWHITE_PEN;
|
2008-03-10 11:24:38 -04:00
|
|
|
|
|
|
|
/**
|
2008-03-28 12:47:58 -04:00
|
|
|
Transparent pen.
|
2009-02-04 11:49:32 -05:00
|
|
|
Except for the color it has all standard attributes
|
|
|
|
(1-pixel width, @c wxPENSTYLE_SOLID and @c wxCAP_ROUND styles, etc...).
|
2008-03-10 11:24:38 -04:00
|
|
|
*/
|
2008-04-06 12:19:04 -04:00
|
|
|
wxPen* wxTRANSPARENT_PEN;
|
2008-03-10 11:24:38 -04:00
|
|
|
|
|
|
|
/**
|
2008-03-28 12:47:58 -04:00
|
|
|
Black dashed pen.
|
2009-02-04 11:49:32 -05:00
|
|
|
Except for the color and for the @c wxPENSTYLE_SHORT_DASH it has all standard attributes
|
|
|
|
(1-pixel width, @c wxCAP_ROUND style, etc...).
|
2008-03-10 11:24:38 -04:00
|
|
|
*/
|
2008-04-06 12:19:04 -04:00
|
|
|
wxPen* wxBLACK_DASHED_PEN;
|
2008-03-10 11:24:38 -04:00
|
|
|
|
|
|
|
/**
|
2008-03-28 12:47:58 -04:00
|
|
|
Grey pen.
|
2009-02-04 11:49:32 -05:00
|
|
|
Except for the color it has all standard attributes
|
|
|
|
(1-pixel width, @c wxPENSTYLE_SOLID and @c wxCAP_ROUND styles, etc...).
|
2008-03-10 11:24:38 -04:00
|
|
|
*/
|
2008-04-06 12:19:04 -04:00
|
|
|
wxPen* wxGREY_PEN;
|
2008-03-10 11:24:38 -04:00
|
|
|
|
|
|
|
/**
|
2008-03-28 12:47:58 -04:00
|
|
|
Medium-grey pen.
|
2009-02-04 11:49:32 -05:00
|
|
|
Except for the color it has all standard attributes
|
|
|
|
(1-pixel width, @c wxPENSTYLE_SOLID and @c wxCAP_ROUND styles, etc...).
|
2008-03-10 11:24:38 -04:00
|
|
|
*/
|
2008-04-06 12:19:04 -04:00
|
|
|
wxPen* wxMEDIUM_GREY_PEN;
|
2008-03-10 11:24:38 -04:00
|
|
|
|
|
|
|
/**
|
2008-03-28 12:47:58 -04:00
|
|
|
Light-grey pen.
|
2009-02-04 11:49:32 -05:00
|
|
|
Except for the color it has all standard attributes
|
|
|
|
(1-pixel width, @c wxPENSTYLE_SOLID and @c wxCAP_ROUND styles, etc...).
|
2008-03-10 11:24:38 -04:00
|
|
|
*/
|
2008-04-06 12:19:04 -04:00
|
|
|
wxPen* wxLIGHT_GREY_PEN;
|
2008-03-10 11:24:38 -04:00
|
|
|
|
|
|
|
|
2008-03-16 20:47:38 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxPenList
|
|
|
|
|
|
|
|
There is only one instance of this class: ::wxThePenList.
|
|
|
|
Use this object to search for a previously created pen of the desired
|
|
|
|
type and create it if not already found. In some windowing systems,
|
|
|
|
the pen may be a scarce resource, so it can pay to reuse old
|
|
|
|
resources if possible. When an application finishes, all pens will
|
|
|
|
be deleted and their resources freed, eliminating the possibility of
|
|
|
|
'memory leaks'. However, it is best not to rely on this automatic
|
|
|
|
cleanup because it can lead to double deletion in some circumstances.
|
|
|
|
|
|
|
|
There are two mechanisms in recent versions of wxWidgets which make the
|
|
|
|
pen list less useful than it once was. Under Windows, scarce resources
|
|
|
|
are cleaned up internally if they are not being used. Also, a referencing
|
|
|
|
counting mechanism applied to all GDI objects means that some sharing
|
|
|
|
of underlying resources is possible. You don't have to keep track of pointers,
|
|
|
|
working out when it is safe delete a pen, because the referencing counting does
|
|
|
|
it for you. For example, you can set a pen in a device context, and then
|
|
|
|
immediately delete the pen you passed, because the pen is 'copied'.
|
|
|
|
|
|
|
|
So you may find it easier to ignore the pen list, and instead create
|
|
|
|
and copy pens as you see fit. If your Windows resource meter suggests
|
|
|
|
your application is using too many resources, you can resort to using
|
|
|
|
GDI lists to share objects explicitly.
|
|
|
|
|
|
|
|
The only compelling use for the pen list is for wxWidgets to keep
|
|
|
|
track of pens in order to clean them up on exit. It is also kept for
|
|
|
|
backward compatibility with earlier versions of wxWidgets.
|
|
|
|
|
|
|
|
@library{wxcore}
|
|
|
|
@category{gdi}
|
|
|
|
|
|
|
|
@stdobjects
|
|
|
|
::wxThePenList
|
|
|
|
|
|
|
|
@see wxPen
|
|
|
|
*/
|
|
|
|
class wxPenList
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Constructor. The application should not construct its own pen list:
|
|
|
|
use the object pointer ::wxThePenList.
|
|
|
|
*/
|
|
|
|
wxPenList();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Finds a pen with the specified attributes and returns it, else creates a
|
|
|
|
new pen, adds it to the pen list, and returns it.
|
|
|
|
|
|
|
|
@param colour
|
|
|
|
Colour object.
|
|
|
|
@param width
|
|
|
|
Width of pen.
|
|
|
|
@param style
|
|
|
|
Pen style. See ::wxPenStyle for a list of styles.
|
|
|
|
*/
|
2008-03-21 20:04:01 -04:00
|
|
|
wxPen* FindOrCreatePen(const wxColour& colour,
|
|
|
|
int width = 1,
|
|
|
|
wxPenStyle style = wxPENSTYLE_SOLID);
|
2008-03-16 20:47:38 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
The global list of wxPen objects ready to be re-used (for better performances).
|
|
|
|
*/
|
|
|
|
wxPenList* wxThePenList;
|
|
|
|
|