libs/flake

KoShapeManager Class Reference

The shape manager hold a list of all shape which are in scope. More...

#include <KoShapeManager.h>

Inheritance diagram for KoShapeManager:

List of all members.

Public Types

enum  Repaint { PaintShapeOnAdd, AddWithoutRepaint }

Signals

void selectionChanged ()
void selectionContentChanged ()

Public Member Functions

 KoShapeManager (KoCanvasBase *canvas, const QList< KoShape * > &shapes)
 KoShapeManager (KoCanvasBase *canvas)
virtual ~KoShapeManager ()
void add (KoShape *shape, Repaint repaint=PaintShapeOnAdd)
void addAdditional (KoShape *shape)
void notifyShapeChanged (KoShape *shape)
virtual void paint (QPainter &painter, const KoViewConverter &converter, bool forPrint)
void paintShape (KoShape *shape, QPainter &painter, const KoViewConverter &converter, bool forPrint)
void remove (KoShape *shape)
void removeAdditional (KoShape *shape)
KoSelectionselection () const
void setPaintingStrategy (KoShapeManagerPaintingStrategy *strategy)
void setShapes (const QList< KoShape * > &shapes, Repaint repaint=PaintShapeOnAdd)
KoShapeshapeAt (const QPointF &position, KoFlake::ShapeSelection selection=KoFlake::ShapeOnTop, bool omitHiddenShapes=true)
QList< KoShape * > shapes () const
QList< KoShape * > shapesAt (const QRectF &rect, bool omitHiddenShapes=true)
void suggestChangeTool (KoPointerEvent *event)
QList< KoShape * > topLevelShapes () const
void update (QRectF &rect, const KoShape *shape=0, bool selectionHandles=false)

Detailed Description

The shape manager hold a list of all shape which are in scope.

There is one shape manager per view.

The selection in the different views can be different.

Definition at line 50 of file KoShapeManager.h.


Member Enumeration Documentation

enum for add()

Enumerator:
PaintShapeOnAdd 

Causes each shapes 'update()' to be called after being added to the shapeManager.

AddWithoutRepaint 

Avoids each shapes 'update()' to be called for faster addition when its possible.

Definition at line 56 of file KoShapeManager.h.


Constructor & Destructor Documentation

KoShapeManager::KoShapeManager ( KoCanvasBase canvas  )  [explicit]

Constructor.

Definition at line 150 of file KoShapeManager.cpp.

KoShapeManager::KoShapeManager ( KoCanvasBase canvas,
const QList< KoShape * > &  shapes 
)

Constructor that takes a list of shapes, convenience version.

Parameters:
shapes the shapes to start out with, see also setShapes()
canvas the canvas this shape manager is working on.

Definition at line 142 of file KoShapeManager.cpp.

KoShapeManager::~KoShapeManager (  )  [virtual]

Definition at line 157 of file KoShapeManager.cpp.


Member Function Documentation

void KoShapeManager::add ( KoShape shape,
Repaint  repaint = PaintShapeOnAdd 
)

Add a KoShape to be displayed and managed by this manager.

This will trigger a repaint of the shape.

Parameters:
shape the shape to add
repaint if true it will trigger a repaint of the shape

Definition at line 184 of file KoShapeManager.cpp.

void KoShapeManager::addAdditional ( KoShape shape  ) 

Add an additional shape to the manager.

For additional shapes only updates are handled

Definition at line 212 of file KoShapeManager.cpp.

void KoShapeManager::notifyShapeChanged ( KoShape shape  ) 

Update the tree for finding the shapes.

This will remove the shape from the tree and will reinsert it again. The update to the tree will be posponed until it is needed so that successive calls will be merged into one.

Parameters:
shape the shape to updated its position in the tree.

Definition at line 488 of file KoShapeManager.cpp.

void KoShapeManager::paint ( QPainter painter,
const KoViewConverter converter,
bool  forPrint 
) [virtual]

Paint all shapes and their selection handles etc.

Parameters:
painter the painter to paint to.
forPrint if true, make sure only actual content is drawn and no decorations.
converter to convert between document and view coordinates.

Definition at line 254 of file KoShapeManager.cpp.

void KoShapeManager::paintShape ( KoShape shape,
QPainter painter,
const KoViewConverter converter,
bool  forPrint 
)

Paint a shape.

Parameters:
shape the shape to paint
painter the painter to paint to.
converter to convert between document and view coordinates.
forPrint if true, make sure only actual content is drawn and no decorations.

Definition at line 300 of file KoShapeManager.cpp.

void KoShapeManager::remove ( KoShape shape  ) 

Remove a KoShape from this manager.

Parameters:
shape the shape to remove

Definition at line 223 of file KoShapeManager.cpp.

void KoShapeManager::removeAdditional ( KoShape shape  ) 

Remove an additional shape.

For additional shapes only updates are handled

Definition at line 246 of file KoShapeManager.cpp.

KoSelection * KoShapeManager::selection (  )  const

return the selection shapes for this shapeManager

Definition at line 521 of file KoShapeManager.cpp.

void KoShapeManager::selectionChanged (  )  [signal]

emitted when the selection is changed

void KoShapeManager::selectionContentChanged (  )  [signal]

emitted when an object in the selection is changed (moved/rotated etc)

void KoShapeManager::setPaintingStrategy ( KoShapeManagerPaintingStrategy strategy  ) 

Set the strategy of the KoShapeManager.

This can be used to change the behaviour of the painting of the shapes.

Parameters:
strategy the new strategy. The ownership of the argument strategy will be taken by the shape manager.

Definition at line 542 of file KoShapeManager.cpp.

void KoShapeManager::setShapes ( const QList< KoShape * > &  shapes,
Repaint  repaint = PaintShapeOnAdd 
)

Remove all previously owned shapes and make the argument list the new shapes to be managed by this manager.

Parameters:
shapes the new shapes to manage.
repaint if true it will trigger a repaint of the shapes

Definition at line 169 of file KoShapeManager.cpp.

KoShape * KoShapeManager::shapeAt ( const QPointF position,
KoFlake::ShapeSelection  selection = KoFlake::ShapeOnTop,
bool  omitHiddenShapes = true 
)

Returns the shape located at a specific point in the document.

If more than one shape is located at the specific point, the given selection type controls which of them is returned.

Parameters:
position the position in the document coordinate system.
selection controls which shape is returned when more than one shape is at the specific point
omitHiddenShapes if true, only visible shapes are considered

Definition at line 410 of file KoShapeManager.cpp.

QList< KoShape * > KoShapeManager::shapes (  )  const

returns the list of maintained shapes

Definition at line 504 of file KoShapeManager.cpp.

QList< KoShape * > KoShapeManager::shapesAt ( const QRectF rect,
bool  omitHiddenShapes = true 
)

Returns the shapes which intersects the specific rect in the document.

Parameters:
rect the rectangle in the document coordinate system.
omitHiddenShapes if true, only visible shapes are considered

Definition at line 459 of file KoShapeManager.cpp.

void KoShapeManager::suggestChangeTool ( KoPointerEvent event  ) 

Switch to editing the shape that is at the position of the event.

This method will check select a shape at the event position and switch to the default tool for that shape, or switch to the default tool if there is no shape at the position.

Parameters:
event the event that holds the point where to look for a shape.

Definition at line 526 of file KoShapeManager.cpp.

QList< KoShape * > KoShapeManager::topLevelShapes (  )  const

Get a list of all shapes that don't have a parent.

Definition at line 509 of file KoShapeManager.cpp.

void KoShapeManager::update ( QRectF rect,
const KoShape shape = 0,
bool  selectionHandles = false 
)

Request a repaint to be queued.

The repaint will be restricted to the parameters rectangle, which is expected to be in points (the document coordinates system of KoShape) and it is expected to be normalized and based in the global coordinates, not any local coordinates.

This method will return immediately and only request a repaint. Successive calls will be merged into an appropriate repaint action.

Parameters:
rect the rectangle (in pt) to queue for repaint.
shape the shape that is going to be redrawn; only needed when selectionHandles=true
selectionHandles if true; find out if the shape is selected and repaint its selection handles at the same time.

Definition at line 479 of file KoShapeManager.cpp.


The documentation for this class was generated from the following files: