.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2017 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc

.. currentmodule:: wx.lib.ogl.composit

.. highlight:: python



.. _wx.lib.ogl.composit.CompositeShape:

==========================================================================================================================================
|phoenix_title|  **wx.lib.ogl.composit.CompositeShape**
==========================================================================================================================================

The :class:`CompositeShape` is a shape with a list of child objects, and a
list of size and positioning constraints between the children.



|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>CompositeShape</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.lib.ogl.composit.CompositeShape_inheritance.png" alt="Inheritance diagram of CompositeShape" usemap="#dummy" class="inheritance"/></center>
   </div>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.lib.ogl.basic.Shape.html" title="wx.lib.ogl.basic.Shape" alt="" coords="53,83,213,112"/> <area shape="rect" id="node4" href="wx.lib.ogl.basic.RectangleShape.html" title="wx.lib.ogl.basic.RectangleShape" alt="" coords="22,160,244,189"/> <area shape="rect" id="node2" href="wx.lib.ogl.basic.ShapeEvtHandler.html" title="wx.lib.ogl.basic.ShapeEvtHandler" alt="" coords="18,5,248,35"/> <area shape="rect" id="node3" href="wx.lib.ogl.composit.CompositeShape.html" title="wx.lib.ogl.composit.CompositeShape" alt="" coords="5,237,261,267"/> </map> 
   </p>

|


|sub_classes| Known Subclasses
==============================

:class:`wx.lib.ogl.composit.DivisionShape`

|


|super_classes| Known Superclasses
==================================

:class:`wx.lib.ogl.basic.RectangleShape`

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.lib.ogl.composit.CompositeShape.__init__`                             Default class constructor.
:meth:`~wx.lib.ogl.composit.CompositeShape.AddChild`                             Add a shape to the composite. If addAfter is not None, the shape
:meth:`~wx.lib.ogl.composit.CompositeShape.AddConstraint`                        Adds a constraint to the composite.
:meth:`~wx.lib.ogl.composit.CompositeShape.AddSimpleConstraint`                  Add a constraint of the given type to the composite.
:meth:`~wx.lib.ogl.composit.CompositeShape.CalculateSize`                        Calculates the size and position of the composite based on
:meth:`~wx.lib.ogl.composit.CompositeShape.Constrain`                            Constrain the children.
:meth:`~wx.lib.ogl.composit.CompositeShape.ContainsDivision`                     Check if division is descendant.
:meth:`~wx.lib.ogl.composit.CompositeShape.Delete`                               Fully disconnect this shape from parents, children, the
:meth:`~wx.lib.ogl.composit.CompositeShape.DeleteConstraint`                     Deletes constraint from composite.
:meth:`~wx.lib.ogl.composit.CompositeShape.DeleteConstraintsInvolvingChild`      This function deletes constraints which mention the given child.
:meth:`~wx.lib.ogl.composit.CompositeShape.FindConstraint`                       Finds the constraint with the given id.
:meth:`~wx.lib.ogl.composit.CompositeShape.FindContainerImage`                   Finds the image used to visualize a container. This is any child of
:meth:`~wx.lib.ogl.composit.CompositeShape.GetConstraints`                       Return the list of constraints.
:meth:`~wx.lib.ogl.composit.CompositeShape.GetDivisions`                         Return the list of divisions.
:meth:`~wx.lib.ogl.composit.CompositeShape.MakeContainer`                        Makes this composite into a container by creating one child
:meth:`~wx.lib.ogl.composit.CompositeShape.OnBeginDragLeft`                      The begin drag left handler.
:meth:`~wx.lib.ogl.composit.CompositeShape.OnCreateDivision`                     Create division handler.
:meth:`~wx.lib.ogl.composit.CompositeShape.OnDragLeft`                           The drag left handler.
:meth:`~wx.lib.ogl.composit.CompositeShape.OnDraw`                               The draw handler.
:meth:`~wx.lib.ogl.composit.CompositeShape.OnDrawContents`                       The draw contents handler.
:meth:`~wx.lib.ogl.composit.CompositeShape.OnEndDragLeft`                        The end drag left handler.
:meth:`~wx.lib.ogl.composit.CompositeShape.OnErase`                              The erase handler.
:meth:`~wx.lib.ogl.composit.CompositeShape.OnMovePre`                            The move 'pre' handler.
:meth:`~wx.lib.ogl.composit.CompositeShape.OnRightClick`                         The right click handler.
:meth:`~wx.lib.ogl.composit.CompositeShape.Recompute`                            Recomputes any constraints associated with the object. If `False` is
:meth:`~wx.lib.ogl.composit.CompositeShape.RemoveChild`                          Removes the child from the composite and any constraint
:meth:`~wx.lib.ogl.composit.CompositeShape.RemoveChildFromConstraints`           Removes the child from the constraints.
:meth:`~wx.lib.ogl.composit.CompositeShape.SetSize`                              Set the size.
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: CompositeShape(RectangleShape)

   The :class:`CompositeShape` is a shape with a list of child objects, and a
   list of size and positioning constraints between the children.

   .. method:: __init__(self)

      Default class constructor.


   .. method:: AddChild(self, child, addAfter = None)

      Add a shape to the composite. If addAfter is not None, the shape
      will be added after addAfter.
      
      :param `child`: an instance of :class:`~lib.ogl.Shape`
      :param `addAfter`: an instance of :class:`~lib.ogl.Shape`


   .. method:: AddConstraint(self, constraint)

      Adds a constraint to the composite.
      
      :param `constraint`: an instance of :class:`~lib.ogl.Shape`


   .. method:: AddSimpleConstraint(self, type, constraining, constrained)

      Add a constraint of the given type to the composite.
      
      :param `type`: see :class:`ConstraintType` for valid types
      :param `constraining`: the constraining :class:`Shape`
      :param `constrained`: the constrained :class:`Shape`


   .. method:: CalculateSize(self)

      Calculates the size and position of the composite based on
      child sizes and positions.


   .. method:: Constrain(self)

      Constrain the children.
      
      :returns: ``True`` if constained otherwise False


   .. method:: ContainsDivision(self, division)

      Check if division is descendant.
      
      :param `division`: divison to check
      :returns: `True` if division is a descendant of this container.


   .. method:: Delete(self)

      Fully disconnect this shape from parents, children, the
      canvas, etc.


   .. method:: DeleteConstraint(self, constraint)

      Deletes constraint from composite.
      
      :param `constraint`: the constraint to delete


   .. method:: DeleteConstraintsInvolvingChild(self, child)

      This function deletes constraints which mention the given child.
      
      Used when deleting a child from the composite.
      
      :param `child`: an instance of :class:`~lib.ogl.Shape`


   .. method:: FindConstraint(self, cId)

      Finds the constraint with the given id.
      
      :param `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.


   .. method:: FindContainerImage(self)

      Finds the image used to visualize a container. This is any child of
      the composite that is not in the divisions list.


   .. method:: GetConstraints(self)

      Return the list of constraints.


   .. method:: GetDivisions(self)

      Return the list of divisions.


   .. method:: MakeContainer(self)

      Makes this composite into a container by creating one child
      DivisionShape.


   .. method:: OnBeginDragLeft(self, x, y, keys = 0, attachment = 0)

      The begin drag left handler.


   .. method:: OnCreateDivision(self)

      Create division handler.


   .. method:: OnDragLeft(self, draw, x, y, keys = 0, attachment = 0)

      The drag left handler.


   .. method:: OnDraw(self, dc)

      The draw handler.


   .. method:: OnDrawContents(self, dc)

      The draw contents handler.


   .. method:: OnEndDragLeft(self, x, y, keys = 0, attachment = 0)

      The end drag left handler.


   .. method:: OnErase(self, dc)

      The erase handler.


   .. method:: OnMovePre(self, dc, x, y, old_x, old_y, display = True)

      The move 'pre' handler.


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


   .. method:: Recompute(self)

      Recomputes any constraints associated with the object. If `False` is
      returned, the constraints could not be satisfied (there was an
      inconsistency).


   .. method:: RemoveChild(self, child)

      Removes the child from the composite and any constraint
      relationships, but does not delete the child.
      
      :param `child`: an instance of :class:`~lib.ogl.Shape`


   .. method:: RemoveChildFromConstraints(self, child)

      Removes the child from the constraints.
      
      :param `child`: an instance of :class:`~lib.ogl.Shape`


   .. method:: SetSize(self, w, h, recursive = True)

      Set the size.
      
      :param `w`: the width
      :param `h`: the heigth
      :param `recursive`: size the children recursively


