KoSelection Class Reference

A selection is a shape that contains a number of references to shapes. More...

#include <KoSelection.h>

Inheritance diagram for KoSelection:

KoShape List of all members.

Signals

void selectionChanged ()
 emitted when the selection is changed

Public Member Functions

virtual void paint (QPainter &painter, const KoViewConverter &converter)
 Paint the shape The class extending this one is responsible for painting itself.
virtual void select (KoShape *object)
 add a selected object
virtual void deselect (KoShape *object)
 remove a selected object
virtual void deselectAll ()
 clear the selections list
virtual const QList< KoShape * > selectedShapes (KoFlake::SelectionType strip=KoFlake::FullSelection) const
 Return the list of selected shapes.
KoShapefirstSelectedShape (KoFlake::SelectionType strip=KoFlake::FullSelection) const
 Return the first selected shape, or 0 if there is nothing selected.
virtual bool isSelected (const KoShape *object) const
 return true if the shape is selected
virtual int count () const
 return the selection count
virtual bool hitTest (const QPointF &position) const
 Check if the shape is hit on position.
virtual QRectF boundingRect () const
 Get the bounding box of the shape.
void setActiveLayer (KoShapeLayer *layer)
 Sets the currently active layer.
KoShapeLayeractiveLayer () const
 Returns a currently active layer.
void updateSizeAndPosition ()
 Updates the size and position of the selection.

Detailed Description

A selection is a shape that contains a number of references to shapes.

That means that a selection can be manipulated in the same way as a single shape.

Note that a single shape can be selected in one view, and not in another, and that in a single view, more than one selection can be present. So selections should not be seen as singletons, or as something completely transient.

A selection, however, should not be selectable. We need to think a little about the interaction here.


Member Function Documentation

KoShapeLayer * KoSelection::activeLayer (  )  const

Returns a currently active layer.

Returns:
the currently active layer, or zero if there is none

QRectF KoSelection::boundingRect (  )  const [virtual]

Get the bounding box of the shape.

This includes the line width but not the shadow of the shape

Returns:
the bounding box of the shape

Reimplemented from KoShape.

KoShape * KoSelection::firstSelectedShape ( KoFlake::SelectionType  strip = KoFlake::FullSelection  )  const

Return the first selected shape, or 0 if there is nothing selected.

Parameters:
strip if StrippedSelection, the returned list will not include any children of a grouped shape if the group-parent is itself also in the set.

bool KoSelection::hitTest ( const QPointF &  position  )  const [virtual]

Check if the shape is hit on position.

Parameters:
position the position where the user clicked.
Returns:
true when it hits.

Reimplemented from KoShape.

void KoSelection::paint ( QPainter &  painter,
const KoViewConverter converter 
) [virtual]

Paint the shape The class extending this one is responsible for painting itself.

Since we do not assume the shape is square the paint must also clear its background if it will draw something transparent on top. This can be done with a method like: painter.fillRect(converter.normalToView(QRectF(QPointF(0.0,0.0), size())), background()); Or equavalent for non-square objects. Do note that a shape's top-left is always at coordinate 0,0. Even if the shape itself is rotated or translated.

Parameters:
painter used for painting the shape
converter to convert between internal and view coordinates.
See also:
applyConversion()

Implements KoShape.

const QList< KoShape * > KoSelection::selectedShapes ( KoFlake::SelectionType  strip = KoFlake::FullSelection  )  const [virtual]

Return the list of selected shapes.

Returns:
the list of selected shapes
Parameters:
strip if StrippedSelection, the returned list will not include any children of a container shape if the container-parent is itself also in the set.

void KoSelection::setActiveLayer ( KoShapeLayer layer  ) 

Sets the currently active layer.

Parameters:
layer the new active layer


The documentation for this class was generated from the following files:
Generated on Sun Jul 20 22:37:16 2008 for libs/flake by  doxygen 1.4.7