wx.lib.ogl.composit.CompositeShape¶
The CompositeShape
is a shape with a list of child objects, and a
list of size and positioning constraints between the children.
Class Hierarchy¶
Known Subclasses¶
wx.lib.ogl.composit.DivisionShape
Known Superclasses¶
wx.lib.ogl.basic.RectangleShape
Methods Summary¶
Default class constructor. |
|
Add a shape to the composite. If addAfter is not None, the shape |
|
Adds a constraint to the composite. |
|
Add a constraint of the given type to the composite. |
|
Calculates the size and position of the composite based on |
|
Constrain the children. |
|
Check if division is descendant. |
|
Fully disconnect this shape from parents, children, the |
|
Deletes constraint from composite. |
|
This function deletes constraints which mention the given child. |
|
Finds the constraint with the given id. |
|
Finds the image used to visualize a container. This is any child of |
|
Return the list of constraints. |
|
Return the list of divisions. |
|
Makes this composite into a container by creating one child |
|
The begin drag left handler. |
|
Create division handler. |
|
The drag left handler. |
|
The draw handler. |
|
The draw contents handler. |
|
The end drag left handler. |
|
The erase handler. |
|
The move ‘pre’ handler. |
|
The right click handler. |
|
Recomputes any constraints associated with the object. If False is |
|
Removes the child from the composite and any constraint |
|
Removes the child from the constraints. |
|
Set the size. |
Class API¶
- class CompositeShape(RectangleShape)¶
The
CompositeShape
is a shape with a list of child objects, and a list of size and positioning constraints between the children.
Methods¶
- __init__(self)¶
Default class constructor.
- AddChild(self, child, addAfter=None)¶
Add a shape to the composite. If addAfter is not None, the shape will be added after addAfter.
- Parameters:
child – an instance of
Shape
addAfter – an instance of
Shape
- AddConstraint(self, constraint)¶
Adds a constraint to the composite.
- Parameters:
constraint – an instance of
Shape
- AddSimpleConstraint(self, type, constraining, constrained)¶
Add a constraint of the given type to the composite.
- Parameters:
type – see
ConstraintType
for valid typesconstraining – the constraining
Shape
constrained – the constrained
Shape
- CalculateSize(self)¶
Calculates the size and position of the composite based on child sizes and positions.
- Constrain(self)¶
Constrain the children.
- Returns:
True
if constrained otherwise False
- ContainsDivision(self, division)¶
Check if division is descendant.
- Parameters:
division – division to check
- Returns:
True if division is a descendant of this container.
- Delete(self)¶
Fully disconnect this shape from parents, children, the canvas, etc.
- DeleteConstraint(self, constraint)¶
Deletes constraint from composite.
- Parameters:
constraint – the constraint to delete
- DeleteConstraintsInvolvingChild(self, child)¶
This function deletes constraints which mention the given child.
Used when deleting a child from the composite.
- Parameters:
child – an instance of
Shape
- FindConstraint(self, cId)¶
Finds the constraint with the given id.
- Parameters:
cId – The constraint id to find.
- Returns:
None or a tuple of the constraint and the actual composite the constraint was in, in case that composite was a descendant of this composit.
- FindContainerImage(self)¶
Finds the image used to visualize a container. This is any child of the composite that is not in the divisions list.
- GetConstraints(self)¶
Return the list of constraints.
- GetDivisions(self)¶
Return the list of divisions.
- MakeContainer(self)¶
Makes this composite into a container by creating one child DivisionShape.
- OnBeginDragLeft(self, x, y, keys=0, attachment=0)¶
The begin drag left handler.
- OnCreateDivision(self)¶
Create division handler.
- OnDragLeft(self, draw, x, y, keys=0, attachment=0)¶
The drag left handler.
- OnDraw(self, dc)¶
The draw handler.
- OnDrawContents(self, dc)¶
The draw contents handler.
- OnEndDragLeft(self, x, y, keys=0, attachment=0)¶
The end drag left handler.
- OnErase(self, dc)¶
The erase handler.
- OnMovePre(self, dc, x, y, old_x, old_y, display=True)¶
The move ‘pre’ handler.
- OnRightClick(self, x, y, keys=0, attachment=0)¶
The right click handler.
Note
If we get a ctrl-right click, this means send the message to the division, so we can invoke a user interface for dealing with regions.
- Recompute(self)¶
Recomputes any constraints associated with the object. If False is returned, the constraints could not be satisfied (there was an inconsistency).
- RemoveChild(self, child)¶
Removes the child from the composite and any constraint relationships, but does not delete the child.
- Parameters:
child – an instance of
Shape
- RemoveChildFromConstraints(self, child)¶
Removes the child from the constraints.
- Parameters:
child – an instance of
Shape
- SetSize(self, w, h, recursive=True)¶
Set the size.
- Parameters:
w – the width
h – the height
recursive – size the children recursively