Wt::WPaintedWidget Class Reference

A widget that is painted using vector graphics. More...

#include <WPaintedWidget>

Inheritance diagram for Wt::WPaintedWidget:

Inheritance graph
[legend]

List of all members.

Public Types

enum  Method { InlineSvgVml, HtmlCanvas }
 Enumeration that indicates a rendering method. More...

Public Member Functions

 WPaintedWidget (WContainerWidget *parent=0)
 Create a new painted widget.
 ~WPaintedWidget ()
 Destructor.
void setPreferredMethod (Method method)
 Set the preferred rendering method.
Method preferredMethod () const
 Get the preferred rendering method.
void update ()
 Let the widget repaint itself.
virtual void resize (WLength width, WLength height)
 Resize the widget.

Protected Member Functions

virtual void paintEvent (WPaintDevice *paintDevice)=0
 Paint the widget.


Detailed Description

A widget that is painted using vector graphics.

Depending on the browser, different rendering methods are used:

BrowserMethods Default method
Firefox 1.5+HtmlCanvas, InlineSVG HtmlCanvas
Internet Explorer 6.0+InlineVML InlineVML
SafariHtmlCanvas, InlineSVG HtmlCanvas
OperaInlineSVG, HtmlCanvas* InlineSVG
other?HtmlCanvas
* HtmlCanvas occasional suffers rendering artefacts in Opera.

If no JavaScript is available, the JavaScript-based HtmlCanvas will not be used, and InlineSVG will be used instead. The method used may be changed by using setPreferredMethod().

InlineSVG requires that the document is rendered as XHTML. This must be enabled in the configuration file using the <send-xhtml-mime-type> option. By default, this option is off.

To use a WPaintedWidget, you must derive from it and reimplement paintEvent(WPaintDevice *paintDevice). To paint on a WPaintDevice, you will need to use a WPainter. Repainting is triggered by calling the update() method.

A WPaintedWidget requires that its size is specified in pixel units using resize().


Member Enumeration Documentation

enum Wt::WPaintedWidget::Method

Enumeration that indicates a rendering method.

Enumerator:
InlineSvgVml  SVG (Most browsers) or VML (Internet Explorer) embedded in the page.
HtmlCanvas  The WHATWG HTML 5 canvas element.

Reimplemented from Wt::WObject.


Member Function Documentation

void Wt::WPaintedWidget::setPreferredMethod ( Method  method  ) 

Set the preferred rendering method.

When method is supported by the browser, then it is chosen for rendering.

Method Wt::WPaintedWidget::preferredMethod (  )  const [inline]

Get the preferred rendering method.

See also:
setPreferredMethod(Method)

void Wt::WPaintedWidget::update (  ) 

Let the widget repaint itself.

Repainting is not immediate, but happens after when the event loop is exited.

void Wt::WPaintedWidget::resize ( WLength  width,
WLength  height 
) [virtual]

Resize the widget.

Specify a new size for this widget, by specifying width and height. By default a widget has automatic width and height, see WLength::isAuto().

See also:
width(), height()

Reimplemented from Wt::WWebWidget.

virtual void Wt::WPaintedWidget::paintEvent ( WPaintDevice paintDevice  )  [protected, pure virtual]

Paint the widget.

You should reimplement this method to paint the contents of the widget, using the given paintDevice.


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