summaryrefslogtreecommitdiff
path: root/alf/alflayout.cpp
diff options
context:
space:
mode:
authorJonas Kümmerlin <jonas@kuemmerlin.eu>2020-05-23 12:28:31 +0200
committerJonas Kümmerlin <jonas@kuemmerlin.eu>2020-05-23 12:28:31 +0200
commit1069c22d0da82ba81a9fb1242a808e0a65316b55 (patch)
tree716c222c373fe75834f204bb86ccc40acc53f396 /alf/alflayout.cpp
parentc218c7323a069eedbb42fbc31b0bcd8a664928c1 (diff)
move checkbox into button
Diffstat (limited to 'alf/alflayout.cpp')
-rw-r--r--alf/alflayout.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/alf/alflayout.cpp b/alf/alflayout.cpp
index 0fa3473..470f728 100644
--- a/alf/alflayout.cpp
+++ b/alf/alflayout.cpp
@@ -214,8 +214,6 @@ ALF_Layout_CalcCheckboxSize(HWND hwndWindow, ALFLayout *layout, HWND hwndCheckbo
{
(void)hwndWindow;
- int checkwidth = 12 * layout->dpi / 96 + 1;
-
HDC hDC = GetDC(hwndCheckbox);
HFONT font = (HFONT)SendMessage(hwndCheckbox, WM_GETFONT, 0, 0);
HFONT oldfont = SelectFont(hDC, font);
@@ -230,11 +228,24 @@ ALF_Layout_CalcCheckboxSize(HWND hwndWindow, ALFLayout *layout, HWND hwndCheckbo
int cx = 0;
GetCharWidth(hDC, '0', '0', &cx);
+ int checkwidth = 12 * layout->dpi / 96 + 1;
+ int checkheight = checkwidth;
+
+ if (!ALF_Compat_IsMinWindowsVersion(4, 0)) {
+ // 3.x-style checkboxes have the checkmark baseline-aligned
+ TEXTMETRIC tm;
+ ZeroMemory(&tm, sizeof(tm));
+
+ if (GetTextMetrics(hDC, &tm)) {
+ checkheight += tm.tmDescent;
+ }
+ }
+
cx += checkwidth + r.right - r.left;
int cy = r.bottom - r.top;
- if (checkwidth > cy)
- cy = checkwidth;
+ if (checkheight > cy)
+ cy = checkheight;
if (ps->cx < cx)
ps->cx = cx;