papyrus logo

Papyrus::Reference Class Reference

An instance of Reference holds a reference to another drawable without becoming the parent of the other drawable. More...

#include <reference.h>

Inheritance diagram for Papyrus::Reference:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 PAPYRUS_DRAWABLE (Reference)
 ~Reference ()
 Destructor.
virtual void draw (Context &cairo) const
 Override of Drawable's virtual draw method that draws the referenced drawable.
Drawable::pointer referenced ()
 Returns the current referenced object, or a null smart pointer if no object is currently reference.
void set_referenced (Drawable::pointer d)
 Sets the current referenced object.
void clear_referenced ()
 Removes the referenced object.
virtual Matrix global_matrix () const
 Override of Drawable's global matrix to include the matrix of the referenced drawable.
virtual Glib::ustring svg (unsigned depth=0)

Static Public Member Functions

static pointer create (Drawable::pointer ref=Drawable::pointer())
 Accepts an object to reference, or sets to a null pointer if no object.
static pointer create (const Glib::ustring &id, Drawable::pointer ref=Drawable::pointer())
 Accepts an object to reference, or sets to a null pointer if no object and names the reference with an id string.

Protected Member Functions

 Reference (const Glib::ustring &id, Drawable::pointer ref)
virtual Matrix calculate_composed_matrix () const
 Extends Drawable's version to include the referenced object's matrix.
virtual Region calculate_extents (const Matrix &m=Matrix::Identity, ExtentsPerformance ep=EXTENTS_QUICK) const

Protected Attributes

Drawable::pointer m_referenced
 The referenced object.
sigc::connection m_connection_referenced_composed_matrix_invalidated
 Used to track connection to referenced drawable's matrix invalidation signal.

Detailed Description

An instance of Reference holds a reference to another drawable without becoming the parent of the other drawable.

The reference's transformation matrix is applied before calling the referenced object to perform drawing. Therefore, the same drawing object may appear differently if two or more Reference instances apply different transformation matrices before performing actual drawing.

This class was motivated by the SVG 'use' element.

As a container, a Reference only holds a single object. If you need more than one object, add them to groups and then add the group to the reference.

If you don't want the group to take ownership, add the items individually to instances of Reference, then add the instances to a Group.

Author:
Rick L Vinyard Jr <rvinyard@cs.nmsu.edu>

Constructor & Destructor Documentation

Papyrus::Reference::Reference ( const Glib::ustring &  id,
Drawable::pointer  ref 
) [protected]
Papyrus::Reference::~Reference (  ) 

Destructor.


Member Function Documentation

Matrix Papyrus::Reference::calculate_composed_matrix (  )  const [protected, virtual]
Region Papyrus::Reference::calculate_extents ( const Matrix m = Matrix::Identity,
ExtentsPerformance  ep = EXTENTS_QUICK 
) const [protected, virtual]

Reimplemented from Papyrus::Drawable.

References m_referenced.

void Papyrus::Reference::clear_referenced (  ) 

Removes the referenced object.

References set_referenced().

Reference::pointer Papyrus::Reference::create ( const Glib::ustring &  id,
Drawable::pointer  ref = Drawable::pointer() 
) [static]

Accepts an object to reference, or sets to a null pointer if no object and names the reference with an id string.

References PAPYRUS_CREATE.

Reference::pointer Papyrus::Reference::create ( Drawable::pointer  ref = Drawable::pointer()  )  [static]

Accepts an object to reference, or sets to a null pointer if no object.

References PAPYRUS_CREATE.

void Papyrus::Reference::draw ( Context cairo  )  const [virtual]

Override of Drawable's virtual draw method that draws the referenced drawable.

Implements Papyrus::Drawable.

References m_referenced.

Matrix Papyrus::Reference::global_matrix (  )  const [virtual]

Override of Drawable's global matrix to include the matrix of the referenced drawable.

Reimplemented from Papyrus::Drawable.

References Papyrus::Drawable::composed_matrix(), Papyrus::Drawable::global_matrix(), Papyrus::Drawable::m_parent, and m_referenced.

Papyrus::Reference::PAPYRUS_DRAWABLE ( Reference   ) 
Drawable::pointer Papyrus::Reference::referenced (  ) 

Returns the current referenced object, or a null smart pointer if no object is currently reference.

References m_referenced.

void Papyrus::Reference::set_referenced ( Drawable::pointer  d  ) 

Sets the current referenced object.

Set to a null smart pointer to remove the referenced object.

References Papyrus::Drawable::invalidate_composed_matrix(), m_connection_referenced_composed_matrix_invalidated, m_referenced, and Papyrus::Drawable::redraw().

Referenced by clear_referenced().

Glib::ustring Papyrus::Reference::svg ( unsigned  depth = 0  )  [virtual]

Member Data Documentation

Used to track connection to referenced drawable's matrix invalidation signal.

Referenced by Reference(), and set_referenced().


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

Generated on Fri Apr 16 12:41:08 2010 for papyrus by doxygen 1.6.1