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

@ -128,8 +128,8 @@ void pgpl_gui_widget_render_full(PGPL_GuiWidget *widget,
double max_height) {
double width, height;
if (widget->use_theme_override) {
theme = &widget->theme_override;
if (widget->theme_override) {
theme = widget->theme_override;
}
x += widget->offset_x;
@ -233,25 +233,17 @@ bool pgpl_gui_widget_within_bounds(PGPL_GuiWidget *widget, PGPL_GuiTheme *theme,
max_height);
}
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) {
widget->offset_x = offset_x;
widget->offset_y = offset_y;
widget->expand_x = expand_x;
widget->expand_y = expand_y;
widget->border = border;
widget->background = background;
widget->font_size = font_size;
if (theme_override != NULL) {
widget->theme_override = *theme_override;
}
widget->use_theme_override = use_theme_override;
widget->ignore_margin = ignore_margin;
widget->ignore_border = ignore_border;
widget->ignore_padding = ignore_padding;
void pgpl_gui_widget_default_config(PGPL_GuiWidget *widget) {
widget->offset_x = 0;
widget->offset_y = 0;
widget->expand_x = true;
widget->expand_y = true;
widget->border = false;
widget->background = false;
widget->font_size = PGPL_GUI_FONT_SIZE_CONTENT;
widget->expansion_fraction = 1;
widget->theme_override = NULL;
widget->ignore_margin = false;
widget->ignore_border = false;
widget->ignore_padding = false;
}