]>
git.saurik.com Git - wxWidgets.git/blob - interface/pen.h
d6252a98317396ebff5ef6f22d2c924932ce217b
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: documentation for wxPen class
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
13 A pen is a drawing tool for drawing outlines. It is used for drawing
14 lines and painting the outline of rectangles, ellipses, etc. It has a
15 colour, a width and a style.
45 wxPenList, wxDC, wxDC::SetPen
47 class wxPen
: public wxGDIObject
52 Copy constructor, uses @ref overview_trefcount "reference counting".
61 Pen width. Under Windows, the pen width cannot be greater than 1 if
62 the style is wxDOT, wxLONG_DASH, wxSHORT_DASH, wxDOT_DASH, or wxUSER_DASH.
68 A pointer or reference to a pen to copy.
71 The style may be one of the following:
106 Use the stipple bitmap.
111 Use the user dashes: see SetDashes().
116 Backward diagonal hatch.
121 Cross-diagonal hatch.
126 Forward diagonal hatch.
143 @remarks Different versions of Windows and different versions of other
144 platforms support very different subsets of the
145 styles above - there is no similarity even between
146 Windows95 and Windows98 - so handle with care.
148 @sa SetStyle(), SetColour(), SetWidth(), SetStipple()
151 wxPen(const wxColour
& colour
, int width
= 1,
152 int style
= wxSOLID
);
153 wxPen(const wxString
& colourName
, int width
, int style
);
154 wxPen(const wxBitmap
& stipple
, int width
);
155 wxPen(const wxPen
& pen
);
160 See @ref overview_refcountdestruct "reference-counted object destruction" for
163 @remarks Although all remaining pens are deleted when the application
164 exits, the application should try to clean up all
165 pens itself. This is because wxWidgets cannot know if
166 a pointer to the pen object is stored in an
167 application data structure, and there is a risk of
173 Returns the pen cap style, which may be one of @b wxCAP_ROUND, @b
175 @b wxCAP_BUTT. The default is @b wxCAP_ROUND.
182 Returns a reference to the pen colour.
186 wxColour
GetColour();
189 Gets an array of dashes (defined as char in X, DWORD under Windows).
190 @e dashes is a pointer to the internal array. Do not deallocate or store this
192 The function returns the number of dashes associated with this pen.
196 int GetDashes(wxDash
** dashes
);
199 Returns the pen join style, which may be one of @b wxJOIN_BEVEL, @b
201 @b wxJOIN_MITER. The default is @b wxJOIN_ROUND.
208 Gets a pointer to the stipple bitmap.
212 wxBitmap
* GetStipple();
215 Returns the pen style.
217 @sa wxPen(), SetStyle()
222 Returns the pen width.
229 Returns @true if the pen is initialised.
231 #define bool IsOk() /* implementation is private */
234 Sets the pen cap style, which may be one of @b wxCAP_ROUND, @b wxCAP_PROJECTING
236 @b wxCAP_BUTT. The default is @b wxCAP_ROUND.
240 void SetCap(int capStyle
);
244 The pen's colour is changed to the given colour.
248 void SetColour(wxColour
& colour
);
249 void SetColour(const wxString
& colourName
);
250 void SetColour(unsigned char red
, unsigned char green
,
255 Associates an array of pointers to dashes (defined as char in X, DWORD under
257 with the pen. The array is not deallocated by wxPen, but neither must it be
258 deallocated by the calling application until the pen is deleted or this
259 function is called with a @NULL array.
263 void SetDashes(int n
, wxDash
* dashes
);
266 Sets the pen join style, which may be one of @b wxJOIN_BEVEL, @b wxJOIN_ROUND
268 @b wxJOIN_MITER. The default is @b wxJOIN_ROUND.
272 void SetJoin(int join_style
);
275 Sets the bitmap for stippling.
279 void SetStipple(wxBitmap
* stipple
);
286 void SetStyle(int style
);
293 void SetWidth(int width
);
297 See @ref overview_refcountequality "reference-counted object comparison" for
300 bool operator !=(const wxPen
& pen
);
303 Assignment operator, using @ref overview_trefcount "reference counting".
305 wxPen
operator =(const wxPen
& pen
);
309 See @ref overview_refcountequality "reference-counted object comparison" for
312 bool operator ==(const wxPen
& pen
);