uhdk c# documentation

This commit is contained in:
Peterino2 2026-09-23 01:49:36 +00:00
parent 9fa0a88e43
commit 29d6109bdf
3 changed files with 34 additions and 4 deletions

View File

@ -4,6 +4,8 @@ A small desktop platform library written in Zig 0.16.0 with a C99 ABI.
It provides windows, input and IME, clipboard, file dialogs, drag and drop, menus,
async file operations, file watching, and OpenGL context creation. The macOS
backend uses AppKit, OpenGL, and FSEvents through a private Objective-C bridge.
File dialog filters accept suffixes without a leading dot, including compound
suffixes such as `level.json`.
Internal naming: `z_` means **Zig bridge**, identifying private bridge functions,
types, and helpers connecting the Zig runtime with native platform code. Public

View File

@ -567,7 +567,30 @@ enum {
UHDK_KEY_END,
UHDK_KEY_PAGE_UP,
UHDK_KEY_PAGE_DOWN,
UHDK_KEY_F1 = 0x110100 /* F1..F24 are contiguous. */
UHDK_KEY_F1 = 0x110100,
UHDK_KEY_F2,
UHDK_KEY_F3,
UHDK_KEY_F4,
UHDK_KEY_F5,
UHDK_KEY_F6,
UHDK_KEY_F7,
UHDK_KEY_F8,
UHDK_KEY_F9,
UHDK_KEY_F10,
UHDK_KEY_F11,
UHDK_KEY_F12,
UHDK_KEY_F13,
UHDK_KEY_F14,
UHDK_KEY_F15,
UHDK_KEY_F16,
UHDK_KEY_F17,
UHDK_KEY_F18,
UHDK_KEY_F19,
UHDK_KEY_F20,
UHDK_KEY_F21,
UHDK_KEY_F22,
UHDK_KEY_F23,
UHDK_KEY_F24
};
typedef uint32_t uhdk_pointer_button;
@ -764,7 +787,8 @@ enum {
typedef struct uhdk_file_filter {
uhdk_text label;
uhdk_text_list extensions; /* Without dots; empty means all files. */
uhdk_text_list extensions; /* No leading dot; internal dots allowed (e.g. level.json).
An empty list means all files. */
} uhdk_file_filter;
typedef struct uhdk_file_dialog_desc {

View File

@ -554,8 +554,12 @@ pub fn copyDialog(command: *Request) !void {
const extensions = try arena.alloc(c.uhdk_text, @intCast(f.extensions.len));
for (extensions, 0..) |*ext, j| {
const event = f.extensions.ptr[j];
if (!abi.validText(event, true) or
std.mem.findAny(u8, abi.textBytes(event), "/\\.") != null) return error.Invalid;
if (!abi.validText(event, true)) return error.Invalid;
const value = abi.textBytes(event);
if (value.len == 0 or value[0] == '.' or value[value.len - 1] == '.')
return error.Invalid;
if (std.mem.indexOf(u8, value, "..") != null) return error.Invalid;
if (std.mem.findAny(u8, value, "/\\") != null) return error.Invalid;
ext.* = try abi.copyText(arena, event);
}