papyrus logo

Papyrus::Rectangle Class Reference

A rectangle centered on the x,y coordinate. More...

#include <rectangle.h>

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

List of all members.

Public Member Functions

 PAPYRUS_DRAWABLE (Rectangle)
virtual ~Rectangle ()
virtual void set (const AttributeValueMap &avmap)
double width ()
 Returns the width of the rectangle.
double height ()
 Returns the height of the rectangle.
void xywh (double &x, double &y, double &w, double &h)
 Fills parameters w and h with the width and height of the rectangle.
void set_width (double w)
 Sets the width of the rectangle to w.
void set_height (double h)
 Sets the height of the rectangle to h.
void set_xywh (double x, double y, double w, double h)
 Sets the center of the rectangle to (x,y) and also sets the width and height of the rectangle.
void set_xywh (const Region &r)
double corner_radius ()
 If not NAN will draw a rectangle with rounded corners.
void set_corner_radius (double r)
 Draws a rounded rectangle using the provided radius.
void unset_corner_radius ()
 Unsets the corner radius.
virtual void draw_shape (Context &cairo) const
 Draws on the provided context.
virtual Glib::ustring svg (unsigned depth=0)
sigc::signal< void > signal_size ()
 signal emitted when the size of the rectangle is changed

Static Public Member Functions

static Rectangle::pointer create (double x, double y, double w, double h, Fill::pointer fill=Fill::pointer(), Stroke::pointer stroke=Stroke::pointer())
static Rectangle::pointer create (double w=0.0, double h=0.0, Fill::pointer fill=Fill::pointer(), Stroke::pointer stroke=Stroke::pointer())
 Creates a rectangle of a specified width and height.
static Rectangle::pointer create (const Glib::ustring &id, double x, double y, double w, double h, Fill::pointer fill=Fill::pointer(), Stroke::pointer stroke=Stroke::pointer())
static Rectangle::pointer create (const Glib::ustring &id, double w, double h, Fill::pointer fill=Fill::pointer(), Stroke::pointer stroke=Stroke::pointer())
static Rectangle::pointer create (const AttributeValueMap &avmap)

Protected Member Functions

 Rectangle (const Glib::ustring &id, double x, double y, double w, double h, Fill::pointer fill, Stroke::pointer stroke)
 Rectangle (const AttributeValueMap &avmap)
virtual Region calculate_extents (const Matrix &m=Matrix::Identity, ExtentsPerformance ep=EXTENTS_QUICK) const
 Reimplments the extent calculation to optimize quick extents without rendering to the sidebuffer.

Protected Attributes

double m_width
double m_height
double m_corner_radius
sigc::signal< void > m_signal_size

Detailed Description

A rectangle centered on the x,y coordinate.

rectangle.png

Rectangle

Author:
Rick L Vinyard Jr

Constructor & Destructor Documentation

Papyrus::Rectangle::Rectangle ( const Glib::ustring &  id,
double  x,
double  y,
double  w,
double  h,
Fill::pointer  fill,
Stroke::pointer  stroke 
) [protected]
Papyrus::Rectangle::Rectangle ( const AttributeValueMap avmap  )  [protected]
Papyrus::Rectangle::~Rectangle (  )  [virtual]

Member Function Documentation

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

Reimplments the extent calculation to optimize quick extents without rendering to the sidebuffer.

Reimplemented from Papyrus::Drawable.

References Papyrus::EXTENTS_QUICK, Papyrus::Region::include(), m_height, Papyrus::Shape::m_stroke, m_width, Papyrus::Matrix::transform_point(), width(), Papyrus::Drawable::x(), and Papyrus::Drawable::y().

double Papyrus::Rectangle::corner_radius (  ) 

If not NAN will draw a rectangle with rounded corners.

References m_corner_radius.

Rectangle::pointer Papyrus::Rectangle::create ( const AttributeValueMap avmap  )  [static]

References PAPYRUS_CREATE, and Rectangle().

Rectangle::pointer Papyrus::Rectangle::create ( const Glib::ustring &  id,
double  w,
double  h,
Fill::pointer  fill = Fill::pointer(),
Stroke::pointer  stroke = Stroke::pointer() 
) [static]

References PAPYRUS_CREATE.

Rectangle::pointer Papyrus::Rectangle::create ( const Glib::ustring &  id,
double  x,
double  y,
double  w,
double  h,
Fill::pointer  fill = Fill::pointer(),
Stroke::pointer  stroke = Stroke::pointer() 
) [static]

References PAPYRUS_CREATE.

Rectangle::pointer Papyrus::Rectangle::create ( double  w = 0.0,
double  h = 0.0,
Fill::pointer  fill = Fill::pointer(),
Stroke::pointer  stroke = Stroke::pointer() 
) [static]

Creates a rectangle of a specified width and height.

References PAPYRUS_CREATE.

Rectangle::pointer Papyrus::Rectangle::create ( double  x,
double  y,
double  w,
double  h,
Fill::pointer  fill = Fill::pointer(),
Stroke::pointer  stroke = Stroke::pointer() 
) [static]

References PAPYRUS_CREATE.

Referenced by Papyrus::SVG::process_element().

void Papyrus::Rectangle::draw_shape ( Context cairo  )  const [virtual]

Draws on the provided context.

Implements Papyrus::Shape.

References m_corner_radius, m_height, and m_width.

double Papyrus::Rectangle::height (  ) 

Returns the height of the rectangle.

References m_height.

Papyrus::Rectangle::PAPYRUS_DRAWABLE ( Rectangle   ) 
void Papyrus::Rectangle::set ( const AttributeValueMap avmap  )  [virtual]

Reimplemented from Papyrus::Shape.

References set_height(), set_width(), and Papyrus::strcaseeq().

void Papyrus::Rectangle::set_corner_radius ( double  r  ) 

Draws a rounded rectangle using the provided radius.

References m_corner_radius, and Papyrus::Shape::shape_changed().

void Papyrus::Rectangle::set_height ( double  h  ) 
void Papyrus::Rectangle::set_width ( double  w  ) 
void Papyrus::Rectangle::set_xywh ( const Region r  ) 
void Papyrus::Rectangle::set_xywh ( double  x,
double  y,
double  w,
double  h 
)

Sets the center of the rectangle to (x,y) and also sets the width and height of the rectangle.

References Papyrus::Drawable::freeze(), m_height, m_signal_size, m_width, Papyrus::Drawable::set_centroid(), Papyrus::Drawable::set_x(), Papyrus::Drawable::set_y(), Papyrus::Shape::shape_changed(), and Papyrus::Drawable::thaw().

Referenced by set_xywh().

sigc::signal< void > Papyrus::Rectangle::signal_size (  ) 

signal emitted when the size of the rectangle is changed

References m_signal_size.

Glib::ustring Papyrus::Rectangle::svg ( unsigned  depth = 0  )  [virtual]
void Papyrus::Rectangle::unset_corner_radius (  ) 

Unsets the corner radius.

The corner radius can be unset either by: # Use unset_corner_radius() to explicitly unset # Set the corner radius to NAN or a negative number

References m_corner_radius, and Papyrus::Shape::shape_changed().

double Papyrus::Rectangle::width (  ) 

Returns the width of the rectangle.

References m_width.

Referenced by calculate_extents().

void Papyrus::Rectangle::xywh ( double &  x,
double &  y,
double &  w,
double &  h 
)

Fills parameters w and h with the width and height of the rectangle.

References m_height, m_width, Papyrus::Drawable::x(), and Papyrus::Drawable::y().


Member Data Documentation

double Papyrus::Rectangle::m_height [protected]
sigc::signal<void> Papyrus::Rectangle::m_signal_size [protected]
double Papyrus::Rectangle::m_width [protected]

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