From c9ebff8e7de093e7705aab6208593fae048ad98d Mon Sep 17 00:00:00 2001 From: Jonas Kümmerlin Date: Fri, 29 May 2020 23:43:00 +0200 Subject: 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. --- alf/alfpriv.h | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) (limited to 'alf/alfpriv.h') diff --git a/alf/alfpriv.h b/alf/alfpriv.h index dd36f55..eb3c358 100644 --- a/alf/alfpriv.h +++ b/alf/alfpriv.h @@ -17,34 +17,14 @@ #include "alfcompat.h" #include "alflayout.h" -extern TCHAR *_alf_comboClass; -extern TCHAR *_alf_panelClass; -extern TCHAR *_alf_labelClass; -extern TCHAR *_alf_notebookClass; -extern TCHAR *_alf_buttonClass; -extern TCHAR *_alf_groupboxClass; extern TCHAR _alf_windowClass[]; +extern TCHAR _alf_controlClass[]; void -ALF_RegisterComboClass(void); - -void -ALF_RegisterPanelClass(void); - -void -ALF_RegisterLabelClass(void); - -void -ALF_RegisterNotebookClass(void); - -void -ALF_RegisterButtonClass(void); - -void -ALF_RegisterGroupBoxClass(void); +ALF_RegisterWindowClass(void); void -ALF_RegisterWindowClass(void); +ALF_RegisterControlClass(void); HWND ALF_CreatePanelWindow(HWND parent, WORD id); @@ -55,5 +35,19 @@ ALF_BuildUniqueName(TCHAR *buf, const TCHAR *prefix, ULONG_PTR uniquifier); void ALF_BuildUniqueNameW(WCHAR *buf, const WCHAR *prefix, ULONG_PTR uniquifier); +// TODO: think about making it public BOOL ALF_ShouldMessageBubble(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); + +// TODO: refine custom control API, make it public + +// passed as ptr in WM_CREATE +typedef struct { + WNDPROC windowProc; + void *param; +} ALFControlCreateParams; + +HWND +ALF_CreateControlWindow(DWORD exstyle, const TCHAR *text, DWORD style, + int x, int y, int w, int h, HWND parent, HMENU hmenu, + WNDPROC windowProc, void *param); -- cgit v1.2.3