Wt examples  3.3.1
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
Option Class Reference

A clickable option. More...

#include <Option.h>

Inheritance diagram for Option:
Inheritance graph
[legend]

Public Member Functions

 Option (const WString &text, WContainerWidget *parent=0)
 Create an Option with the given text. More...
 
void setText (const WString &text)
 Change the text. More...
 
WInteractWidgetitem ()
 Returns the clickable part. More...
 
virtual void setHidden (bool)
 
- Public Member Functions inherited from Wt::WWidget
virtual void setPositionScheme (PositionScheme scheme)=0
 
virtual PositionScheme positionScheme () const =0
 
virtual void setOffsets (const WLength &offset, WFlags< Side > sides=All)=0
 
virtual WLength offset (Side side) const =0
 
virtual void resize (const WLength &width, const WLength &height)
 
virtual WLength width () const =0
 
virtual WLength height () const =0
 
virtual void setMinimumSize (const WLength &width, const WLength &height)=0
 
virtual WLength minimumWidth () const =0
 
virtual WLength minimumHeight () const =0
 
virtual void setMaximumSize (const WLength &width, const WLength &height)=0
 
virtual WLength maximumWidth () const =0
 
virtual WLength maximumHeight () const =0
 
virtual void setLineHeight (const WLength &height)=0
 
virtual WLength lineHeight () const =0
 
virtual void setFloatSide (Side s)=0
 
virtual Side floatSide () const =0
 
virtual void setClearSides (WFlags< Side > sides)=0
 
virtual WFlags< SideclearSides () const =0
 
virtual void setMargin (const WLength &margin, WFlags< Side > sides=All)=0
 
virtual WLength margin (Side side) const =0
 
virtual void setHiddenKeepsGeometry (bool enabled)=0
 
virtual bool hiddenKeepsGeometry () const =0
 
virtual void setHidden (bool hidden, const WAnimation &animation=WAnimation())=0
 
virtual bool isHidden () const =0
 
virtual bool isVisible () const =0
 
virtual void setDisabled (bool disabled)=0
 
virtual bool isDisabled () const =0
 
virtual bool isEnabled () const =0
 
virtual void setPopup (bool popup)=0
 
virtual bool isPopup () const =0
 
virtual void setInline (bool inlined)=0
 
virtual bool isInline () const =0
 
virtual void setDecorationStyle (const WCssDecorationStyle &style)=0
 
virtual WCssDecorationStyledecorationStyle ()=0
 
virtual void setStyleClass (const WString &styleClass)=0
 
virtual WString styleClass () const =0
 
virtual void addStyleClass (const WString &styleClass, bool force=false)=0
 
virtual void removeStyleClass (const WString &styleClass, bool force=false)=0
 
virtual bool hasStyleClass (const WString &styleClass) const =0
 
virtual void setVerticalAlignment (AlignmentFlag alignment, const WLength &length=WLength::Auto)=0
 
virtual AlignmentFlag verticalAlignment () const =0
 
virtual WLength verticalAlignmentLength () const =0
 
virtual void setToolTip (const WString &text, TextFormat textFormat=PlainText)=0
 
virtual const WStringtoolTip () const =0
 
virtual void refresh ()
 
virtual void setAttributeValue (const std::string &name, const WString &value)=0
 
virtual WString attributeValue (const std::string &name) const =0
 
virtual void setJavaScriptMember (const std::string &name, const std::string &value)=0
 
virtual std::string javaScriptMember (const std::string &name) const =0
 
virtual void callJavaScriptMember (const std::string &name, const std::string &args)=0
 
virtual void load ()=0
 
virtual bool loaded () const =0
 
virtual void setTabIndex (int index)=0
 
virtual int tabIndex () const =0
 
virtual void setId (const std::string &id)=0
 
virtual WWidgetfind (const std::string &name)=0
 
virtual void setSelectable (bool selectable)=0
 
virtual void doJavaScript (const std::string &js)=0
 

Private Member Functions

void setOptionList (OptionList *l)
 
void addSeparator ()
 Create and show the separator. More...
 
void showSeparator ()
 Show the separator. More...
 
void hideSeparator ()
 Hide the separator. More...
 

Private Attributes

WTextoption_
 The option command text. More...
 
WTextsep_
 The separator '|'. More...
 
OptionListlist_
 The list in which this option is managed, if managed. More...
 

Friends

class OptionList
 

Additional Inherited Members

- Protected Member Functions inherited from Wt::WWidget
virtual void enableAjax ()=0
 
virtual void propagateSetEnabled (bool enabled)=0
 
virtual void render (WFlags< RenderFlag > flags)
 

Detailed Description

A clickable option.

This widget is part of the Wt composer example.

On its own, an option is a text which is style "option". An Option may also be used as items in an OptionList.

See also
OptionList

Definition at line 31 of file Option.h.

Constructor & Destructor Documentation

Option::Option ( const WString text,
WContainerWidget parent = 0 
)

Create an Option with the given text.

Definition at line 12 of file Option.C.

13  : WContainerWidget(parent),
14  sep_(0),
15  list_(0)
16 {
17  setInline(true);
18 
19  option_ = new WText(text, this);
20  option_->setStyleClass("option");
21 }
OptionList * list_
The list in which this option is managed, if managed.
Definition: Option.h:56
virtual void setInline(bool inlined)=0
WText * option_
The option command text.
Definition: Option.h:50
WText * sep_
The separator '|'.
Definition: Option.h:53
virtual void setStyleClass(const WString &styleClass)=0

Member Function Documentation

void Option::addSeparator ( )
private

Create and show the separator.

Definition at line 33 of file Option.C.

34 {
35  sep_ = new WText("|", this);
36  sep_->setStyleClass("sep");
37 }
WText * sep_
The separator '|'.
Definition: Option.h:53
virtual void setStyleClass(const WString &styleClass)=0
void Option::hideSeparator ( )
private

Hide the separator.

Definition at line 39 of file Option.C.

40 {
41  sep_->hide();
42 }
WText * sep_
The separator '|'.
Definition: Option.h:53
WInteractWidget* Option::item ( )
inline

Returns the clickable part.

Definition at line 44 of file Option.h.

44 { return option_; }
WText * option_
The option command text.
Definition: Option.h:50
void Option::setHidden ( bool  hidden)
virtual

Definition at line 49 of file Option.C.

50 {
51  WContainerWidget::setHidden(hidden);
52 
53  if (list_)
54  list_->optionVisibilityChanged(this, hidden);
55 }
OptionList * list_
The list in which this option is managed, if managed.
Definition: Option.h:56
void optionVisibilityChanged(Option *opt, bool hidden)
An option changed visibility: possibly update the separators inbetween.
Definition: OptionList.C:38
void Option::setOptionList ( OptionList l)
private

Definition at line 28 of file Option.C.

29 {
30  list_ = l;
31 }
OptionList * list_
The list in which this option is managed, if managed.
Definition: Option.h:56
void Option::setText ( const WString text)

Change the text.

Definition at line 23 of file Option.C.

24 {
25  option_->setText(text);
26 }
WText * option_
The option command text.
Definition: Option.h:50
void Option::showSeparator ( )
private

Show the separator.

Definition at line 44 of file Option.C.

45 {
46  sep_->show();
47 }
WText * sep_
The separator '|'.
Definition: Option.h:53

Friends And Related Function Documentation

friend class OptionList
friend

Definition at line 58 of file Option.h.

Member Data Documentation

OptionList* Option::list_
private

The list in which this option is managed, if managed.

Definition at line 56 of file Option.h.

WText* Option::option_
private

The option command text.

Definition at line 50 of file Option.h.

WText* Option::sep_
private

The separator '|'.

Definition at line 53 of file Option.h.


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

Generated on Wed Jun 11 2014 for the C++ Web Toolkit (Wt) by doxygen 1.8.7