More TODO resolution and TODOs.

This commit is contained in:
Pietro Gagliardi 2015-09-01 16:44:09 -04:00
parent e46822a9b1
commit f130360be6
5 changed files with 24 additions and 8 deletions

View File

@ -77,6 +77,14 @@ void uiControlSetParent(uiControl *c, uiControl *parent)
controlUpdateState(c);
}
// only to be called by the immediate parent of a control
int controlSelfVisible(uiControl *c)
{
struct controlBase *cb = controlBase(c);
return !cb->hidden;
}
static int controlContainerVisible(uiControl *c)
{
struct controlBase *cb = controlBase(c);
@ -143,6 +151,7 @@ void controlUpdateState(uiControl *c)
osCommitDisable(c);
(*(c->ContainerUpdateState))(c);
// and queue a resize, just in case we showed/hid something
// for instance, on Windows uiBox, if we don't do this, hiding a control will show empty space until the window is resized
//TODO uiControlQueueResize(c);
}

View File

@ -17,6 +17,7 @@ extern void complain(const char *, ...);
extern int isToplevel(uiControl *);
extern uiControl *toplevelOwning(uiControl *);
extern int controlSelfVisible(uiControl *);
extern void controlUpdateState(uiControl *);
extern void osCommitEnable(uiControl *);

View File

@ -79,8 +79,8 @@ static void minimumSize(uiWindowsControl *c, uiWindowsSizing *d, intmax_t *width
maxStretchyHeight = 0;
for (i = 0; i < b->controls->len; i++) {
bc = ptrArrayIndex(b->controls, struct child *, i);
//TODO if (!uiControlContainerVisible(bc->c))
//TODO continue;
if (!childVisible(bc))
continue;
childMinimumSize(bc, dself, &minimumWidth, &minimumHeight);
if (ctrlStretchy(bc)) {
nStretchy++;
@ -151,8 +151,8 @@ static void boxRelayout(uiWindowsControl *c, intmax_t x, intmax_t y, intmax_t wi
nStretchy = 0;
for (i = 0; i < b->controls->len; i++) {
bc = ptrArrayIndex(b->controls, struct child *, i);
//TODO if (!uiControlContainerVisible(bc->c))
//TODO continue;
if (!childVisible(bc))
continue;
if (ctrlStretchy(bc)) {
nStretchy++;
continue;
@ -177,8 +177,8 @@ static void boxRelayout(uiWindowsControl *c, intmax_t x, intmax_t y, intmax_t wi
stretchywid /= nStretchy;
for (i = 0; i < b->controls->len; i++) {
bc = ptrArrayIndex(b->controls, struct child *, i);
//TODO if (!uiControlContainerVisible(bc->c))
//TODO continue;
if (!childVisible(bc))
continue;
if (ctrlStretchy(bc)) {
ctrlSetWidth(bc, stretchywid);
ctrlSetHeight(bc, stretchyht);
@ -191,8 +191,8 @@ static void boxRelayout(uiWindowsControl *c, intmax_t x, intmax_t y, intmax_t wi
y = 0;
for (i = 0; i < b->controls->len; i++) {
bc = ptrArrayIndex(b->controls, struct child *, i);
//TODO if (!uiControlContainerVisible(bc->c))
//TODO continue;
if (!childVisible(bc))
continue;
childRelayout(bc, x, y, ctrlWidth(bc), ctrlHeight(bc));
if (b->vertical)
y += ctrlHeight(bc) + ypadding;

View File

@ -113,6 +113,11 @@ void childQueueRelayout(struct child *c)
uiWindowsControlQueueRelayout(uiWindowsControl(c->c));
}
int childVisible(struct child *c)
{
return controlSelfVisible(c->c);
}
void childUpdateState(struct child *c)
{
controlUpdateState(c->c);

View File

@ -104,6 +104,7 @@ extern HWND childHWND(struct child *c);
extern void childMinimumSize(struct child *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height);
extern void childRelayout(struct child *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height);
extern void childQueueRelayout(struct child *c);
extern int childVisible(struct child *c);
extern void childUpdateState(struct child *c);
extern HWND childTabPage(struct child *c);
extern int childMargined(struct child *c);