ASW Lib
A.D.S. Games SDL Wrapper Library. A library targeted at Allegro4 users who want to switch to SDL3 and use modern c++.
Loading...
Searching...
No Matches
asw::ui::Label Class Reference

A text display widget. More...

#include <label.h>

Inheritance diagram for asw::ui::Label:
[legend]
Collaboration diagram for asw::ui::Label:
[legend]

Public Member Functions

 Label ()
 Default constructor.
 
void draw (Context &ctx) override
 Draw the label.
 
- Public Member Functions inherited from asw::ui::Widget
 Widget ()
 Default constructor for Widget.
 
virtual ~Widget ()=default
 Default virtual destructor.
 
 Widget (Widget &&)=default
 Move constructor.
 
Widgetoperator= (Widget &&)=default
 Move assignment operator.
 
 Widget (const Widget &)=delete
 
Widgetoperator= (const Widget &)=delete
 
WidgetId id () const
 Get the unique identifier for this widget.
 
virtual void layout (Context &ctx)
 Lay out this widget and its children.
 
virtual bool on_event (Context &ctx, const UIEvent &e)
 Handle a UI event.
 
virtual void on_focus_changed (Context &ctx, bool focused)
 Called when focus state changes.
 
template<class T , class... Args>
T & add_child (Args &&... args)
 Add a child widget.
 

Public Attributes

asw::Font font
 The font to use for rendering.
 
std::string text
 The text to display.
 
asw::TextJustify justify = asw::TextJustify::Left
 The text justification.
 
asw::Color color
 The text color.
 
- Public Attributes inherited from asw::ui::Widget
bool visible = true
 Whether the widget is visible.
 
bool enabled = true
 Whether the widget is enabled.
 
bool focusable = false
 Whether the widget can receive focus.
 
Widgetparent = nullptr
 Pointer to the parent widget.
 
std::vector< std::unique_ptr< Widget > > children
 Child widgets.
 
asw::Quad< float > transform
 The transform (position and size) of the widget.
 

Detailed Description

A text display widget.

Definition at line 22 of file label.h.

Constructor & Destructor Documentation

◆ Label()

asw::ui::Label::Label ( )
inline

Default constructor.

Definition at line 26 of file label.h.

Member Function Documentation

◆ draw()

void asw::ui::Label::draw ( Context & ctx)
overridevirtual

Draw the label.

Parameters
ctxThe UI context.

Reimplemented from asw::ui::Widget.

Definition at line 5 of file label.cpp.

Member Data Documentation

◆ color

asw::Color asw::ui::Label::color

The text color.

Definition at line 47 of file label.h.

◆ font

asw::Font asw::ui::Label::font

The font to use for rendering.

Definition at line 38 of file label.h.

◆ justify

asw::TextJustify asw::ui::Label::justify = asw::TextJustify::Left

The text justification.

Definition at line 44 of file label.h.

◆ text

std::string asw::ui::Label::text

The text to display.

Definition at line 41 of file label.h.


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