power_play/src/pp/pp_vis/pp_vis_widgets.h
2025-12-08 11:39:27 -06:00

94 lines
2.0 KiB
C

////////////////////////////////////////////////////////////
//~ Theme types
Struct(V_WidgetTheme)
{
GC_FontKey font;
f32 font_size;
f32 window_title_font_size;
Vec4 window_background_color;
Vec4 window_border_color;
Vec4 divider_color;
f32 window_border;
f32 window_padding;
f32 window_width;
f32 text_padding_x;
f32 text_padding_y;
};
////////////////////////////////////////////////////////////
//~ Hotkey types
#define V_HOTKEY(_button, ...) { .button = _button, __VA_ARGS__ }
Struct(V_Hotkey)
{
Button button;
b32 ctrl;
b32 alt;
b32 shift;
};
////////////////////////////////////////////////////////////
//~ Commands widget types
Struct(V_CommandsWidgetItemReport)
{
b32 pressed;
b32 hotkey_changed;
UI_Report ui_report;
V_Hotkey new_hotkeys[8];
};
Struct(V_CommandsWidgetItemDesc)
{
String display_name;
V_Hotkey hotkeys[8];
};
Struct(V_CommandsWidgetItem)
{
V_CommandsWidgetItem *next;
UI_Key key;
V_CommandsWidgetItemDesc desc;
};
Struct(V_CommandsWidget)
{
/* Persistent state */
Vec2 pos;
/* Per-build state */
struct
{
UI_Checkpoint cp;
V_CommandsWidgetItem *first_item;
V_CommandsWidgetItem *last_item;
u64 num_items;
} build;
};
////////////////////////////////////////////////////////////
//~ Theme helpers
V_WidgetTheme V_GetWidgetThemeStyles(void);
void V_PushWidgetTheme(V_WidgetTheme theme);
////////////////////////////////////////////////////////////
//~ Hotkey helpers
String V_StringFromHotkey(Arena *arena, V_Hotkey hotkey);
////////////////////////////////////////////////////////////
//~ Commands widget
void V_BeginCommandsWidget(V_CommandsWidget *widget);
V_CommandsWidgetItemReport V_PushCommandsWidgetItem(V_CommandsWidget *widget, V_CommandsWidgetItemDesc desc);
void V_EndCommandsWidget(V_CommandsWidget *widget);
////////////////////////////////////////////////////////////
//~ Console widget
UI_Key V_BuildConsoleWidget(b32 minimized);