/usr/include/Wt/WRectF 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 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | // This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
*
* See the LICENSE file for terms of use.
*/
#ifndef WRECTF_H_
#define WRECTF_H_
#include <Wt/WDllDefs.h>
#include <Wt/WJavaScriptExposableObject>
namespace Wt {
class WPointF;
/*! \class WRectF Wt/WRectF Wt/WRectF
* \brief A value class that defines a rectangle.
*
* The rectangle is defined by a top-left point and a width and height.
*
* <h3>JavaScript exposability</h3>
*
* A %WRectF is JavaScript exposable. If a %WRectF \link isJavaScriptBound()
* is JavaScript bound\endlink, it can be accessed in your custom JavaScript
* code through \link WJavaScriptHandle::jsRef() its handle's jsRef()\endlink.
* A rectangle is represented in JavaScript as an array of four elements (x,y,width,height), e.g. a rectangle
* WRectF(10,20,30,40) will be represented in JavaScript as:
* \code
* [10, 20, 30, 40]
* \endcode
*
* \warning A %WRectF that is JavaScript exposed should be modified only through its \link WJavaScriptHandle handle\endlink.
* Any attempt at modifying it will cause an exception to be thrown.
*
* \sa WPaintedWidget::createJSRect()
*
* \ingroup painting
*/
class WT_API WRectF : public WJavaScriptExposableObject
{
public:
/*! \brief Default constructor.
*
* \if cpp
* Constructs a \p null rectangle.
*
* \sa isNull()
* \endif
*
* \if java
* Constructs an empty rectangle.
*
* \sa isEmpty()
* \endif
*/
WRectF();
/*! \brief Creates a rectangle.
*
* Constructs a rectangle with top left point (\p x, \p y)
* and size \p width x \p height.
*/
WRectF(double x, double y, double width, double height);
WRectF(const WRectF& other);
/*! \brief Creates a rectangle.
*
* Constructs a rectangle from the two points \p topLeft and
* \p bottomRight.
*
* If you want to create a rectangle from two arbitrary corner
* points, you can use this constructor too, but should call
* normalized() afterwords.
*/
WRectF(const WPointF& topLeft, const WPointF& bottomRight);
#ifdef WT_TARGET_JAVA
/*! \brief Internal assign method.
*/
WRectF& operator= (const WRectF& rhs);
#endif // WT_TARGET_JAVA
#ifdef WT_TARGET_JAVA
WRectF clone() const;
#endif
virtual ~WRectF();
/*! \brief Comparison operator.
*/
bool operator== (const WRectF& rhs) const;
bool operator!= (const WRectF& rhs) const;
/*! \brief Checks for a <i>null</i> rectangle.
*
* A rectangle that isJavaScriptBound() is never null.
*
* \sa WRectF()
*/
bool isNull() const;
/*! \brief Determines whether or not this rectangle is empty.
*
* A rectangle is empty if its width and height are zero.
*
* A rectangle that isJavaScriptBound() is JavaScript bound\endlink is never empty.
*/
bool isEmpty() const;
/*! \brief Sets the X-position of the left side.
*
* The right side of the rectangle does not move, and as a result,
* the rectangle may be resized.
*
* \throws WException if the rectangle \link isJavaScriptBound() is JavaScript bound\endlink
*/
void setX(double x);
/*! \brief Sets the Y-position of the top side.
*
* The bottom side of the rectangle does not move, and as a result,
* the rectangle may be resized.
*
* \throws WException if the rectangle \link isJavaScriptBound() is JavaScript bound\endlink
*/
void setY(double y);
/*! \brief Sets the width.
*
* The right side of the rectangle may move, but this does not
* affect the left side.
*
* \throws WException if the rectangle \link isJavaScriptBound() is JavaScript bound\endlink
*/
void setWidth(double width) { width_ = width; }
/*! \brief Sets the Y-position of the top side.
*
* The bottom side of the rectangle may move, but this does not
* affect the Y position of the top side.
*
* \throws WException if the rectangle \link isJavaScriptBound() is JavaScript bound\endlink
*/
void setHeight(double height) { height_ = height; }
/*! \brief Returns the X-position (left side offset).
*
* This is equivalent to left().
*
* \sa y(), left()
*/
double x() const { return x_; }
/*! \brief Returns the Y-position (top side offset).
*
* This is equivalent to top().
*
* \sa x(), top()
*/
double y() const { return y_; }
/*! \brief Returns the width.
*
* \sa height()
*/
double width() const { return width_; }
/*! \brief Returns the height.
*
* \sa width()
*/
double height() const { return height_; }
/*! \brief Returns the X position (left side offset).
*
* \sa x(), right()
*/
double left() const { return x_; }
/*! \brief Returns the Y position (top side offset).
*
* \sa y(), bottom()
*/
double top() const { return y_; }
/*! \brief Returns the the right side offset.
*
* \sa left()
*/
double right() const { return x_ + width_; }
/*! \brief Returns the bottom side offset.
*
* \sa top()
*/
double bottom() const { return y_ + height_; }
/*! \brief Returns the top left point.
*
* \sa left(), top()
*/
WPointF topLeft() const;
/*! \brief Returns the top right point.
*
* \sa right(), top()
*/
WPointF topRight() const;
/*! \brief Returns the center point.
*/
WPointF center() const;
/*! \brief Returns the bottom left point.
*
* \sa left(), bottom()
*/
WPointF bottomLeft() const;
/*! \brief Returns the bottom right point.
*
* \sa right(), bottom()
*/
WPointF bottomRight() const;
/*! \brief Tests if a rectangle contains a point.
*
* \note This method is not supported if this rectangle isJavaScriptBound()
*/
bool contains(const WPointF& p) const;
/*! \brief Tests if a rectangle contains a point.
*
* \note This method is not supported if this rectangle isJavaScriptBound()
*/
bool contains(double x, double y) const;
/*! \brief Tests if two rectangles intersect.
*/
bool intersects(const WRectF& other) const;
/*! \brief Makes the union of to rectangles.
*
* \note This method is not supported if this rectangle \link isJavaScriptBound() is JavaScript bound\endlink.
*/
WRectF united(const WRectF& other) const;
/*! \brief Returns a normalized rectangle.
*
* A normalized rectangle has a positive width and height.
*
* This method supports JavaScript bound rectangles.
*/
WRectF normalized() const;
virtual std::string jsValue() const WT_CXX11ONLY(override) ;
protected:
void assignFromJSON(const Json::Value &value) WT_CXX11ONLY(override) ;
private:
double x_, y_, width_, height_;
friend class WTransform;
};
}
#endif // WRECTF_H_
|