Wt: Wt::WCssStyleSheet Class Reference

Wt 3.3.0

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

- Class List
- Class Hierarchy
- Class Members

Public Member Functions
Wt::WCssStyleSheet Class Reference
Style classes

A CSS style sheet. More...

`#include <Wt/WCssStyleSheet>`

List of all members.

## Public Member Functions
| WCssStyleSheet ()
| Creates a new (internal) style sheet.
| WCssStyleSheet (const WLink &link, const std::string &media="all")
| Creates a new (external) style sheet reference.
| ~WCssStyleSheet ()
| Destroys a style sheet, and all rules in it.
WCssTextRule * | addRule (const std::string &selector, const WString &declarations, const std::string &ruleName=std::string())
| Adds a CSS rule.
WCssTemplateRule * | addRule (const std::string &selector, const WCssDecorationStyle &style, const std::string &ruleName=std::string())
| Adds a CSS rule.
WCssRule * | addRule (WCssRule *rule, const std::string &ruleName=std::string())
| Adds a CSS rule.
bool | isDefined (const std::string &ruleName) const
| Returns if a rule was already defined in this style sheet.
void | removeRule (WCssRule *rule)
| Removes a rule.

## Detailed Description

A CSS style sheet.

Usage example:

     Wt::WApplication::instance()->styleSheet().addRule(".MyWidget .item", "width: 100px; cursor: pointer;");

See also:
  WApplication::styleSheet()

## Member Function Documentation

WCssTextRule * Wt::WCssStyleSheet::addRule | ( | const std::string & | selector,
|  | const WString & | declarations,
|  | const std::string & | ruleName = `std::string()`
| ) |  |

Adds a CSS rule.

Add a rule using the CSS selector `selector`, with CSS declarations in `declarations`. These declarations must be a list separated by semi-colons (;).

Optionally, you may give a `ruleName`, which may later be used to check if the rule was already defined.

See also:
  isDefined()

WCssTemplateRule * Wt::WCssStyleSheet::addRule | ( | const std::string & | selector,
|  | const WCssDecorationStyle & | style,
|  | const std::string & | ruleName = `std::string()`
| ) |  |

Adds a CSS rule.

Add a rule using the CSS selector `selector`, with styles specified in `style`.

Optionally, you may give a `ruleName`, which may later be used to check if the rule was already defined.

See also:
  isDefined()

WCssRule * Wt::WCssStyleSheet::addRule | ( | WCssRule * | rule,
|  | const std::string & | ruleName = `std::string()`
| ) |  |

Adds a CSS rule.

Optionally, you may give a `ruleName`, which may later be used to check if the rule was already defined.

See also:
  isDefined()

bool Wt::WCssStyleSheet::isDefined | ( | const std::string & | ruleName | ) | const

Returns if a rule was already defined in this style sheet.

Returns whether a rule was added with the given `ruleName`.

See also:
  addRule()

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator