.\" This is a wxWidgets manpage page generated from the XML docs .TH wxPen 3wx 2005-02-15 "wxWidgets" "wxWidgets class documentation" .SH NAME wxPen \- Used for drawing lines on a device context .SH DESCRIPTION A pen is a drawing tool for drawing outlines. It is used for drawing lines and painting the outline of rectangles, ellipses, etc. It has a colour, a width and a style. .SH REMARKS On a monochrome display, wxWidgets shows all non-white pens as black. Do not initialize objects on the stack before the program commences, since other required structures may not have been set up yet. Instead, define global pointers to objects and create them in OnInit 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 the global list of pens wxThePenList , and calling the member function FindOrCreatePen . See the entry for wxPenList . wxPen uses a reference counting system, so assignments between brushes are very cheap. You can therefore use actual wxPen objects instead of pointers without efficiency problems. Once one wxPen object changes its data it will create its own pen data internally so that other pens, which previously shared the data using the reference counting, are not affected. .SH "PARENTS" wxGDIObject wxObject .SH "INCLUDE FILES" wx/pen.h .SH MEMBERS .SS wxPen () Default constructor. The pen will be uninitialised, and wxPen::Ok will return false. .SS wxPen (const wxColour& colourint width = 1int style = wxSOLID) Constructs a pen from a colour object, pen width and style. .SS wxPen (const wxString& colourNameint widthint style) Constructs a pen from a colour name, pen width and style. .SS wxPen (const wxBitmap& stippleint width) Constructs a stippled pen from a stipple bitmap and a width. .SS wxPen (const wxPen& pen) .SS ~wxPen () Destructor. .SS int GetCap () Returns the pen cap style, which may be one of wxCAP_ROUND , wxCAP_PROJECTING and wxCAP_BUTT . The default is wxCAP_ROUND . .SS wxColour& GetColour () Returns a reference to the pen colour. .SS int GetDashes (wxDash** dashes) Gets an array of dashes (defined as char in X, DWORD under Windows). dashes is a pointer to the internal array. Do not deallocate or store this pointer. The function returns the number of dashes associated with this pen. .SS int GetJoin () Returns the pen join style, which may be one of wxJOIN_BEVEL , wxJOIN_ROUND and wxJOIN_MITER . The default is wxJOIN_ROUND . .SS wxBitmap* GetStipple () Gets a pointer to the stipple bitmap. .SS int GetStyle () .SS int GetWidth () Returns the pen width. .SS bool Ok () Returns true if the pen is initialised. .SS void SetCap (int capStyle) Sets the pen cap style, which may be one of wxCAP_ROUND , wxCAP_PROJECTING and wxCAP_BUTT . The default is wxCAP_ROUND . .SS void SetColour (wxColour& colour) .SS void SetColour (const wxString& colourName) .SS void SetColour (unsigned char redunsigned char greenunsigned char blue) The pen's colour is changed to the given colour. .SS void SetDashes (int nwxDash* dashes) Associates an array of pointers to dashes (defined as char in X, DWORD under 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. .SS void SetJoin (int join_style) Sets the pen join style, which may be one of wxJOIN_BEVEL , wxJOIN_ROUND and wxJOIN_MITER . The default is wxJOIN_ROUND . .SS void SetStipple (wxBitmap* stipple) Sets the bitmap for stippling. .SS void SetStyle (int style) Set the pen style. .SS void SetWidth (int width) Sets the pen width. .SS wxPen& operator = (const wxPen& pen) Assignment operator, using reference counting. Returns a reference to `this'. .SS bool operator == (const wxPen& pen) Equality operator. Two pens are equal if they contain pointers to the same underlying pen data. It does not compare each attribute, so two independently-created pens using the same parameters will fail the test. .SS bool operator != (const wxPen& pen) Inequality operator. Two pens are not equal if they contain pointers to different underlying pen data. It does not compare each attribute. .SH "SEE ALSO" wxGDIObject wxObject wxPenList wxDC wxDC::SetPen .SH "AUTHORS" Documentation content by Julian Smart, Robert Roebling, Vadim Zeitlin, Robin Dunn, et al Conversion to manpage format by Arnout Engelen (http://bzzt.net), bugreports welcome.