Adds missing delete() method for darwin

This commit is contained in:
emersion 2016-06-14 22:55:55 +02:00
parent 52bd3b2c35
commit b817a16c05
1 changed files with 26 additions and 2 deletions

View File

@ -40,7 +40,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;
//TODO- (void)delete:(int)n; - (void)delete:(int)n;
- (int)isPadded; - (int)isPadded;
- (void)setPadded:(int)p; - (void)setPadded:(int)p;
- (BOOL)hugsTrailing; - (BOOL)hugsTrailing;
@ -388,7 +388,31 @@ struct uiForm {
[fc release]; // we don't need the initial reference now [fc release]; // we don't need the initial reference now
} }
//TODO- (void)delete:(int)n - (void)delete:(int)n
{
formChild *fc;
int stretchy;
fc = (formChild *) [self->children objectAtIndex:n];
stretchy = fc.stretchy;
uiControlSetParent(fc.c, NULL);
uiDarwinControlSetSuperview(uiDarwinControl(fc.c), nil);
uiDarwinControlSetHuggingPriority(uiDarwinControl(fc.c), fc.oldHorzHuggingPri, NSLayoutConstraintOrientationHorizontal);
uiDarwinControlSetHuggingPriority(uiDarwinControl(fc.c), fc.oldVertHuggingPri, NSLayoutConstraintOrientationVertical);
[fc.label removeFromSuperview];
[self->children removeObjectAtIndex:n];
[self establishOurConstraints];
if (stretchy) {
self->nStretchy--;
if (self->nStretchy == 0)
uiDarwinNotifyEdgeHuggingChanged(uiDarwinControl(self->f));
}
}
- (int)isPadded - (int)isPadded
{ {