Wt: Wt::WCssTemplateRule Class Reference

Wt 3.3.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Hierarchy
- Class Members

Public Member Functions
Wt::WCssTemplateRule Class Reference
Style classes

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

`#include <Wt/WCssStyleSheet>`

Inheritance diagram for Wt::WCssTemplateRule:
[legend]

List of all members.

## Public Member Functions
| WCssTemplateRule (const std::string &selector, WObject *parent=0)
| Creates a CSS rule with a given selector.
WWidget * | templateWidget ()
| 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,
|  | WObject * | parent = `0`
| ) |  |

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:

- size and dimensions: WWidget::resize(), WWidget::setMinimumSize(), and WWidget::setMaximumSize()
- its position: WWidget::setPositionScheme(), WWidget::setOffsets(), WWidget::setFloatSide(), WWidget::setClearSides()
- visibility: WWidget::hide(), WWidget::show() and WWidget::setHidden()
- margins: WWidget::setMargin()
- line height: WWidget::setLineHeight()
- all decoration style properties: WWidget::decorationStyle()

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

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator