Prepared a few things for migrating windows/container.c.
This commit is contained in:
parent
75b7e66d9e
commit
ef08a106f9
22
redo/box.c
22
redo/box.c
|
@ -4,7 +4,8 @@
|
||||||
|
|
||||||
struct box {
|
struct box {
|
||||||
uiBox b;
|
uiBox b;
|
||||||
void (*baseDestroy)(uiControl *);
|
void (*baseCommitDestroy)(uiControl *);
|
||||||
|
uintptr_t handle;
|
||||||
struct ptrArray *controls;
|
struct ptrArray *controls;
|
||||||
int vertical;
|
int vertical;
|
||||||
int padded;
|
int padded;
|
||||||
|
@ -18,7 +19,7 @@ struct boxControl {
|
||||||
intmax_t height;
|
intmax_t height;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void boxDestroy(uiControl *c)
|
static void boxCommitDestroy(uiControl *c)
|
||||||
{
|
{
|
||||||
struct box *b = (struct box *) c;
|
struct box *b = (struct box *) c;
|
||||||
struct boxControl *bc;
|
struct boxControl *bc;
|
||||||
|
@ -33,8 +34,14 @@ static void boxDestroy(uiControl *c)
|
||||||
}
|
}
|
||||||
ptrArrayDestroy(b->controls);
|
ptrArrayDestroy(b->controls);
|
||||||
// NOW we can chain up to base
|
// NOW we can chain up to base
|
||||||
(*(b->baseDestroy))(uiControl(b));
|
(*(b->baseCommitDestroy))(uiControl(b));
|
||||||
uiFree(b);
|
}
|
||||||
|
|
||||||
|
static uintptr_t boxHandle(uiControl *c)
|
||||||
|
{
|
||||||
|
struct box *b = (struct box *) c;
|
||||||
|
|
||||||
|
return b->handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void boxPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *height)
|
static void boxPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *height)
|
||||||
|
@ -257,16 +264,17 @@ uiBox *uiNewHorizontalBox(void)
|
||||||
b = uiNew(struct box);
|
b = uiNew(struct box);
|
||||||
uiTyped(b)->Type = uiTypeBox();
|
uiTyped(b)->Type = uiTypeBox();
|
||||||
|
|
||||||
uiMakeContainer(uiControl(b));
|
b->handle = uiMakeContainer(uiControl(b));
|
||||||
|
|
||||||
b->controls = newPtrArray();
|
b->controls = newPtrArray();
|
||||||
|
|
||||||
b->baseDestroy = uiControl(b)->Destroy;
|
uiControl(b)->Handle = boxHandle;
|
||||||
uiControl(b)->Destroy = boxDestroy;
|
|
||||||
uiControl(b)->PreferredSize = boxPreferredSize;
|
uiControl(b)->PreferredSize = boxPreferredSize;
|
||||||
b->baseResize = uiControl(b)->Resize;
|
b->baseResize = uiControl(b)->Resize;
|
||||||
uiControl(b)->Resize = boxResize;
|
uiControl(b)->Resize = boxResize;
|
||||||
uiControl(b)->SysFunc = boxSysFunc;
|
uiControl(b)->SysFunc = boxSysFunc;
|
||||||
|
b->baseCommitDestroy = uiControl(b)->CommitDestroy;
|
||||||
|
uiControl(b)->CommitDestroy = boxCommitDestroy;
|
||||||
|
|
||||||
uiBox(b)->Append = boxAppend;
|
uiBox(b)->Append = boxAppend;
|
||||||
uiBox(b)->Delete = boxDelete;
|
uiBox(b)->Delete = boxDelete;
|
||||||
|
|
|
@ -87,7 +87,7 @@ raw " }";
|
||||||
|
|
||||||
func FreeSizing(d *Sizing);
|
func FreeSizing(d *Sizing);
|
||||||
|
|
||||||
func MakeContainer(c *Control);
|
func MakeContainer(c *Control) uintptr_t;
|
||||||
|
|
||||||
interface Window from Control {
|
interface Window from Control {
|
||||||
func Title(void) *char;
|
func Title(void) *char;
|
||||||
|
|
|
@ -144,11 +144,8 @@ static void singleHWNDStartZOrder(uiControl *c, uiControlSysFuncParams *p)
|
||||||
uiWindowsUtilStartZOrder(HWND(c), p);
|
uiWindowsUtilStartZOrder(HWND(c), p);
|
||||||
}
|
}
|
||||||
|
|
||||||
uiControl *uiWindowsNewSingleHWNDControl(uintmax_t type)
|
void setSingleHWNDFuncs(uiControl *c)
|
||||||
{
|
{
|
||||||
uiControl *c;
|
|
||||||
|
|
||||||
c = uiNewControl(type);
|
|
||||||
uiControl(c)->CommitDestroy = singleHWNDCommitDestroy;
|
uiControl(c)->CommitDestroy = singleHWNDCommitDestroy;
|
||||||
uiControl(c)->CommitSetParent = singleHWNDCommitSetParent;
|
uiControl(c)->CommitSetParent = singleHWNDCommitSetParent;
|
||||||
uiControl(c)->Resize = singleHWNDResize;
|
uiControl(c)->Resize = singleHWNDResize;
|
||||||
|
@ -159,5 +156,13 @@ uiControl *uiWindowsNewSingleHWNDControl(uintmax_t type)
|
||||||
uiControl(c)->CommitDisable = singleHWNDCommitDisable;
|
uiControl(c)->CommitDisable = singleHWNDCommitDisable;
|
||||||
uiControl(c)->SysFunc = singleHWNDSysFunc;
|
uiControl(c)->SysFunc = singleHWNDSysFunc;
|
||||||
uiControl(c)->StartZOrder = singleHWNDStartZOrder;
|
uiControl(c)->StartZOrder = singleHWNDStartZOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
uiControl *uiWindowsNewSingleHWNDControl(uintmax_t type)
|
||||||
|
{
|
||||||
|
uiControl *c;
|
||||||
|
|
||||||
|
c = uiNewControl(type);
|
||||||
|
setSingleHWNDFuncs(c);
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,3 +128,6 @@ extern void dialogHelperUnregisterWindow(HWND);
|
||||||
extern ATOM initDialogHelper(HICON, HCURSOR);
|
extern ATOM initDialogHelper(HICON, HCURSOR);
|
||||||
extern HWND beginDialogHelper(void);
|
extern HWND beginDialogHelper(void);
|
||||||
extern void endDialogHelper(HWND);
|
extern void endDialogHelper(HWND);
|
||||||
|
|
||||||
|
// control.c
|
||||||
|
extern void setSingleHWNDFuncs(uiControl *);
|
||||||
|
|
Loading…
Reference in New Issue