/usr/include/Wt/WMeasurePaintDevice is in libwt-dev 3.3.6+dfsg-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | // This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2014 Emweb bvba, Kessel-Lo, Belgium.
*
* See the LICENSE file for terms of use.
*/
#ifndef WMEASURE_PAINT_DEVICE_H_
#define WMEASURE_PAINT_DEVICE_H_
#include <Wt/WPaintDevice>
#include <Wt/WRectF>
namespace Wt {
/*! \brief 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().
*/
class WMeasurePaintDevice : public WPaintDevice
{
public:
/*! \brief Creates a paint device to measure for the underlying device.
*/
WMeasurePaintDevice(WPaintDevice *paintDevice);
/*! \brief Returns the bounding rectangle of everything painted so far.
*
* The bounding rect is returned in device coordinates (i.e. after all
* transformations applied).
*/
WRectF boundingRect() const { return bounds_; }
virtual WFlags<FeatureFlag> features() const;
virtual void setChanged(WFlags<ChangeFlag> flags);
virtual void drawArc(const WRectF& rect, double startAngle, double spanAngle);
virtual void drawImage(const WRectF& rect, const std::string& imgUri,
int imgWidth, int imgHeight, const WRectF& sourceRect);
virtual void drawLine(double x1, double y1, double x2, double y2);
virtual void drawPath(const WPainterPath& path);
virtual void drawText(const WRectF& rect,
WFlags<AlignmentFlag> alignmentFlags,
TextFlag textFlag,
const WString& text,
const WPointF *clipPoint);
virtual WTextItem measureText(const WString& text, double maxWidth = -1,
bool wordWrap = false);
virtual WFontMetrics fontMetrics();
virtual void init();
virtual void done();
virtual bool paintActive() const { return painter_ != 0; }
virtual WLength width() const;
virtual WLength height() const;
protected:
virtual WPainter *painter() const { return painter_; }
virtual void setPainter(WPainter *painter) { painter_ = painter; }
private:
WPainter *painter_;
WPaintDevice *device_;
WRectF bounds_;
void expandBounds(const WRectF& bounds);
};
}
#endif // WMEASURE_PAINT_DEVICE_H_
|