better layout management

This commit is contained in:
Patrick 2025-10-07 23:39:22 +02:00
commit a315d72a57
11 changed files with 86 additions and 79 deletions

View file

@ -50,15 +50,8 @@ bool pgpl_gui_widget_within_bounds(PGPL_GuiWidget *widget, PGPL_GuiTheme *theme,
double max_width, double max_height,
double x, double y);
/* This configures all of the widget properties that should be configurable by
* the user. Check the PGPL_GuiWidget struct comment for more info. */
void pgpl_gui_widget_configure(PGPL_GuiWidget *widget, double offset_x,
double offset_y, bool expand_x, bool expand_y,
bool border, bool background,
PGPL_GuiFontSize font_size,
PGPL_GuiTheme *theme_override,
bool use_theme_override, bool ignore_margin,
bool ignore_border, bool ignore_padding);
/* This initializes all of the widget properties to their default values. */
void pgpl_gui_widget_default_config(PGPL_GuiWidget *widget);
#ifdef __cplusplus
}

View file

@ -80,12 +80,13 @@ struct PGPL_GuiWidget {
PGPL_GuiFontSize font_size;
/* This picks out which color from the theme to use. */
PGPL_GuiStatusColor gui_color;
/* This is used to determine what fraction of the space should be taken up by
* this widget in a layout. */
uint32_t expansion_fraction;
/* This is the theme that should be used instead of the main theme. Note that
* this theme should propagate to any possible child widgets as well. */
PGPL_GuiTheme theme_override;
/* This determines if the override theme should even be used. If this is
* false, the theme_override is simply ignored. */
bool use_theme_override;
* this theme should propagate to any possible child widgets as well. Will not
* be used if it is NULL. */
PGPL_GuiTheme *theme_override;
/* These attributes determine whether or not margin, border and padding sizes
* respectively should be ignored when rendering. */
bool ignore_margin, ignore_border, ignore_padding;