setting to prefer os native file dialog uis (off by default because they are slow and bad)

This commit is contained in:
Ryan Fleury
2025-05-20 15:59:49 -07:00
parent 2d5bf9efc2
commit 25dda717ad
8 changed files with 61 additions and 1 deletions
+6
View File
@@ -680,6 +680,12 @@ os_graphical_message(B32 error, String8 title, String8 message)
fprintf(stderr, "%.*s\n\n", str8_varg(message));
}
internal String8
os_graphical_pick_file(Arena *arena, String8 initial_path)
{
return str8_zero();
}
////////////////////////////////
//~ rjf: @os_hooks Shell Operations
+1
View File
@@ -191,6 +191,7 @@ internal void os_set_cursor(OS_Cursor cursor);
//~ rjf: @os_hooks Native User-Facing Graphical Messages (Implemented Per-OS)
internal void os_graphical_message(B32 error, String8 title, String8 message);
internal String8 os_graphical_pick_file(Arena *arena, String8 initial_path);
////////////////////////////////
//~ rjf: @os_hooks Shell Operations
+6
View File
@@ -242,6 +242,12 @@ os_graphical_message(B32 error, String8 title, String8 message)
{
}
internal String8
os_graphical_pick_file(Arena *arena, String8 initial_path)
{
return str8_zero();
}
////////////////////////////////
//~ rjf: @os_hooks Shell Operations
+23
View File
@@ -1577,6 +1577,29 @@ os_graphical_message(B32 error, String8 title, String8 message)
scratch_end(scratch);
}
internal String8
os_graphical_pick_file(Arena *arena, String8 initial_path)
{
String8 result = {0};
{
Temp scratch = scratch_begin(&arena, 1);
U64 buffer_size = 4096;
U16 *buffer = push_array(scratch.arena, U16, buffer_size);
OPENFILENAMEW params = {sizeof(params)};
{
params.lpstrFile = (WCHAR *)buffer;
params.nMaxFile = buffer_size;
params.lpstrInitialDir = (WCHAR *)str16_from_8(scratch.arena, initial_path).str;
}
if(GetOpenFileNameW(&params))
{
result = str8_from_16(arena, str16_cstring((U16 *)buffer));
}
scratch_end(scratch);
}
return result;
}
////////////////////////////////
//~ rjf: @os_hooks Shell Operations
+1
View File
@@ -15,6 +15,7 @@
#pragma comment(lib, "UxTheme")
#pragma comment(lib, "ole32")
#pragma comment(lib, "user32")
#pragma comment(lib, "comdlg32")
#ifndef WM_NCUAHDRAWCAPTION
#define WM_NCUAHDRAWCAPTION (0x00AE)
#endif