Wt  3.3.8
Public Member Functions | Protected Member Functions | List of all members
Wt::WMeasurePaintDevice Class Reference

WMeasurePaintDevice Wt/WMeasurePaintDevice Wt/WMeasurePaintDevice. More...

Inheritance diagram for Wt::WMeasurePaintDevice:
Inheritance graph
[legend]

Public Member Functions

 WMeasurePaintDevice (WPaintDevice *paintDevice)
 Creates a paint device to measure for the underlying device.
 
WRectF boundingRect () const
 Returns the bounding rectangle of everything painted so far. More...
 
virtual WFlags< FeatureFlagfeatures () const
 Returns device features.
 
virtual void setChanged (WFlags< ChangeFlag > flags)
 Indicates changes in painter state. More...
 
virtual void drawArc (const WRectF &rect, double startAngle, double spanAngle)
 Draws an arc. More...
 
virtual void drawImage (const WRectF &rect, const std::string &imgUri, int imgWidth, int imgHeight, const WRectF &sourceRect)
 Draws an image. More...
 
virtual void drawLine (double x1, double y1, double x2, double y2)
 Draws a line. More...
 
virtual void drawPath (const WPainterPath &path)
 Draws a path. More...
 
virtual void drawText (const WRectF &rect, WFlags< AlignmentFlag > alignmentFlags, TextFlag textFlag, const WString &text, const WPointF *clipPoint)
 Draws text. More...
 
virtual WTextItem measureText (const WString &text, double maxWidth=-1, bool wordWrap=false)
 Measures rendered text size. More...
 
virtual WFontMetrics fontMetrics ()
 Returns font metrics. More...
 
virtual void init ()
 Initializes the device for painting. More...
 
virtual void done ()
 Finishes painting on the device. More...
 
virtual bool paintActive () const
 Returns whether painting is active. More...
 
virtual WLength width () const
 Returns the device width. More...
 
virtual WLength height () const
 Returns the device height. More...
 
- Public Member Functions inherited from Wt::WPaintDevice
virtual ~WPaintDevice ()
 Destructor. More...
 

Protected Member Functions

virtual WPainterpainter () const
 Returns the painter that is currently painting on the device. More...
 
virtual void setPainter (WPainter *painter)
 Sets the painter.
 

Additional Inherited Members

- Public Types inherited from Wt::WPaintDevice

Detailed Description

WMeasurePaintDevice Wt/WMeasurePaintDevice Wt/WMeasurePaintDevice.

This implements a (pseudo)-paintdevice which measures the bounding rect of whatever is being painted on it, using fontmetrics from the underlying device.

The only output of the device is the computation of a bounding rect which is returned by boundingRect().

Member Function Documentation

WRectF Wt::WMeasurePaintDevice::boundingRect ( ) const

Returns the bounding rectangle of everything painted so far.

The bounding rect is returned in device coordinates (i.e. after all transformations applied).

void Wt::WMeasurePaintDevice::done ( )
virtual

Finishes painting on the device.

This method is called when a WPainter stopped painting.

See also
WPainter::end()

Implements Wt::WPaintDevice.

void Wt::WMeasurePaintDevice::drawArc ( const WRectF rect,
double  startAngle,
double  spanAngle 
)
virtual

Draws an arc.

The arc describes the segment of an ellipse enclosed by the rect. The segment starts at startAngle, and spans an angle given by spanAngle. These angles have as unit degree, and are measured counter-clockwise starting from the 3 o'clock position.

The arc must be stroked, filled, and transformed using the current painter settings.

Implements Wt::WPaintDevice.

void Wt::WMeasurePaintDevice::drawImage ( const WRectF rect,
const std::string &  imageUri,
int  imgWidth,
int  imgHeight,
const WRectF sourceRect 
)
virtual

Draws an image.

Draws sourceRect from the image with URL imageUri and original dimensions imgWidth and imgHeight to the location, into the rectangle defined by rect.

The image is transformed using the current painter settings.

Implements Wt::WPaintDevice.

void Wt::WMeasurePaintDevice::drawLine ( double  x1,
double  y1,
double  x2,
double  y2 
)
virtual

Draws a line.

The line must be stroked and transformed using the current painter settings.

Implements Wt::WPaintDevice.

void Wt::WMeasurePaintDevice::drawPath ( const WPainterPath path)
virtual

Draws a path.

The path must be stroked, filled, and transformed using the current painter settings.

Implements Wt::WPaintDevice.

void Wt::WMeasurePaintDevice::drawText ( const WRectF rect,
WFlags< AlignmentFlag alignmentFlags,
TextFlag  textFlag,
const WString text,
const WPointF clipPoint 
)
virtual

Draws text.

The text must be rendered, stroked and transformed using the current painter settings.

If clipPoint is not null, a check is performed whether the point is inside of the current clip area. If not, the text is not drawn.

Implements Wt::WPaintDevice.

WFontMetrics Wt::WMeasurePaintDevice::fontMetrics ( )
virtual

Returns font metrics.

This returns font metrics for the current font.

Throws a std::logic_error if the underlying device does not provide font metrics.

Implements Wt::WPaintDevice.

WLength Wt::WMeasurePaintDevice::height ( ) const
virtual

Returns the device height.

The device height, in pixels, establishes the height of the device coordinate system.

Implements Wt::WPaintDevice.

void Wt::WMeasurePaintDevice::init ( )
virtual

Initializes the device for painting.

This method is called when a WPainter starts painting.

See also
WPainter::begin(WPaintDevice *), painter()

Implements Wt::WPaintDevice.

WTextItem Wt::WMeasurePaintDevice::measureText ( const WString text,
double  maxWidth = -1,
bool  wordWrap = false 
)
virtual

Measures rendered text size.

Returns the bounding rect of the given text when rendered using the current font.

If maxWidth != -1, then the text is truncated to fit in the width.

If wordWrap = true then text is truncated only at word boundaries. Note that in this case the whitespace at the truncated position is included in the text but not accounted for by the returned width (since usually you will not render the whitespace at the end of a line).

Throws a std::logic_error if the underlying device does not provide font metrics.

Implements Wt::WPaintDevice.

virtual bool Wt::WMeasurePaintDevice::paintActive ( ) const
virtual

Returns whether painting is active.

See also
init(), painter()

Implements Wt::WPaintDevice.

virtual WPainter* Wt::WMeasurePaintDevice::painter ( ) const
protectedvirtual

Returns the painter that is currently painting on the device.

See also
init()

Implements Wt::WPaintDevice.

void Wt::WMeasurePaintDevice::setChanged ( WFlags< ChangeFlag flags)
virtual

Indicates changes in painter state.

The flags argument is the logical OR of one or more change flags.

See also
ChangeFlag

Implements Wt::WPaintDevice.

WLength Wt::WMeasurePaintDevice::width ( ) const
virtual

Returns the device width.

The device width, in pixels, establishes the width of the device coordinate system.

Implements Wt::WPaintDevice.


Generated on Mon Sep 4 2017 for the C++ Web Toolkit (Wt) by doxygen 1.8.11