Controls that support deletion need to provide the number of children they contain for error detection
This commit is contained in:
parent
f56411fde1
commit
87a9354e81
11
darwin/box.m
11
darwin/box.m
|
@ -37,6 +37,7 @@
|
||||||
- (CGFloat)paddingAmount;
|
- (CGFloat)paddingAmount;
|
||||||
- (void)establishOurConstraints;
|
- (void)establishOurConstraints;
|
||||||
- (void)append:(uiControl *)c stretchy:(int)stretchy;
|
- (void)append:(uiControl *)c stretchy:(int)stretchy;
|
||||||
|
- (int)countChildren;
|
||||||
- (void)delete:(int)n;
|
- (void)delete:(int)n;
|
||||||
- (int)isPadded;
|
- (int)isPadded;
|
||||||
- (void)setPadded:(int)p;
|
- (void)setPadded:(int)p;
|
||||||
|
@ -292,6 +293,11 @@ struct uiBox {
|
||||||
[bc release]; // we don't need the initial reference now
|
[bc release]; // we don't need the initial reference now
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (int)countChildren
|
||||||
|
{
|
||||||
|
return (int) [self->children count];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)delete:(int)n
|
- (void)delete:(int)n
|
||||||
{
|
{
|
||||||
boxChild *bc;
|
boxChild *bc;
|
||||||
|
@ -423,6 +429,11 @@ static void uiBoxChildVisibilityChanged(uiDarwinControl *c)
|
||||||
[b->view establishOurConstraints];
|
[b->view establishOurConstraints];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int uiBoxNumChildren(uiBox *b)
|
||||||
|
{
|
||||||
|
return [b->view countChildren];
|
||||||
|
}
|
||||||
|
|
||||||
void uiBoxAppend(uiBox *b, uiControl *c, int stretchy)
|
void uiBoxAppend(uiBox *b, uiControl *c, int stretchy)
|
||||||
{
|
{
|
||||||
// LONGTERM on other platforms
|
// LONGTERM on other platforms
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
- (CGFloat)paddingAmount;
|
- (CGFloat)paddingAmount;
|
||||||
- (void)establishOurConstraints;
|
- (void)establishOurConstraints;
|
||||||
- (void)append:(NSString *)label c:(uiControl *)c stretchy:(int)stretchy;
|
- (void)append:(NSString *)label c:(uiControl *)c stretchy:(int)stretchy;
|
||||||
|
- (int)countChildren;
|
||||||
- (void)delete:(int)n;
|
- (void)delete:(int)n;
|
||||||
- (int)isPadded;
|
- (int)isPadded;
|
||||||
- (void)setPadded:(int)p;
|
- (void)setPadded:(int)p;
|
||||||
|
@ -394,6 +395,11 @@ struct uiForm {
|
||||||
[fc release]; // we don't need the initial reference now
|
[fc release]; // we don't need the initial reference now
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (int)countChildren
|
||||||
|
{
|
||||||
|
return (int) [self->children count];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)delete:(int)n
|
- (void)delete:(int)n
|
||||||
{
|
{
|
||||||
formChild *fc;
|
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];
|
[f->view append:toNSString(label) c:c stretchy:stretchy];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int uiFormNumChildren(uiForm *f)
|
||||||
|
{
|
||||||
|
return [f->view countChildren];
|
||||||
|
}
|
||||||
|
|
||||||
void uiFormDelete(uiForm *f, int n)
|
void uiFormDelete(uiForm *f, int n)
|
||||||
{
|
{
|
||||||
[f->view delete:n];
|
[f->view delete:n];
|
||||||
|
|
2
ui.h
2
ui.h
|
@ -123,6 +123,7 @@ _UI_EXTERN uiButton *uiNewButton(const char *text);
|
||||||
typedef struct uiBox uiBox;
|
typedef struct uiBox uiBox;
|
||||||
#define uiBox(this) ((uiBox *) (this))
|
#define uiBox(this) ((uiBox *) (this))
|
||||||
_UI_EXTERN void uiBoxAppend(uiBox *b, uiControl *child, int stretchy);
|
_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 void uiBoxDelete(uiBox *b, int index);
|
||||||
_UI_EXTERN int uiBoxPadded(uiBox *b);
|
_UI_EXTERN int uiBoxPadded(uiBox *b);
|
||||||
_UI_EXTERN void uiBoxSetPadded(uiBox *b, int padded);
|
_UI_EXTERN void uiBoxSetPadded(uiBox *b, int padded);
|
||||||
|
@ -657,6 +658,7 @@ _UI_EXTERN uiColorButton *uiNewColorButton(void);
|
||||||
typedef struct uiForm uiForm;
|
typedef struct uiForm uiForm;
|
||||||
#define uiForm(this) ((uiForm *) (this))
|
#define uiForm(this) ((uiForm *) (this))
|
||||||
_UI_EXTERN void uiFormAppend(uiForm *f, const char *label, uiControl *c, int stretchy);
|
_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 void uiFormDelete(uiForm *f, int index);
|
||||||
_UI_EXTERN int uiFormPadded(uiForm *f);
|
_UI_EXTERN int uiFormPadded(uiForm *f);
|
||||||
_UI_EXTERN void uiFormSetPadded(uiForm *f, int padded);
|
_UI_EXTERN void uiFormSetPadded(uiForm *f, int padded);
|
||||||
|
|
|
@ -47,6 +47,11 @@ static void uiBoxDestroy(uiControl *c)
|
||||||
uiFreeControl(uiControl(b));
|
uiFreeControl(uiControl(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int uiBoxNumChildren(uiBox *b)
|
||||||
|
{
|
||||||
|
return (int) b->controls->len;
|
||||||
|
}
|
||||||
|
|
||||||
void uiBoxAppend(uiBox *b, uiControl *c, int stretchy)
|
void uiBoxAppend(uiBox *b, uiControl *c, int stretchy)
|
||||||
{
|
{
|
||||||
struct boxChild bc;
|
struct boxChild bc;
|
||||||
|
|
|
@ -101,6 +101,11 @@ void uiFormAppend(uiForm *f, const char *label, uiControl *c, int stretchy)
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int uiFormNumChildren(uiForm *f)
|
||||||
|
{
|
||||||
|
return (int) f->children->len;
|
||||||
|
}
|
||||||
|
|
||||||
void uiFormDelete(uiForm *f, int index)
|
void uiFormDelete(uiForm *f, int index)
|
||||||
{
|
{
|
||||||
struct formChild *fc;
|
struct formChild *fc;
|
||||||
|
|
|
@ -254,6 +254,11 @@ static void boxArrangeChildren(uiBox *b)
|
||||||
uiWindowsControlAssignControlIDZOrder(uiWindowsControl(bc.c), &controlID, &insertAfter);
|
uiWindowsControlAssignControlIDZOrder(uiWindowsControl(bc.c), &controlID, &insertAfter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int uiBoxNumChildren(uiBox *b)
|
||||||
|
{
|
||||||
|
return (int) b->controls->size();
|
||||||
|
}
|
||||||
|
|
||||||
void uiBoxAppend(uiBox *b, uiControl *c, int stretchy)
|
void uiBoxAppend(uiBox *b, uiControl *c, int stretchy)
|
||||||
{
|
{
|
||||||
struct boxChild bc;
|
struct boxChild bc;
|
||||||
|
|
|
@ -276,6 +276,11 @@ void uiFormAppend(uiForm *f, const char *label, uiControl *c, int stretchy)
|
||||||
uiWindowsControlMinimumSizeChanged(uiWindowsControl(f));
|
uiWindowsControlMinimumSizeChanged(uiWindowsControl(f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int uiFormNumChildren(uiForm *f)
|
||||||
|
{
|
||||||
|
return (int) f->controls->size();
|
||||||
|
}
|
||||||
|
|
||||||
void uiFormDelete(uiForm *f, int index)
|
void uiFormDelete(uiForm *f, int index)
|
||||||
{
|
{
|
||||||
struct formChild fc;
|
struct formChild fc;
|
||||||
|
|
Loading…
Reference in New Issue