Wt examples  3.2.1
Public Member Functions | Private Member Functions | Private Attributes | Friends
OptionList Class Reference

A list of options, separated by '|'. More...

#include <OptionList.h>

Inheritance diagram for OptionList:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 OptionList (WContainerWidget *parent=0)
 Create an OptionList.
void add (Option *option)
 Add an Option to the list.
void update ()
 Updates the stateless implementations after an Option has been hidden or shown.
- Public Member Functions inherited from Wt::WContainerWidget
 WContainerWidget (WContainerWidget *parent=0)
 ~WContainerWidget ()
void setLayout (WLayout *layout)
void setLayout (WLayout *layout, WFlags< AlignmentFlag > alignment)
WLayoutlayout ()
virtual void addWidget (WWidget *widget)
virtual void insertBefore (WWidget *widget, WWidget *before)
virtual void insertWidget (int index, WWidget *widget)
virtual void removeWidget (WWidget *widget)
virtual void clear ()
virtual int indexOf (WWidget *widget) const
virtual WWidgetwidget (int index) const
virtual int count () const
void setContentAlignment (WFlags< AlignmentFlag > contentAlignment)
void setPadding (const WLength &padding, WFlags< Side > sides=All)
WLength padding (Side side) const
WFlags< AlignmentFlagcontentAlignment () const
void setOverflow (Overflow overflow, WFlags< Orientation > orientation=(Horizontal|Vertical))
void setList (bool list, bool ordered=false)
bool isList () const
bool isUnorderedList () const
bool isOrderedList () const
EventSignal< WScrollEvent > & scrolled ()
 WInteractWidget (WContainerWidget *parent=0)
EventSignal< WKeyEvent > & keyWentDown ()
EventSignal< WKeyEvent > & keyPressed ()
EventSignal< WKeyEvent > & keyWentUp ()
EventSignalenterPressed ()
EventSignalescapePressed ()
EventSignal< WMouseEvent > & clicked ()
EventSignal< WMouseEvent > & doubleClicked ()
EventSignal< WMouseEvent > & mouseWentDown ()
EventSignal< WMouseEvent > & mouseWentUp ()
EventSignal< WMouseEvent > & mouseWentOut ()
EventSignal< WMouseEvent > & mouseWentOver ()
EventSignal< WMouseEvent > & mouseMoved ()
EventSignal< WMouseEvent > & mouseDragged ()
EventSignal< WMouseEvent > & mouseWheel ()
EventSignal< WTouchEvent > & touchStarted ()
EventSignal< WTouchEvent > & touchEnded ()
EventSignal< WTouchEvent > & touchMoved ()
EventSignal< WGestureEvent > & gestureStarted ()
EventSignal< WGestureEvent > & gestureChanged ()
EventSignal< WGestureEvent > & gestureEnded ()
void setDraggable (const std::string &mimeType, WWidget *dragWidget=0, bool isDragWidgetOnly=false, WObject *sourceWidget=0)
virtual void load ()
virtual bool isEnabled () const
 WWebWidget (WContainerWidget *parent=0)
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 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())
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 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 &javascript)
virtual const std::string id () const
void setLoadLaterWhenInvisible (bool)
const std::vector< WWidget * > & children () const
SignalchildrenChanged ()
bool isRendered () const
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)
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)

Private Member Functions

void optionVisibilityChanged (Option *opt, bool hidden)
 An option changed visibility: possibly update the separators inbetween.

Private Attributes

std::vector< Option * > options_
 The list of options.
OptionoptionNeedReset_
 The option that needs its stateless code updated.

Friends

class Option

Additional Inherited Members

- Public Types inherited from Wt::WContainerWidget
enum  Overflow
- Public Attributes inherited from Wt::WContainerWidget
 OverflowVisible
 OverflowAuto
 OverflowHidden
 OverflowScroll
- Protected Member Functions inherited from Wt::WContainerWidget
virtual void propagateSetEnabled (bool enabled)
virtual void enableAjax ()
virtual void removeChild (WObject *child)
void setLayoutSizeAware (bool sizeAware)
virtual void layoutSizeChanged (int width, int height)
 WWidget (WContainerWidget *parent=0)
virtual void dropEvent (WDropEvent dropEvent)
virtual int boxPadding (Orientation orientation) const
virtual int boxBorder (Orientation orientation) const
virtual WStatelessSlot * getStateless (Method method)

Detailed Description

A list of options, separated by '|'.

This widget is part of the Wt composer example.

An OptionList displays a list of Option widgets, which are separated by a '|' separator.

For example, Foo | Bar | Huu

When Options are hidden, the separators are adjusted so that there is no separator after the last visible option. However, this requires a call of update() each time an option is hidden or shown. This is because the removing of separators is optimized in stateless implementations, and thus in client-side JavaScript code. Since the behaviour is not entirely stateless, the update() method resets stateless implementations if necessary.

See also:
OptionList

Definition at line 40 of file OptionList.h.


Constructor & Destructor Documentation

OptionList::OptionList ( WContainerWidget parent = 0)

Create an OptionList.

Definition at line 11 of file OptionList.C.

: WContainerWidget(parent),
{
resize(WLength::Auto, WLength(2.5, WLength::FontEx));
}

Member Function Documentation

void OptionList::add ( Option option)

Add an Option to the list.

Definition at line 18 of file OptionList.C.

{
addWidget(option);
option->setOptionList(this);
if (!options_.empty()) {
options_.back()->addSeparator();
}
options_.push_back(option);
}
void OptionList::optionVisibilityChanged ( Option opt,
bool  hidden 
)
private

An option changed visibility: possibly update the separators inbetween.

Definition at line 38 of file OptionList.C.

{
/*
* Check if it was the last visible option, in that case the second last
* visible option loses its separator.
*/
for (std::size_t i = options_.size() - 1; i > 0; --i) {
if (options_[i] == opt) {
for (int j = i - 1; j >= 0; --j) {
if (!options_[j]->isHidden()) {
if (hidden)
options_[j]->hideSeparator();
else
options_[j]->showSeparator();
break;
}
}
break;
} else
if (!options_[i]->isHidden())
break;
}
/*
* The Option to the right needs to relearn its stateless
* slot code for hide() and show().
*/
for (unsigned i = 0; i < options_.size(); ++i) {
if (options_[i] == opt) {
for (unsigned j = i + 1; j < options_.size(); ++j) {
if (!options_[j]->isHidden()) {
break;
}
}
break;
}
}
}
void OptionList::update ( )

Updates the stateless implementations after an Option has been hidden or shown.

Definition at line 30 of file OptionList.C.


Friends And Related Function Documentation

friend class Option
friend

Definition at line 66 of file OptionList.h.


Member Data Documentation

Option* OptionList::optionNeedReset_
private

The option that needs its stateless code updated.

Definition at line 61 of file OptionList.h.

std::vector<Option *> OptionList::options_
private

The list of options.

Definition at line 58 of file OptionList.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