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.
|