Wt examples  4.11.1
Loading...
Searching...
No Matches
Option Class Reference

A clickable option. More...

#include <Option.h>

Inheritance diagram for Option:
[legend]

Public Member Functions

 Option (const WString &text)
 Create an Option with the given text.
void setText (const WString &text)
 Change the text.
WInteractWidget * item ()
 Returns the clickable part.
virtual void setHidden (bool hidden, const WAnimation &animation=WAnimation())

Private Member Functions

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

Private Attributes

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

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)

Create an Option with the given text.

Definition at line 12 of file Option.C.

13 : WContainerWidget(),
14 sep_(0),
15 list_(0)
16{
17 setInline(true);
18
19 option_ = this->addWidget(std::make_unique<WText>(text));
20 option_->setStyleClass("option");
21}
WText * option_
The option command text.
Definition Option.h:51
WText * sep_
The separator '|'.
Definition Option.h:54
OptionList * list_
The list in which this option is managed, if managed.
Definition Option.h:57

Member Function Documentation

◆ addSeparator()

void Option::addSeparator ( )
private

Create and show the separator.

Definition at line 33 of file Option.C.

34{
35 sep_ = this->addWidget(std::make_unique<WText>("|"));
36 sep_->setStyleClass("sep");
37}

◆ hideSeparator()

void Option::hideSeparator ( )
private

Hide the separator.

Definition at line 39 of file Option.C.

40{
41 sep_->hide();
42}

◆ item()

WInteractWidget * Option::item ( )
inline

Returns the clickable part.

Definition at line 44 of file Option.h.

44{ return option_; }

◆ 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}

◆ setOptionList()

void Option::setOptionList ( OptionList * l)
private

Definition at line 28 of file Option.C.

29{
30 list_ = l;
31}

◆ setText()

void Option::setText ( const WString & text)

Change the text.

Definition at line 23 of file Option.C.

24{
25 option_->setText(text);
26}

◆ showSeparator()

void Option::showSeparator ( )
private

Show the separator.

Definition at line 44 of file Option.C.

45{
46 sep_->show();
47}

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