Add container style, remove some debug messages

This commit is contained in:
2025-07-19 09:26:23 +02:00
parent 320dabc5b1
commit 03df7fb82b
4 changed files with 12 additions and 5 deletions
+2 -1
View File
@@ -50,6 +50,7 @@ uiman_init ()
Widget *debug_menu = Widget_flowbox_new (TRUE);
debug_menu->layout_padding = 8;
debug_menu->layout_spacing = 8;
debug_menu->style = WSTYLE (STYLE_CONTAINER);
Widget_add_child_flowbox (debug_menu, Widget_label_make_float ("Frame time: %.2f", &delta_time, TEXT_ALIGN_LEFT), 1, 20);
Widget_add_child_flowbox (debug_menu, Widget_label_make_int ("Chunks: %d", &n_frame_chunks, TEXT_ALIGN_LEFT), 1./2., 20);
@@ -60,7 +61,7 @@ uiman_init ()
Widget_add_child_flowbox (debug_menu, Widget_label_make_float ("Z: %.1f", &camera_position[2], TEXT_ALIGN_RIGHT), 1./3., 20);
Widget *spinner = Widget_composite_spinner_make_int ("Render distance: %d", &render_distance);
spinner->tooltip = g_string_new ("A tooltip");
spinner->tooltip = g_string_new ("Right click to show a context menu");
Widget_add_child_flowbox (debug_menu, spinner, 1, 20);
Widget_add_child_flowbox (debug_menu, Widget_composite_checkbox_make ("Wireframe", "wireframe_enabled"), 1./2., 20);
-2
View File
@@ -45,8 +45,6 @@ Widget_composite_spinner_make_int (const char *fmt, int *ptr)
Widget *
Widget_composite_checkbox_make (const char *label, char *flag)
{
UNUSED (flag);
Widget *cont = Widget_container_new (TRUE);
Widget *box = Widget_plain_new ();
-2
View File
@@ -239,8 +239,6 @@ Widget_layout_flowbox (Widget *self)
int logical_main = self->position[main_axis];
int logical_cross = self->position[cross_axis];
g_debug ("Flowbox being layouted!");
Widget *child;
WIDGET_FOREACH_CHILD (self, i, child)
{
+10
View File
@@ -40,6 +40,7 @@ typedef enum WidgetStyleId
STYLE_TOOLTIP,
STYLE_ICON_BUTTON,
STYLE_WINDOW,
STYLE_CONTAINER,
NSTYLES
} WidgetStyleId;
@@ -103,6 +104,15 @@ static const WidgetStyle widget_styles[NSTYLES] = {
.border_width = 3,
},
[STYLE_CONTAINER] = {
.background_color = { 0.3, 0.3, 0.3, 1.0 },
.background_color_hovered = { 0.3, 0.3, 0.3, 1.0 },
.background_color_clicked = { 0.3, 0.3, 0.3, 1.0 },
/* .border_color = { 0.5, 0.5, 0.5, 1.0 }, */
/* .border_width = 2, */
},
};
#define WSTYLE(id) (&widget_styles[id])