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.
- Note
- 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 wxApp::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 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:
- See also
- wxPenList, wxDC, wxDC::SetPen()
|
| wxPen () |
| Default constructor. More...
|
|
| wxPen (const wxColour &colour, int width=1, wxPenStyle style=wxPENSTYLE_SOLID) |
| Constructs a pen from a colour object, pen width and style. More...
|
|
| wxPen (const wxBitmap &stipple, int width) |
| Constructs a stippled pen from a stipple bitmap and a width. More...
|
|
| wxPen (const wxPen &pen) |
| Copy constructor, uses Reference Counting. More...
|
|
virtual | ~wxPen () |
| Destructor. More...
|
|
virtual wxPenCap | GetCap () const |
| Returns the pen cap style, which may be one of wxCAP_ROUND , wxCAP_PROJECTING and wxCAP_BUTT . More...
|
|
virtual wxColour | GetColour () const |
| Returns a reference to the pen colour. More...
|
|
virtual int | GetDashes (wxDash **dashes) const |
| Gets an array of dashes (defined as char in X, DWORD under Windows). More...
|
|
virtual wxPenJoin | GetJoin () const |
| Returns the pen join style, which may be one of wxJOIN_BEVEL , wxJOIN_ROUND and wxJOIN_MITER . More...
|
|
virtual wxBitmap * | GetStipple () const |
| Gets a pointer to the stipple bitmap. More...
|
|
virtual wxPenStyle | GetStyle () const |
| Returns the pen style. More...
|
|
virtual int | GetWidth () const |
| Returns the pen width. More...
|
|
virtual bool | IsOk () const |
| Returns true if the pen is initialised. More...
|
|
bool | IsNonTransparent () const |
| Returns true if the pen is a valid non-transparent pen. More...
|
|
bool | IsTransparent () const |
| Returns true if the pen is transparent. More...
|
|
virtual void | SetCap (wxPenCap capStyle) |
| Sets the pen cap style, which may be one of wxCAP_ROUND , wxCAP_PROJECTING and wxCAP_BUTT . More...
|
|
virtual void | SetDashes (int n, const wxDash *dash) |
| Associates an array of dash values (defined as char in X, DWORD under Windows) with the pen. More...
|
|
virtual void | SetJoin (wxPenJoin join_style) |
| Sets the pen join style, which may be one of wxJOIN_BEVEL , wxJOIN_ROUND and wxJOIN_MITER . More...
|
|
virtual void | SetStipple (const wxBitmap &stipple) |
| Sets the bitmap for stippling. More...
|
|
virtual void | SetStyle (wxPenStyle style) |
| Set the pen style. More...
|
|
virtual void | SetWidth (int width) |
| Sets the pen width. More...
|
|
bool | operator!= (const wxPen &pen) const |
| Inequality operator. More...
|
|
wxPen & | operator= (const wxPen &pen) |
| Assignment operator, using Reference Counting. More...
|
|
bool | operator== (const wxPen &pen) const |
| Equality operator. More...
|
|
|
virtual void | SetColour (wxColour &colour) |
| The pen's colour is changed to the given colour. More...
|
|
virtual void | SetColour (unsigned char red, unsigned char green, unsigned char blue) |
| The pen's colour is changed to the given colour. More...
|
|
| wxGDIObject () |
| Default constructor. More...
|
|
| wxObject () |
| Default ctor; initializes to NULL the internal reference data. More...
|
|
| wxObject (const wxObject &other) |
| Copy ctor. More...
|
|
virtual | ~wxObject () |
| Destructor. More...
|
|
virtual wxClassInfo * | GetClassInfo () const |
| This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar). More...
|
|
wxObjectRefData * | GetRefData () const |
| Returns the wxObject::m_refData pointer, i.e. the data referenced by this object. More...
|
|
bool | IsKindOf (const wxClassInfo *info) const |
| Determines whether this class is a subclass of (or the same class as) the given class. More...
|
|
bool | IsSameAs (const wxObject &obj) const |
| Returns true if this object has the same data pointer as obj. More...
|
|
void | Ref (const wxObject &clone) |
| Makes this object refer to the data in clone. More...
|
|
void | SetRefData (wxObjectRefData *data) |
| Sets the wxObject::m_refData pointer. More...
|
|
void | UnRef () |
| Decrements the reference count in the associated data, and if it is zero, deletes the data. More...
|
|
void | UnShare () |
| This is the same of AllocExclusive() but this method is public. More...
|
|
void | operator delete (void *buf) |
| The delete operator is defined for debugging versions of the library only, when the identifier WXDEBUG is defined. More...
|
|
void * | operator new (size_t size, const wxString &filename=NULL, int lineNum=0) |
| The new operator is defined for debugging versions of the library only, when the identifier WXDEBUG is defined. More...
|
|