diff --git a/new/ui.h b/new/ui.h index 8387dda..82d549b 100644 --- a/new/ui.h +++ b/new/ui.h @@ -17,9 +17,30 @@ void uiQuit(void); void uiFreeText(char *); +typedef struct uiSizing uiSizing; +struct uiSizing { + intmax_t xPadding; + intmax_t yPadding; + struct uiSizingSys *sys; +}; + typedef struct uiControl uiControl; +struct uiControl { + void *data; // for use by implementations only + void *internal; // for use by ui only + void (*destroy)(uiControl *); + uintptr_t (*handle)(uiControl *); + void (*setParent)(uiControl *, uintptr_t); + void (*removeParent)(uiControl *); + void (*preferredSize)(uiControl *, uiSizing *, intmax_t *, intmax_t *); + void (*resize)(uiControl *, intmax_t, intmax_t, intmax_t, intmax_t, uiSizing *); +}; void uiControlDestroy(uiControl *); uintptr_t uiControlHandle(uiControl *); +void uiControlSetParent(uiControl *, uintptr_t); +void uiControlRemoveParent(uiControl *); +void uiControlPreferredSize(uiControl *, uiSizing *, intmax_t *width, intmax_t *height); +void uiControlResize(uiControl *, intmax_t, intmax_t, intmax_t, intmax_t, uiSizing *); typedef struct uiWindow uiWindow; uiWindow *uiNewWindow(char *, int, int); diff --git a/new/uipriv.h b/new/uipriv.h index 7745c2a..c42cbb0 100644 --- a/new/uipriv.h +++ b/new/uipriv.h @@ -2,33 +2,6 @@ #include #include "ui.h" -typedef struct uiSize uiSize; -typedef struct uiSizing uiSizing; -typedef struct uiSizingComm uiSizingComm; - -struct uiSize { - intmax_t width; - intmax_t height; -}; - -// TODO this is a bit iffy; clean it up -#define uiSizingCommon \ - intmax_t xPadding; \ - intmax_t yPadding; - -struct uiSizingComm { - uiSizingCommon -}; - -struct uiControl { - void (*destroy)(uiControl *); - uintptr_t (*handle)(uiControl *); - void (*setParent)(uiControl *, uintptr_t); - void (*removeParent)(uiControl *); - uiSize (*preferredSize)(uiControl *, uiSizing *); - void (*resize)(uiControl *, intmax_t, intmax_t, intmax_t, intmax_t, uiSizing *); -}; - // uncomment the following line to enable memory logging; see leaks.awk #define uiLogAllocations