The wxShape is the top-level, abstract object that all other objects are derived from. All common functionality is represented by wxShape's members, and overriden members that appear in derived classes and have behaviour as documented for wxShape, are not documented separately.
Derived from
Members
wxShape::wxShape
wxShape::~wxShape
wxShape::AddLine
wxShape::AddRegion
wxShape::AddText
wxShape::AddToCanvas
wxShape::AncestorSelected
wxShape::ApplyAttachmentOrdering
wxShape::AssignNewIds
wxShape::Attach
wxShape::AttachmentIsValid
wxShape::AttachmentSortTest
wxShape::CalcSimpleAttachment
wxShape::CalculateSize
wxShape::ClearAttachments
wxShape::ClearRegions
wxShape::ClearText
wxShape::Constrain
wxShape::Copy
wxShape::CreateNewCopy
wxShape::DeleteControlPoints
wxShape::Detach
wxShape::Draggable
wxShape::Draw
wxShape::DrawContents
wxShape::DrawLinks
wxShape::Erase
wxShape::EraseContents
wxShape::EraseLinks
wxShape::FindRegion
wxShape::FindRegionNames
wxShape::Flash
wxShape::FormatText
wxShape::GetAttachmentMode
wxShape::GetAttachmentPosition
wxShape::GetBoundingBoxMax
wxShape::GetBoundingBoxMin
wxShape::GetBrush
wxShape::GetCanvas
wxShape::GetCentreResize
wxShape::GetChildren
wxShape::GetClientData
wxShape::GetDisableLabel
wxShape::GetEventHandler
wxShape::GetFixedHeight
wxShape::GetFixedSize
wxShape::GetFixedWidth
wxShape::GetFont
wxShape::GetFunctor
wxShape::GetId
wxShape::GetLinePosition
wxShape::GetLines
wxShape::GetMaintainAspectRatio
wxShape::GetNumberOfAttachments
wxShape::GetNumberOfTextRegions
wxShape::GetParent
wxShape::GetPen
wxShape::GetPerimeterPoint
wxShape::GetRegionId
wxShape::GetRegionName
wxShape::GetRegions
wxShape::GetRotation
wxShape::GetSensitivityFilter
wxShape::GetShadowMode
wxShape::GetSpaceAttachments
wxShape::GetTextColour
wxShape::GetTopAncestor
wxShape::GetX
wxShape::GetY
wxShape::HitTest
wxShape::Insert
wxShape::IsHighlighted
wxShape::IsShown
wxShape::MakeControlPoints
wxShape::MakeMandatoryControlPoints
wxShape::Move
wxShape::MoveLineToNewAttachment
wxShape::MoveLinks
wxShape::NameRegions
wxShape::Rotate
wxShape::ReadConstraints
wxShape::ReadAttributes
wxShape::ReadRegions
wxShape::Recentre
wxShape::RemoveFromCanvas
wxShape::ResetControlPoints
wxShape::ResetMandatoryControlPoints
wxShape::Recompute
wxShape::RemoveLine
wxShape::Select
wxShape::Selected
wxShape::SetAttachmentMode
wxShape::SetBrush
wxShape::SetCanvas
wxShape::SetCentreResize
wxShape::SetClientData
wxShape::SetDefaultRegionSize
wxShape::SetDisableLabel
wxShape::SetDraggable
wxShape::SetDrawHandles
wxShape::SetEventHandler
wxShape::SetFixedSize
wxShape::SetFont
wxShape::SetFormatMode
wxShape::SetHighlight
wxShape::SetId
wxShape::SetMaintainAspectRatio
wxShape::SetPen
wxShape::SetRegionName
wxShape::SetSensitivityFilter
wxShape::SetShadowMode
wxShape::SetSize
wxShape::SetSpaceAttachments
wxShape::SetTextColour
wxShape::SetX
wxShape::SetX
wxShape::SpaceAttachments
wxShape::Show
wxShape::Unlink
wxShape::WriteAttributes
wxShape::WriteRegions
wxShape(wxShapeCanvas* canvas = NULL)
Constructs a new wxShape.
~wxShape()
Destructor.
void AddLine(wxLineShape* line, wxShape* other, int attachFrom = 0, int attachTo = 0, int positionFrom = -1, int positionTo = -1)
Adds a line between the specified canvas shapes, at the specified attachment points.
The position in the list of lines at each end can also be specified, so that the line will be drawn at a particular point on its attachment point.
void AddRegion(wxShapeRegion* region)
Adds a region to the shape.
void AddText(const wxString& string)
Adds a line of text to the shape's default text region.
void AddToCanvas(wxShapeCanvas* theCanvas, wxShape* addAfter=NULL)
Adds the shape to the canvas's shape list. If addAfter is non-NULL, will add the shape after this one.
bool AncestorSelected() const
TRUE if the shape's ancestor is currently selected.
void ApplyAttachmentOrdering(wxList& linesToSort)
Applies the line ordering in linesToSort to the shape, to reorder the way lines are attached.
void AssignNewIds()
Assigns new ids to this image and its children.
void Attach(wxShapeCanvas* can)
Sets the shape's internal canvas pointer to point to the given canvas.
bool AttachmentIsValid(int attachment) const
Returns TRUE if attachment is a valid attachment point.
bool AttachmentSortTest(int attachment, const wxRealPoint& pt1, const wxRealPoint& pt2) const
Returns TRUE if pt1 is less than or equal to pt2, in the sense that one point comes before another on an edge of the shape. attachment is the attachment point (side) in question.
This function is used in wxShape::MoveLineToNewAttachment to determine the new line ordering.
wxRealPoint CalcSimpleAttachment(const wxRealPoint& pt1, const wxRealPoint& pt2, int nth, int noArcs, wxLineShape* line)
Assuming the attachment lies along a vertical or horizontal line, calculates the position on that point.
Parameters
pt1
pt2
nth
noArcs
line
Remarks
This function expects the line to be either vertical or horizontal, and determines which.
void CalculateSize()
Called to calculate the shape's size if dependent on children sizes.
void ClearAttachments()
Clears internal custom attachment point shapes (of class wxAttachmentPoint).
void ClearRegions()
Clears the wxShapeRegions from the shape.
void ClearText(int regionId = 0)
Clears the text from the specified text region.
bool Constrain()
Calculates the shape's constraints (if any). Applicable only to wxCompositeShape, does nothing if the shape is of a different class.
void Copy(wxShape& copy)
Copy this shape into copy. Every derived class must have one of these, and each Copy implementation must call the derived class's implementation to ensure everything is copied. See also wxShape::CreateNewCopy.
wxShape* CreateNewCopy(bool resetMapping = TRUE, bool recompute = TRUE)
Creates and returns a new copy of this shape (calling wxShape::Copy). Do not override this function.
This function should always be used to create a new copy, since it must do special processing for copying constraints associated with constraints.
If resetMapping is TRUE, a mapping table used for complex shapes is reset; this may not be desirable if the shape being copied is a child of a composite (and so the mapping table is in use).
If recompute is TRUE, wxShape::Recompute is called for the new shape.
Remarks
This function uses the wxWindows dynamic object creation system to create a new shape of the same type as 'this', before calling Copy.
If the event handler for this shape is not the same as the shape itself, the event handler is also copied using wxShapeEvtHandler::CreateNewCopy.
void DeleteControlPoints()
Deletes the control points (or handles) for the shape. Does not redraw the shape.
void Detach()
Disassociates the shape from its canvas by setting the internal shape canvas pointer to NULL.
bool Draggable()
TRUE if the shape may be dragged by the user.
void Draw(wxDC& dc)
Draws the whole shape and any lines attached to it.
Do not override this function: override OnDraw, which is called by this function.
void DrawContents(wxDC& dc)
Draws the internal graphic of the shape (such as text).
Do not override this function: override OnDrawContents, which is called by this function.
void DrawLinks(wxDC& dc, int attachment = -1)
Draws any lines linked to this shape.
void Erase(wxDC& dc)
Erases the shape, but does not repair damage caused to other shapes.
void EraseContents(wxDC& dc)
Erases the shape contents, that is, the area within the shape's minimum bounding box.
void EraseLinks(wxDC& dc, int attachment = -1)
Erases links attached to this shape, but does not repair damage caused to other shapes.
wxShape * FindRegion(const wxString& regionName, int *regionId)
Finds the actual image ('this' if non-composite) and region id for the given region name.
void FindRegionNames(wxStringList& list)
Finds all region names for this image (composite or simple). Supply an empty string list.
void Flash()
Flashes the shape.
void FormatText(const wxString& s, int i = 0)
Reformats the given text region; defaults to formatting the default region.
bool GetAttachmentMode() const
Returns the attachment mode, which is TRUE if attachments are used, FALSE otherwise (in which case lines will be drawn as if to the centre of the shape). See wxShape::SetAttachmentMode.
bool GetAttachmentPosition(int attachment, double* x, double* y, int nth = 0, int noArcs = 1, wxLineShape* line = NULL)
Gets the position at which the given attachment point should be drawn.
If attachment isn't found among the attachment points of the shape, returns FALSE.
void GetBoundingBoxMax(double *width, double *height)
Gets the maximum bounding box for the shape, taking into account external features such as shadows.
void GetBoundingBoxMin(double *width, double *height)
Gets the minimum bounding box for the shape, that defines the area available for drawing the contents (such as text).
wxBrush* GetBrush() const
Returns the brush used for filling the shape.
wxShapeCanvas* GetCanvas() const
Gets the internal canvas pointer.
bool GetCentreResize() const
Returns TRUE if the shape is to be resized from the centre (the centre stands still), or FALSE if from the corner or side being dragged (the other corner or side stands still).
wxList& GetChildren() const
Returns a reference to the list of children for this shape.
wxObject* GetClientData()
Gets the client data associated with the shape (NULL if there is none).
bool GetDisableLabel() const
Returns TRUE if the default region will not be shown, FALSE otherwise.
wxShapeEvtHandler* GetEventHandler() const
Returns the event handler for this shape.
bool GetFixedHeight() const
Returns TRUE if the shape cannot be resized in the vertical plane.
void GetFixedSize(bool * x, bool * y)
Returns flags indicating whether the shape is of fixed size in either direction.
bool GetFixedWidth() const
Returns TRUE if the shape cannot be resized in the horizontal plane.
wxFont* GetFont(int regionId = 0) const
Gets the font for the specified text region.
wxString GetFunctor() const
Gets a string representing the type of the shape, to be used when writing out shape descriptions to a file. This is overridden by each derived shape class to provide an appropriate type string. By default, "node_image" is used for non-line shapes, and "arc_image" for lines.
long GetId() const
Returns the integer identifier for this shape.
int GetLinePosition(wxLineShape* line)
Gets the zero-based position of line in the list of lines for this shape.
wxList& GetLines() const
Returns a reference to the list of lines connected to this shape.
bool GetMaintainAspectRatio() const
If returns TRUE, resizing the shape will not change the aspect ratio (width and height will be in the original proportion).
int GetNumberOfAttachments() const
Gets the number of attachment points for this shape.
int GetNumberOfTextRegions() const
Gets the number of text regions for this shape.
wxShape * GetParent() const
Returns the parent of this shape, if it is part of a composite.
wxPen* GetPen() const
Returns the pen used for drawing the shape's outline.
bool GetPerimeterPoint(double x1, double y1, double x2, double y2, double *x3, double *y3)
Gets the point at which the line from (x1, y1) to (x2, y2) hits the shape. Returns TRUE if the line hits the perimeter.
int GetRegionId(const wxString& name)
Gets the region's identifier by name. This is not unique for within an entire composite, but is unique for the image.
wxString GetRegionName(int regionId = 0)
Gets the region's name. A region's name can be used to uniquely determine a region within an entire composite image hierarchy. See also wxShape::SetRegionName.
wxList& GetRegions()
Returns the list of wxShapeRegions.
double GetRotatation() const
Returns the angle of rotation in radians.
void GetSensitivityFilter() const
Returns the sensitivity filter, a bitlist of values. See wxShape::SetSensitivityFilter.
int SetShadowMode() const
Returns the shadow mode. See wxShape::SetShadowMode.
bool GetSpaceAttachments() const
Indicates whether lines should be spaced out evenly at the point they touch the node (TRUE), or whether they should join at a single point (FALSE).
wxString GetTextColour(int regionId = 0) const
Gets the colour for the specified text region.
wxShape * GetTopAncestor() const
Returns the top-most ancestor of this shape (the root of the composite).
double GetX() const
Gets the x position of the centre of the shape.
double GetY() const
Gets the y position of the centre of the shape.
bool HitTest(double x, double y, int* attachment, double* distance)
Given a point on a canvas, returns TRUE if the point was on the shape, and returns the nearest attachment point and distance from the given point and target.
void InsertInCanvas(wxShapeCanvas* canvas)
Inserts the shape at the front of the shape list of canvas.
bool IsHighlighted() const
Returns TRUE if the shape is highlighted. Shape highlighting is unimplemented.
bool IsShown() const
Returns TRUE if the shape is in a visible state, FALSE otherwise. Note that this has nothing to do with whether the window is hidden or the shape has scrolled off the canvas; it refers to the internal visibility flag.
void MakeControlPoints()
Make a list of control points (draggable handles) appropriate to the shape.
void MakeMandatoryControlPoints()
Make the mandatory control points. For example, the control point on a dividing line should appear even if the divided rectangle shape's handles should not appear (because it is the child of a composite, and children are not resizable).
void Move(wxDC& dc, double x1, double y1, bool display = TRUE)
Move the shape to the given position, redrawing if display is TRUE.
void MoveLineToNewAttachment(wxDC& dc, wxLineShape* toMove, double x, double y)
Move the given line (which must already be attached to the shape) to a different attachment point on the shape, or a different order on the same attachment.
Cals wxShape::AttachmentSortTest and then wxShapeEvtHandler::OnChangeAttachment.
void MoveLinks(wxDC& dc)
Redraw all the lines attached to the shape.
void NameRegions(const wxString& parentName = "")
Make unique names for all the regions in a shape or composite shape.
void Rotate(double x, double y, double theta)
Rotate about the given axis by the given amount in radians (does nothing for most shapes). But even non-rotating shapes should record their notional rotation in case it's important (e.g. in dog-leg code).
void ReadConstraints(wxExpr *clause, wxExprDatabase *database)
If the shape is a composite, it may have constraints that need to be read in in a separate pass.
void ReadAttributes(wxExpr* clause)
Reads the attributes (data member values) from the given expression.
void ReadRegions(wxExpr *clause)
Reads in the regions.
void Recentre()
Does recentring (or other formatting) for all the text regions for this shape.
void RemoveFromCanvas(wxShapeCanvas* canvas)
Removes the shape from the canvas.
void ResetControlPoints()
Resets the positions of the control points (for instance when the shape's shape has changed).
void ResetMandatoryControlPoints()
Reset the mandatory control points. For example, the control point on a dividing line should appear even if the divided rectangle shape's handles should not appear (because it is the child of a composite, and children are not resizable).
bool Recompute()
Recomputes any constraints associated with the shape (normally applicable to wxCompositeShapes only, but harmless for other classes of shape).
void RemoveLine(wxLineShape* line)
Removes the given line from the shape's list of attached lines.
void Select(bool select = TRUE)
Selects or deselects the given shape, drawing or erasing control points (handles) as necessary.
bool Selected() const
TRUE if the shape is currently selected.
void SetAttachmentMode(bool flag)
Sets the attachment mode to TRUE or FALSE. If TRUE, attachment points will be significant when drawing lines to and from this shape. If FALSE, lines will be drawn as if to the centre of the shape.
void SetBrush(wxBrush *brush)
Sets the brush for filling the shape's shape.
void SetCanvas(wxShapeCanvas* theCanvas)
Identical to wxShape::Attach.
void SetCentreResize(bool cr)
Specify whether the shape is to be resized from the centre (the centre stands still) or from the corner or side being dragged (the other corner or side stands still).
void SetClientData(wxObject *clientData)
Sets the client data.
void SetDefaultRegionSize()
Set the default region to be consistent with the shape size.
void SetDisableLabel(bool flag)
Set flag to TRUE to stop the default region being shown, FALSE otherwise.
void SetDraggable(bool drag, bool recursive = FALSE)
Sets the shape to be draggable or not draggable.
void SetDrawHandles(bool drawH)
Sets the drawHandles flag for this shape and all descendants. If drawH is TRUE (the default), any handles (control points) will be drawn. Otherwise, the handles will not be drawn.
void GetEventHandler(wxShapeEvtHandler *handler)
Sets the event handler for this shape.
void SetFixedSize(bool x, bool y)
Sets the shape to be of the given, fixed size.
void SetFont(wxFont *font, int regionId = 0)
Sets the font for the specified text region.
void SetFormatMode(int mode, int regionId = 0)
Sets the format mode of the default text region. The argument can be a bit list of the following:
void SetHighlight(bool hi, bool recurse = FALSE)
Sets the highlight for a shape. Shape highlighting is unimplemented.
void SetId(long id)
Set the integer identifier for this shape.
void SetMaintainAspectRatio(bool flag)
If the argument is TRUE, tells the shape that resizes should not change the aspect ratio (width and height should be in the original proportion).
void SetPen(wxPen *pen)
Sets the pen for drawing the shape's outline.
void SetRegionName(const wxString& name, int regionId = 0)
Sets the name for this region. The name for a region is unique within the scope of the whole composite, whereas a region id is unique only for a single image.
void SetSensitivityFilter(int sens=OP_ALL, bool recursive = FALSE)
Sets the shape to be sensitive or insensitive to specific mouse operations.
sens is a bitlist of the following:
void SetShadowMode(int mode, bool redraw = FALSE)
Sets the shadow mode (whether a shadow is drawn or not). mode can be one of the following:
void SetSize(double x, double y, bool recursive = TRUE)
Sets the shape's size.
void SetSpaceAttachments(bool sp)
Indicate whether lines should be spaced out evenly at the point they touch the node (TRUE), or whether they should join at a single point (FALSE).
void SetTextColour(const wxString& colour, int regionId = 0)
Sets the colour for the specified text region.
void SetX(double x)
Sets the x position of the shape.
void SetY(double y)
Sets the y position of the shape.
void SpaceAttachments(bool sp)
Sets the spacing mode: if TRUE, lines at the same attachment point will be spaced evenly across that side of the shape. If false, all lines at the same attachment point will emanate from the same point.
void Show(bool show)
Sets a flag indicating whether the shape should be drawn.
void Unlink()
If the shape is a line, unlinks the nodes attached to the shape, removing itself from the list of lines for each of the 'to' and 'from' nodes.
void WriteAttributes(wxExpr *clause)
Writes the shape's attributes (data member values) into the given expression.
void WriteRegions(wxExpr *clause)
Writes the regions.