diff options
| author | Jonas Kümmerlin <jonas@kuemmerlin.eu> | 2020-05-29 23:43:00 +0200 |
|---|---|---|
| committer | Jonas Kümmerlin <jonas@kuemmerlin.eu> | 2020-05-29 23:43:00 +0200 |
| commit | c9ebff8e7de093e7705aab6208593fae048ad98d (patch) | |
| tree | 06f641c182e4013e95c7fa1f255e4adbd32a67f2 /alf/alfgroupbox.cpp | |
| parent | 46326d57e0c912f265595ffed375d211bbe23f44 (diff) | |
controls: subclass generic "ALFControl" window
The idea is that the compiler can strip unused controls when linking
statically, but the window class initialization functions blocked that.
Diffstat (limited to 'alf/alfgroupbox.cpp')
| -rw-r--r-- | alf/alfgroupbox.cpp | 41 |
1 files changed, 8 insertions, 33 deletions
diff --git a/alf/alfgroupbox.cpp b/alf/alfgroupbox.cpp index 5c459dc..bfe5519 100644 --- a/alf/alfgroupbox.cpp +++ b/alf/alfgroupbox.cpp @@ -5,8 +5,6 @@ #define GBS_DISABLED 2 #define TMT_TEXTCOLOR 3803 -TCHAR *_alf_groupboxClass = NULL; - typedef struct { ALFLayout layout; HTHEME theme; @@ -342,40 +340,17 @@ ALF_GroupBox_WindowProc(HWND window, UINT msg, WPARAM wparam, LPARAM lparam) return DefWindowProc(window, msg, wparam, lparam); } -void -ALF_RegisterGroupBoxClass(void) -{ - WNDCLASS cls; - ZeroMemory(&cls, sizeof(cls)); - - TCHAR classNameBuf[256]; - ALF_BuildUniqueName(classNameBuf, TEXT("ALFGroupBox."), (ULONG_PTR)&_alf_groupboxClass); - - cls.hInstance = ALF_HINSTANCE; - cls.hCursor = LoadCursor(NULL, (LPTSTR)IDC_ARROW); - cls.lpszClassName = classNameBuf; - cls.cbWndExtra = sizeof(void*); - cls.lpfnWndProc = ALF_GroupBox_WindowProc; - - ATOM classatom = RegisterClass(&cls); - if (!classatom) - MessageBox(NULL, TEXT("FATAL: Could not register groupbox class"), NULL, MB_OK); - - _alf_groupboxClass = MAKEINTATOM(classatom); -} - HWND ALF_AddGroupBox(HWND parent, WORD id, int x, int y, const TCHAR *text) { - HWND hwndPanel = CreateWindowEx(WS_EX_CONTROLPARENT, - _alf_groupboxClass, - text, - WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP, - 0, 0, 0, 0, - parent, - (HMENU)(UINT_PTR)id, - ALF_HINSTANCE, - NULL); + HWND hwndPanel = ALF_CreateControlWindow(WS_EX_CONTROLPARENT, + text, + WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP, + 0, 0, 0, 0, + parent, + (HMENU)(UINT_PTR)id, + ALF_GroupBox_WindowProc, + NULL); ALF_AddWidget(parent, x, y, hwndPanel, 0, 0, ALF_LAYOUT_SIZE_QUERY | ALF_LAYOUT_INHERITFONT | ALF_LAYOUT_INHERITBGCOLOR | ALF_LAYOUT_SENDBGCHANGE | ALF_LAYOUT_SENDDPICHANGE); |
