diff --git a/redo/reredo/control.c b/redo/reredo/control.c index 3469c299..88a7fcca 100644 --- a/redo/reredo/control.c +++ b/redo/reredo/control.c @@ -62,8 +62,6 @@ uiControl *toplevelOwning(uiControl *c) } } -static void controlUpdateState(uiControl *); - void uiControlSetParent(uiControl *c, uiControl *parent) { struct controlBase *cb = controlBase(c); @@ -133,7 +131,7 @@ void uiControlDisable(uiControl *c) controlUpdateState(c); } -static void controlUpdateState(uiControl *c) +void controlUpdateState(uiControl *c) { if (controlContainerVisible(c)) osCommitShow(c); diff --git a/redo/reredo/darwin/box.m b/redo/reredo/darwin/box.m index 28a5e6fd..b493d057 100644 --- a/redo/reredo/darwin/box.m +++ b/redo/reredo/darwin/box.m @@ -56,7 +56,21 @@ static void onDestroy(uiBox *b) [b->stretchy release]; } -// TODO container update state +static void boxContainerUpdateState(uiControl *c) +{ + uiBox *b = uiBox(c); + NSUInteger i; + + for (i = 0; i < [b->children count]; i++) { + NSValue *v; + uiControl *child; + + v = (NSValue *) [b->children objectAtIndex:i]; + // TODO change all these other instances of casts to conversions + child = uiControl([v pointerValue]); + controlUpdateState(child); + } +} static NSString *viewName(uintmax_t n) { @@ -281,6 +295,7 @@ static uiBox *finishNewBox(BOOL vertical) setHuggingPri(b->noStretchyView, NSLayoutPriorityDefaultLow, NSLayoutConstraintOrientationVertical); uiDarwinFinishNewControl(b, uiBox); + uiControl(b)->ContainerUpdateState = boxContainerUpdateState; uiDarwinControl(b)->Relayout = boxRelayout; return b; diff --git a/redo/reredo/darwin/group.m b/redo/reredo/darwin/group.m index cf6a9698..8dbc3573 100644 --- a/redo/reredo/darwin/group.m +++ b/redo/reredo/darwin/group.m @@ -28,7 +28,13 @@ static void onDestroy(uiGroup *g) } } -// TODO group container update +static void groupContainerUpdateState(uiControl *c) +{ + uiGroup *g = uiGroup(c); + + if (g->child != NULL) + controlUpdateState(g->child); +} static void groupRelayout(uiDarwinControl *c) { @@ -110,6 +116,7 @@ uiGroup *uiNewGroup(const char *title) [g->box setTitleFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]]]; uiDarwinFinishNewControl(g, uiGroup); + uiControl(g)->ContainerUpdateState = groupContainerUpdateState; uiDarwinControl(g)->Relayout = groupRelayout; return g; diff --git a/redo/reredo/darwin/window.m b/redo/reredo/darwin/window.m index ce635492..785db77b 100644 --- a/redo/reredo/darwin/window.m +++ b/redo/reredo/darwin/window.m @@ -112,7 +112,13 @@ static void windowCommitHide(uiControl *c) [w->window orderOut:w->window]; } -// TODO container update state +static void windowContainerUpdateState(uiControl *c) +{ + uiWindow *w = uiWindow(c); + + if (w->child != NULL) + controlUpdateState(w->child); +} static void windowRelayout(uiDarwinControl *c) { @@ -209,6 +215,7 @@ uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar) uiDarwinFinishNewControl(w, uiWindow); //TODO uiControl(w)->CommitShow = windowCommitShow; //TODO uiControl(w)->CommitHide = windowCommitHide; + uiControl(w)->ContainerUpdateState = windowContainerUpdateState; uiDarwinControl(w)->Relayout = windowRelayout; return w; diff --git a/redo/reredo/uipriv.h b/redo/reredo/uipriv.h index a30841ec..7ae515f7 100644 --- a/redo/reredo/uipriv.h +++ b/redo/reredo/uipriv.h @@ -17,6 +17,7 @@ extern void complain(const char *, ...); extern int isToplevel(uiControl *); extern uiControl *toplevelOwning(uiControl *); +extern void controlUpdateState(uiControl *); extern void osCommitShow(uiControl *); extern void osCommitHide(uiControl *);