guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
guillaume::components::SurfaceTone Class Reference

State of a tonal surface: how high it sits above the background, and whether it casts a shadow. More...

#include <headers/guillaume/components/surface_tone.hpp>

Inheritance diagram for guillaume::components::SurfaceTone:
Collaboration diagram for guillaume::components::SurfaceTone:

Public Member Functions

 SurfaceTone (void)=default
 Create the state of a level 1 surface with a shadow.
 ~SurfaceTone (void)=default
 Default destructor.
theme::ElevationLevel getElevation (void) const noexcept
 Get how high the surface sits above the background.
SurfaceTone & setElevation (theme::ElevationLevel elevation)
 Set how high the surface sits above the background.
bool hasShadow (void) const noexcept
 Tell whether the surface casts a shadow.
SurfaceTone & setShadow (bool shadow)
 Turn the shadow of the surface on or off.
Public Member Functions inherited from guillaume::ecs::Component
bool hasChanged (void) const
 Tell whether a value of the component changed since the flags were last reset (the end of the previous frame).
void setHasChanged (bool hasChanged)
 Raise or lower the changed flag.
 Component (void)=default
 Create a component that is not marked as changed.
virtual ~Component (void)=default
 Virtual destructor, so components can be destroyed through the base class.

Detailed Description

State of a tonal surface: how high it sits above the background, and whether it casts a shadow.

The entities::Surface widget writes it. systems::SurfaceTone reads it every frame in the Measure phase and overwrites two other components of the entity: Color (the theme's surface color tinted for the level) and Elevation (the shadow, level 0 when the shadow is off). So on an entity with this component, set the level here, not on Color or Elevation.

See also
systems::SurfaceTone, components::Elevation, entities::Surface

Definition at line 43 of file surface_tone.hpp.

Member Function Documentation

◆ getElevation()

theme::ElevationLevel guillaume::components::SurfaceTone::getElevation ( void ) const
noexcept

Get how high the surface sits above the background.

Returns
The elevation level, Level1 by default.

Definition at line 26 of file surface_tone.cpp.

◆ hasShadow()

bool guillaume::components::SurfaceTone::hasShadow ( void ) const
noexcept

Tell whether the surface casts a shadow.

Returns
True when it does, which is the default.

Definition at line 40 of file surface_tone.cpp.

Here is the caller graph for this function:

◆ setElevation()

SurfaceTone & guillaume::components::SurfaceTone::setElevation ( theme::ElevationLevel elevation)

Set how high the surface sits above the background.

A higher level gives a stronger tint and, with the shadow on, a larger shadow. Marks the component changed only when the level differs.

Parameters
elevationThe new elevation level.
Returns
This component, for chaining.

Definition at line 31 of file surface_tone.cpp.

Here is the call graph for this function:

◆ setShadow()

SurfaceTone & guillaume::components::SurfaceTone::setShadow ( bool shadow)

Turn the shadow of the surface on or off.

Without a shadow the surface keeps the tint of its level. Marks the component changed only when the flag differs.

Parameters
shadowTrue to cast a shadow.
Returns
This component, for chaining.

Definition at line 45 of file surface_tone.cpp.

Here is the call graph for this function:

The documentation for this class was generated from the following files: