Big change time: decided to stop playing around with hiding and made both uiControl and uiSizing public. Also restructured uiSizing to make system-dependent data in another structure.
This commit is contained in:
parent
b60ff74a9e
commit
6d600f08cd
21
ui.h
21
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);
|
||||
|
|
27
uipriv.h
27
uipriv.h
|
@ -2,33 +2,6 @@
|
|||
#include <stdlib.h>
|
||||
#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
|
||||
|
||||
|
|
Loading…
Reference in New Issue