Add uiBoxChild

This commit is contained in:
endoffile78 2018-04-29 12:02:13 -05:00
parent f88c23602e
commit e22b084bea
No known key found for this signature in database
GPG Key ID: 1CFE61B9BD92B60B
4 changed files with 38 additions and 4 deletions

View File

@ -292,6 +292,17 @@ struct uiBox {
[bc release]; // we don't need the initial reference now
}
- (int)Child:(uiControl *)c
{
boxChild *bc;
for (bc in self->children) {
if (bc.c == c) {
return 1;
}
}
return 0;
}
- (void)delete:(int)n
{
boxChild *bc;

9
ui.h
View File

@ -142,6 +142,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 uiBoxChild(uiBox *b, uiControl *c);
_UI_EXTERN void uiBoxDelete(uiBox *b, int index);
_UI_EXTERN int uiBoxPadded(uiBox *b);
_UI_EXTERN void uiBoxSetPadded(uiBox *b, int padded);
@ -685,7 +686,7 @@ _UI_EXTERN uiUnderline uiAttributeUnderline(const uiAttribute *a);
// platform-specific colors for suggestion underlines; to use them
// correctly, pair them with uiUnderlineSuggestion (though they can
// be used on other types of underline as well).
//
//
// If an underline type is applied but no underline color is
// specified, the text color is used instead. If an underline color
// is specified without an underline type, the underline color
@ -721,10 +722,10 @@ _UI_EXTERN void uiAttributeUnderlineColor(const uiAttribute *a, uiUnderlineColor
// uiOpenTypeFeatures instance. Each value is a 32-bit integer,
// often used as a Boolean flag, but sometimes as an index to choose
// a glyph shape to use.
//
//
// If a font does not support a certain feature, that feature will be
// ignored. (TODO verify this on all OSs)
//
//
// See the OpenType specification at
// https://www.microsoft.com/typography/otspec/featuretags.htm
// for the complete list of available features, information on specific
@ -765,7 +766,7 @@ _UI_EXTERN void uiOpenTypeFeaturesRemove(uiOpenTypeFeatures *otf, char a, char b
// uiOpenTypeFeaturesGet() determines whether the given feature
// tag is present in otf. If it is, *value is set to the tag's value and
// nonzero is returned. Otherwise, zero is returned.
//
//
// Note that if uiOpenTypeFeaturesGet() returns zero, value isn't
// changed. This is important: if a feature is not present in a
// uiOpenTypeFeatures, the feature is NOT treated as if its

View File

@ -88,6 +88,18 @@ void uiBoxAppend(uiBox *b, uiControl *c, int stretchy)
g_array_append_val(b->controls, bc);
}
int uiBoxChild(uiBox *b, uiControl *c)
{
guint i;
for (i = 0; i < b->controls->len; i++) {
struct boxChild *bc = ctrl(b, i);
if (bc->c == c) {
return 1;
}
}
return 0;
}
void uiBoxDelete(uiBox *b, int index)
{
struct boxChild *bc;

View File

@ -267,6 +267,16 @@ void uiBoxAppend(uiBox *b, uiControl *c, int stretchy)
uiWindowsControlMinimumSizeChanged(uiWindowsControl(b));
}
void uiBoxChild(uiBox *b, uiControl *c)
{
for (struct boxChild *bc : b->controls) {
if (bc->c == c){
return 1;
}
}
return 0;
}
void uiBoxDelete(uiBox *b, int index)
{
uiControl *c;