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 uiWindowsGetSizing(HWND hwnd, uiWindowsSizing *sizing);
_UI_EXTERN void uiWindowsSizingDlgUnitsToPixels(uiWindowsSizing *sizing, int *x, int *y); _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); _UI_EXTERN void uiWindowsSizingStandardPadding(uiWindowsSizing *sizing, int *x, int *y);
// TODO document // TODO document

View File

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

View File

@ -48,10 +48,10 @@ void uiWindowsSizingDlgUnitsToPixels(uiWindowsSizing *sizing, int *x, int *y)
*y = dlgUnitsToY(*y, sizing->BaseY); *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)
{ {
if (x != NULL)
*x = sizing->BaseX * width_chars; *x = sizing->BaseX * width_chars;
*y = sizing->BaseY;
} }
// 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 // 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