Wt examples  3.2.1
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
IconPair Class Reference

An icon pair (identical to WIconPair) More...

#include <IconPair.h>

Inheritance diagram for IconPair:
Inheritance graph
[legend]

List of all members.

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.
void setState (int num)
 Set which icon should be visible.
int state () const
 Get the current state.
Wt::WImageicon1 () const
 Get the first icon image.
Wt::WImageicon2 () const
 Get the second icon image.
void showIcon1 ()
 Set state to 0 (show icon 1).
void showIcon2 ()
 Set state to 1 (show icon 2).
- Public Member Functions inherited from Wt::WCompositeWidget
 WCompositeWidget (WContainerWidget *parent=0)
 WCompositeWidget (WWidget *implementation, WContainerWidget *parent)
virtual const std::string id () const
virtual void setPositionScheme (PositionScheme scheme)
virtual PositionScheme positionScheme () const
virtual void setOffsets (const WLength &offset, WFlags< Side > sides=All)
virtual WLength offset (Side s) const
virtual void resize (const WLength &width, const WLength &height)
virtual WLength width () const
virtual WLength height () const
virtual void setMinimumSize (const WLength &width, const WLength &height)
virtual WLength minimumWidth () const
virtual WLength minimumHeight () const
virtual void setMaximumSize (const WLength &width, const WLength &height)
virtual WLength maximumWidth () const
virtual WLength maximumHeight () const
virtual void setLineHeight (const WLength &height)
virtual WLength lineHeight () const
virtual void setFloatSide (Side s)
virtual Side floatSide () const
virtual void setClearSides (WFlags< Side > sides)
virtual WFlags< SideclearSides () const
virtual void setMargin (const WLength &margin, WFlags< Side > sides=All)
virtual WLength margin (Side side) const
virtual void setHiddenKeepsGeometry (bool enabled)
virtual bool hiddenKeepsGeometry () const
virtual void setHidden (bool hidden, const WAnimation &animation=WAnimation())
virtual bool isHidden () const
virtual bool isVisible () const
virtual void setDisabled (bool disabled)
virtual bool isDisabled () const
virtual bool isEnabled () const
virtual void setPopup (bool popup)
virtual bool isPopup () const
virtual void setInline (bool isInline)
virtual bool isInline () const
virtual void setDecorationStyle (const WCssDecorationStyle &style)
virtual WCssDecorationStyledecorationStyle ()
virtual void setStyleClass (const WString &styleClass)
virtual WString styleClass () const
virtual void addStyleClass (const WString &styleClass, bool force=false)
virtual void removeStyleClass (const WString &styleClass, bool force=false)
virtual void setVerticalAlignment (AlignmentFlag alignment, const WLength &length=WLength::Auto)
virtual AlignmentFlag verticalAlignment () const
virtual WLength verticalAlignmentLength () const
virtual void setToolTip (const WString &text, TextFormat textFormat=PlainText)
virtual WString toolTip () const
virtual void refresh ()
virtual void setAttributeValue (const std::string &name, const WString &value)
virtual WString attributeValue (const std::string &name) const
virtual void setJavaScriptMember (const std::string &name, const std::string &value)
virtual std::string javaScriptMember (const std::string &name) const
virtual void callJavaScriptMember (const std::string &name, const std::string &args)
virtual void load ()
virtual bool loaded () const
virtual void setTabIndex (int index)
virtual int tabIndex () const
virtual void setId (const std::string &id)
virtual WWidgetfind (const std::string &name)
virtual void setSelectable (bool selectable)
virtual void doJavaScript (const std::string &js)
virtual void propagateSetEnabled (bool enabled)
virtual ~WWidget ()
WWidgetparent () const
void setWidth (const WLength &width)
void setHeight (const WLength &height)
virtual void positionAt (const WWidget *widget, Orientation orientation=Vertical)
std::string jsRef () const
virtual void acceptDrops (const std::string &mimeType, const WString &hoverStyleClass=WString())
virtual void stopAcceptDrops (const std::string &mimeType)
virtual void htmlText (std::ostream &out)
bool isRendered () const
void hide ()
void animateHide (const WAnimation &animation)
void show ()
void animateShow (const WAnimation &animation)
void enable ()
void disable ()
bool layoutSizeAware () const
 WObject (WObject *parent=0)
virtual ~WObject ()
void setObjectName (const std::string &name)
virtual std::string objectName () const
void resetLearnedSlots ()
void resetLearnedSlot (void(T::*method)())
WStatelessSlot * implementStateless (void(T::*method)())
WStatelessSlot * implementStateless (void(T::*method)(), void(T::*undoMethod)())
WStatelessSlot * implementJavaScript (void(T::*method)(), const std::string &jsCode)
void addChild (WObject *child)
virtual void removeChild (WObject *child)
const std::vector< WObject * > & children () const

Public Attributes

Wt::EventSignal
< Wt::WMouseEvent > & 
icon1Clicked
 Signal emitted when clicked while in state 0 (icon 1 is shown).
Wt::EventSignal
< Wt::WMouseEvent > & 
icon2Clicked
 Signal emitted when clicked while in state 1 (icon 2 is shown).

Private Member Functions

void undoShowIcon1 ()
 Undo function for prelearning showIcon1()
void undoShowIcon2 ()
 Undo function for prelearning showIcon2()

Private Attributes

Wt::WContainerWidgetimpl_
Wt::WImageicon1_
 First icon.
Wt::WImageicon2_
 Second icon.
int previousState_
 Undo state for prelearning stateless showIcon1() and showIcon2() slots.

Additional Inherited Members

- Static Public Member Functions inherited from Wt::WCompositeWidget
static WString tr (const char *key)
- Protected Member Functions inherited from Wt::WCompositeWidget
virtual void enableAjax ()
void setImplementation (WWidget *widget)
WWidgetimplementation ()
virtual int boxPadding (Orientation orientation) const
virtual int boxBorder (Orientation orientation) const
void setLayoutSizeAware (bool sizeAware)
virtual void layoutSizeChanged (int width, int height)
 WWidget (WContainerWidget *parent=0)
virtual void dropEvent (WDropEvent dropEvent)
virtual WStatelessSlot * getStateless (Method method)

Detailed Description

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.

See also:
TreeNode

Definition at line 34 of file IconPair.h.


Constructor & Destructor Documentation

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.


Member Function Documentation

Wt::WImage* IconPair::icon1 ( ) const
inline

Get the first icon image.

Definition at line 61 of file IconPair.h.

{ return icon1_; }
Wt::WImage* IconPair::icon2 ( ) const
inline

Get the second icon image.

Definition at line 65 of file IconPair.h.

{ return icon2_; }
void IconPair::setState ( int  num)

Set which icon should be visible.

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

See also:
state()

Definition at line 41 of file IconPair.C.

{
if (num == 0) {
} else {
}
}
void IconPair::showIcon1 ( )

Set state to 0 (show icon 1).

Definition at line 57 of file IconPair.C.

{
previousState_ = (icon1_->isHidden() ? 1 : 0);
}
void IconPair::showIcon2 ( )

Set state to 1 (show icon 2).

Definition at line 63 of file IconPair.C.

{
previousState_ = (icon1_->isHidden() ? 1 : 0);
}
int IconPair::state ( ) const

Get the current state.

See also:
setState()

Definition at line 52 of file IconPair.C.

{
return (icon1_->isHidden() ? 1 : 0);
}
void IconPair::undoShowIcon1 ( )
private

Undo function for prelearning showIcon1()

Definition at line 69 of file IconPair.C.

void IconPair::undoShowIcon2 ( )
private

Undo function for prelearning showIcon2()

Definition at line 74 of file IconPair.C.


Member Data Documentation

Wt::WImage* IconPair::icon1_
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.

Wt::WImage* IconPair::icon2_
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.

Wt::WContainerWidget* IconPair::impl_
private

Definition at line 76 of file IconPair.h.

int IconPair::previousState_
private

Undo state for prelearning stateless showIcon1() and showIcon2() slots.

Definition at line 97 of file IconPair.h.


The documentation for this class was generated from the following files:

Generated on Mon Jun 18 2012 for the C++ Web Toolkit (Wt) by doxygen 1.8.1