diff --git a/darwin/box.m b/darwin/box.m index 18d536d5..31a0c18e 100644 --- a/darwin/box.m +++ b/darwin/box.m @@ -37,6 +37,7 @@ - (CGFloat)paddingAmount; - (void)establishOurConstraints; - (void)append:(uiControl *)c stretchy:(int)stretchy; +- (int)countChildren; - (void)delete:(int)n; - (int)isPadded; - (void)setPadded:(int)p; @@ -292,6 +293,11 @@ struct uiBox { [bc release]; // we don't need the initial reference now } +- (int)countChildren +{ + return (int) [self->children count]; +} + - (void)delete:(int)n { boxChild *bc; @@ -423,6 +429,11 @@ static void uiBoxChildVisibilityChanged(uiDarwinControl *c) [b->view establishOurConstraints]; } +int uiBoxNumChildren(uiBox *b) +{ + return [b->view countChildren]; +} + void uiBoxAppend(uiBox *b, uiControl *c, int stretchy) { // LONGTERM on other platforms diff --git a/darwin/form.m b/darwin/form.m index 7cdb965a..68f635c4 100644 --- a/darwin/form.m +++ b/darwin/form.m @@ -39,6 +39,7 @@ - (CGFloat)paddingAmount; - (void)establishOurConstraints; - (void)append:(NSString *)label c:(uiControl *)c stretchy:(int)stretchy; +- (int)countChildren; - (void)delete:(int)n; - (int)isPadded; - (void)setPadded:(int)p; @@ -394,6 +395,11 @@ struct uiForm { [fc release]; // we don't need the initial reference now } +- (int)countChildren +{ + return (int) [self->children count]; +} + - (void)delete:(int)n { formChild *fc; @@ -534,6 +540,11 @@ void uiFormAppend(uiForm *f, const char *label, uiControl *c, int stretchy) [f->view append:toNSString(label) c:c stretchy:stretchy]; } +int uiFormNumChildren(uiForm *f) +{ + return [f->view countChildren]; +} + void uiFormDelete(uiForm *f, int n) { [f->view delete:n]; diff --git a/ui.h b/ui.h index 5852bf6d..558718d1 100644 --- a/ui.h +++ b/ui.h @@ -123,6 +123,7 @@ _UI_EXTERN uiButton *uiNewButton(const char *text); typedef struct uiBox uiBox; #define uiBox(this) ((uiBox *) (this)) _UI_EXTERN void uiBoxAppend(uiBox *b, uiControl *child, int stretchy); +_UI_EXTERN int uiBoxNumChildren(uiBox *b); _UI_EXTERN void uiBoxDelete(uiBox *b, int index); _UI_EXTERN int uiBoxPadded(uiBox *b); _UI_EXTERN void uiBoxSetPadded(uiBox *b, int padded); @@ -657,6 +658,7 @@ _UI_EXTERN uiColorButton *uiNewColorButton(void); typedef struct uiForm uiForm; #define uiForm(this) ((uiForm *) (this)) _UI_EXTERN void uiFormAppend(uiForm *f, const char *label, uiControl *c, int stretchy); +_UI_EXTERN int uiFormNumChildren(uiForm *f); _UI_EXTERN void uiFormDelete(uiForm *f, int index); _UI_EXTERN int uiFormPadded(uiForm *f); _UI_EXTERN void uiFormSetPadded(uiForm *f, int padded); diff --git a/unix/box.c b/unix/box.c index 23fb7f7c..d16cf545 100644 --- a/unix/box.c +++ b/unix/box.c @@ -47,6 +47,11 @@ static void uiBoxDestroy(uiControl *c) uiFreeControl(uiControl(b)); } +int uiBoxNumChildren(uiBox *b) +{ + return (int) b->controls->len; +} + void uiBoxAppend(uiBox *b, uiControl *c, int stretchy) { struct boxChild bc; diff --git a/unix/form.c b/unix/form.c index 54422b3d..e236c762 100644 --- a/unix/form.c +++ b/unix/form.c @@ -101,6 +101,11 @@ void uiFormAppend(uiForm *f, const char *label, uiControl *c, int stretchy) NULL); } +int uiFormNumChildren(uiForm *f) +{ + return (int) f->children->len; +} + void uiFormDelete(uiForm *f, int index) { struct formChild *fc; diff --git a/windows/box.cpp b/windows/box.cpp index 9567954b..93f786c2 100644 --- a/windows/box.cpp +++ b/windows/box.cpp @@ -254,6 +254,11 @@ static void boxArrangeChildren(uiBox *b) uiWindowsControlAssignControlIDZOrder(uiWindowsControl(bc.c), &controlID, &insertAfter); } +int uiBoxNumChildren(uiBox *b) +{ + return (int) b->controls->size(); +} + void uiBoxAppend(uiBox *b, uiControl *c, int stretchy) { struct boxChild bc; diff --git a/windows/form.cpp b/windows/form.cpp index febcc693..f45dc59b 100644 --- a/windows/form.cpp +++ b/windows/form.cpp @@ -276,6 +276,11 @@ void uiFormAppend(uiForm *f, const char *label, uiControl *c, int stretchy) uiWindowsControlMinimumSizeChanged(uiWindowsControl(f)); } +int uiFormNumChildren(uiForm *f) +{ + return (int) f->controls->size(); +} + void uiFormDelete(uiForm *f, int index) { struct formChild fc;