#include <KoShapeContainer.h>
Inheritance diagram for KoShapeContainer:

Public Member Functions | |
| KoShapeContainer () | |
| Default constructor; this constructs a container a default model that does what you expect. | |
| KoShapeContainer (KoShapeContainerModel *model) | |
| Constructor with custom model to be used for maintaining the list of children. | |
| virtual | ~KoShapeContainer () |
| Destructor for the shape container. | |
| void | addChild (KoShape *shape) |
| Add a child to this container. | |
| void | removeChild (KoShape *shape) |
| Remove a child to be completely separated from the container. | |
| int | childCount () const |
| Return the current number of children registered. | |
| void | setClipping (const KoShape *child, bool clipping) |
| Set the argument child to have its 'clipping' property set. | |
| bool | childClipped (const KoShape *child) const |
| Returns if the argument child has its 'clipping' property set. | |
| bool | isChildLocked (const KoShape *child) const |
| Return wheather the child has the effective state of being locked for user modifications. | |
| virtual void | paint (QPainter &painter, const KoViewConverter &converter) |
| reimplemented | |
| virtual void | paintComponent (QPainter &painter, const KoViewConverter &converter)=0 |
| Paint the component Implement this method to allow the shape to paint itself, just like the KoShape::paint() method does. | |
| virtual void | update () const |
| reimplemented | |
| QList< KoShape * > | iterator () const |
| Create and return an iterator over all child shapes. | |
| KoShapeContainerModel * | model () const |
| return the model for this container | |
Protected Member Functions | |
| virtual void | childCountChanged () |
| This hook is for inheriting classes that need to do something on adding/removing of children. | |
Extending from this class allows you to have child-shapes. Like the KoShape class, this shape is a visible class with a position and a size. It can paint itself as well if you implement the paintComponent() method.
The most important feature of this class is that you can make other KoShape classes to be children of this container.
The effect of grouping those shapes is that their position is relative to the position of the container. Move the container and all children move with it.
Each child can optionally be said to be 'clipped' by the container. This feature will give the effect that if the child has a size and position outside the container, parts outside the container will not be shown. This is especially useful for showing cutouts of content, like images, without changing the actual content.
For so called clipped children any modification made to the container is propagated to the child. This includes rotation as well as scaling and shearing.
Maintaining the list of children can be done using the supplied methods addChild() and removeChild(). However, they only forward their requests to the data model KoShapeContainerModel and if you provide a custom implementation of that model any means can be used to maintain a list of children, as long as you will take care to register them with the appropriate shape manager.
An example usage where a custom model might be useful is when you have a container for text areas which are split into columns. If you resize the container and the width of the individual columns gets too small, the model can choose to remove a child or add one when the width allows another column.
| KoShapeContainer::KoShapeContainer | ( | KoShapeContainerModel * | model | ) | [explicit] |
Constructor with custom model to be used for maintaining the list of children.
For all the normal cases you don't need a custom model. Only when you want to respond to moves of the container to do something special, or disable one of the features the container normally has (like clipping). Use the default constructor in those cases.
| model | the custom model to be used for maintaining the list of children. |
| KoShapeContainer::~KoShapeContainer | ( | ) | [virtual] |
Destructor for the shape container.
All children will be orphaned by calling a KoShape::setParent(0)
| void KoShapeContainer::addChild | ( | KoShape * | shape | ) |
Add a child to this container.
| shape | the child to be managed in the container. |
| bool KoShapeContainer::childClipped | ( | const KoShape * | child | ) | const |
Returns if the argument child has its 'clipping' property set.
| child | the child for which the property will be returned. |
| int KoShapeContainer::childCount | ( | ) | const |
Return the current number of children registered.
| virtual void KoShapeContainer::childCountChanged | ( | ) | [inline, protected, virtual] |
This hook is for inheriting classes that need to do something on adding/removing of children.
This method will be called just after the child has been added/removed. The default implementation is empty.
| bool KoShapeContainer::isChildLocked | ( | const KoShape * | child | ) | const |
Return wheather the child has the effective state of being locked for user modifications.
This method is deferred to the model, which should call the KoShape::isLocked() on the child.
| child | the shape that the user wants to move. |
| QList< KoShape * > KoShapeContainer::iterator | ( | ) | const |
Create and return an iterator over all child shapes.
| virtual void KoShapeContainer::paintComponent | ( | QPainter & | painter, | |
| const KoViewConverter & | converter | |||
| ) | [pure virtual] |
Paint the component Implement this method to allow the shape to paint itself, just like the KoShape::paint() method does.
| painter | used for painting the shape | |
| converter | to convert between internal and view coordinates. |
Implemented in KoPAPageBase, KoShapeGroup, and KoShapeLayer.
| void KoShapeContainer::removeChild | ( | KoShape * | shape | ) |
Remove a child to be completely separated from the container.
| shape | the child to be removed. |
| void KoShapeContainer::setClipping | ( | const KoShape * | child, | |
| bool | clipping | |||
| ) |
Set the argument child to have its 'clipping' property set.
| child | the child for which the property will be changed. | |
| clipping | the property |
1.4.7