Jiggled uiTab and uiGroup back to functioning properly when initially laid out.

This commit is contained in:
Pietro Gagliardi 2016-05-12 20:18:22 -04:00
parent 19006c46c6
commit e3f822a003
5 changed files with 14 additions and 1 deletions

View File

@ -18,6 +18,14 @@ NSLayoutConstraint *mkConstraint(id view1, NSLayoutAttribute attr1, NSLayoutRela
return constraint;
}
// this is needed for NSSplitView to work properly; see http://stackoverflow.com/questions/34574478/how-can-i-set-the-position-of-a-nssplitview-nowadays-setpositionofdivideratind (stal in irc.freenode.net/#macdev came up with the exact combination)
// turns out it also works on NSTabView too, possibly others!
void jiggleViewLayout(NSView *view)
{
[view setNeedsLayout:YES];
[view layoutSubtreeIfNeeded];
}
static CGFloat margins(int margined)
{
if (!margined)

View File

@ -2,7 +2,7 @@
#import "uipriv_darwin.h"
// TODOs:
// - tab on page 2 is glitched initially and doesn't grow
// - tab on page 2 doesn't grow (groupbox does instead)
// - page 3 doesn't work right; probably due to our shouldExpand logic being applied incorrectly
// TODOs to confirm

View File

@ -70,6 +70,8 @@ static void groupRelayout(uiGroup *g)
uiDarwinControlHugsBottom(uiDarwinControl(g->child)),
g->margined,
@"uiGroup");
// needed for some very rare drawing errors...
jiggleViewLayout(g->box);
}
// TODO rename these since I'm starting to get confused by what they mean by hugging

View File

@ -124,6 +124,8 @@ static void tabRelayout(uiTab *t)
for (page in t->pages)
[page establishChildConstraints];
// and this gets rid of some weird issues with regards to box alignment
jiggleViewLayout(t->tabview);
}
BOOL uiTabHugsTrailingEdge(uiDarwinControl *c)

View File

@ -57,6 +57,7 @@ extern void uninitAlloc(void);
// autolayout.m
extern NSLayoutConstraint *mkConstraint(id view1, NSLayoutAttribute attr1, NSLayoutRelation relation, id view2, NSLayoutAttribute attr2, CGFloat multiplier, CGFloat c, NSString *desc);
extern void jiggleViewLayout(NSView *view);
struct singleChildConstraints {
NSLayoutConstraint *leadingConstraint;
NSLayoutConstraint *topConstraint;