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

A container widget with a background color or image. More...

#include <panel.h>

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

Public Member Functions

 Panel ()
 Default constructor.
 
void draw (Context &ctx) override
 Draw the panel and its children.
 
- 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::Color bg { 0, 0, 0, 0 }
 The background color.
 
asw::Texture bg_image
 The background image texture.
 
- 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 container widget with a background color or image.

Definition at line 20 of file panel.h.

Constructor & Destructor Documentation

◆ Panel()

asw::ui::Panel::Panel ( )
inline

Default constructor.

Definition at line 24 of file panel.h.

Member Function Documentation

◆ draw()

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

Draw the panel and its children.

Parameters
ctxThe UI context.

Reimplemented from asw::ui::Widget.

Definition at line 5 of file panel.cpp.

Member Data Documentation

◆ bg

asw::Color asw::ui::Panel::bg { 0, 0, 0, 0 }

The background color.

Definition at line 30 of file panel.h.

◆ bg_image

asw::Texture asw::ui::Panel::bg_image

The background image texture.

Definition at line 33 of file panel.h.


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