Wt 3.1.10
Public Member Functions
Wt::WIconPair Class Reference

A widget that shows one of two icons depending on its state. More...

#include <Wt/WIconPair>

Inheritance diagram for Wt::WIconPair:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 WIconPair (const std::string &icon1URL, const std::string &icon2URL, bool clickIsSwitch=true, WContainerWidget *parent=0)
 Construct an icon pair from the two icons.
void setState (int num)
 Sets the state, which determines the visible icon.
int state () const
 Returns the current state.
WImageicon1 () const
 Returns the first icon image.
WImageicon2 () const
 Returns the second icon image.
void showIcon1 ()
 Sets the state to 0 (show icon 1).
void showIcon2 ()
 Sets the state to 1 (show icon 2).
EventSignal< WMouseEvent > & icon1Clicked ()
 Signal emitted when clicked while in state 0 (icon 1 is shown).
EventSignal< WMouseEvent > & icon2Clicked ()
 Signal emitted when clicked while in state 1 (icon 2 is shown).

Detailed Description

A widget that shows one of two icons depending on its state.

This is a utility class that simply manages two images, only one of which is shown at a single time, which reflects the current 'state'.

The widget may react to click events, by changing state.

CSS

This widget does not provide styling, and can be styled using inline or external CSS as appropriate. The image may be styled via the <img> elements.


Constructor & Destructor Documentation

Wt::WIconPair::WIconPair ( const std::string &  icon1URL,
const std::string &  icon2URL,
bool  clickIsSwitch = true,
WContainerWidget parent = 0 
)

Construct an icon pair from the two icons.

The constructor takes the URL of the two icons. When clickIsSwitch is set true, clicking on the icon will switch state.


Member Function Documentation

EventSignal< WMouseEvent > & Wt::WIconPair::icon1Clicked ( )

Signal emitted when clicked while in state 0 (icon 1 is shown).

Equivalent to:

 icon1()->clicked()
EventSignal< WMouseEvent > & Wt::WIconPair::icon2Clicked ( )

Signal emitted when clicked while in state 1 (icon 2 is shown).

Equivalent to:

 icon2()->clicked()
void Wt::WIconPair::setState ( int  num)

Sets the state, which determines the visible icon.

The first icon has number 0, and the second icon has number 1.

The default state is 0.

See also:
state()
void Wt::WIconPair::showIcon1 ( )

Sets the state to 0 (show icon 1).

See also:
setState(int)
void Wt::WIconPair::showIcon2 ( )

Sets the state to 1 (show icon 2).

See also:
setState(int)
int Wt::WIconPair::state ( ) const

Returns the current state.

See also:
setState()
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator

Generated on Sat Dec 24 2011 for the C++ Web Toolkit (Wt) by doxygen 1.7.4