Papyrus::Group Class Reference

#include <papyrus/group.h>

Inheritance diagram for Papyrus::Group:

Inheritance graph
[legend]
List of all members.

Detailed Description

A group is a container for ordered collections of shapes, with the shapes at the top (front of the container) drawn last and the shapes at the bottom drawn first (end of the container).

The current implementation is very simplistic, and doesn't even try to do anything smart like taking into account occlusion or anything else. Instead all objects are simply drawn and it is left to cairo to take care of efficiency. At the current time there are no plans to improve this behavior, since it runs 'fast enough' for now.

Groups are also useful since transforms upon the group are also applied to the contained objects. Thus, scaling, translating or rotating a group has the same effect as performing those operations upon each member of the group.

group.png

Group contain an ordered set of shapes

Author:
Rick L Vinyard Jr


Public Types

typedef PapyrusSmartPointer<
Group
pointer
typedef std::list< Drawable::pointer > Children

Public Member Functions

virtual bool add (Drawable::pointer item, bool drawing_only=false)
virtual bool remove (Drawable::pointer object)
virtual bool remove (Drawable *object)
 The main purpose of this method is so that a child may use the this pointer to remove itself on destruction.
virtual bool clear ()
virtual bool raise (Drawable::pointer item)
virtual bool raise_to_top (Drawable::pointer item)
virtual bool lower (Drawable::pointer item)
virtual bool lower_to_bottom (Drawable::pointer item)
Children & get_children ()
virtual bool inside (double x, double y)
 Overrides parent method for determining whether (x,y) is inside the drawable.
virtual std::vector< Drawable::pointer > select (double x, double y, unsigned depth=1)
sigc::signal< void, Drawable::pointer > & signal_child_added ()
sigc::signal< void, Drawable::pointer > & signal_child_removed ()
virtual bool is_group ()
 PAPYRUS_CLASS_NAME ("Group")
 PAPYRUS_CLONE_METHOD (Group)

Static Public Member Functions

static pointer create ()

Protected Types

typedef std::map< Drawable::pointer,
sigc::connection > 
Connections

Protected Member Functions

virtual void on_child_changed (Drawable::pointer child)
 Virtual method called when a child is changed.
virtual void update_extents ()
 Virtual method that recalculates the extents and emits the changed signal.
void on_child_need_redraw (double x, double y, double w, double h, Drawable::pointer child)
virtual void draw (Cairo::RefPtr< Cairo::Context > cairo)
void rebuild_extents ()

Protected Attributes

Children m_children
Connections m_redraw_connections
Connections m_changed_connections
sigc::signal< void, Drawable::pointer > m_signal_child_added
sigc::signal< void, Drawable::pointer > m_signal_child_removed

Friends

class Canvas


Member Function Documentation

bool Papyrus::Group::inside ( double  x,
double  y 
) [virtual]

Overrides parent method for determining whether (x,y) is inside the drawable.

If the group itself is selectable, performs a simple extents test. If the group is not selectable, performs a test on each of the children, returning true if any of the children are selectable.

Reimplemented from Papyrus::Drawable.

void Papyrus::Group::on_child_changed ( Drawable::pointer  child  )  [protected, virtual]

Virtual method called when a child is changed.

Parameters indicate which child changed and contain hint as to which aspect of the child changed.

When a child is added, the child's changed signal is actually connected to the private proxy method, which in turn calls the virtual method. This allows children to implement their own behavior by reimplementing this method without worrying about modifying the add() or remove() methods.

void Papyrus::Group::update_extents (  )  [protected, virtual]

Virtual method that recalculates the extents and emits the changed signal.

Children should reimplement this method if they need to perform special behavior when an event occurs that could effect the extents, and that behavior needs to take place before the signal is emitted.

Reimplemented in Papyrus::Boxed, and Papyrus::Handlebox.


The documentation for this class was generated from the following files:
Generated on Sun Jan 7 22:53:59 2007 by  doxygen 1.5.1