Wt  4.12.0
Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
Wt::WLeafletMap::AbstractOverlayItem Class Reference

An abstract map item with text. More...

#include <WLeafletMap.h>

Inheritance diagram for Wt::WLeafletMap::AbstractOverlayItem:
[legend]

Public Member Functions

void setOptions (const Json::Object &options)
 Set the options of the AbstractOverlayItem. More...
 
void setContent (std::unique_ptr< WWidget > content)
 Set the content.
 
void setContent (const WString &content)
 Set the content.
 
const WWidgetcontent () const
 Get the content. More...
 
void open ()
 Opens the AbstractOverlayItem. More...
 
void close ()
 Closes the AbstractOverlayItem. More...
 
void toggle ()
 Opens or closes the AbstractOverlayItem. More...
 
bool isOpen () const
 Returns whether the AbstractOverlayItem is open. More...
 
Signalopened ()
 Signal emited after the AbstractOverlayItem was opened. More...
 
Signalclosed ()
 Signal emited after the AbstractOverlayItem was closed. More...
 
void bringToFront ()
 Brings this AbstractOverlayItem to the front. More...
 
void bringToBack ()
 Brings this AbstractOverlayItem to the back. More...
 
- Public Member Functions inherited from Wt::WLeafletMap::AbstractMapItem
void move (const Coordinate &pos)
 Move the map item. More...
 
Coordinate position () const
 Get the current position. More...
 
Signalclicked ()
 Signal emitted when the user clicks on the map item. More...
 
SignaldoubleClicked ()
 Signal emitted when the user double-clicks on the map item. More...
 
SignalmouseWentDown ()
 Signal emitted when the user holds the mouse click on the map item. More...
 
SignalmouseWentUp ()
 Signal emitted when the user releases the mouse click on the map item. More...
 
SignalmouseWentOver ()
 Signal emitted when the user's mouse enters the map item. More...
 
SignalmouseWentOut ()
 Signal emitted when the user's mouse leaves the map item. More...
 
- 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 >
Child * addChild (std::unique_ptr< Child > child)
 Add a child WObject, returning a raw pointer. More...
 
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< Child > removeChild (Child *child)
 Remove a child WObject, so its lifetime is no longer determined by this WObject. More...
 
virtual const std::string id () const
 Returns the (unique) identifier for this object. More...
 
virtual void setObjectName (const std::string &name)
 Sets an object name. More...
 
virtual std::string objectName () const
 Returns the object name. More...
 
void resetLearnedSlots ()
 Resets learned stateless slot implementations. More...
 
template<class T >
void resetLearnedSlot (void(T::*method)())
 Resets a learned stateless slot implementation. More...
 
template<class T >
WStatelessSlot * implementStateless (void(T::*method)())
 Declares a slot to be stateless and learn client-side behaviour on first invocation. More...
 
template<class T >
WStatelessSlot * implementStateless (void(T::*method)(), void(T::*undoMethod)())
 Declares a slot to be stateless and learn client-side behaviour in advance. More...
 
void isNotStateless ()
 Marks the current function as not stateless. More...
 
template<class T >
WStatelessSlot * implementJavaScript (void(T::*method)(), const std::string &jsCode)
 Provides a JavaScript implementation for a method. More...
 
- Public Member Functions inherited from Wt::Core::observable
 observable () noexcept
 Default constructor.
 
virtual ~observable ()
 Destructor. More...
 
template<typename... Args, typename C >
auto bindSafe (void(C::*method)(Args...)) noexcept
 Protects a method call against object destruction. More...
 
template<typename... Args, typename C >
auto bindSafe (void(C::*method)(Args...) const) const noexcept
 Protects a const method call against object destruction. More...
 
template<typename Function >
auto bindSafe (const Function &function) noexcept
 Protects a function against object destruction. More...
 

Protected Member Functions

 AbstractOverlayItem (const Coordinate &pos)
 Constructor. More...
 
 AbstractOverlayItem (const Coordinate &pos, std::unique_ptr< WWidget > content)
 Constructor. More...
 
void setMap (WLeafletMap *map) override
 Set the map this item belongs to. More...
 
- Protected Member Functions inherited from Wt::WLeafletMap::AbstractMapItem
 AbstractMapItem (const Coordinate &pos)
 Constructor. More...
 
virtual void createItemJS (WStringStream &ss, WStringStream &postJS, long long id)=0
 Writes the JS code to create this item to the stream. More...
 
virtual void unrender ()
 Unrender the item. More...
 
virtual bool needsUpdate () const
 Return whether this item needs to be updated. More...
 
WLeafletMapmap ()
 Returns the map this item belongs to.
 
const WLeafletMapmap () const
 Returns the map this item belongs to.
 
virtual void update (WStringStream &js)
 Writes the JS to update this item to the stream. More...
 
- Protected Member Functions inherited from Wt::WObject
virtual WStatelessSlot * getStateless (Method method)
 On-demand stateless slot implementation. More...
 

Private Member Functions

void applyChangeJS (WStringStream &ss, long long id) override
 
std::string addFunctionJs () const override
 The name of the JS function that adds the item to the map.
 

Additional Inherited Members

- Public Types inherited from Wt::WObject
typedef void(WObject::* Method) ()
 Typedef for a WObject method without arguments.
 

Detailed Description

An abstract map item with text.

This is the base class for all AbstractMapItems that can be added to other AbstractMapItems. This is an abstract class, so it should not be used directly.

Constructor & Destructor Documentation

◆ AbstractOverlayItem() [1/2]

Wt::WLeafletMap::AbstractOverlayItem::AbstractOverlayItem ( const Coordinate pos)
explicitprotected

Constructor.

Creates a new AbstractOverlayItem that has the given coordinates.

Since this is an abstract class, this should not be used directly.

◆ AbstractOverlayItem() [2/2]

Wt::WLeafletMap::AbstractOverlayItem::AbstractOverlayItem ( const Coordinate pos,
std::unique_ptr< WWidget content 
)
protected

Constructor.

Creates a new AbstractOverlayItem with the given content and that has the given coordinates.

Since this is an abstract class, this should not be used directly.

Member Function Documentation

◆ applyChangeJS()

void Wt::WLeafletMap::AbstractOverlayItem::applyChangeJS ( WStringStream ss,
long long  id 
)
overrideprivatevirtual

This method should write the JS code needed to update the item. The JS code written can use o.wtObj to refer to the WLeafletMap JS object.

Reimplemented from Wt::WLeafletMap::AbstractMapItem.

◆ bringToBack()

void Wt::WLeafletMap::AbstractOverlayItem::bringToBack ( )

Brings this AbstractOverlayItem to the back.

This brings this AbstractOverlayItem to the back of other AbstractOverlayItem of the same type.

Warning
This function only works after the AbstractOverlayItem is added to the map.
See also
bringToFront

◆ bringToFront()

void Wt::WLeafletMap::AbstractOverlayItem::bringToFront ( )

Brings this AbstractOverlayItem to the front.

This brings this AbstractOverlayItem to the front of other AbstractOverlayItem of the same type.

Warning
This function only works after the AbstractOverlayItem is added to the map.
See also
bringToBack

◆ close()

void Wt::WLeafletMap::AbstractOverlayItem::close ( )

Closes the AbstractOverlayItem.

See also
open, toggle

◆ closed()

Signal& Wt::WLeafletMap::AbstractOverlayItem::closed ( )

Signal emited after the AbstractOverlayItem was closed.

See also
opened

◆ content()

const WWidget* Wt::WLeafletMap::AbstractOverlayItem::content ( ) const

Get the content.

See also
setContent

◆ isOpen()

bool Wt::WLeafletMap::AbstractOverlayItem::isOpen ( ) const

Returns whether the AbstractOverlayItem is open.

See also
close, toggle

◆ open()

void Wt::WLeafletMap::AbstractOverlayItem::open ( )

Opens the AbstractOverlayItem.

See also
close, toggle

◆ opened()

Signal& Wt::WLeafletMap::AbstractOverlayItem::opened ( )

Signal emited after the AbstractOverlayItem was opened.

See also
closed

◆ setMap()

void Wt::WLeafletMap::AbstractOverlayItem::setMap ( WLeafletMap map)
overrideprotectedvirtual

Set the map this item belongs to.

This is called to set the map the item belongs to. You can override this function if you need to do something when the item is added to a map.

You should not call this function directly.

See also
map()

Reimplemented from Wt::WLeafletMap::AbstractMapItem.

◆ setOptions()

void Wt::WLeafletMap::AbstractOverlayItem::setOptions ( const Json::Object options)

Set the options of the AbstractOverlayItem.

Set the options that will be passed to the WLeafletMap AbstractOverlayItem at construction.

Usage example:

options["autoClose"] = true;
options["closeOnClick"] = true;
popup->setOptions(options);
A JSON object.
Definition: Object.h:35

See https://leafletjs.com/reference.html for the list of options.

Note
Modifying the options after the AbstractOverlayItem has been loaded by the user will not work as the AbstractOverlayItem was already constructed. Some option like 'content' can be changed after load using the appropriate function.
See also
setContent

◆ toggle()

void Wt::WLeafletMap::AbstractOverlayItem::toggle ( )

Opens or closes the AbstractOverlayItem.

See also
open, close