summaryrefslogtreecommitdiff
path: root/alf/alfcombobox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'alf/alfcombobox.cpp')
-rw-r--r--alf/alfcombobox.cpp36
1 files changed, 28 insertions, 8 deletions
diff --git a/alf/alfcombobox.cpp b/alf/alfcombobox.cpp
index 8afdace..a6e846f 100644
--- a/alf/alfcombobox.cpp
+++ b/alf/alfcombobox.cpp
@@ -24,6 +24,13 @@ ALF__ComboItemHeight(HWND hwnd)
SelectFont(hDc, oldfont);
}
+ if (LOBYTE(LOWORD(GetVersion())) < 4) {
+ // baseline alignment for NT3.x/Win32s
+ // ideally, this would only be applied for the ODS_COMOBOXEDIT state,
+ // but that state is not sent pre-Win95.
+ height += 2;
+ }
+
ReleaseDC(hwnd, hDc);
return height;
}
@@ -42,9 +49,7 @@ ALF__ComboWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (uMsg == WM_CREATE) {
ALFComboCreateParams *params = (ALFComboCreateParams*)((CREATESTRUCT*)lParam)->lpCreateParams;
- DWORD comboStyle = params->comboStyle;
- if (LOBYTE(LOWORD(GetVersion())) >= 4)
- comboStyle |= CBS_OWNERDRAWFIXED | CBS_HASSTRINGS;
+ DWORD comboStyle = params->comboStyle | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS;
HWND hwndCombo = CreateWindowEx(0,
TEXT("COMBOBOX"),
@@ -186,6 +191,13 @@ ALF__ComboWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LONG y = lpdis->rcItem.top;
LONG x = lpdis->rcItem.left;
+ if (LOBYTE(LOWORD(GetVersion())) < 4) {
+ // baseline alignment for NT3.x/Win32s
+ // ideally, this would only be applied for the ODS_COMOBOXEDIT state,
+ // but that state is not sent pre-Win95.
+ y += 1;
+ }
+
// add left padding like an edit control
TEXTMETRIC tm;
ZeroMemory(&tm, sizeof(tm));
@@ -233,13 +245,21 @@ ALF__ComboWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
SetWindowPos(hwndChild, NULL, 0, 1, pos->cx, 200, SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOCOPYBITS);
SendMessage(hwndChild, CB_SETEDITSEL, 0, (LPARAM)sel);
+ DWORD heightOffset = 0;
if (LOBYTE(LOWORD(GetVersion())) >= 4) {
- SendMessage(hwndChild, CB_SETITEMHEIGHT, (WPARAM)-1, pos->cy - 8);
-
- int h = ALF__ComboItemHeight(hwnd);
- if (h)
- SendMessage(hwndChild, CB_SETITEMHEIGHT, (WPARAM)0, h);
+ heightOffset = - 2*app->compatFn->GetSystemMetricsForDpi(
+ SM_CYEDGE, ALF_CentipointsToPixels(GetParent(hwnd), 7200))
+ - 4;
+ } else {
+ heightOffset = -2;
}
+
+ SendMessage(hwndChild, CB_SETITEMHEIGHT, (WPARAM)-1, pos->cy + heightOffset);
+
+ int h = ALF__ComboItemHeight(hwnd);
+ if (h)
+ SendMessage(hwndChild, CB_SETITEMHEIGHT, (WPARAM)0, h);
+
}
}