#include <wx/pen.h>

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 wxPenList::FindOrCreatePen(). See wxPenList for more info.
This class uses reference counting and copy-on-write internally so that assignments between two instances of this class are very cheap. You can therefore use actual objects instead of pointers without efficiency problems. If an instance of this class is changed it will create its own data internally so that other instances, which previously shared the data using the reference counting, are not affected.
Predefined objects/pointers:
Public Member Functions | |
| wxPen () | |
| wxPen (const wxColour &colour, int width=1, wxPenStyle style=wxPENSTYLE_SOLID) | |
| wxPen (const wxBitmap &stipple, int width) | |
| wxPen (const wxPen &pen) | |
| virtual | ~wxPen () |
| virtual wxPenCap | GetCap () const |
| virtual wxColour | GetColour () const |
| virtual int | GetDashes (wxDash **dashes) const |
| virtual wxPenJoin | GetJoin () const |
| virtual wxBitmap * | GetStipple () const |
| virtual wxPenStyle | GetStyle () const |
| virtual int | GetWidth () const |
| bool | IsOk () const |
| virtual void | SetCap (wxPenCap capStyle) |
| virtual void | SetDashes (int n, wxDash *dashes) |
| virtual void | SetJoin (wxPenJoin join_style) |
| virtual void | SetStipple (wxBitmap *stipple) |
| virtual void | SetStyle (wxPenStyle style) |
| virtual void | SetWidth (int width) |
| bool | operator!= (const wxPen &pen) |
| wxPen | operator= (const wxPen &pen) |
| bool | operator== (const wxPen &pen) |
| virtual void | SetColour (wxColour &colour) |
| virtual void | SetColour (unsigned char red, unsigned char green, unsigned char blue) |
| wxPen::wxPen | ( | ) |
Default constructor. The pen will be uninitialised, and IsOk() will return false.
| wxPen::wxPen | ( | const wxColour & | colour, | |
| int | width = 1, |
|||
| wxPenStyle | style = wxPENSTYLE_SOLID | |||
| ) |
Constructs a pen from a colour object, pen width and style.
| colour | A colour object. | |
| width | Pen width. Under Windows, the pen width cannot be greater than 1 if the style is wxDOT, wxLONG_DASH, wxSHORT_DASH, wxDOT_DASH, or wxUSER_DASH. | |
| style | The style may be one of the wxPenStyle values. |
| wxPen::wxPen | ( | const wxBitmap & | stipple, | |
| int | width | |||
| ) |
Constructs a stippled pen from a stipple bitmap and a width.
| width | Pen width. Under Windows, the pen width cannot be greater than 1 if the style is wxDOT, wxLONG_DASH, wxSHORT_DASH, wxDOT_DASH, or wxUSER_DASH. | |
| stipple | A stipple bitmap. |
| wxPen::wxPen | ( | const wxPen & | pen | ) |
| virtual wxPen::~wxPen | ( | ) | [virtual] |
Destructor.
| virtual wxPenCap wxPen::GetCap | ( | ) | const [virtual] |
Returns the pen cap style, which may be one of wxCAP_ROUND, wxCAP_PROJECTING and wxCAP_BUTT.
The default is wxCAP_ROUND.
| virtual wxColour wxPen::GetColour | ( | ) | const [virtual] |
| virtual int wxPen::GetDashes | ( | wxDash ** | dashes | ) | const [virtual] |
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.
| virtual wxPenJoin wxPen::GetJoin | ( | ) | const [virtual] |
Returns the pen join style, which may be one of wxJOIN_BEVEL, wxJOIN_ROUND and wxJOIN_MITER.
The default is wxJOIN_ROUND.
| virtual wxBitmap* wxPen::GetStipple | ( | ) | const [virtual] |
| virtual wxPenStyle wxPen::GetStyle | ( | ) | const [virtual] |
| virtual int wxPen::GetWidth | ( | ) | const [virtual] |
| bool wxPen::IsOk | ( | ) | const |
Returns true if the pen is initialised.
| virtual void wxPen::SetCap | ( | wxPenCap | capStyle | ) | [virtual] |
Sets the pen cap style, which may be one of wxCAP_ROUND, wxCAP_PROJECTING and wxCAP_BUTT. The default is wxCAP_ROUND.
| virtual void wxPen::SetColour | ( | wxColour & | colour | ) | [virtual] |
| virtual void wxPen::SetColour | ( | unsigned char | red, | |
| unsigned char | green, | |||
| unsigned char | blue | |||
| ) | [virtual] |
| virtual void wxPen::SetDashes | ( | int | n, | |
| wxDash * | dashes | |||
| ) | [virtual] |
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.
| virtual void wxPen::SetJoin | ( | wxPenJoin | join_style | ) | [virtual] |
Sets the pen join style, which may be one of wxJOIN_BEVEL, wxJOIN_ROUND and wxJOIN_MITER.
The default is wxJOIN_ROUND.
| virtual void wxPen::SetStipple | ( | wxBitmap * | stipple | ) | [virtual] |
| virtual void wxPen::SetStyle | ( | wxPenStyle | style | ) | [virtual] |
| virtual void wxPen::SetWidth | ( | int | width | ) | [virtual] |
| bool wxPen::operator!= | ( | const wxPen & | pen | ) |
Inequality operator.
See reference-counted object comparison for more info.
Assignment operator, using Reference Counting.
| bool wxPen::operator== | ( | const wxPen & | pen | ) |
Equality operator.
See reference-counted object comparison for more info.
|
[ top ] |