Wt examples
3.3.0
|
An icon pair (identical to WIconPair) More...
#include <IconPair.h>
Public Member Functions | |
IconPair (const std::string icon1URI, const std::string icon2URI, bool clickIsSwitch=true, Wt::WContainerWidget *parent=0) | |
Construct a two-state icon widget. More... | |
void | setState (int num) |
Set which icon should be visible. More... | |
int | state () const |
Get the current state. More... | |
Wt::WImage * | icon1 () const |
Get the first icon image. More... | |
Wt::WImage * | icon2 () const |
Get the second icon image. More... | |
void | showIcon1 () |
Set state to 0 (show icon 1). More... | |
void | showIcon2 () |
Set state to 1 (show icon 2). More... | |
Public Attributes | |
Wt::EventSignal < Wt::WMouseEvent > & | icon1Clicked |
Signal emitted when clicked while in state 0 (icon 1 is shown). More... | |
Wt::EventSignal < Wt::WMouseEvent > & | icon2Clicked |
Signal emitted when clicked while in state 1 (icon 2 is shown). More... | |
Private Member Functions | |
void | undoShowIcon1 () |
Undo function for prelearning showIcon1() More... | |
void | undoShowIcon2 () |
Undo function for prelearning showIcon2() More... | |
Private Attributes | |
Wt::WContainerWidget * | impl_ |
Wt::WImage * | icon1_ |
First icon. More... | |
Wt::WImage * | icon2_ |
Second icon. More... | |
int | previousState_ |
Undo state for prelearning stateless showIcon1() and showIcon2() slots. More... | |
Additional Inherited Members | |
![]() | |
virtual void | enableAjax ()=0 |
virtual void | propagateSetEnabled (bool enabled)=0 |
virtual void | render (WFlags< RenderFlag > flags) |
An icon pair (identical to WIconPair)
This widget manages two images, only one of which is shown at a single time.
The widget may also react to click events, by changing state.
This widget is part of the Wt treelist example, where it is used to represent the expand/collapse icons, and the corresponding map open/close icon.
Definition at line 34 of file IconPair.h.
IconPair::IconPair | ( | const std::string | icon1URI, |
const std::string | icon2URI, | ||
bool | clickIsSwitch = true , |
||
Wt::WContainerWidget * | parent = 0 |
||
) |
Construct a two-state icon widget.
The constructor takes the URI of the two icons. When clickIsSwitch is set true, clicking on the icon will switch state.
Definition at line 12 of file IconPair.C.
|
inline |
|
inline |
void IconPair::setState | ( | int | num | ) |
void IconPair::showIcon1 | ( | ) |
Set state to 0 (show icon 1).
Definition at line 57 of file IconPair.C.
void IconPair::showIcon2 | ( | ) |
Set state to 1 (show icon 2).
Definition at line 63 of file IconPair.C.
int IconPair::state | ( | ) | const |
|
private |
Undo function for prelearning showIcon1()
Definition at line 69 of file IconPair.C.
|
private |
Undo function for prelearning showIcon2()
Definition at line 74 of file IconPair.C.
|
private |
First icon.
Definition at line 79 of file IconPair.h.
Wt::EventSignal<Wt::WMouseEvent>& IconPair::icon1Clicked |
Signal emitted when clicked while in state 0 (icon 1 is shown).
Definition at line 88 of file IconPair.h.
|
private |
Second icon.
Definition at line 82 of file IconPair.h.
Wt::EventSignal<Wt::WMouseEvent>& IconPair::icon2Clicked |
Signal emitted when clicked while in state 1 (icon 2 is shown).
Definition at line 93 of file IconPair.h.
|
private |
Definition at line 76 of file IconPair.h.
|
private |
Undo state for prelearning stateless showIcon1() and showIcon2() slots.
Definition at line 97 of file IconPair.h.