libepaper 2.0.0
A C++23 library for controlling Waveshare e-paper displays on Raspberry Pi, featuring transparent sleep/wake management and a fluent builder API.
Loading...
Searching...
No Matches
Public Member Functions | List of all members
epaper::TextBuilder Class Reference

#include <builders.hpp>

Public Member Functions

 TextBuilder () noexcept
 Default constructor creates a builder with empty text.
 
 TextBuilder (std::string_view txt) noexcept
 Construct a text builder with string content.
 
auto text (std::string_view txt) noexcept -> TextBuilder &
 Set the text content.
 
auto number (std::int32_t num) noexcept -> TextBuilder &
 Set the content to an integer number.
 
auto decimal (double dec, std::uint8_t places) noexcept -> TextBuilder &
 Set the content to a decimal number.
 
auto at (Point pt) noexcept -> TextBuilder &
 Set the text position.
 
auto at (std::size_t x, std::size_t y) noexcept -> TextBuilder &
 Set the text position using coordinates.
 
auto font (const Font *f) noexcept -> TextBuilder &
 Set the font.
 
auto foreground (Color c) noexcept -> TextBuilder &
 Set the foreground (text) color.
 
auto background (Color c) noexcept -> TextBuilder &
 Set the background color.
 
auto with_style (const TextStyleSpec &text_style) noexcept -> TextBuilder &
 Apply a reusable text style.
 
auto build () const -> TextCommand
 Build the final TextCommand.
 

Constructor & Destructor Documentation

◆ TextBuilder() [1/2]

epaper::TextBuilder::TextBuilder ( )
inlinenoexcept

Default constructor creates a builder with empty text.

Examples
/mnt/nas/libepaper/include/epaper/draw/builders.hpp.

◆ TextBuilder() [2/2]

epaper::TextBuilder::TextBuilder ( std::string_view  txt)
inlineexplicitnoexcept

Construct a text builder with string content.

Parameters
txtText content

Member Function Documentation

◆ at() [1/2]

auto epaper::TextBuilder::at ( Point  pt) -> TextBuilder &
inlinenoexcept

Set the text position.

Parameters
ptPosition point
Returns
Reference to this builder for chaining
Examples
/mnt/nas/libepaper/include/epaper/draw/builders.hpp.

◆ at() [2/2]

auto epaper::TextBuilder::at ( std::size_t  x,
std::size_t  y 
) -> TextBuilder &
inlinenoexcept

Set the text position using coordinates.

Parameters
xX coordinate
yY coordinate
Returns
Reference to this builder for chaining

◆ background()

auto epaper::TextBuilder::background ( Color  c) -> TextBuilder &
inlinenoexcept

Set the background color.

Parameters
cBackground color
Returns
Reference to this builder for chaining
Examples
/mnt/nas/libepaper/include/epaper/draw/builders.hpp.

◆ build()

auto epaper::TextBuilder::build ( ) const -> TextCommand
inline

Build the final TextCommand.

Returns
TextCommand ready to be passed to Display::draw()
Examples
/mnt/nas/libepaper/include/epaper/draw/builders.hpp.

◆ decimal()

auto epaper::TextBuilder::decimal ( double  dec,
std::uint8_t  places 
) -> TextBuilder &
inlinenoexcept

Set the content to a decimal number.

Parameters
decDecimal value
placesNumber of decimal places
Returns
Reference to this builder for chaining
Examples
/mnt/nas/libepaper/include/epaper/draw/builders.hpp.

◆ font()

auto epaper::TextBuilder::font ( const Font f) -> TextBuilder &
inlinenoexcept

Set the font.

Parameters
fFont to use
Returns
Reference to this builder for chaining
Examples
/mnt/nas/libepaper/include/epaper/draw/builders.hpp.

◆ foreground()

auto epaper::TextBuilder::foreground ( Color  c) -> TextBuilder &
inlinenoexcept

Set the foreground (text) color.

Parameters
cForeground color
Returns
Reference to this builder for chaining
Examples
/mnt/nas/libepaper/include/epaper/draw/builders.hpp.

◆ number()

auto epaper::TextBuilder::number ( std::int32_t  num) -> TextBuilder &
inlinenoexcept

Set the content to an integer number.

Parameters
numInteger value
Returns
Reference to this builder for chaining
Examples
/mnt/nas/libepaper/include/epaper/draw/builders.hpp.

◆ text()

auto epaper::TextBuilder::text ( std::string_view  txt) -> TextBuilder &
inlinenoexcept

Set the text content.

Parameters
txtText string
Returns
Reference to this builder for chaining
Examples
/mnt/nas/libepaper/include/epaper/draw/builders.hpp.

◆ with_style()

auto epaper::TextBuilder::with_style ( const TextStyleSpec text_style) -> TextBuilder &
inlinenoexcept

Apply a reusable text style.

Parameters
text_styleStyle specification to apply
Returns
Reference to this builder for chaining
Examples
/mnt/nas/libepaper/include/epaper/draw/builders.hpp.

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