Wt: Wt::WCssDecorationStyle Class Reference

Wt 3.3.0

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

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Member Functions
Wt::WCssDecorationStyle Class Reference
Style classes

A style class for a single widget or style sheet rule. More...

`#include <Wt/WCssDecorationStyle>`

List of all members.

## Public Types
enum | Repeat { RepeatXY, RepeatX, RepeatY, NoRepeat }
| How a background image must be repeated. More...
enum | TextDecoration { Underline = 0x1, Overline = 0x2, LineThrough = 0x4, Blink = 0x8 }
| Text decoration options. More...
## Public Member Functions
| WCssDecorationStyle ()
| Creates a default style.
| ~WCssDecorationStyle ()
| Destructor.
WCssDecorationStyle & | operator= (const WCssDecorationStyle &other)
| Assignment operator.
void | setCursor (Cursor c)
| Sets the cursor style.
Cursor | cursor () const
| Returns the cursor style.
void | setCursor (std::string cursorImage, Cursor fallback=ArrowCursor)
| Sets a custom cursor image Url.
std::string | cursorImage () const
| Returns the cursor image.
void | setBackgroundColor (WColor color)
| Sets the background color.
WColor | backgroundColor () const
| Returns the background color.
void | setBackgroundImage (const WLink &link, Repeat repeat=RepeatXY, WFlags< Side > sides=0)
| Sets a background image.
std::string | backgroundImage () const
| Returns the background image URL.
Repeat | backgroundImageRepeat () const
| Returns the background image repeat.
void | setForegroundColor (WColor color)
| Sets the text color.
WColor | foregroundColor () const
| Returns the text color.
void | setBorder (WBorder border, WFlags< Side > sides=All)
| Sets the border style.
WBorder | border (Side side=Top) const
| Returns the border style.
void | setFont (const WFont &font)
| Sets the text font.
WFont & | font ()
| Returns the font.
void | setTextDecoration (WFlags< TextDecoration > decoration)
| Sets text decoration options.
WFlags< TextDecoration > | textDecoration () const
| Returns the text decoration options.

## Detailed Description

A style class for a single widget or style sheet rule.

You can manipulate the decoration style of a single widget using WWidget::decorationStyle() or you can use a WCssDecorationStyle to add a rule to the inline style sheet using WCssStyleSheet::addRule(const std::string&, const WCssDecorationStyle& style, const std::string&).

Usage example:

     Wt::WWidget *widget = ...
     widget->decorationStyle().setCursor(PointingHandCursor);

## Member Enumeration Documentation

enum Wt::WCssDecorationStyle::Repeat

How a background image must be repeated.

Enumerator:

  RepeatXY | Repeat horizontally and vertically, default.
  RepeatX | Repeat horizontally.
  RepeatY | Repeat vertically.
  NoRepeat | Do not repeat.

enum Wt::WCssDecorationStyle::TextDecoration

Text decoration options.

Enumerator:

  Underline | Underline.
  Overline | Overline.
  LineThrough | LineThrough.
  Blink | Blink.

## Member Function Documentation

WColor Wt::WCssDecorationStyle::backgroundColor | ( |  | ) | const

Returns the background color.

See also:
  setBackgroundColor()

std::string Wt::WCssDecorationStyle::backgroundImage | ( |  | ) | const

Returns the background image URL.

See also:
  setBackgroundImage()

Repeat Wt::WCssDecorationStyle::backgroundImageRepeat | ( |  | ) | const

Returns the background image repeat.

See also:
  setBackgroundImage()

WBorder WCssDecorationStyle::border | ( | Side | side = `Top` | ) | const

Returns the border style.

Returns the border style set using setBorder() for the given `side`.

See also:
  setBorder()

Note:
  Prior to version 3.1.9 it was not possible to pass a side and only one border could be configured.

Cursor Wt::WCssDecorationStyle::cursor | ( |  | ) | const

Returns the cursor style.

See also:
  setCursor()

std::string Wt::WCssDecorationStyle::cursorImage | ( |  | ) | const

Returns the cursor image.

See also:
  setCursor()

WFont& Wt::WCssDecorationStyle::font | ( |  | ) |

Returns the font.

See also:
  setFont()

WColor Wt::WCssDecorationStyle::foregroundColor | ( |  | ) | const

Returns the text color.

See also:
  setForegroundColor()

void WCssDecorationStyle::setBackgroundImage | ( | const WLink & | link,
|  | Repeat | repeat = `RepeatXY`,
|  | WFlags< Side > | sides = `0`
| ) |  |

Sets a background image.

The `link` may be a URL or a resource.

The image may be placed in a particular location by specifying sides by OR'ing Wt::Side values together, e.g. (Right | Top).

void WCssDecorationStyle::setBorder | ( | WBorder | border,
|  | WFlags< Side > | sides = `All`
| ) |  |

Sets the border style.

The given `border` will be set for the specified `sides`.

A different border style may be specified for each of the four sides.

void WCssDecorationStyle::setCursor | ( | std::string | cursorImage,
|  | Cursor | fallback = `ArrowCursor`
| ) |  |

Sets a custom cursor image Url.

The Url should point to a .cur file (this shoul be a real .cur file, renaming an .ico is not enough for Internet Explorer).

void WCssDecorationStyle::setTextDecoration | ( | WFlags< TextDecoration > | decoration | ) |

Sets text decoration options.

You may logically or together any of the options of the TextDecoration enumeration.

The default is 0.

WFlags<TextDecoration> Wt::WCssDecorationStyle::textDecoration | ( |  | ) | const

Returns the text decoration options.

See also:
  setTextDecoration()

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator