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

Spacing constants: the 4 dp grid every margin and gap is a multiple of, and the minimum size of something a user can hit. More...

#include <headers/guillaume/theme/tokens.hpp>

Static Public Member Functions

static constexpr float get (unsigned int steps)
 Get a spacing as a number of grid units.
static constexpr float touchMargin (float extent)
 Get the invisible margin that makes a small control as easy to hit as MinTouchTarget.

Static Public Attributes

static constexpr float Unit = 4.0f
 Base grid unit, in dp.
static constexpr float MinTouchTarget = 48.0f
 Smallest width and height an interactive control should offer to a pointer or a finger, in dp.

Detailed Description

Spacing constants: the 4 dp grid every margin and gap is a multiple of, and the minimum size of something a user can hit.

Everything is static and the same for every theme; the class is never instantiated.

const float padding = theme::SpacingScale::get(4); // 16 dp
const float margin = theme::SpacingScale::touchMargin(40); // 4 dp
static constexpr float get(unsigned int steps)
Get a spacing as a number of grid units.
Definition tokens.hpp:441
static constexpr float touchMargin(float extent)
Get the invisible margin that makes a small control as easy to hit as MinTouchTarget.
Definition tokens.hpp:453

Definition at line 422 of file tokens.hpp.

Member Function Documentation

◆ get()

constexpr float guillaume::theme::SpacingScale::get ( unsigned int steps)
inlinestaticconstexpr

Get a spacing as a number of grid units.

Parameters
stepsThe number of 4 dp units.
Returns
The spacing, in dp (steps times 4).

Definition at line 441 of file tokens.hpp.

Here is the caller graph for this function:

◆ touchMargin()

constexpr float guillaume::theme::SpacingScale::touchMargin ( float extent)
inlinestaticconstexpr

Get the invisible margin that makes a small control as easy to hit as MinTouchTarget.

Parameters
extentThe visible width or height of the control, in dp.
Returns
The margin to add on each side along that axis, in dp; 0 when the control is already at least MinTouchTarget.

Definition at line 453 of file tokens.hpp.

Here is the caller graph for this function:

Member Data Documentation

◆ MinTouchTarget

float guillaume::theme::SpacingScale::MinTouchTarget = 48.0f
staticconstexpr

Smallest width and height an interactive control should offer to a pointer or a finger, in dp.

Definition at line 434 of file tokens.hpp.

◆ Unit

float guillaume::theme::SpacingScale::Unit = 4.0f
staticconstexpr

Base grid unit, in dp.

Definition at line 428 of file tokens.hpp.


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