Wt::WCssTemplateRule Class Reference
[Style classes]

A CSS rule based on a template widget. More...

#include <Wt/WCssStyleSheet>

Inherits Wt::WCssRule.

List of all members.

Public Member Functions

 WCssTemplateRule (const std::string &selector)
 Creates a CSS rule with a given selector.
WWidgettemplateWidget ()
 Returns the widget that is used as a template.
const std::string declarations ()
 Returns the declarations.

Detailed Description

A CSS rule based on a template widget.

This is a CSS rule whose CSS style properties are defined based on properties of a template widget. When modifying the template widget, these changes are reflected on the CSS rule and thus all widgets that have this CSS rule.

Usage example:

 Wt::WCssTemplateRule *styleRule = new Wt::WCssTemplateRule("#" + id() + " .item");
 Wt::WApplication::instance()->styleSheet().addRule(styleRule);

 styleRule->templateWidget()->resize(100, WLength::Auto);
 styleRule->templateWidget()->decorationStyle().setCursor(PointingHandCursor);
See also:
Wt::WCssStyleSheet

Constructor & Destructor Documentation

Wt::WCssTemplateRule::WCssTemplateRule ( const std::string &  selector  ) 

Creates a CSS rule with a given selector.

The selector should be a valid CSS selector.

Note:
If you want to update the rule, then the selector should be unique and not contain commas, since this is not supported by Microsoft Internet Explorer.

Member Function Documentation

const std::string Wt::WCssTemplateRule::declarations (  )  [virtual]

Returns the declarations.

This is a semi-colon separated list of CSS declarations.

Implements Wt::WCssRule.

WWidget * Wt::WCssTemplateRule::templateWidget (  ) 

Returns the widget that is used as a template.

Various properties of the widget are reflected in the CSS style:

When modifying one of these properties of the returned widget, the rule will be updated accordingly.


Generated on Thu May 13 05:16:16 2010 for Wt by doxygen 1.6.3