Wt  4.10.4
Public Member Functions | List of all members
Wt::WPointF Class Reference

A value class that defines a 2D point. More...

#include <Wt/WPointF.h>

Inheritance diagram for Wt::WPointF:
[legend]

Public Member Functions

 WPointF ()
 Creates point (0, 0).
 
 WPointF (double x, double y)
 Creates a point (x, y).
 
 WPointF (const WPointF &other)
 Copy constructor.
 
 WPointF (const Coordinates &other)
 Creates a point from mouse coordinates.
 
void setX (double x)
 Sets the X coordinate. More...
 
void setY (double y)
 Sets the Y coordinate. More...
 
double x () const
 Returns the X coordinate.
 
double y () const
 Returns the Y coordinate.
 
bool operator== (const WPointF &other) const
 Comparison operator.
 
bool operator!= (const WPointF &other) const
 Comparison operator.
 
virtual std::string jsValue () const override
 Returns a JavaScript representation of the value of this object. More...
 
- Public Member Functions inherited from Wt::WJavaScriptExposableObject
bool isJavaScriptBound () const
 Returns whether this object is JavaScript bound. More...
 
std::string jsRef () const
 Returns a JavaScript reference to this object. More...
 

Detailed Description

A value class that defines a 2D point.

JavaScript exposability

A WPointF is JavaScript exposable. If a WPointF is JavaScript bound, it can be accessed in your custom JavaScript code through its handle's jsRef(). A point is represented in JavaScript as an array of two elements, e.g. a point WPointF(10,20) will be represented in JavaScript as:

[10, 20]
Warning
A WPointF that is JavaScript exposed should be modified only through its handle. Any attempt at modifying it will cause an exception to be thrown.
See also
WPaintedWidget::createJSPoint()

Member Function Documentation

◆ jsValue()

std::string Wt::WPointF::jsValue ( ) const
overridevirtual

Returns a JavaScript representation of the value of this object.

Note
The value returned will reflect the current server side value of the object. If this object is JavaScript bound, this value may not reflect the actual client side value. If you need access to the client side value, use jsRef() intead.

Implements Wt::WJavaScriptExposableObject.

◆ setX()

void Wt::WPointF::setX ( double  x)

Sets the X coordinate.

Exceptions
WExceptionif the point is JavaScript bound

◆ setY()

void Wt::WPointF::setY ( double  y)

Sets the Y coordinate.

Exceptions
WExceptionif the point is JavaScript bound