Got rid of the typedef struct box box; and typedef struct boxControl boxControl; from box.c, for consistency.
This commit is contained in:
parent
bdbf72e69f
commit
80b82b7698
32
box.c
32
box.c
|
@ -5,14 +5,10 @@
|
||||||
// TODOs
|
// TODOs
|
||||||
// - setting padded doesn't take effect immediately on Windows and OS X
|
// - setting padded doesn't take effect immediately on Windows and OS X
|
||||||
|
|
||||||
// TODO remove these
|
|
||||||
typedef struct box box;
|
|
||||||
typedef struct boxControl boxControl;
|
|
||||||
|
|
||||||
struct box {
|
struct box {
|
||||||
uiBox b;
|
uiBox b;
|
||||||
void (*baseDestroy)(uiControl *);
|
void (*baseDestroy)(uiControl *);
|
||||||
boxControl *controls;
|
struct boxControl *controls;
|
||||||
uintmax_t len;
|
uintmax_t len;
|
||||||
uintmax_t cap;
|
uintmax_t cap;
|
||||||
int vertical;
|
int vertical;
|
||||||
|
@ -30,7 +26,7 @@ struct boxControl {
|
||||||
|
|
||||||
static void boxDestroy(uiControl *c)
|
static void boxDestroy(uiControl *c)
|
||||||
{
|
{
|
||||||
box *b = (box *) c;
|
struct box *b = (struct box *) c;
|
||||||
uintmax_t i;
|
uintmax_t i;
|
||||||
|
|
||||||
// TODO find a way to move the parented check here
|
// TODO find a way to move the parented check here
|
||||||
|
@ -47,7 +43,7 @@ static void boxDestroy(uiControl *c)
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
box *b = (box *) c;
|
struct box *b = (struct box *) c;
|
||||||
int xpadding, ypadding;
|
int xpadding, ypadding;
|
||||||
uintmax_t nStretchy;
|
uintmax_t nStretchy;
|
||||||
// these two contain the largest preferred width and height of all stretchy controls in the box
|
// these two contain the largest preferred width and height of all stretchy controls in the box
|
||||||
|
@ -113,7 +109,7 @@ static void boxPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_
|
||||||
|
|
||||||
static void boxSysFunc(uiControl *c, uiControlSysFuncParams *p)
|
static void boxSysFunc(uiControl *c, uiControlSysFuncParams *p)
|
||||||
{
|
{
|
||||||
box *b = (box *) c;
|
struct box *b = (struct box *) c;
|
||||||
uintmax_t i;
|
uintmax_t i;
|
||||||
|
|
||||||
for (i = 0; i < b->len; i++)
|
for (i = 0; i < b->len; i++)
|
||||||
|
@ -122,7 +118,7 @@ static void boxSysFunc(uiControl *c, uiControlSysFuncParams *p)
|
||||||
|
|
||||||
static void boxResizeChildren(uiContainer *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height, uiSizing *d)
|
static void boxResizeChildren(uiContainer *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height, uiSizing *d)
|
||||||
{
|
{
|
||||||
box *b = (box *) c;
|
struct box *b = (struct box *) c;
|
||||||
int xpadding, ypadding;
|
int xpadding, ypadding;
|
||||||
uintmax_t nStretchy;
|
uintmax_t nStretchy;
|
||||||
intmax_t stretchywid, stretchyht;
|
intmax_t stretchywid, stretchyht;
|
||||||
|
@ -201,11 +197,11 @@ static void boxResizeChildren(uiContainer *c, intmax_t x, intmax_t y, intmax_t w
|
||||||
|
|
||||||
static void boxAppend(uiBox *ss, uiControl *c, int stretchy)
|
static void boxAppend(uiBox *ss, uiControl *c, int stretchy)
|
||||||
{
|
{
|
||||||
box *b = (box *) ss;
|
struct box *b = (struct box *) ss;
|
||||||
|
|
||||||
if (b->len >= b->cap) {
|
if (b->len >= b->cap) {
|
||||||
b->cap += boxCapGrow;
|
b->cap += boxCapGrow;
|
||||||
b->controls = (boxControl *) uiRealloc(b->controls, b->cap * sizeof (boxControl));
|
b->controls = (struct boxControl *) uiRealloc(b->controls, b->cap * sizeof (struct boxControl));
|
||||||
}
|
}
|
||||||
b->controls[b->len].c = c;
|
b->controls[b->len].c = c;
|
||||||
b->controls[b->len].stretchy = stretchy;
|
b->controls[b->len].stretchy = stretchy;
|
||||||
|
@ -216,7 +212,7 @@ static void boxAppend(uiBox *ss, uiControl *c, int stretchy)
|
||||||
|
|
||||||
static void boxDelete(uiBox *ss, uintmax_t index)
|
static void boxDelete(uiBox *ss, uintmax_t index)
|
||||||
{
|
{
|
||||||
box *b = (box *) ss;
|
struct box *b = (struct box *) ss;
|
||||||
uiControl *removed;
|
uiControl *removed;
|
||||||
uintmax_t i;
|
uintmax_t i;
|
||||||
|
|
||||||
|
@ -230,14 +226,14 @@ static void boxDelete(uiBox *ss, uintmax_t index)
|
||||||
|
|
||||||
static int boxPadded(uiBox *ss)
|
static int boxPadded(uiBox *ss)
|
||||||
{
|
{
|
||||||
box *b = (box *) ss;
|
struct box *b = (struct box *) ss;
|
||||||
|
|
||||||
return b->padded;
|
return b->padded;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void boxSetPadded(uiBox *ss, int padded)
|
static void boxSetPadded(uiBox *ss, int padded)
|
||||||
{
|
{
|
||||||
box *b = (box *) ss;
|
struct box *b = (struct box *) ss;
|
||||||
|
|
||||||
b->padded = padded;
|
b->padded = padded;
|
||||||
if (b->parent != NULL)
|
if (b->parent != NULL)
|
||||||
|
@ -246,9 +242,9 @@ static void boxSetPadded(uiBox *ss, int padded)
|
||||||
|
|
||||||
uiBox *uiNewHorizontalBox(void)
|
uiBox *uiNewHorizontalBox(void)
|
||||||
{
|
{
|
||||||
box *b;
|
struct box *b;
|
||||||
|
|
||||||
b = uiNew(box);
|
b = uiNew(struct box);
|
||||||
|
|
||||||
uiMakeContainer(uiContainer(b));
|
uiMakeContainer(uiContainer(b));
|
||||||
|
|
||||||
|
@ -270,10 +266,10 @@ uiBox *uiNewHorizontalBox(void)
|
||||||
uiBox *uiNewVerticalBox(void)
|
uiBox *uiNewVerticalBox(void)
|
||||||
{
|
{
|
||||||
uiBox *bb;
|
uiBox *bb;
|
||||||
box *b;
|
struct box *b;
|
||||||
|
|
||||||
bb = uiNewHorizontalBox();
|
bb = uiNewHorizontalBox();
|
||||||
b = (box *) bb;
|
b = (struct box *) bb;
|
||||||
b->vertical = 1;
|
b->vertical = 1;
|
||||||
return bb;
|
return bb;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue