Files
kryon/include/ui_core_props.generated.h
T
waozi 7901590204 Declare the interface host in a props module; unify the focus symbols
include/ui_core.h is deleted. runtime/core_props.kry now carries the public
ABI: TextInputPlatformCallback and FrameState — anonymous capture arrays,
inline arrays, and all — as one-line "#type" records; ui_view_width and
ui_view_height as "#global #export" moved from src/ui/frame.kry; and the
forty-eight interface, focus, and cursor calls as "#extern #export"
declarations.

SetFocus/GetFocus become KryonSetFocus/KryonGetFocus everywhere in C: the old
header renamed only the MinGW declaration via __asm__, so the exported symbol
already differed per platform, and a plain props declaration could not carry
the label. The real names remove the collision by construction; the Go API
keeps its SetFocus spelling, which never collided. Callers across the UI
hosts, tests, and the generated-runtime-parity templates follow (the parity
script's Go section keeps SetFocus for the Go interface).

Gates: generated-runtime-parity-test (17 fixtures, C and Go), fast-test,
k2c/k2cpp/k2go-syntax-test, go-runtime-test, examples-syntax-test,
kryon-boundary-check, and the refreshed public-API snapshot pass.
2026-09-21 02:27:21 -03:00

80 lines
3.6 KiB
C

/* Generated by k2c from runtime/core_props.kry. */
#ifndef K_RUNTIME_CORE_PROPS_H
#define K_RUNTIME_CORE_PROPS_H
#include <stdint.h>
#include <stdbool.h>
#include "kry_bounds.h"
#ifndef KIR_STRING_VALUE_DEFINED
#define KIR_STRING_VALUE_DEFINED
#include <stddef.h>
#include <string.h>
/* Immutable borrowed UTF-8 bytes; length preserves embedded nulls. */
typedef struct String { const char *data; size_t length; } String;
static inline String StringView(const char *data, size_t length) {
String value = {data, length};
return value;
}
static inline bool StringEqual(String a, String b) {
return a.length == b.length && (a.length == 0 || memcmp(a.data, b.data, a.length) == 0);
}
#endif
#include "kryon_compat.generated.h"
#include "ui_input_props.generated.h"
typedef void (*TextInputPlatformCallback)(int active);
typedef struct FrameState { int view_width; int view_height; Camera2D camera; int input_clip_count; Rectangle input_clips[16]; int input_capture_count; struct { Rectangle bounds; int allow_inside; } input_captures[16]; int cursor_priority; int cursor_had_intent; int pointer_down; int pointer_dragging; int pointer_dragged_this_click; int pointer_start_x; int pointer_start_y; int pointer_owner; int release_consumed; int focus_active_id; int focus_ids[256]; int focus_count; int focus_tab_dir; int focus_frame_open; int focus_text_input_active; int text_input_requested; int text_input_show_requested; int mouse_world_override_enabled; Vector2 mouse_world_override; unsigned long frame_serial; int auto_focus_id; float ui_scale; } FrameState;
extern int32_t ui_view_width;
extern int32_t ui_view_height;
void InitInterface(int32_t width, int32_t height, float dpi);
void SetDefaultFontAutoLoad(int32_t enabled);
void ApplyCurrentTheme(void);
int32_t IsDesktopMode(void);
Camera2D GetDefaultCamera(void);
void BeginInterfaceFrame(int32_t width, int32_t height, float dpi);
void EndInterfaceFrame(void);
int32_t ResolveFocusID(int32_t id);
void SetFrameCamera(Camera2D camera);
FrameState SaveFrameState(void);
void RestoreFrameState(FrameState state);
void SetMouseWorldOverride(int32_t enabled, Vector2 position);
int32_t SetKeyboardInputEnabled(int32_t enabled);
int32_t IsKeyboardInputEnabled(void);
void ClearInputCaptures(void);
void PushInputCapture(Rectangle bounds, int32_t allow_inside);
void PopInputCapture(void);
void BeginModalLayer(void);
void PushInputClip(Rectangle bounds);
void PopInputClip(void);
void SetModalCapture(Rectangle bounds);
void SetTextInputPlatformCallback(TextInputPlatformCallback callback);
void SetCursorClickable(int32_t* cursor_clickable);
void SetCursorDisabled(int32_t* cursor_disabled);
void MarkCursor(int32_t cursor);
void MarkClickable(void);
void MarkDisabled(void);
int32_t GetMouseCursorIntent(void);
void SetInterfaceIcons(Texture2D gear_icon, Texture2D x_icon);
int32_t HandleClick(Rectangle bounds, int32_t disabled, int32_t* hover);
Activation ReadActivation(Rectangle bounds, int32_t id, bool enabled);
int32_t HandleCircleClick(Vector2 center, float radius, int32_t disabled, int32_t* hover);
int32_t InputCapturesClick(Vector2 point);
int32_t ReleaseConsumed(void);
void ConsumeRelease(void);
int32_t HoverEffectsEnabled(void);
void SetTransitionCuesEnabled(int32_t enabled);
int32_t TransitionCuesEnabled(void);
int32_t FocusFrameOpen(void);
int32_t RegisterFocus(int32_t id, Rectangle bounds);
int32_t IsFocusActive(int32_t id);
int32_t IsFocusActivatePressed(int32_t id);
void KryonSetFocus(int32_t id);
int32_t KryonGetFocus(void);
void ClearFocus(void);
void SetFocusTextInputActive(int32_t active);
int32_t TextInputActive(void);
#endif /* K_RUNTIME_CORE_PROPS_H */