Fixed build errors and some runtime errors. Things don't look right yet...
This commit is contained in:
parent
f66b5a8873
commit
63dac7c13a
|
@ -46,25 +46,25 @@ void singleChildConstraintsEstablish(struct singleChildConstraints *c, NSView *c
|
||||||
[desc stringByAppendingString:@" top constraint"]);
|
[desc stringByAppendingString:@" top constraint"]);
|
||||||
[contentView addConstraint:c->topConstraint];
|
[contentView addConstraint:c->topConstraint];
|
||||||
|
|
||||||
relation = NSLayoutRelationGreaterOrEqual;
|
relation = NSLayoutRelationGreaterThanOrEqual;
|
||||||
if (hugsTrailing)
|
if (hugsTrailing)
|
||||||
relation = NSLayoutRelationEqual;
|
relation = NSLayoutRelationEqual;
|
||||||
c->leadingConstraint = mkConstraint(contentView, NSLayoutAttributeTrailing,
|
c->trailingConstraint = mkConstraint(contentView, NSLayoutAttributeTrailing,
|
||||||
relation,
|
relation,
|
||||||
childView, NSLayoutAttributeTrailing,
|
childView, NSLayoutAttributeTrailing,
|
||||||
1, -margin,
|
1, -margin,
|
||||||
[desc stringByAppendingString:@" trailing constraint"]);
|
[desc stringByAppendingString:@" trailing constraint"]);
|
||||||
[contentView addConstraint:c->trailingConstraint];
|
[contentView addConstraint:c->trailingConstraint];
|
||||||
|
|
||||||
relation = NSLayoutRelationGreaterOrEqual;
|
relation = NSLayoutRelationGreaterThanOrEqual;
|
||||||
if (hugsBottom)
|
if (hugsBottom)
|
||||||
relation = NSLayoutRelationEqual;
|
relation = NSLayoutRelationEqual;
|
||||||
c->leadingConstraint = mkConstraint(contentView, NSLayoutAttributeBottom,
|
c->bottomConstraint = mkConstraint(contentView, NSLayoutAttributeBottom,
|
||||||
relation,
|
relation,
|
||||||
childView, NSLayoutAttributeBottom,
|
childView, NSLayoutAttributeBottom,
|
||||||
1, -margin,
|
1, -margin,
|
||||||
[desc stringByAppendingString:@" bottom constraint"]);
|
[desc stringByAppendingString:@" bottom constraint"]);
|
||||||
[contentView addConstraint:c->leadingConstraint];
|
[contentView addConstraint:c->bottomConstraint];
|
||||||
}
|
}
|
||||||
|
|
||||||
void singleChildConstraintsRemove(struct singleChildConstraints *c, NSView *cv)
|
void singleChildConstraintsRemove(struct singleChildConstraints *c, NSView *cv)
|
||||||
|
|
11
darwin/box.m
11
darwin/box.m
|
@ -196,15 +196,15 @@ struct uiBox {
|
||||||
|
|
||||||
// then arrange in the secondary direction
|
// then arrange in the secondary direction
|
||||||
for (bc in self->children) {
|
for (bc in self->children) {
|
||||||
c = mkConstraint(self, b->secondaryStart,
|
c = mkConstraint(self, self->secondaryStart,
|
||||||
NSLayoutRelationEqual,
|
NSLayoutRelationEqual,
|
||||||
[bc view], b->secondaryStart,
|
[bc view], self->secondaryStart,
|
||||||
1, 0,
|
1, 0,
|
||||||
@"uiBox secondary start constraint");
|
@"uiBox secondary start constraint");
|
||||||
[self->otherConstraints addObject:c];
|
[self->otherConstraints addObject:c];
|
||||||
c = mkConstraint([bc view], b->secondaryEnd,
|
c = mkConstraint([bc view], self->secondaryEnd,
|
||||||
NSLayoutRelationEqual,
|
NSLayoutRelationEqual,
|
||||||
self, b->secondaryEnd,
|
self, self->secondaryEnd,
|
||||||
1, 0,
|
1, 0,
|
||||||
@"uiBox secondary end constraint");
|
@"uiBox secondary end constraint");
|
||||||
[self->otherConstraints addObject:c];
|
[self->otherConstraints addObject:c];
|
||||||
|
@ -360,7 +360,7 @@ static void uiBoxSyncEnableState(uiDarwinControl *c, int enabled)
|
||||||
|
|
||||||
uiDarwinControlDefaultSetSuperview(uiBox, view)
|
uiDarwinControlDefaultSetSuperview(uiBox, view)
|
||||||
|
|
||||||
static BOOL uiBoxHugsTrailing(uiDarwinControl *c)
|
static BOOL uiBoxHugsTrailingEdge(uiDarwinControl *c)
|
||||||
{
|
{
|
||||||
uiBox *b = uiBox(c);
|
uiBox *b = uiBox(c);
|
||||||
|
|
||||||
|
@ -382,7 +382,6 @@ static void uiBoxChildEdgeHuggingChanged(uiDarwinControl *c)
|
||||||
[b->view setNeedsUpdateConstraints:YES];
|
[b->view setNeedsUpdateConstraints:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void uiBoxAppend(uiBox *b, uiControl *c, int stretchy)
|
void uiBoxAppend(uiBox *b, uiControl *c, int stretchy)
|
||||||
{
|
{
|
||||||
[b->view append:c stretchy:stretchy];
|
[b->view append:c stretchy:stretchy];
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
struct uiGroup {
|
struct uiGroup {
|
||||||
uiDarwinControl c;
|
uiDarwinControl c;
|
||||||
libuiIntrinsicBox *box;
|
NSBox *box;
|
||||||
uiControl *child;
|
uiControl *child;
|
||||||
int margined;
|
int margined;
|
||||||
struct singleChildConstraints constraints;
|
struct singleChildConstraints constraints;
|
||||||
|
@ -102,7 +102,6 @@ void uiGroupSetChild(uiGroup *g, uiControl *child)
|
||||||
uiControlSetParent(g->child, NULL);
|
uiControlSetParent(g->child, NULL);
|
||||||
}
|
}
|
||||||
g->child = child;
|
g->child = child;
|
||||||
[g->box libui_setHasChild:(g->child != NULL)];
|
|
||||||
if (g->child != NULL) {
|
if (g->child != NULL) {
|
||||||
childView = (NSView *) uiControlHandle(g->child);
|
childView = (NSView *) uiControlHandle(g->child);
|
||||||
uiControlSetParent(g->child, uiControl(g));
|
uiControlSetParent(g->child, uiControl(g));
|
||||||
|
@ -120,7 +119,7 @@ int uiGroupMargined(uiGroup *g)
|
||||||
void uiGroupSetMargined(uiGroup *g, int margined)
|
void uiGroupSetMargined(uiGroup *g, int margined)
|
||||||
{
|
{
|
||||||
g->margined = margined;
|
g->margined = margined;
|
||||||
singleChildConstraintsSetMargined(&(w->constraints), w->margined);
|
singleChildConstraintsSetMargined(&(g->constraints), g->margined);
|
||||||
// TODO issue a relayout command?
|
// TODO issue a relayout command?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +129,7 @@ uiGroup *uiNewGroup(const char *title)
|
||||||
|
|
||||||
uiDarwinNewControl(uiGroup, g);
|
uiDarwinNewControl(uiGroup, g);
|
||||||
|
|
||||||
g->box = [[libuiIntrinsicBox alloc] initWithFrame:NSZeroRect];
|
g->box = [[NSBox alloc] initWithFrame:NSZeroRect];
|
||||||
[g->box setTitle:toNSString(title)];
|
[g->box setTitle:toNSString(title)];
|
||||||
[g->box setBoxType:NSBoxPrimary];
|
[g->box setBoxType:NSBoxPrimary];
|
||||||
[g->box setBorderType:NSLineBorder];
|
[g->box setBorderType:NSLineBorder];
|
||||||
|
@ -138,7 +137,6 @@ uiGroup *uiNewGroup(const char *title)
|
||||||
[g->box setTitlePosition:NSAtTop];
|
[g->box setTitlePosition:NSAtTop];
|
||||||
// we can't use uiDarwinSetControlFont() because the selector is different
|
// we can't use uiDarwinSetControlFont() because the selector is different
|
||||||
[g->box setTitleFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]]];
|
[g->box setTitleFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]]];
|
||||||
[g->box libui_setHasChild:NO];
|
|
||||||
|
|
||||||
return g;
|
return g;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ struct uiTab {
|
||||||
|
|
||||||
@implementation tabPage
|
@implementation tabPage
|
||||||
|
|
||||||
- (id)initWithView:(NSView *)v pageID:(NSObject *o)
|
- (id)initWithView:(NSView *)v pageID:(NSObject *)o
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self != nil) {
|
if (self != nil) {
|
||||||
|
@ -141,7 +141,7 @@ void uiTabAppend(uiTab *t, const char *name, uiControl *child)
|
||||||
|
|
||||||
void uiTabInsertAt(uiTab *t, const char *name, uintmax_t n, uiControl *child)
|
void uiTabInsertAt(uiTab *t, const char *name, uintmax_t n, uiControl *child)
|
||||||
{
|
{
|
||||||
boxPage *page;
|
tabPage *page;
|
||||||
NSView *view;
|
NSView *view;
|
||||||
NSTabViewItem *i;
|
NSTabViewItem *i;
|
||||||
NSObject *pageID;
|
NSObject *pageID;
|
||||||
|
@ -176,7 +176,6 @@ void uiTabDelete(uiTab *t, uintmax_t n)
|
||||||
{
|
{
|
||||||
tabPage *page;
|
tabPage *page;
|
||||||
uiControl *child;
|
uiControl *child;
|
||||||
NSView *childView;
|
|
||||||
NSTabViewItem *i;
|
NSTabViewItem *i;
|
||||||
|
|
||||||
page = (tabPage *) [t->pages objectAtIndex:n];
|
page = (tabPage *) [t->pages objectAtIndex:n];
|
||||||
|
|
Loading…
Reference in New Issue