Class evab::PaddingH¶
template <class T>
Decorator that adds horizontal padding (left and right) to any element. More...
#include <evabPadding.h>
Inherits the following classes: T
Public Functions¶
| Type | Name |
|---|---|
| PaddingH (Args &&... args) Constructor forwarding all arguments to the base element. |
Protected Functions¶
| Type | Name |
|---|---|
| void | drawer (Screen * aScreen, Coor aPos, Coor aSize, unsigned char aIsFocused) override Draws the element with horizontal padding. |
Detailed Description¶
This class wraps an element and adds empty space at the left and right, effectively centering the content horizontally within the available area.
The padding is applied as follows: * Left: 1 tile cleared * Content: drawn in the middle columns * Right: 1 tile cleared
Template parameters:
TBase element type to decorate
Note:
The element must be at least 3 tiles wide to have visible content. If the width is less than 3, the content may be clipped.
See also: PaddingV For vertical padding (top and bottom)
// Add horizontal padding to an InputInt
PaddingH<InputInt> paddedInput(42);
// Use with Labeled decorator
PaddingH<LabeledLeft<InputInt>> paddedLabel("Value", 42);
// Combine vertical and horizontal padding (center element)
PaddingV<PaddingH<InputInt>> centeredInput(42);
Public Functions Documentation¶
function PaddingH¶
Constructor forwarding all arguments to the base element.
template<typename... Args>
inline evab::PaddingH::PaddingH (
Args &&... args
)
Template parameters:
ArgsTypes of the constructor arguments
Parameters:
argsArguments forwarded to the base element constructor
Protected Functions Documentation¶
function drawer¶
Draws the element with horizontal padding.
inline void evab::PaddingH::drawer (
Screen * aScreen,
Coor aPos,
Coor aSize,
unsigned char aIsFocused
) override
Clears one tile at the left and right, then draws the base element in the remaining horizontal space.
Parameters:
aScreenScreen to draw onaPosPosition on screenaSizeSize of the elementaIsFocusedFocus state (1 = focused, 0 = not focused)
The documentation for this class was generated from the following file src/evabPadding.h