Wt examples  3.3.6
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...
 
WInteractWidget * item ()
 Returns the clickable part. More...
 
virtual void setHidden (bool hidden, const WAnimation &animation=WAnimation())
 

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

WText * option_
 The option command text. More...
 
WText * sep_
 The separator '|'. More...
 
OptionListlist_
 The list in which this option is managed, if managed. More...
 

Friends

class OptionList
 

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::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:57
WText * option_
The option command text.
Definition: Option.h:51
WText * sep_
The separator &#39;|&#39;.
Definition: Option.h:54

Member Function Documentation

§ addSeparator()

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 &#39;|&#39;.
Definition: Option.h:54

§ hideSeparator()

void Option::hideSeparator ( )
private

Hide the separator.

Definition at line 39 of file Option.C.

40 {
41  sep_->hide();
42 }
WText * sep_
The separator &#39;|&#39;.
Definition: Option.h:54

§ item()

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:51

§ setHidden()

void Option::setHidden ( bool  hidden,
const WAnimation &  animation = WAnimation() 
)
virtual

Definition at line 49 of file Option.C.

50 {
51  WContainerWidget::setHidden(hidden, animation);
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:57
void optionVisibilityChanged(Option *opt, bool hidden)
An option changed visibility: possibly update the separators inbetween.
Definition: OptionList.C:38

§ setOptionList()

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:57

§ setText()

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:51

§ showSeparator()

void Option::showSeparator ( )
private

Show the separator.

Definition at line 44 of file Option.C.

45 {
46  sep_->show();
47 }
WText * sep_
The separator &#39;|&#39;.
Definition: Option.h:54

Friends And Related Function Documentation

§ OptionList

friend class OptionList
friend

Definition at line 59 of file Option.h.

Member Data Documentation

§ list_

OptionList* Option::list_
private

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

Definition at line 57 of file Option.h.

§ option_

WText* Option::option_
private

The option command text.

Definition at line 51 of file Option.h.

§ sep_

WText* Option::sep_
private

The separator '|'.

Definition at line 54 of file Option.h.


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

Generated on Thu Jan 12 2017 for the C++ Web Toolkit (Wt) by doxygen 1.8.12