Wt  4.10.4
Public Member Functions | List of all members
Wt::WCssTextRule Class Reference

A CSS rule specified directly using CSS declarations. More...

#include <Wt/WCssStyleSheet.h>

Inheritance diagram for Wt::WCssTextRule:
[legend]

Public Member Functions

 WCssTextRule (const std::string &selector, const WString &declarations)
 Creates a CSS rule with a given selector and declarations.
 
virtual std::string declarations () override
 Returns the declarations. More...
 
- Public Member Functions inherited from Wt::WCssRule
virtual ~WCssRule ()
 Destructor.
 
void setSelector (const std::string &selector)
 Sets the selector. More...
 
virtual std::string selector () const
 Returns the selector.
 
WCssStyleSheetsheet () const
 Returns the style sheet to which this rule belongs.
 
void modified ()
 Indicates that the rule has changed and needs updating.
 
- 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. More...
 
std::unique_ptr< WObjectremoveChild (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. More...
 
virtual const std::string id () const
 Returns the (unique) identifier for this object. More...
 
virtual void setObjectName (const std::string &name)
 Sets an object name. More...
 
virtual std::string objectName () const
 Returns the object name. More...
 
void resetLearnedSlots ()
 Resets learned stateless slot implementations. More...
 
template<class T >
void resetLearnedSlot (void(T::*method)())
 Resets a learned stateless slot implementation. More...
 
template<class T >
WStatelessSlot * implementStateless (void(T::*method)())
 Declares a slot to be stateless and learn client-side behaviour on first invocation. More...
 
template<class T >
WStatelessSlot * implementStateless (void(T::*method)(), void(T::*undoMethod)())
 Declares a slot to be stateless and learn client-side behaviour in advance. More...
 
void isNotStateless ()
 Marks the current function as not stateless. More...
 
template<class T >
WStatelessSlot * implementJavaScript (void(T::*method)(), const std::string &jsCode)
 Provides a JavaScript implementation for a method. More...
 
- Public Member Functions inherited from Wt::Core::observable
 observable () noexcept
 Default constructor.
 
virtual ~observable ()
 Destructor. More...
 
template<typename... Args, typename C >
auto bindSafe (void(C::*method)(Args...)) noexcept
 Protects a method call against object destruction. More...
 
template<typename... Args, typename C >
auto bindSafe (void(C::*method)(Args...) const) const noexcept
 Protects a const method call against object destruction. More...
 
template<typename Function >
auto bindSafe (const Function &function) noexcept
 Protects a function against object destruction. More...
 

Additional Inherited Members

- Public Types inherited from Wt::WObject
typedef void(WObject::* Method) ()
 Typedef for a WObject method without arguments.
 
- Protected Member Functions inherited from Wt::WCssRule
 WCssRule (const std::string &selector)
 Creates a new CSS rule with given selector.
 
- Protected Member Functions inherited from Wt::WObject
virtual WStatelessSlot * getStateless (Method method)
 On-demand stateless slot implementation. More...
 

Detailed Description

A CSS rule specified directly using CSS declarations.

Usage example:

auto styleRule = std::make_unique<Wt::WCssTextRule>(".MyWidget .item", "width: 100px; cursor: pointer;");
Wt::WApplication::instance()->styleSheet().addRule(std::move(styleRule));
static WApplication * instance()
Returns the current application instance.
Definition: WApplication.C:1337
WCssStyleSheet & styleSheet()
Returns a reference to the inline style sheet.
Definition: WApplication.h:318
WCssTextRule * addRule(const std::string &selector, const WString &declarations, const std::string &ruleName=std::string())
Adds a CSS rule.
Definition: WCssStyleSheet.C:202
See also
WCssStyleSheet

Member Function Documentation

◆ declarations()

std::string Wt::WCssTextRule::declarations ( )
overridevirtual

Returns the declarations.

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

Implements Wt::WCssRule.