#include <WText>
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 WString & | text () 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. |
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.
WApplication::messageResourceBundle()
WApplication::characterEncoding()
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 | |||
) |
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.