Ensure only x size of entry is changed

This commit is contained in:
Francesco Abbate 2018-06-30 23:06:33 +02:00
parent a9dab61430
commit e19f78f56f
3 changed files with 10 additions and 12 deletions

View File

@ -242,7 +242,7 @@ struct uiWindowsSizing {
};
_UI_EXTERN void uiWindowsGetSizing(HWND hwnd, uiWindowsSizing *sizing);
_UI_EXTERN void uiWindowsSizingDlgUnitsToPixels(uiWindowsSizing *sizing, int *x, int *y);
_UI_EXTERN void uiWindowsSizingCharsToPixels(uiWindowsSizing *sizing, int *x, int *y, int width_chars);
_UI_EXTERN void uiWindowsSizingCharsToPixels(uiWindowsSizing *sizing, int *x, int width_chars);
_UI_EXTERN void uiWindowsSizingStandardPadding(uiWindowsSizing *sizing, int *x, int *y);
// TODO document

View File

@ -44,14 +44,12 @@ static void uiEntryMinimumSize(uiWindowsControl *c, int *width, int *height)
uiWindowsSizing sizing;
int x, y;
if (e->width_chars <= 0) {
x = entryWidth;
y = entryHeight;
uiWindowsGetSizing(e->hwnd, &sizing);
uiWindowsSizingDlgUnitsToPixels(&sizing, &x, &y);
} else {
uiWindowsGetSizing(e->hwnd, &sizing);
uiWindowsSizingCharsToPixels(&sizing, &x, &y, e->width_chars);
x = entryWidth;
y = entryHeight;
uiWindowsGetSizing(e->hwnd, &sizing);
uiWindowsSizingDlgUnitsToPixels(&sizing, &x, &y);
if (e->width_chars > 0) {
uiWindowsSizingCharsToPixels(&sizing, &x, e->width_chars);
}
*width = x;
*height = y;

View File

@ -48,10 +48,10 @@ void uiWindowsSizingDlgUnitsToPixels(uiWindowsSizing *sizing, int *x, int *y)
*y = dlgUnitsToY(*y, sizing->BaseY);
}
void uiWindowsSizingCharsToPixels(uiWindowsSizing *sizing, int *x, int *y, int width_chars)
void uiWindowsSizingCharsToPixels(uiWindowsSizing *sizing, int *x, int width_chars)
{
*x = sizing->BaseX * width_chars;
*y = sizing->BaseY;
if (x != NULL)
*x = sizing->BaseX * width_chars;
}
// from https://msdn.microsoft.com/en-us/library/windows/desktop/dn742486.aspx#sizingandspacing and https://msdn.microsoft.com/en-us/library/windows/desktop/bb226818%28v=vs.85%29.aspx