]>
git.saurik.com Git - wxWidgets.git/blob - interface/pen.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxPen
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
11 @ingroup group_class_gdi
14 A pen is a drawing tool for drawing outlines. It is used for drawing
15 lines and painting the outline of rectangles, ellipses, etc. It has a
16 colour, a width and a style.
22 ::Objects:, ::wxNullPen, ::Pointers:, ::wxRED_PEN, ::wxCYAN_PEN, ::wxGREEN_PEN,
23 ::wxBLACK_PEN, ::wxWHITE_PEN, ::wxTRANSPARENT_PEN, ::wxBLACK_DASHED_PEN, ::wxGREY_PEN, ::wxMEDIUM_GREY_PEN, ::wxLIGHT_GREY_PEN,
25 @see wxPenList, wxDC, wxDC::SetPen
27 class wxPen
: public wxGDIObject
32 Copy constructor, uses @ref overview_trefcount "reference counting".
39 Pen width. Under Windows, the pen width cannot be greater than 1 if
40 the style is wxDOT, wxLONG_DASH, wxSHORT_DASH, wxDOT_DASH, or wxUSER_DASH.
44 A pointer or reference to a pen to copy.
46 The style may be one of the following:
124 Use the stipple bitmap.
135 Use the user dashes: see SetDashes().
146 Backward diagonal hatch.
157 Cross-diagonal hatch.
168 Forward diagonal hatch.
203 @remarks Different versions of Windows and different versions of other
204 platforms support very different subsets of the styles
205 above - there is no similarity even between Windows95
206 and Windows98 - so handle with care.
208 @see SetStyle(), SetColour(), SetWidth(), SetStipple()
211 wxPen(const wxColour
& colour
, int width
= 1,
212 int style
= wxSOLID
);
213 wxPen(const wxString
& colourName
, int width
, int style
);
214 wxPen(const wxBitmap
& stipple
, int width
);
215 wxPen(const wxPen
& pen
);
220 See @ref overview_refcountdestruct "reference-counted object destruction" for
223 @remarks Although all remaining pens are deleted when the application
224 exits, the application should try to clean up all pens
225 itself. This is because wxWidgets cannot know if a
226 pointer to the pen object is stored in an application
227 data structure, and there is a risk of double deletion.
232 Returns the pen cap style, which may be one of @b wxCAP_ROUND, @b
234 @b wxCAP_BUTT. The default is @b wxCAP_ROUND.
241 Returns a reference to the pen colour.
245 wxColour
GetColour() const;
248 Gets an array of dashes (defined as char in X, DWORD under Windows).
249 @a dashes is a pointer to the internal array. Do not deallocate or store this
251 The function returns the number of dashes associated with this pen.
255 int GetDashes(wxDash
** dashes
) const;
258 Returns the pen join style, which may be one of @b wxJOIN_BEVEL, @b
260 @b wxJOIN_MITER. The default is @b wxJOIN_ROUND.
267 Gets a pointer to the stipple bitmap.
271 wxBitmap
* GetStipple() const;
274 Returns the pen style.
276 @see wxPen(), SetStyle()
278 int GetStyle() const;
281 Returns the pen width.
285 int GetWidth() const;
288 Returns @true if the pen is initialised.
293 Sets the pen cap style, which may be one of @b wxCAP_ROUND, @b wxCAP_PROJECTING
295 @b wxCAP_BUTT. The default is @b wxCAP_ROUND.
299 void SetCap(int capStyle
);
303 The pen's colour is changed to the given colour.
307 void SetColour(wxColour
& colour
);
308 void SetColour(const wxString
& colourName
);
309 void SetColour(unsigned char red
, unsigned char green
,
314 Associates an array of pointers to dashes (defined as char in X, DWORD under
316 with the pen. The array is not deallocated by wxPen, but neither must it be
317 deallocated by the calling application until the pen is deleted or this
318 function is called with a @NULL array.
322 void SetDashes(int n
, wxDash
* dashes
);
325 Sets the pen join style, which may be one of @b wxJOIN_BEVEL, @b wxJOIN_ROUND
327 @b wxJOIN_MITER. The default is @b wxJOIN_ROUND.
331 void SetJoin(int join_style
);
334 Sets the bitmap for stippling.
338 void SetStipple(wxBitmap
* stipple
);
345 void SetStyle(int style
);
352 void SetWidth(int width
);
356 See @ref overview_refcountequality "reference-counted object comparison" for
359 bool operator !=(const wxPen
& pen
);
362 Assignment operator, using @ref overview_trefcount "reference counting".
364 wxPen
operator =(const wxPen
& pen
);
368 See @ref overview_refcountequality "reference-counted object comparison" for
371 bool operator ==(const wxPen
& pen
);
420 wxPen wxTRANSPARENT_PEN
;
425 wxPen wxBLACK_DASHED_PEN
;
435 wxPen wxMEDIUM_GREY_PEN
;
440 wxPen wxLIGHT_GREY_PEN
;