Fixed uiRadioButtons sizing problems.

This commit is contained in:
Pietro Gagliardi 2015-08-23 17:53:29 -04:00
parent 5a6d96c20c
commit 35ed8a2125
1 changed files with 1 additions and 10 deletions

View File

@ -19,13 +19,6 @@ static NSButtonCell *cellAt(uiRadioButtons *r, uintmax_t n)
return (NSButtonCell *) [r->matrix cellAtRow:n column:0]; return (NSButtonCell *) [r->matrix cellAtRow:n column:0];
} }
static void radioButtonsRelayout(uiDarwinControl *c)
{
uiRadioButtons *r = uiRadioButtons(c);
[r->matrix sizeToCells];
}
void uiRadioButtonsAppend(uiRadioButtons *r, const char *text) void uiRadioButtonsAppend(uiRadioButtons *r, const char *text)
{ {
intmax_t prevSelection; intmax_t prevSelection;
@ -37,8 +30,7 @@ void uiRadioButtonsAppend(uiRadioButtons *r, const char *text)
[cellAt(r, [r->matrix numberOfRows] - 1) setTitle:toNSString(text)]; [cellAt(r, [r->matrix numberOfRows] - 1) setTitle:toNSString(text)];
// this will definitely cause a resize in at least the vertical direction, even if not in the horizontal // this will definitely cause a resize in at least the vertical direction, even if not in the horizontal
// we do that when relaying out below // DO NOT CALL sizeToCells! this will glitch out; see http://stackoverflow.com/questions/32162562/dynamically-adding-cells-to-a-nsmatrix-laid-out-with-auto-layout-has-weird-effec
// TODO sometimes it doesn't work right
// and renew the previous selection // and renew the previous selection
// we need to turn on allowing empty selection for this to work properly on the initial state // we need to turn on allowing empty selection for this to work properly on the initial state
@ -79,7 +71,6 @@ uiRadioButtons *uiNewRadioButtons(void)
[r->matrix setAutosizesCells:YES]; [r->matrix setAutosizesCells:YES];
uiDarwinFinishNewControl(r, uiRadioButtons); uiDarwinFinishNewControl(r, uiRadioButtons);
uiDarwinControl(r)->Relayout = radioButtonsRelayout;
return r; return r;
} }