summaryrefslogtreecommitdiff
path: root/alf/alfedit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'alf/alfedit.cpp')
-rw-r--r--alf/alfedit.cpp52
1 files changed, 1 insertions, 51 deletions
diff --git a/alf/alfedit.cpp b/alf/alfedit.cpp
index 87ddf80..f732452 100644
--- a/alf/alfedit.cpp
+++ b/alf/alfedit.cpp
@@ -1,55 +1,6 @@
#include "alfpriv.h"
/* EDIT */
-static LRESULT CALLBACK
-ALF__EditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
-{
- (void)uIdSubclass;
- (void)dwRefData;
-
- if (uMsg == ALF_WM_QUERYSIZE) {
- HDC hDc = GetDC(hwnd);
- HFONT font = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0);
-
- HFONT oldfont = SelectFont(hDc, font);
-
- TEXTMETRIC tm;
- ZeroMemory(&tm, sizeof(tm));
-
- if (GetTextMetrics(hDc, &tm)) {
- SIZE *ps = (SIZE*)lParam;
- if (!ps->cx) {
- ps->cx = ALF_CentipointsToPixels(GetParent(hwnd), 12000);
- }
-
- if (!ps->cy) {
- ps->cy = tm.tmHeight + 2*ALF_Compat_GetSystemMetricsForDpi(
- SM_CYEDGE, (UINT)ALF_CentipointsToPixels(GetParent(hwnd), 7200))
- + 4 /* padding internal to the edit control */;
- }
- }
-
- SelectFont(hDc, oldfont);
-
- ReleaseDC(hwnd, hDc);
- return 0;
- } else if (uMsg == ALF_WM_APPLYSIZE) {
- RECT *p = (RECT *)lParam;
-
- // SWP_NOCOPYBITS as a bandaid since NT 3.51 doesn't invalidate properly
- return (LRESULT)DeferWindowPos((HDWP)wParam,
- hwnd, NULL,
- 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);
- } else if (uMsg == WM_SETFONT) {
- ALF_InvalidateLayout(GetParent(hwnd));
- }
-
- return ALF_Compat_DefSubclassProc(hwnd, uMsg, wParam, lParam);
-}
HWND
ALF_AddEdit(HWND win, WORD id, int x, int y, const TCHAR *text)
@@ -75,10 +26,9 @@ ALF_AddEdit(HWND win, WORD id, int x, int y, const TCHAR *text)
(HINSTANCE)GetWindowLongPtr(win, GWLP_HINSTANCE),
NULL);
- ALF_Compat_SetWindowSubclass(hwndEdit, ALF__EditSubclassProc, 0, 0);
SetWindowPos(hwndEdit, NULL, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_FRAMECHANGED);
- ALF_AddWidget(win, x, y, hwndEdit, 0, 0, ALF_LAYOUT_SIZE_QUERY | ALF_LAYOUT_CUSTOMPOS | ALF_LAYOUT_INHERITFONT);
+ ALF_AddWidget(win, x, y, hwndEdit, 0, 0, ALF_LAYOUT_SIZE_EDIT | ALF_LAYOUT_INHERITFONT);
return hwndEdit;
}