Wt::WText Class Reference

A widget that renders (XHMTL) text. More...

#include <WText>

Inheritance diagram for Wt::WText:

Inheritance graph
[legend]

List of all members.

Public Types

enum  Formatting { XHTMLFormatting, XHTMLUnsafeFormatting, PlainFormatting }
 Formatting for the text. More...

Public Member Functions

 WText (WContainerWidget *parent=0)
 Construct a WText widget with empty text.
 WText (const WString &text, WContainerWidget *parent=0)
 Construct a WText widget with a given text.
 WText (bool inlined, const WString &text, WContainerWidget *parent=0)
 Construct a WText widget with a given text.
const WStringtext () const
 Get the text.
void setText (const WString &text)
 Change the text.
void setFormatting (Formatting formatting)
 Set the formatting.
Formatting formatting () const
 Get the formatting.
virtual void refresh ()
 Refresh the widget.


Detailed Description

A widget that renders (XHMTL) text.

WText is by default an inline widget.

The text is set through a WString, which may either hold a literal text, or localized text which is looked up in locale dependent XML files.

Use setFormatting() to configure the formatting of the text. The default formatting is WText::XHMTLFormatting, which allows any XHMTL formatting to be included in the text (except for script code) and this formatting is used in rendering the text. Script code is stripped away not only to enforce use of Wt's event handling, but also to avoid security risks exposed by JavaScript such as Cross-Site Scripting. The WText::PlainFormatting format will display the text literally (escaping any HTML special characters). Finally, XHTMLUnsafeFormatting will not be stripped off any potentially dangerous code. Use if it if you're sure that a user cannot interfere with the text set.

See also:
WApplication::setLocale()

WApplication::messageResourceBundle()

WApplication::characterEncoding()


Member Enumeration Documentation

enum Wt::WText::Formatting

Formatting for the text.

Enumerator:
XHTMLFormatting  Format as XHTML markup'ed text.
XHTMLUnsafeFormatting  Format as XHTML markup'ed text that does not get stripped.
PlainFormatting  Format as plain text.


Constructor & Destructor Documentation

Wt::WText::WText ( const WString text,
WContainerWidget parent = 0 
)

Construct a WText widget with a given text.

The text message is rendered using WText::XHTMLFormatting.

Wt::WText::WText ( bool  inlined,
const WString text,
WContainerWidget parent = 0 
)

Construct a WText widget with a given text.

The text message is rendered using WText::XHTMLFormatting. This is an overloaded constructor provided for convience for the frequent case where you want a non-inline WText, and equivalent to:

 WText *t = new WText(text, parent);
 t->setInline(inlined)


Member Function Documentation

void Wt::WText::refresh (  )  [virtual]

Refresh the widget.

The refresh method is invoked when the locale is changed using WApplication::setLocale() or when the user hit the refresh button.

The widget must actualize its contents in response.

Reimplemented from Wt::WWebWidget.


The documentation for this class was generated from the following files:
Generated on Mon Apr 14 15:15:01 2008 for Wt by doxygen 1.5.3