Fixed uiRadioButtons rendering on Windows.

This commit is contained in:
Pietro Gagliardi 2016-05-21 22:17:29 -04:00
parent 772caf19f3
commit a8fe3004a3
1 changed files with 10 additions and 17 deletions

View File

@ -74,8 +74,6 @@ static void uiRadioButtonsMinimumSize(uiWindowsControl *c, intmax_t *width, intm
x = radiobuttonXFromLeftOfBoxToLeftOfLabel; x = radiobuttonXFromLeftOfBoxToLeftOfLabel;
y = radiobuttonHeight; y = radiobuttonHeight;
// get it for the radio button itself since that's what counts
// TODO for all of them?
uiWindowsGetSizing((*(r->hwnds))[0], &sizing); uiWindowsGetSizing((*(r->hwnds))[0], &sizing);
uiWindowsSizingDlgUnitsToPixels(&sizing, &x, &y); uiWindowsSizingDlgUnitsToPixels(&sizing, &x, &y);
@ -86,28 +84,23 @@ static void uiRadioButtonsMinimumSize(uiWindowsControl *c, intmax_t *width, intm
static void radiobuttonsRelayout(uiRadioButtons *r) static void radiobuttonsRelayout(uiRadioButtons *r)
{ {
RECT client; RECT client;
intmax_t height1;
intmax_t h;
intmax_t x, y, width, height; intmax_t x, y, width, height;
int height1;
uiWindowsSizing sizing;
if (r->hwnds->size() == 0)
return;
uiWindowsEnsureGetClientRect(r->hwnd, &client); uiWindowsEnsureGetClientRect(r->hwnd, &client);
x = client.left; x = client.left;
y = client.top; y = client.top;
width = client.right - client.left; width = client.right - client.left;
height = client.bottom - client.top; height1 = radiobuttonHeight;
// TODO compute the real height1 uiWindowsGetSizing((*(r->hwnds))[0], &sizing);
height1 = 25; uiWindowsSizingDlgUnitsToPixels(&sizing, NULL, &height1);
height = height1;
for (const HWND &hwnd : *(r->hwnds)) { for (const HWND &hwnd : *(r->hwnds)) {
h = height1; uiWindowsEnsureMoveWindowDuringResize(hwnd, x, y, width, height);
if (h > height) // clip to height y += height;
h = height;
uiWindowsEnsureMoveWindowDuringResize(hwnd, x, y, width, h);
y += height1;
height -= height1;
if (height <= 0) // clip to height
break;
// TODO don't do the above to avoid overlap
// TODO in fact, only do this on add/remove/change labels/etc.
} }
} }