Implemented uiControlContainerUpdateState() on uiBox, uiGroup, and uiWindow. Not on uiTab yet; there's a few glitches that I need to take care of first.
This commit is contained in:
parent
133f258c3f
commit
ff4f8fbd58
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 *);
|
||||
|
|
Loading…
Reference in New Issue