]>
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 /////////////////////////////////////////////////////////////////////////////
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.
21 ::Objects:, ::wxNullPen, ::Pointers:, ::wxRED_PEN, ::wxCYAN_PEN, ::wxGREEN_PEN,
22 ::wxBLACK_PEN, ::wxWHITE_PEN, ::wxTRANSPARENT_PEN, ::wxBLACK_DASHED_PEN, ::wxGREY_PEN, ::wxMEDIUM_GREY_PEN, ::wxLIGHT_GREY_PEN,
24 @see wxPenList, wxDC, wxDC::SetPen
26 class wxPen
: public wxGDIObject
31 Copy constructor, uses @ref overview_trefcount "reference counting".
38 Pen width. Under Windows, the pen width cannot be greater than 1 if
39 the style is wxDOT, wxLONG_DASH, wxSHORT_DASH, wxDOT_DASH, or wxUSER_DASH.
43 A pointer or reference to a pen to copy.
45 The style may be one of the following:
123 Use the stipple bitmap.
134 Use the user dashes: see SetDashes().
145 Backward diagonal hatch.
156 Cross-diagonal hatch.
167 Forward diagonal hatch.
202 @remarks Different versions of Windows and different versions of other
203 platforms support very different subsets of the styles
204 above - there is no similarity even between Windows95
205 and Windows98 - so handle with care.
207 @see SetStyle(), SetColour(), SetWidth(), SetStipple()
210 wxPen(const wxColour
& colour
, int width
= 1,
211 int style
= wxSOLID
);
212 wxPen(const wxString
& colourName
, int width
, int style
);
213 wxPen(const wxBitmap
& stipple
, int width
);
214 wxPen(const wxPen
& pen
);
219 See @ref overview_refcountdestruct "reference-counted object destruction" for
222 @remarks Although all remaining pens are deleted when the application
223 exits, the application should try to clean up all pens
224 itself. This is because wxWidgets cannot know if a
225 pointer to the pen object is stored in an application
226 data structure, and there is a risk of double deletion.
231 Returns the pen cap style, which may be one of @b wxCAP_ROUND, @b
233 @b wxCAP_BUTT. The default is @b wxCAP_ROUND.
240 Returns a reference to the pen colour.
244 wxColour
GetColour() const;
247 Gets an array of dashes (defined as char in X, DWORD under Windows).
248 @a dashes is a pointer to the internal array. Do not deallocate or store this
250 The function returns the number of dashes associated with this pen.
254 int GetDashes(wxDash
** dashes
) const;
257 Returns the pen join style, which may be one of @b wxJOIN_BEVEL, @b
259 @b wxJOIN_MITER. The default is @b wxJOIN_ROUND.
266 Gets a pointer to the stipple bitmap.
270 wxBitmap
* GetStipple() const;
273 Returns the pen style.
275 @see wxPen(), SetStyle()
277 int GetStyle() const;
280 Returns the pen width.
284 int GetWidth() const;
287 Returns @true if the pen is initialised.
292 Sets the pen cap style, which may be one of @b wxCAP_ROUND, @b wxCAP_PROJECTING
294 @b wxCAP_BUTT. The default is @b wxCAP_ROUND.
298 void SetCap(int capStyle
);
302 The pen's colour is changed to the given colour.
306 void SetColour(wxColour
& colour
);
307 void SetColour(const wxString
& colourName
);
308 void SetColour(unsigned char red
, unsigned char green
,
313 Associates an array of pointers to dashes (defined as char in X, DWORD under
315 with the pen. The array is not deallocated by wxPen, but neither must it be
316 deallocated by the calling application until the pen is deleted or this
317 function is called with a @NULL array.
321 void SetDashes(int n
, wxDash
* dashes
);
324 Sets the pen join style, which may be one of @b wxJOIN_BEVEL, @b wxJOIN_ROUND
326 @b wxJOIN_MITER. The default is @b wxJOIN_ROUND.
330 void SetJoin(int join_style
);
333 Sets the bitmap for stippling.
337 void SetStipple(wxBitmap
* stipple
);
344 void SetStyle(int style
);
351 void SetWidth(int width
);
355 See @ref overview_refcountequality "reference-counted object comparison" for
358 bool operator !=(const wxPen
& pen
);
361 Assignment operator, using @ref overview_trefcount "reference counting".
363 wxPen
operator =(const wxPen
& pen
);
367 See @ref overview_refcountequality "reference-counted object comparison" for
370 bool operator ==(const wxPen
& pen
);
419 wxPen wxTRANSPARENT_PEN
;
424 wxPen wxBLACK_DASHED_PEN
;
434 wxPen wxMEDIUM_GREY_PEN
;
439 wxPen wxLIGHT_GREY_PEN
;