summaryrefslogtreecommitdiff
path: root/alf/alfnotebook.cpp
diff options
context:
space:
mode:
authorJonas Kümmerlin <jonas@kuemmerlin.eu>2020-05-29 23:43:00 +0200
committerJonas Kümmerlin <jonas@kuemmerlin.eu>2020-05-29 23:43:00 +0200
commitc9ebff8e7de093e7705aab6208593fae048ad98d (patch)
tree06f641c182e4013e95c7fa1f255e4adbd32a67f2 /alf/alfnotebook.cpp
parent46326d57e0c912f265595ffed375d211bbe23f44 (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/alfnotebook.cpp')
-rw-r--r--alf/alfnotebook.cpp41
1 files changed, 8 insertions, 33 deletions
diff --git a/alf/alfnotebook.cpp b/alf/alfnotebook.cpp
index 314ee85..bdcb304 100644
--- a/alf/alfnotebook.cpp
+++ b/alf/alfnotebook.cpp
@@ -10,8 +10,6 @@
#define TABP_BODY 10
#define TMT_FILLCOLORHINT 3821
-TCHAR *_alf_notebookClass = NULL;
-
typedef struct {
HWND hwndTabCtrl;
HTHEME hTheme;
@@ -559,41 +557,18 @@ ALF__NotebookWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
-void
-ALF_RegisterNotebookClass(void)
-{
- WNDCLASS cls;
- ZeroMemory(&cls, sizeof(cls));
-
- TCHAR classNameBuf[256];
- ALF_BuildUniqueName(classNameBuf, TEXT("ALFNotebook."), (ULONG_PTR)&_alf_notebookClass);
-
- cls.hInstance = ALF_HINSTANCE;
- cls.hCursor = LoadCursor(NULL, (LPTSTR)IDC_ARROW);
- cls.lpszClassName = classNameBuf;
- cls.cbWndExtra = sizeof(ALFNotebookPriv*);
- cls.lpfnWndProc = ALF__NotebookWindowProc;
-
- ATOM classatom = RegisterClass(&cls);
- if (!classatom)
- MessageBox(NULL, TEXT("FATAL: Could not register notebook class"), NULL, MB_OK);
-
- _alf_notebookClass = MAKEINTATOM(classatom);
-}
-
// tab control
HWND
ALF_AddNotebook(HWND parent, WORD id, int x, int y)
{
- HWND hwndNtbk = CreateWindowEx(WS_EX_CONTROLPARENT,
- _alf_notebookClass,
- TEXT(""),
- WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN,
- 0, 0, 100, 100,
- parent,
- (HMENU)(ULONG_PTR)id,
- ALF_HINSTANCE,
- NULL);
+ HWND hwndNtbk = ALF_CreateControlWindow(WS_EX_CONTROLPARENT,
+ TEXT(""),
+ WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN,
+ 0, 0, 100, 100,
+ parent,
+ (HMENU)(ULONG_PTR)id,
+ ALF__NotebookWindowProc,
+ NULL);
ALF_AddWidget(parent, x, y, hwndNtbk, 0, 0, ALF_LAYOUT_SIZE_QUERY | ALF_LAYOUT_INHERITFONT | ALF_LAYOUT_SENDDPICHANGE);