6#include <Wt/WCssDecorationStyle.h>
7#include <Wt/WContainerWidget.h>
20 icon1Clicked(nullptr),
23 auto impl = std::make_unique<WContainerWidget>();
25 icon1_ =
impl_->addWidget(std::make_unique<WImage>(icon1URI));
26 icon2_ =
impl_->addWidget(std::make_unique<WImage>(icon2URI));
30 setImplementation(std::move(impl));
46 decorationStyle().setCursor(Cursor::PointingHand);
63 return (
icon1_->isHidden() ? 1 : 0);
WImage * icon2_
Second icon.
int state() const
Get the current state.
EventSignal< WMouseEvent > * icon2Clicked
Signal emitted when clicked while in state 1 (icon 2 is shown).
void undoShowIcon2()
Undo function for prelearning showIcon2()
void setState(int num)
Set which icon should be visible.
WImage * icon1_
First icon.
void showIcon2()
Set state to 1 (show icon 2).
void undoShowIcon1()
Undo function for prelearning showIcon1()
IconPair(const std::string icon1URI, const std::string icon2URI, bool clickIsSwitch=true)
Construct a two-state icon widget.
EventSignal< WMouseEvent > * icon1Clicked
Signal emitted when clicked while in state 0 (icon 1 is shown).
int previousState_
Undo state for prelearning stateless showIcon1() and showIcon2() slots.
void showIcon1()
Set state to 0 (show icon 1).