include/kryon_node.h is deleted. runtime/node_props.kry declares KryonNodeEdit — whose PropertyValue field is the property system's union in the handwritten kryon_property.h host header — as a one-line "#type" record that imports that header, and KryonNodeKindName/KryonNodeInit as "#extern #export" declarations. The node host, kryon.h, and kryon_edit_host.h include the props header directly. Gates: generated-runtime-parity-test, fast-test, k2c/k2cpp/k2go-syntax-test, go-runtime-test, examples-syntax-test, kryon-boundary-check, and the refreshed public-API snapshot pass.
75 lines
2.2 KiB
C
75 lines
2.2 KiB
C
/* Generated by k2c from runtime/node_props.kry. */
|
|
#ifndef K_RUNTIME_NODE_PROPS_H
|
|
#define K_RUNTIME_NODE_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 "kryon_property.h"
|
|
#define KRYON_NODE_ID_MAX 96
|
|
#define KRYON_NODE_NAME_MAX 128
|
|
#define KRYON_NODE_TYPE_MAX 64
|
|
#define KRYON_NODE_PATH_MAX 512
|
|
|
|
typedef struct { const char *node_id; const char *property_id; PropertyValue value; } KryonNodeEdit;
|
|
|
|
typedef enum KryonNodeKind {
|
|
KRYON_NODE_KIND_UNKNOWN = 0,
|
|
KRYON_NODE_KIND_UI = 1,
|
|
KRYON_NODE_KIND_2D = 2,
|
|
KRYON_NODE_KIND_DATA = 3,
|
|
KRYON_NODE_KIND_GROUP = 4,
|
|
} KryonNodeKind;
|
|
|
|
typedef enum KryonNodeFlags {
|
|
KRYON_NODE_FLAG_SELECTABLE = 1,
|
|
KRYON_NODE_FLAG_MOVABLE = 2,
|
|
KRYON_NODE_FLAG_RESIZABLE = 4,
|
|
KRYON_NODE_FLAG_DELETABLE = 8,
|
|
KRYON_NODE_FLAG_INSERTABLE = 16,
|
|
KRYON_NODE_FLAG_READONLY = 32,
|
|
KRYON_NODE_FLAG_VISIBLE = 64,
|
|
KRYON_NODE_FLAG_LOCKED = 128,
|
|
} KryonNodeFlags;
|
|
|
|
typedef struct KryonNode {
|
|
char id[KRYON_NODE_ID_MAX];
|
|
char name[KRYON_NODE_NAME_MAX];
|
|
char type[KRYON_NODE_TYPE_MAX];
|
|
char base_type[KRYON_NODE_TYPE_MAX];
|
|
char parent_id[KRYON_NODE_ID_MAX];
|
|
char source_path[KRYON_NODE_PATH_MAX];
|
|
KryonNodeKind kind;
|
|
unsigned flags;
|
|
Rectangle bounds;
|
|
Vector2 position;
|
|
Vector2 scale;
|
|
Vector2 origin;
|
|
float rotation;
|
|
int layer;
|
|
int order;
|
|
int source_line;
|
|
int source_start;
|
|
int source_end;
|
|
} KryonNode;
|
|
const char* KryonNodeKindName(KryonNodeKind kind);
|
|
void KryonNodeInit(KryonNode* node, const char* id, const char* type, KryonNodeKind kind);
|
|
|
|
#endif /* K_RUNTIME_NODE_PROPS_H */
|