I realized that overriding uiControlResize() isn't going to work because we need to be able to call that directly AND have that called by the container widget implementation. Therefore, added uiContainerResizeChildren().

This commit is contained in:
Pietro Gagliardi 2015-04-27 00:57:44 -04:00
parent 3907efcc2f
commit 664d6d7dd0
2 changed files with 4 additions and 6 deletions

View File

@ -9,7 +9,6 @@ typedef struct boxControl boxControl;
struct box {
uiBox b;
void (*baseDestroy)(uiControl *);
void (*baseResize)(uiControl *, intmax_t, intmax_t, intmax_t, intmax_t, uiSizing *);
boxControl *controls;
uintmax_t len;
uintmax_t cap;
@ -109,7 +108,7 @@ static void boxPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_
*width += nStretchy * maxStretchyWidth;
}
static void boxResize(uiControl *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height, uiSizing *d)
static void boxResizeChildren(uiControl *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height, uiSizing *d)
{
box *b = (box *) c;
int xpadding, ypadding;
@ -118,8 +117,6 @@ static void boxResize(uiControl *c, intmax_t x, intmax_t y, intmax_t width, intm
uintmax_t i;
intmax_t preferredWidth, preferredHeight;
(*(b->baseResize))(c, x, y, width, height, d);
if (b->len == 0)
return;
@ -249,8 +246,8 @@ uiBox *uiNewHorizontalBox(void)
b->baseDestroy = uiControl(b)->Destroy;
uiControl(b)->Destroy = boxDestroy;
uiControl(b)->PreferredSize = boxPreferredSize;
b->baseResize = uiControl(b)->Resize;
uiControl(b)->Resize = boxResize;
uiContainer(b)->ResizeChildren = boxResizeChildren;
uiBox(b)->Append = boxAppend;
uiBox(b)->Delete = boxDelete;

View File

@ -61,6 +61,7 @@ interface Control {
};
interface Container from Control {
func ResizeChildren(x intmax_t, y intmax_t, width intmax_t, height intmax_t, d *Sizing);
func Update(voiid);
};
func MakeContainer(c *Container);