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 Types

typedef PapyrusPointer< Referencepointer

Public Member Functions

 ~Reference ()
 Destructor.
 PAPYRUS_CLASS_NAME ("Reference")
 Utility macro to provide class name.
 PAPYRUS_CLONE_METHOD (Reference)
 Utility mactro to provide virtual clone() method.
virtual void draw (Cairo::RefPtr< Cairo::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.
virtual Region extents (const Matrix &m=Matrix::Identity, ExtentsPerformance ep=EXTENTS_QUICK) const
 Reimplement to provide referenced Drawable's extents.
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 void update_extents ()
 Null method since parent is pure virtual.

Protected Attributes

Drawable::pointer m_referenced
 The referenced object.


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>

Member Typedef Documentation

typedef PapyrusPointer<Reference> Papyrus::Reference::pointer

Reimplemented from Papyrus::Drawable.


Constructor & Destructor Documentation

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

Papyrus::Reference::~Reference (  ) 

Destructor.


Member Function Documentation

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.

Referenced by Papyrus::example_reference().

void Papyrus::Reference::draw ( Cairo::RefPtr< Cairo::Context >  cairo  )  const [virtual]

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

Implements Papyrus::Drawable.

References m_referenced.

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

Reimplement to provide referenced Drawable's extents.

Reimplemented from 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_CLASS_NAME ( "Reference"   ) 

Utility macro to provide class name.

Papyrus::Reference::PAPYRUS_CLONE_METHOD ( Reference   ) 

Utility mactro to provide virtual clone() method.

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 m_referenced, and Papyrus::Drawable::redraw().

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

virtual void Papyrus::Reference::update_extents (  )  [inline, protected, virtual]

Null method since parent is pure virtual.


Member Data Documentation

The referenced object.

Referenced by draw(), extents(), global_matrix(), referenced(), set_referenced(), and svg().


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

Generated on Wed Mar 18 12:34:58 2009 for papyrus by doxygen 1.5.7.1