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::VBox Class Reference

A vertical box layout container. More...

#include <vbox.h>

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

Public Member Functions

void layout (Context &ctx) override
 Lay out children vertically.
 
- 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 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.
 
virtual void draw (Context &ctx)
 Draw this widget and its children.
 
template<class T , class... Args>
T & add_child (Args &&... args)
 Add a child widget.
 

Public Attributes

float gap = 8.0F
 Gap between child elements.
 
float padding = 10.0F
 Padding around the content.
 
- 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 vertical box layout container.

Definition at line 19 of file vbox.h.

Member Function Documentation

◆ layout()

void asw::ui::VBox::layout ( Context & ctx)
overridevirtual

Lay out children vertically.

Parameters
ctxThe UI context.

Reimplemented from asw::ui::Widget.

Definition at line 3 of file vbox.cpp.

Member Data Documentation

◆ gap

float asw::ui::VBox::gap = 8.0F

Gap between child elements.

Definition at line 22 of file vbox.h.

◆ padding

float asw::ui::VBox::padding = 10.0F

Padding around the content.

Definition at line 25 of file vbox.h.


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