Wt::WTextEdit Class Reference

A rich-text XHTML editor. More...

#include <Wt/WTextEdit>

Inheritance diagram for Wt::WTextEdit:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 WTextEdit (WContainerWidget *parent=0)
 Create a new text editor.
 WTextEdit (const WString &text, WContainerWidget *parent=0)
 Create a new text editor and initialize with given text.
 ~WTextEdit ()
 Destructor.
virtual void setText (const WString &text)
 Set the content.
void setStyleSheet (const std::string &uri)
 Set the stylesheet for displaying the content.
const std::string & styleSheet () const
 Returns the content stylesheet.
void setExtraPlugins (const std::string &plugins)
 Load additional TinyMCE plugins.
const std::string & extraPlugins () const
 Returns the extra plugins.
void setToolBar (int i, const std::string &config)
 Configure a tool bar.
const std::string & toolBar (int i)
 Returns a tool bar configuration.


Detailed Description

A rich-text XHTML editor.

The editor provides interactive editing of XHTML text. By default it provides basic mark-up (font, formatting, color, links, and lists), but additional buttons may be added to the tool bars that add additional formatting options.

The implementation is based on TinyMCE. The widget may be configured and tailored using the setExtraPlugins() and setToolBar() methods that provide direct access to the underlying TinyMCE component.

To use this widget, you need to download TinyMCE (version 3.0.7 or later) and deploy the tinymce/jscripts/tiny_mce folder to tinyMCEURL. The default value for tinyMCEURL is resourcesURL"/tiny_mce", where resourcesURL is the configuration property that locates the Wt resources/ folder (i.e., we assume by default that you copy the tiny_mce folder to the resources/ folder).

The value may be overridden with a URL that points to the directory where the tiny_mce folder is located, by configuring the tinyMCEURL property in your Wt configuration file.

WTextEdit-1.png

Default configuration of a WTextEdit


Constructor & Destructor Documentation

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

Create a new text editor and initialize with given text.

The text should be valid XHTML.


Member Function Documentation

void Wt::WTextEdit::setText ( const WString text  )  [virtual]

Set the content.

The text should be valid XHTML.

The default value is "".

Reimplemented from Wt::WTextArea.

void Wt::WTextEdit::setStyleSheet ( const std::string &  uri  ) 

Set the stylesheet for displaying the content.

The content is rendered using the rules defined in this stylesheet. The stylesheet is also used to derive additional styles that are available in the text editor, for example in the "styleselect" button.

Multiple stylesheets may be specified as a comma separated list.

const std::string& Wt::WTextEdit::styleSheet (  )  const [inline]

Returns the content stylesheet.

See also:
setStyleSheet()

void Wt::WTextEdit::setExtraPlugins ( const std::string &  plugins  ) 

Load additional TinyMCE plugins.

Wt loads by default only the plugin 'safari' (which adds support for the Safari web browser). Use this method to load additional plugins. Multiple plugins may be specified as a comma separated list.

The various plugins are described in the TinyMCE documentation.

Note:
Plugins can only be loaded before the initial display of the widget.

const std::string& Wt::WTextEdit::extraPlugins (  )  const [inline]

Returns the extra plugins.

See also:
setExtraPlugins()

void Wt::WTextEdit::setToolBar ( int  i,
const std::string &  config 
)

Configure a tool bar.

This configures the buttons for the i'th tool bar (with 0 <= i <= 3).

The syntax and available buttons is documented in the TinyMCE documentation.

The default config for the first tool bar (i = 0) is: "fontselect, |, bold, italic, underline, |, fontsizeselect, |, forecolor, backcolor, |, justifyleft, justifycenter, justifyright, justifyfull, |, anchor, |, numlist, bullist".

By default, the other three tool bars are disabled (config = "").

Note that some buttons are only available after loading extra plugins using setExtraPlugins().

Note:
The tool bar configuration can only be set before the initial display of the widget.

const std::string& Wt::WTextEdit::toolBar ( int  i  )  [inline]

Returns a tool bar configuration.

See also:
setToolBar()


Generated on Fri Jul 25 17:56:38 2008 for Wt by doxygen 1.5.3