A value class that describes a CSS length. More...
#include <Wt/WLength>
Public Types | |
enum | Unit { FontEm, FontEx, Pixel, Inch, Centimeter, Millimeter, Point, Pica, Percentage } |
The unit. More... |
Public Member Functions | |
WLength () | |
Creates an 'auto' length. | |
WLength (const char *c) | |
Creates a length by parsing the argument as a css length string. | |
WLength (double value, Unit unit=Pixel) | |
Creates a length with value and unit. | |
WLength (int value, Unit unit=Pixel) | |
Creates a length with value and unit. | |
WLength (long value, Unit unit=Pixel) | |
Creates a length with value and unit. | |
WLength (unsigned value, Unit unit=Pixel) | |
Creates a length with value and unit. | |
WLength (unsigned long value, Unit unit=Pixel) | |
Creates a length with value and unit. | |
bool | isAuto () const |
Returns whether the length is 'auto'. | |
double | value () const |
Returns the value. | |
Unit | unit () const |
Returns the unit. | |
const std::string | cssText () const |
Returns the CSS text. | |
bool | operator== (const WLength &other) const |
Comparison operator. | |
bool | operator!= (const WLength &other) const |
Comparison operator. | |
double | toPixels (double fontSize=16.0) const |
Returns the (approximate) length in pixels. |
Static Public Attributes | |
static WLength | Auto |
An 'auto' length. |
A value class that describes a CSS length.
The class combines a value with a unit. There is a special value auto which has a different meaning depending on the context.
enum Wt::WLength::Unit |
Wt::WLength::WLength | ( | ) |
Wt::WLength::WLength | ( | const char * | c | ) |
Creates a length by parsing the argument as a css length string.
This supports all CSS length formats that have an API counterpart.
Creates a length with value and unit.
This constructor is also used for the implicit conversion of a double to a WLength, assuming a pixel unit.
Creates a length with value and unit.
This constructor is also used for the implicit conversion of a int to a WLength, assuming a pixel unit.
Creates a length with value and unit.
This constructor is also used for the implicit conversion of a long to a WLength, assuming a pixel unit.
Creates a length with value and unit.
This constructor is also used for the implicit conversion of an unsigned to a WLength, assuming a pixel unit.
Creates a length with value and unit.
This constructor is also used for the implicit conversion of an unsigned long to a WLength, assuming a pixel unit.
double Wt::WLength::toPixels | ( | double | fontSize = 16.0 | ) | const |
Returns the (approximate) length in pixels.
When the length isAuto(), 0 is returned, otherwise the approximate length in pixels.
double Wt::WLength::value | ( | ) | const |
Returns the value.