fix & improve platform popups

This commit is contained in:
2026-03-05 17:43:19 -05:00
parent cb7ecbd3f7
commit a0875fd1ff
12 changed files with 189 additions and 17 deletions

View File

@@ -54,8 +54,9 @@ struct PlatformInput {
struct PlatformWindow;
enum PlatformWindowStyle {
PLATFORM_WINDOW_STYLE_NORMAL = 0,
PLATFORM_WINDOW_STYLE_POPUP = 1, // utility panel, owned by parent
PLATFORM_WINDOW_STYLE_NORMAL = 0,
PLATFORM_WINDOW_STYLE_POPUP = 1, // utility panel, owned by parent, fixed size
PLATFORM_WINDOW_STYLE_POPUP_RESIZABLE = 2, // utility panel, owned by parent, resizable
};
struct PlatformWindowDesc {
@@ -64,6 +65,7 @@ struct PlatformWindowDesc {
S32 height = 720;
PlatformWindowStyle style = PLATFORM_WINDOW_STYLE_NORMAL;
PlatformWindow *parent = nullptr;
B32 independent = 0; // if true, don't attach as child (independent top-level window)
};
enum PlatformMsgBoxType {
@@ -104,6 +106,9 @@ PlatformInput platform_get_input(PlatformWindow *window);
// Returns true if the window's close button was clicked (for popup windows).
B32 platform_window_should_close(PlatformWindow *window);
// Bring a window to front and give it keyboard focus.
void platform_focus_window(PlatformWindow *window);
// Blocks until user responds. Returns 0=first button, 1=second button, -1=dismissed.
S32 platform_message_box(PlatformWindow *parent, const char *title,
const char *message, PlatformMsgBoxType type);