Wt  4.11.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Wt::WPolygonArea Class Reference

An interactive area in a widget, specified by a polygon. More...

#include <Wt/WPolygonArea.h>

Inheritance diagram for Wt::WPolygonArea:
[legend]

Public Member Functions

 WPolygonArea ()
 Creates an empty polygon.
 
 WPolygonArea (const std::vector< WPoint > &points)
 Creates a polygon area with given vertices.
 
 WPolygonArea (const std::vector< WPointF > &points)
 Creates a polygon area with given vertices.
 
void addPoint (int x, int y)
 Adds a point.
 
void addPoint (double x, double y)
 Adds a point.
 
void addPoint (const WPoint &point)
 Adds a point.
 
void addPoint (const WPointF &point)
 Adds a point.
 
void setPoints (const std::vector< WPoint > &points)
 Sets the polygon vertices.
 
void setPoints (const std::vector< WPointF > &points)
 Sets the polygon vertices.
 
const std::vector< WPointF > & pointFs () const
 Returns the polygon vertices.
 
const std::vector< WPoint > & points () const
 Returns the polygon vertices.
 
- Public Member Functions inherited from Wt::WAbstractArea
virtual ~WAbstractArea ()
 Destructor.
 
void setHole (bool hole)
 Specifies that this area specifies a hole for another area.
 
bool isHole () const
 Returns whether this area specifies a hole.
 
void setLink (const WLink &link)
 Sets a link.
 
WLink link () const
 Returns the link.
 
void setAlternateText (const WString &text)
 Sets an alternate text.
 
const WString alternateText () const
 Returns the alternate text.
 
void setToolTip (const WString &text)
 Sets the tooltip.
 
WString toolTip () const
 Returns the tooltip text.
 
void setStyleClass (const WString &styleClass)
 Defines a style class.
 
WString styleClass () const
 Returns the style class.
 
void addStyleClass (const WString &styleClass, bool force=false)
 Adds a style class.
 
void removeStyleClass (const WString &styleClass, bool force=false)
 Removes a style class.
 
void setCursor (Cursor cursor)
 Sets the cursor.
 
void setCursor (std::string cursorImage, Cursor fallback=Cursor::Arrow)
 Sets a custom cursor image URL.
 
Cursor cursor () const
 Returns the cursor.
 
EventSignal< WKeyEvent > & keyWentDown ()
 Event signal emitted when a keyboard key is pushed down.
 
EventSignal< WKeyEvent > & keyPressed ()
 Event signal emitted when a "character" was entered.
 
EventSignal< WKeyEvent > & keyWentUp ()
 Event signal emitted when a keyboard key is released.
 
EventSignalenterPressed ()
 Event signal emitted when enter was pressed.
 
EventSignalescapePressed ()
 Event signal emitted when escape was pressed.
 
EventSignal< WMouseEvent > & clicked ()
 Event signal emitted when a mouse key was clicked on this widget.
 
EventSignal< WMouseEvent > & doubleClicked ()
 Event signal emitted when a mouse key was double clicked on this widget.
 
EventSignal< WMouseEvent > & mouseWentDown ()
 Event signal emitted when a mouse key was pushed down on this widget.
 
EventSignal< WMouseEvent > & mouseWentUp ()
 Event signal emitted when a mouse key was released on this widget.
 
EventSignal< WMouseEvent > & mouseWentOut ()
 Event signal emitted when the mouse went out of this widget.
 
EventSignal< WMouseEvent > & mouseWentOver ()
 Event signal emitted when the mouse entered this widget.
 
EventSignal< WMouseEvent > & mouseMoved ()
 Event signal emitted when the mouse moved over this widget.
 
EventSignal< WMouseEvent > & mouseDragged ()
 Event signal emitted when the mouse is dragged over this widget.
 
EventSignal< WMouseEvent > & mouseWheel ()
 Event signal emitted when the mouse scroll wheel was used.
 
- Public Member Functions inherited from Wt::WObject
void addChild (std::unique_ptr< WObject > child)
 Add a child WObject whose lifetime is determined by this WObject.
 
template<typename Child >
ChildaddChild (std::unique_ptr< Child > child)
 Add a child WObject, returning a raw pointer.
 
std::unique_ptr< WObjectremoveChild (WObject *child)
 Remove a child WObject, so its lifetime is no longer determined by this WObject.
 
template<typename Child >
std::unique_ptr< ChildremoveChild (Child *child)
 Remove a child WObject, so its lifetime is no longer determined by this WObject.
 
virtual const std::string id () const
 Returns the (unique) identifier for this object.
 
virtual void setObjectName (const std::string &name)
 Sets an object name.
 
virtual std::string objectName () const
 Returns the object name.
 
void resetLearnedSlots ()
 Resets learned stateless slot implementations.
 
template<class T >
void resetLearnedSlot (void(T::*method)())
 Resets a learned stateless slot implementation.
 
template<class T >
WStatelessSlot * implementStateless (void(T::*method)())
 Declares a slot to be stateless and learn client-side behaviour on first invocation.
 
template<class T >
WStatelessSlot * implementStateless (void(T::*method)(), void(T::*undoMethod)())
 Declares a slot to be stateless and learn client-side behaviour in advance.
 
void isNotStateless ()
 Marks the current function as not stateless.
 
template<class T >
WStatelessSlot * implementJavaScript (void(T::*method)(), const std::string &jsCode)
 Provides a JavaScript implementation for a method.
 
- Public Member Functions inherited from Wt::Core::observable
 observable () noexcept
 Default constructor.
 
virtual ~observable ()
 Destructor.
 
template<typename... Args, typename C >
auto bindSafe (void(C::*method)(Args...)) noexcept
 Protects a method call against object destruction.
 
template<typename... Args, typename C >
auto bindSafe (void(C::*method)(Args...) const) const noexcept
 Protects a const method call against object destruction.
 
template<typename Function >
auto bindSafe (const Function &function) noexcept
 Protects a function against object destruction.
 

Additional Inherited Members

- Public Types inherited from Wt::WObject
typedef void(WObject::* Method) ()
 Typedef for a WObject method without arguments.
 
- Protected Member Functions inherited from Wt::WObject
virtual WStatelessSlot * getStateless (Method method)
 On-demand stateless slot implementation.
 

Detailed Description

An interactive area in a widget, specified by a polygon.

The area may be added to a WImage or WPaintedWidget to provide interactivity on a polygon area of the image. The polygon is specified in pixel coordinates, and uses an even-odd winding rule (overlaps create holes).

auto image = std::make_unique<Wt::WImage>("images/family.jpg");
auto face = std::make_unique<Wt::WPolygonArea>();
face->addPoint(100, 120);
face->addPoint(300, 120);
face->addPoint (200, 250);
face->setToolTip("Uncle Frank");
image->addArea(std::move(face));
A signal that conveys user-interface events.
Definition WSignal.h:558
void addArea(std::unique_ptr< WAbstractArea > area)
Adds an interactive area.
Definition WImage.C:144

The polygon area corresponds to the HTML <area shape="poly"> tag.

See also
WImage::addArea(), WPaintedWidget::addArea()
WCircleArea, WRectArea

Constructor & Destructor Documentation

◆ WPolygonArea() [1/3]

Wt::WPolygonArea::WPolygonArea ( )

Creates an empty polygon.

Defines an empty polygon.

◆ WPolygonArea() [2/3]

Wt::WPolygonArea::WPolygonArea ( const std::vector< WPoint > &  points)

Creates a polygon area with given vertices.

The polygon is defined with vertices corresponding to points. The polygon is closed by connecting the last point with the first point.

◆ WPolygonArea() [3/3]

Wt::WPolygonArea::WPolygonArea ( const std::vector< WPointF > &  points)

Creates a polygon area with given vertices.

The polygon is defined with vertices corresponding to points. The polygon is closed by connecting the last point with the first point.

Member Function Documentation

◆ pointFs()

const std::vector< WPointF > & Wt::WPolygonArea::pointFs ( ) const

Returns the polygon vertices.

See also
setPoints(), points()

◆ points()

const std::vector< WPoint > & Wt::WPolygonArea::points ( ) const

Returns the polygon vertices.

See also
setPoints(), pointFs()

◆ setPoints() [1/2]

void Wt::WPolygonArea::setPoints ( const std::vector< WPoint > &  points)

Sets the polygon vertices.

The polygon is defined with vertices corresponding to points. The polygon is closed by connecting the last point with the first point.

◆ setPoints() [2/2]

void Wt::WPolygonArea::setPoints ( const std::vector< WPointF > &  points)

Sets the polygon vertices.

The polygon is defined with vertices corresponding to points. The polygon is closed by connecting the last point with the first point.