Wt  4.11.1
Loading...
Searching...
No Matches
Wt::WCssTheme Class Reference

#include <Wt/WCssTheme.h>

Inheritance diagram for Wt::WCssTheme:
[legend]

Public Member Functions

 WCssTheme (const std::string &name)
 Constructor.
virtual std::string name () const override
 Returns a theme name.
virtual std::vector< WLinkedCssStyleSheetstyleSheets () const override
 Returns the stylesheets.
virtual void apply (WWidget *widget, WWidget *child, int widgetRole) const override
 Applies the theme to a child of a composite widget.
virtual void apply (WWidget *widget, DomElement &element, int elementRole) const override
 Applies the theme to a DOM element that renders a widget.
virtual std::string disabledClass () const override
 Returns a generic CSS class name for a disabled element.
virtual std::string activeClass () const override
 Returns a generic CSS class name for an active element.
virtual std::string utilityCssClass (int utilityCssClassRole) const override
 Returns a generic CSS class name for the chosen role.
virtual bool canStyleAnchorAsButton () const override
 Returns whether the theme allows for an anchor to be styled as a button.
virtual void applyValidationStyle (WWidget *widget, const Wt::WValidator::Result &validation, WFlags< ValidationStyleFlag > styles) const override
 Applies a style that indicates the result of validation.
Public Member Functions inherited from Wt::WTheme
 WTheme ()
 Constructor.
virtual ~WTheme ()
 Destructor.
virtual std::string resourcesUrl () const
 Returns the URL where theme-related resources are stored.
virtual void serveCss (WStringStream &out) const
 Serves the CSS for the theme.
virtual void init (WApplication *app) const
 Called when the theme is assigned to a WApplication.
virtual Side panelCollapseIconSide () const
 Returns which side the WPanel collapse icon should be added on.
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< 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.
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.
Protected Member Functions inherited from Wt::WObject
virtual WStatelessSlot * getStateless (Method method)
 On-demand stateless slot implementation.

Detailed Description

CSS-based theme support. This implements the classic Wt themes, which were available before theme support was customized with the addition of the WTheme class.

The following table shows which style classes are applied by this theme.

WAbstractItemView *.Wt-itemview
.Wt-itemview .Wt-headerdivthe header container
.Wt-itemview .Wt-headerthe header
.Wt-itemview .Wt-header .Wt-labela header label
.Wt-itemview .Wt-header .Wt-labela header label
.Wt-itemview .Wt-tv-rhresize handle
.Wt-itemview .Wt-tv-shsort handle
.Wt-itemview .Wt-tv-sh-nonesort handle, unsorted
.Wt-itemview .Wt-tv-sh-downsort handle, descending sort
.Wt-itemview .Wt-tv-sh-upsort handle, ascending sort
.Wt-itemview .Wt-selectedselected item (or row)
.Wt-itemview .Wt-spacerspacer (briefly visible during scrolling)
WAbstractSpinBox.Wt-spinbox(for the HTML4 implementation)
WCalendar *.Wt-cal
.Wt-cal table.d1the table (single letter days)
.Wt-cal table.d3the table (three letter days)
.Wt-cal table.dlongthe table (ful day names)
.Wt-cal th.captiona caption cell (containing month/year navigation)
.Wt-cal thweek day header cell
.Wt-cal tdday cell
.Wt-cal-oomout-of-month day
.Wt-cal-oomout-of-range day (ray < bottom or day > top)
.Wt-cal-selselected day
.Wt-cal-nowtoday
WDateEdit.Wt-dateedit
.Wt-datepickerthe popup
WDatePicker.Wt-datepickerthe popup
WDialog.Wt-dialogthe dialog
.Wt-dialog .closeiconthe close icon in the titlebar
.Wt-dialog .titlebarthe titlebar
.Wt-dialog .bodythe dialog body
.Wt-dialog .footerthe dialog footer
WMenuItem.iteman unselected item
.itemselecteda selected item
.item.Wt-closablea closable item
.item.Wt-separatora separator item
.item.Wt-sectheadera section header item
.item .Wt-iconthe item's icon
.item .Wt-chkboxthe item's checkbox
.item .closeiconthe item's close icon
WMessageBox.Wt-dialogsee supra (WDialog)
WPanel.Wt-panel
.Wt-panel .titlebarthe titlebar
.Wt-panel .bodythe body
WPopupMenu.Wt-popupmenuthe popup menu; for the items, see supra (WMenuItem)
WPopupWidget.Wt-outset
WProgressBar.Wt-progressbar
.Wt-progressbar .Wt-pgb-barthe bar
.Wt-progressbar .Wt-pgb-labelthe value label
WPushButton.Wt-btn
WSlider *.Wt-slider-h or .Wt-slider-vfor horizontal or vertical slider
.Wt-slider-[hv] .Wt-slider-bgbackground element
.Wt-slider-[hv] .fillfill to the current value
.Wt-slider-[hv] .handlethe slider handle
.Wt-slider-[hv] .Wt-wan additional element for styling
.Wt-slider-[hv] .Wt-ean additional element for styling
WSuggestionPopup.Wt-suggest
.Wt-suggest lian item
.Wt-suggest .activean active item
WTabWidget.Wt-tabsthe header, which is a WMenu
WTableView *.Wt-tableviewsee supra (WAbstractItemView)
.Wt-tableview .Wt-contentsthe contents area
.Wt-tableview .Wt-contents .Wt-tv-ca contents cell
WTreeNode *.Wt-treea tree node
.Wt-tree.Wt-trunka trunk node
.Wt-tree.Wt-endan end node (last node within parent)
.Wt-tree ulchildren list
.Wt-tree .Wt-ctrlcollapse/expand control
.Wt-tree .Wt-ctrl.expandexpand control
.Wt-tree .Wt-ctrl.collapsecollapse control
.Wt-tree .Wt-ctrl.noexpandan item that cannot be expanded
.Wt-tree .Wt-selecteda selected node
.Wt-tree .Wt-labelthe label
WTreeView *.Wt-treeviewsee supra (WAbstractItemView)
.Wt-treeview ula node
.Wt-treeview ul.Wt-tv-rootthe root node
.Wt-treeview .Wt-tv-rowa row of additional cells
.Wt-treeview .Wt-trunka trunk node
.Wt-treeview .Wt-endan end node (last node within parent)
.Wt-treeview .Wt-ctrlcollapse/expand control
.Wt-treeview .Wt-ctrl.expandexpand control
.Wt-treeview .Wt-ctrl.collapsecollapse control
.Wt-treeview .Wt-ctrl.noexpandan item that cannot be expanded

* CSS selectors for these widgets are currently still hard-coded in the widget itself.

See also
WApplication::setTheme()

Constructor & Destructor Documentation

◆ WCssTheme()

Wt::WCssTheme::WCssTheme ( const std::string & name)

Constructor.

Creates a classic Wt theme. Wt comes with two CSS themes: "polished" and default. For the bootstrap theme, use WBootstrapTheme.

Member Function Documentation

◆ activeClass()

std::string Wt::WCssTheme::activeClass ( ) const
overridevirtual

Returns a generic CSS class name for an active element.

The CSS class Wt-selected is applied to active classes.

Implements Wt::WTheme.

◆ apply() [1/2]

void Wt::WCssTheme::apply ( WWidget * widget,
DomElement & element,
int elementRole ) const
overridevirtual

Applies the theme to a DOM element that renders a widget.

The element is a rendered representation of the widget, and may be further customized to reflect the theme.

Implements Wt::WTheme.

◆ apply() [2/2]

void Wt::WCssTheme::apply ( WWidget * widget,
WWidget * child,
int widgetRole ) const
overridevirtual

Applies the theme to a child of a composite widget.

The widgetRole indicates the role that child has within the implementation of the widget.

Implements Wt::WTheme.

◆ canStyleAnchorAsButton()

bool Wt::WCssTheme::canStyleAnchorAsButton ( ) const
overridevirtual

Returns whether the theme allows for an anchor to be styled as a button.

Returns false.

Implements Wt::WTheme.

◆ disabledClass()

std::string Wt::WCssTheme::disabledClass ( ) const
overridevirtual

Returns a generic CSS class name for a disabled element.

The CSS class Wt-disabled is applied to disabled classes.

Implements Wt::WTheme.

◆ name()

std::string Wt::WCssTheme::name ( ) const
overridevirtual

Returns a theme name.

Returns a unique name for the theme. This name is used by the default implementation of resourcesUrl() to compute a location for the theme's resources.

Implements Wt::WTheme.

◆ styleSheets()

std::vector< WLinkedCssStyleSheet > Wt::WCssTheme::styleSheets ( ) const
overridevirtual

Returns the stylesheets.

Returns wt.css, plus on IE wt_ie.css, plus on IE6 wt_ie6.css. The style sheets are located in the theme directory in the resources folder.

Implements Wt::WTheme.

◆ utilityCssClass()

std::string Wt::WCssTheme::utilityCssClass ( int utilityCssClassRole) const
overridevirtual

Returns a generic CSS class name for the chosen role.

See also
WTheme::utilityCssClassRole

Implements Wt::WTheme.