]>
git.saurik.com Git - wxWidgets.git/blob - interface/pen.h
56ee53f9911e8d4ab6129732b8d82c555f903ed8
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".
59 Pen width. Under Windows, the pen width cannot be greater than 1 if
60 the style is wxDOT, wxLONG_DASH, wxSHORT_DASH, wxDOT_DASH, or wxUSER_DASH.
64 A pointer or reference to a pen to copy.
66 The style may be one of the following:
144 Use the stipple bitmap.
155 Use the user dashes: see SetDashes().
166 Backward diagonal hatch.
177 Cross-diagonal hatch.
188 Forward diagonal hatch.
223 @remarks Different versions of Windows and different versions of other
224 platforms support very different subsets of the styles
225 above - there is no similarity even between Windows95
226 and Windows98 - so handle with care.
228 @see SetStyle(), SetColour(), SetWidth(), SetStipple()
231 wxPen(const wxColour
& colour
, int width
= 1,
232 int style
= wxSOLID
);
233 wxPen(const wxString
& colourName
, int width
, int style
);
234 wxPen(const wxBitmap
& stipple
, int width
);
235 wxPen(const wxPen
& pen
);
240 See @ref overview_refcountdestruct "reference-counted object destruction" for
243 @remarks Although all remaining pens are deleted when the application
244 exits, the application should try to clean up all pens
245 itself. This is because wxWidgets cannot know if a
246 pointer to the pen object is stored in an application
247 data structure, and there is a risk of double deletion.
252 Returns the pen cap style, which may be one of @b wxCAP_ROUND, @b
254 @b wxCAP_BUTT. The default is @b wxCAP_ROUND.
261 Returns a reference to the pen colour.
265 wxColour
GetColour() const;
268 Gets an array of dashes (defined as char in X, DWORD under Windows).
269 @a dashes is a pointer to the internal array. Do not deallocate or store this
271 The function returns the number of dashes associated with this pen.
275 int GetDashes(wxDash
** dashes
) const;
278 Returns the pen join style, which may be one of @b wxJOIN_BEVEL, @b
280 @b wxJOIN_MITER. The default is @b wxJOIN_ROUND.
287 Gets a pointer to the stipple bitmap.
291 wxBitmap
* GetStipple() const;
294 Returns the pen style.
296 @see wxPen(), SetStyle()
298 int GetStyle() const;
301 Returns the pen width.
305 int GetWidth() const;
308 Returns @true if the pen is initialised.
313 Sets the pen cap style, which may be one of @b wxCAP_ROUND, @b wxCAP_PROJECTING
315 @b wxCAP_BUTT. The default is @b wxCAP_ROUND.
319 void SetCap(int capStyle
);
323 The pen's colour is changed to the given colour.
327 void SetColour(wxColour
& colour
);
328 void SetColour(const wxString
& colourName
);
329 void SetColour(unsigned char red
, unsigned char green
,
334 Associates an array of pointers to dashes (defined as char in X, DWORD under
336 with the pen. The array is not deallocated by wxPen, but neither must it be
337 deallocated by the calling application until the pen is deleted or this
338 function is called with a @NULL array.
342 void SetDashes(int n
, wxDash
* dashes
);
345 Sets the pen join style, which may be one of @b wxJOIN_BEVEL, @b wxJOIN_ROUND
347 @b wxJOIN_MITER. The default is @b wxJOIN_ROUND.
351 void SetJoin(int join_style
);
354 Sets the bitmap for stippling.
358 void SetStipple(wxBitmap
* stipple
);
365 void SetStyle(int style
);
372 void SetWidth(int width
);
376 See @ref overview_refcountequality "reference-counted object comparison" for
379 bool operator !=(const wxPen
& pen
);
382 Assignment operator, using @ref overview_trefcount "reference counting".
384 wxPen
operator =(const wxPen
& pen
);
388 See @ref overview_refcountequality "reference-counted object comparison" for
391 bool operator ==(const wxPen
& pen
);