Wt: Wt::WCssDecorationStyle Class Reference

Wt 4.10.4

Loading...
Searching...
No Matches
Public Member Functions | List of all members
Wt::WCssDecorationStyle Class Reference
Style classes

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

`#include <Wt/WCssDecorationStyle.h>`

Inheritance diagram for Wt::WCssDecorationStyle:
[legend]

## Public Member Functions
| WCssDecorationStyle ()
| Creates a default style.
| WCssDecorationStyle (const WCssDecorationStyle &other)
| Copy constructor.
| ~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=Cursor::Arrow)
| 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, WFlags< Orientation > repeat=Orientation::Horizontal|Orientation::Vertical, WFlags< Side > sides=None)
| Sets a background image.
std::string | backgroundImage () const
| Returns the background image URL.
WFlags< Orientation > | 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=AllSides)
| Sets the border style.
WBorder | border (Side 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.
Public Member Functions inherited from Wt::WObject
void | addChild (std::unique_ptr< WObject > child)
| Add a child WObject whose lifetime is determined by this WObject.
template<typename Child >
Child * | addChild (std::unique_ptr< Child > child)
| Add a child WObject, returning a raw pointer.
std::unique_ptr< WObject > | removeChild (WObject *child)
| Remove a child WObject, so its lifetime is no longer determined by this WObject.
template<typename Child >
std::unique_ptr< Child > | removeChild (Child *child)
| Remove a child WObject, so its lifetime is no longer determined by this WObject.
virtual const std::string | id () const
| Returns the (unique) identifier for this object.
virtual void | setObjectName (const std::string &name)
| Sets an object name.
virtual std::string | objectName () const
| Returns the object name.
void | resetLearnedSlots ()
| Resets learned stateless slot implementations.
template<class T >
void | resetLearnedSlot (void(T::*method)())
| Resets a learned stateless slot implementation.
template<class T >
WStatelessSlot * | implementStateless (void(T::*method)())
| Declares a slot to be stateless and learn client-side behaviour on first invocation.
template<class T >
WStatelessSlot * | implementStateless (void(T::*method)(), void(T::*undoMethod)())
| Declares a slot to be stateless and learn client-side behaviour in advance.
void | isNotStateless ()
| Marks the current function as not stateless.
template<class T >
WStatelessSlot * | implementJavaScript (void(T::*method)(), const std::string &jsCode)
| Provides a JavaScript implementation for a method.
Public Member Functions inherited from Wt::Core::observable
| observable () noexcept
| Default constructor.
virtual | ~observable ()
| Destructor.
template<typename... Args, typename C >
auto | bindSafe (void(C::*method)(Args...)) noexcept
| Protects a method call against object destruction.
template<typename... Args, typename C >
auto | bindSafe (void(C::*method)(Args...) const) const noexcept
| Protects a const method call against object destruction.
template<typename Function >
auto | bindSafe (const Function &function) noexcept
| Protects a function against object destruction.

## Additional Inherited Members
Public Types inherited from Wt::WObject
typedef void(WObject::*) | Method()
| Typedef for a WObject method without arguments.
Static Public Member Functions inherited from Wt::WObject
Protected Member Functions inherited from Wt::WObject
virtual WStatelessSlot * | getStateless (Method method)
| On-demand stateless slot implementation.

## 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(Cursor::PointingHand);
Wt::WCssDecorationStyle::setCursor
void setCursor(Cursor c)
Sets the cursor style.
Wt::WWidget
The abstract base class for a user-interface component.
Definition WWidget.h:66
Wt::WWidget::decorationStyle
virtual WCssDecorationStyle & decorationStyle()=0
Returns the decoration style of this widget.
Wt::Cursor::PointingHand
@ PointingHand
Pointing hand, CSS 'pointer' cursor.

## Member Function Documentation

## ◆ backgroundColor()

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

Returns the background color.

See also
  setBackgroundColor()

## ◆ backgroundImage()

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

Returns the background image URL.

See also
  setBackgroundImage()

## ◆ backgroundImageRepeat()

WFlags< Orientation > Wt::WCssDecorationStyle::backgroundImageRepeat | ( |  | ) | const

Returns the background image repeat.

See also
  setBackgroundImage()

## ◆ border()

WBorder Wt::WCssDecorationStyle::border | ( | Side | 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()

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

Returns the cursor style.

See also
  setCursor()

## ◆ cursorImage()

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

Returns the cursor image.

See also
  setCursor()

## ◆ font()

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

Returns the font.

See also
  setFont()

## ◆ foregroundColor()

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

Returns the text color.

See also
  setForegroundColor()

## ◆ setBackgroundImage()

void Wt::WCssDecorationStyle::setBackgroundImage | ( | const WLink & | link,
|  | WFlags< Orientation > | repeat = Orientation::Horizontal|Orientation::Vertical,
|  | WFlags< Side > | sides = None )

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. (Side::Right | Side::Top).

## ◆ setBorder()

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

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.

## ◆ setCursor()

void Wt::WCssDecorationStyle::setCursor | ( | std::string | cursorImage,
|  | Cursor | fallback = Cursor::Arrow )

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).

## ◆ setTextDecoration()

void Wt::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.

## ◆ textDecoration()

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

Returns the text decoration options.

See also
  setTextDecoration()