#include <reference.h>
Public Types | |
typedef PapyrusPointer< Reference > | pointer |
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. |
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.
typedef PapyrusPointer<Reference> Papyrus::Reference::pointer |
Reimplemented from Papyrus::Drawable.
Papyrus::Reference::Reference | ( | const Glib::ustring & | id, | |
Drawable::pointer | ref | |||
) | [protected] |
Papyrus::Reference::~Reference | ( | ) |
Destructor.
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] |
Reimplemented from Papyrus::Renderable.
References m_referenced, Papyrus::Renderable::svg_id(), Papyrus::Renderable::svg_spacing(), and Papyrus::Drawable::svg_transform().
virtual void Papyrus::Reference::update_extents | ( | ) | [inline, protected, virtual] |
Null method since parent is pure virtual.
Drawable::pointer Papyrus::Reference::m_referenced [protected] |
The referenced object.
Referenced by draw(), extents(), global_matrix(), referenced(), set_referenced(), and svg().