diff options
| author | Jonas Kümmerlin <jonas@kuemmerlin.eu> | 2019-01-25 22:06:18 +0100 |
|---|---|---|
| committer | Jonas Kümmerlin <jonas@kuemmerlin.eu> | 2019-01-25 22:06:18 +0100 |
| commit | 6b301ea64ca71777e38611d8c49dd119808b4365 (patch) | |
| tree | ed03de73b802a337b62eafe1ae28f10e6312d8d9 /alf | |
| parent | 55211af76164fe6c39249c14be47363d35a4db0f (diff) | |
remove edit control margins to match up with button
we'll owner-draw the button to get rid of the margin
Diffstat (limited to 'alf')
| -rw-r--r-- | alf/alfbutton.cpp | 17 | ||||
| -rw-r--r-- | alf/alfcombobox.cpp | 9 | ||||
| -rw-r--r-- | alf/alfedit.cpp | 7 | ||||
| -rw-r--r-- | alf/alflabel.cpp | 3 |
4 files changed, 9 insertions, 27 deletions
diff --git a/alf/alfbutton.cpp b/alf/alfbutton.cpp index 5f7a638..9cf7c1d 100644 --- a/alf/alfbutton.cpp +++ b/alf/alfbutton.cpp @@ -33,7 +33,7 @@ ALF__ButtonSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT int xpadding = ALF_Compat_GetSystemMetricsForDpi(SM_CXEDGE, ALF_CentipointsToPixels(GetParent(hwnd), 7200)) * 2 + 6; int ypadding = ALF_Compat_GetSystemMetricsForDpi(SM_CYEDGE, - ALF_CentipointsToPixels(GetParent(hwnd), 7200)) * 2 + 6; + ALF_CentipointsToPixels(GetParent(hwnd), 7200)) * 2 + 4; SIZE *pSize = (SIZE*)(void*)lParam; if (pSize->cx < r.right - r.left + xpadding) { @@ -50,19 +50,6 @@ ALF__ButtonSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT SelectFont(hdc, oldFont); ReleaseDC(hwnd, hdc); - } else if (uMsg == ALF_WM_APPLYSIZE) { - // HACK: a themed button contains a 1px margin. An unthemed button - // does not, so we add one. - - RECT *p = (RECT *)lParam; - - int padding = ALF_Compat_IsAppThemed() ? 0 : 1; - - return (LRESULT)DeferWindowPos((HDWP)wParam, - hwnd, NULL, - p->left, p->top + padding, - p->right - p->left, p->bottom - p->top - 2*padding, - SWP_NOZORDER|SWP_NOACTIVATE); } else if (uMsg == WM_DESTROY) { ALF_Compat_RemoveWindowSubclass(hwnd, ALF__ButtonSubclassProc, 0); } @@ -93,7 +80,7 @@ ALF_AddButton(HWND win, WORD id, UINT x, UINT y, const TCHAR *text) p.y = y; p.width = 0; p.height = 0; - p.flags = ALF_QUERYSIZE | ALF_MESSAGEFONT | ALF_APPLYSIZE; + p.flags = ALF_QUERYSIZE | ALF_MESSAGEFONT; ALF_AddWidgetEx(win, &p); diff --git a/alf/alfcombobox.cpp b/alf/alfcombobox.cpp index df88730..0444b14 100644 --- a/alf/alfcombobox.cpp +++ b/alf/alfcombobox.cpp @@ -153,8 +153,7 @@ ALF__ComboWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) if (!ps->cy) { ps->cy = tm.tmHeight + 2*ALF_Compat_GetSystemMetricsForDpi( SM_CYEDGE, ALF_CentipointsToPixels(GetParent(hwnd), 7200)) - + 4 /* padding internal to the edit control */ - + 2 /* external padding to line up with themed button */; + + 4 /* padding internal to the edit control */; } } @@ -241,16 +240,14 @@ ALF__ComboWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) DWORD sel = SendMessage(hwndChild, CB_GETEDITSEL, 0, 0); SendMessage(hwndChild, CB_SETEDITSEL, 0, -1); // SWP_NOCOPYBITS because NT 3.51 doesn't properly repaint the drop-down button - SetWindowPos(hwndChild, NULL, 0, 1, pos->cx, 200, SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOCOPYBITS); + SetWindowPos(hwndChild, NULL, 0, 0, pos->cx, 200, SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOCOPYBITS); SendMessage(hwndChild, CB_SETEDITSEL, 0, (LPARAM)sel); DWORD heightOffset = 0; if (LOBYTE(LOWORD(GetVersion())) >= 4) { heightOffset = - 2*ALF_Compat_GetSystemMetricsForDpi( SM_CYEDGE, ALF_CentipointsToPixels(GetParent(hwnd), 7200)) - - 4; - } else { - heightOffset = -2; + - 2; } SendMessage(hwndChild, CB_SETITEMHEIGHT, (WPARAM)-1, pos->cy + heightOffset); diff --git a/alf/alfedit.cpp b/alf/alfedit.cpp index 1fde70d..c6570e4 100644 --- a/alf/alfedit.cpp +++ b/alf/alfedit.cpp @@ -26,8 +26,7 @@ ALF__EditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_P if (!ps->cy) { ps->cy = tm.tmHeight + 2*ALF_Compat_GetSystemMetricsForDpi( SM_CYEDGE, ALF_CentipointsToPixels(GetParent(hwnd), 7200)) - + 4 /* padding internal to the edit control */ - + 2 /* external padding to line up with themed button */; + + 4 /* padding internal to the edit control */; } } @@ -42,8 +41,8 @@ ALF__EditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_P // SWP_NOCOPYBITS as a bandaid since NT 3.51 doesn't invalidate properly return (LRESULT)DeferWindowPos((HDWP)wParam, hwnd, NULL, - p->left, p->top + 1, - p->right - p->left, p->bottom - p->top - 2, + p->left, p->top, + p->right - p->left, p->bottom - p->top, SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOCOPYBITS); } else if (uMsg == WM_DESTROY) { ALF_Compat_RemoveWindowSubclass(hwnd, ALF__EditSubclassProc, 0); diff --git a/alf/alflabel.cpp b/alf/alflabel.cpp index 0a18a54..e7550e4 100644 --- a/alf/alflabel.cpp +++ b/alf/alflabel.cpp @@ -9,8 +9,7 @@ int ALF__LabelTopPadding(HWND hwnd) // see also: alfedit.cpp return ALF_Compat_GetSystemMetricsForDpi( SM_CYEDGE, ALF_CentipointsToPixels(GetParent(hwnd), 7200)) - + ((LOBYTE(LOWORD(GetVersion())) < 4) ? 2 : 1) /* internal padding in edit control */ - + 1 /* external padding around edit control */; + + ((LOBYTE(LOWORD(GetVersion())) < 4) ? 2 : 1) /* internal padding in edit control */; } static LRESULT CALLBACK |
