wxpena 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. derived from include files <wx/pen.h> predefined objects objects: wxnullpen pointers:
wxred_pen 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. 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. see also members
wxpen::wxpen
wxpen::wxpenwxpen() default constructor. the pen will be uninitialised, and wxpen:isok will return false. wxpen(const wxcolour& colour, int width = 1, int style = wxsolid) constructs a pen from a colour object, pen width and style. wxpen(const wxstring& colourname, int width, int style) constructs a pen from a colour name, pen width and style. wxpen(const wxbitmap& stipple, int width) constructs a stippled pen from a stipple bitmap and a width. wxpen(const wxpen& pen) copy constructor, uses reference counting. parameters colour
colourname
width
stipple
pen
style
remarks different versions of windows and different versions of other platforms support very different subsets of the styles above - there is no similarity even between windows95 and windows98 - so handle with care. if the named colour form is used, an appropriate wxcolour structure is found in the colour database. see also wxpen::setstyle, wxpen::setcolour, wxpen::setwidth, wxpen::setstipple wxperl note: constructors supported by wxperl are:
wxpen::~wxpen~wxpen() destructor. see reference-counted object destruction for more info. remarks although all remaining pens are deleted when the application exits, the application should try to clean up all pens itself. this is because wxwidgets cannot know if a pointer to the pen object is stored in an application data structure, and there is a risk of double deletion.
wxpen::getcapint getcap() const returns the pen cap style, which may be one of wxcap_round, wxcap_projecting and wxcap_butt. the default is wxcap_round. see also
wxpen::getcolourwxcolour& getcolour() const returns a reference to the pen colour. see also
wxpen::getdashesint getdashes(wxdash** dashes) const 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. see also
wxpen::getjoinint getjoin() const returns the pen join style, which may be one of wxjoin_bevel, wxjoin_round and wxjoin_miter. the default is wxjoin_round. see also
wxpen::getstipplewxbitmap* getstipple() const gets a pointer to the stipple bitmap. see also
wxpen::getstyleint getstyle() const returns the pen style. see also
wxpen::getwidthint getwidth() const returns the pen width. see also
wxpen::isokbool isok() const returns true if the pen is initialised.
wxpen::setcapvoid 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. see also
wxpen::setcolourvoid setcolour(wxcolour& colour) void setcolour(const wxstring& colourname) void setcolour(unsigned char red, unsigned char green, unsigned char blue) the pen's colour is changed to the given colour. see also
wxpen::setdashesvoid setdashes(int n, wxdash* 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. see also
wxpen::setjoinvoid 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. see also
wxpen::setstipplevoid setstipple(wxbitmap* stipple) sets the bitmap for stippling. see also
wxpen::setstylevoid setstyle(int style) set the pen style. see also
wxpen::setwidthvoid setwidth(int width) sets the pen width. see also
wxpen::operator =wxpen& operator =(const wxpen& pen) assignment operator, using reference counting.
wxpen::operator ==bool operator ==(const wxpen& pen) equality operator. see reference-counted object comparison for more info.
wxpen::operator !=bool operator !=(const wxpen& pen) inequality operator. see reference-counted object comparison for more info.
|