summaryrefslogtreecommitdiff
path: root/alf/alflabel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'alf/alflabel.cpp')
-rw-r--r--alf/alflabel.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/alf/alflabel.cpp b/alf/alflabel.cpp
index 108c8d5..eb27fb1 100644
--- a/alf/alflabel.cpp
+++ b/alf/alflabel.cpp
@@ -3,11 +3,11 @@
/* LABEL */
static
-int ALF__LabelTopPadding(HWND hwnd, ALFAPP app)
+int ALF__LabelTopPadding(HWND hwnd)
{
// some pixels on top to align with the edit control
// see also: alfedit.cpp
- return app->compatFn->GetSystemMetricsForDpi(
+ 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 */;
@@ -19,8 +19,6 @@ ALF__LabelSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_
(void)uIdSubclass;
(void)dwRefData;
- ALFAPP app = (ALFAPP)dwRefData;
-
if (uMsg == ALF_WM_QUERYSIZE) {
HDC hdcLabel = GetDC(hwnd);
HFONT font = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0);
@@ -52,7 +50,7 @@ ALF__LabelSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_
if (pSize->cx == 0)
pSize->cx = r.right - r.left;
if (pSize->cy == 0)
- pSize->cy = r.bottom - r.top + ALF__LabelTopPadding(hwnd, app);
+ pSize->cy = r.bottom - r.top + ALF__LabelTopPadding(hwnd);
if (font)
SelectFont(hdcLabel, oldFont);
@@ -61,7 +59,7 @@ ALF__LabelSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_
} else if (uMsg == ALF_WM_APPLYSIZE) {
RECT *p = (RECT *)lParam;
- int topPadding = ALF__LabelTopPadding(hwnd, app);
+ int topPadding = ALF__LabelTopPadding(hwnd);
return (LRESULT)DeferWindowPos((HDWP)wParam,
hwnd, NULL,
@@ -69,10 +67,10 @@ ALF__LabelSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_
p->right - p->left, p->bottom - p->top - topPadding,
SWP_NOZORDER|SWP_NOACTIVATE);
} else if (uMsg == WM_DESTROY) {
- app->compatFn->RemoveWindowSubclass(hwnd, ALF__LabelSubclassProc, 0);
+ ALF_Compat_RemoveWindowSubclass(hwnd, ALF__LabelSubclassProc, 0);
}
- return app->compatFn->DefSubclassProc(hwnd, uMsg, wParam, lParam);
+ return ALF_Compat_DefSubclassProc(hwnd, uMsg, wParam, lParam);
}
HWND
@@ -87,8 +85,7 @@ ALF_AddLabel(HWND win, WORD id, UINT x, UINT y, const TCHAR *text)
(HINSTANCE)GetWindowLongPtr(win, GWLP_HINSTANCE),
NULL);
- ALFAPP app = ALF_ApplicationFromWindow(win);
- app->compatFn->SetWindowSubclass(hwndLabel, ALF__LabelSubclassProc, 0, (DWORD_PTR)app);
+ ALF_Compat_SetWindowSubclass(hwndLabel, ALF__LabelSubclassProc, 0, 0);
ALFWidgetLayoutParams p;
ZeroMemory(&p, sizeof(p));