power_play/src/proto/pp_widgets.h
2025-11-08 21:27:32 -06:00

94 lines
2.0 KiB
C

////////////////////////////////////////////////////////////
//~ Theme types
Struct(PP_WidgetTheme)
{
ResourceKey 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 PP_HOTKEY(_button, ...) { .button = _button, __VA_ARGS__ }
Struct(PP_Hotkey)
{
Button button;
b32 ctrl;
b32 alt;
b32 shift;
};
////////////////////////////////////////////////////////////
//~ Commands widget types
Struct(PP_CommandsWidgetItemReport)
{
b32 pressed;
b32 hotkey_changed;
UI_Report ui_report;
PP_Hotkey new_hotkeys[8];
};
Struct(PP_CommandsWidgetItemDesc)
{
String display_name;
PP_Hotkey hotkeys[8];
};
Struct(PP_CommandsWidgetItem)
{
PP_CommandsWidgetItem *next;
UI_Key key;
PP_CommandsWidgetItemDesc desc;
};
Struct(PP_CommandsWidget)
{
/* Persistent state */
Vec2 pos;
/* Per-build state */
struct
{
UI_Checkpoint cp;
PP_CommandsWidgetItem *first_item;
PP_CommandsWidgetItem *last_item;
u64 num_items;
} build;
};
////////////////////////////////////////////////////////////
//~ Theme helpers
PP_WidgetTheme PP_GetWidgetThemeStyles(void);
void PP_PushWidgetTheme(PP_WidgetTheme theme);
////////////////////////////////////////////////////////////
//~ Hotkey helpers
String PP_StringFromHotkey(Arena *arena, PP_Hotkey hotkey);
////////////////////////////////////////////////////////////
//~ Commands widget
void PP_BeginCommandsWidget(PP_CommandsWidget *widget);
PP_CommandsWidgetItemReport PP_PushCommandsWidgetItem(PP_CommandsWidget *widget, PP_CommandsWidgetItemDesc desc);
void PP_EndCommandsWidget(PP_CommandsWidget *widget);
////////////////////////////////////////////////////////////
//~ Console widget
UI_Key PP_BuildConsoleWidget(b32 minimized);