summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--alf/alf.cpp17
-rw-r--r--alf/alf.h9
-rw-r--r--widgetfactory.cpp6
3 files changed, 10 insertions, 22 deletions
diff --git a/alf/alf.cpp b/alf/alf.cpp
index c83ac4a..78eed99 100644
--- a/alf/alf.cpp
+++ b/alf/alf.cpp
@@ -3,11 +3,11 @@
/* ALF App and Window */
static void
-ALF_InitializeWindowPriv(HWND hwnd, ALFWindowPriv *priv, ALFWindowInstanceParams *params)
+ALF_InitializeWindowPriv(HWND hwnd, ALFWindowPriv *priv, void *closure)
{
priv->vtbl = (ALFWindowVTable*)GetClassLongPtr(hwnd, 0);
priv->app = (ALFAPP)GetClassLongPtr(hwnd, sizeof(void*));
- priv->closure = params->closure;
+ priv->closure = closure;
ALF_ListInit(&priv->widgets);
priv->defid = (WORD)-1;
}
@@ -486,10 +486,9 @@ ALF_WindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
if (msg == WM_NCCREATE) {
CREATESTRUCT *cs = (CREATESTRUCT*)(void*)lparam;
- ALFWindowInstanceParams *params = (ALFWindowInstanceParams*)cs->lpCreateParams;
ALFWindowPriv *priv = (ALFWindowPriv*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY|HEAP_GENERATE_EXCEPTIONS, sizeof(ALFWindowPriv));
SetWindowLongPtr(hwnd, 0, (LONG_PTR)priv);
- ALF_InitializeWindowPriv(hwnd, priv, params);
+ ALF_InitializeWindowPriv(hwnd, priv, cs->lpCreateParams);
}
ALFWindowPriv *priv = (ALFWindowPriv*)(void*)GetWindowLongPtr(hwnd, 0);
@@ -555,18 +554,18 @@ ALF_RegisterWindowClass(ALFAPP app, const ALFWindowClassParams *params)
return MAKEINTATOM(classatom);
}
-HWND ALF_InstantiateWindow(ALFAPP app, LPCTSTR className, const ALFWindowInstanceParams* params)
+HWND ALF_InstantiateWindow(ALFAPP app, LPCTSTR className, HWND hwndParent, void *closure)
{
- return CreateWindowEx(params->windowExStyle,
+ return CreateWindowEx(0,
className,
L"Window",
- params->windowStyle,
+ WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
CW_USEDEFAULT, CW_USEDEFAULT,
300, 100, //FIXME
- params->hwndParent,
+ hwndParent,
NULL,
app->hInstance,
- (void*)params);
+ closure);
}
ALFAPP
diff --git a/alf/alf.h b/alf/alf.h
index 987874a..6730445 100644
--- a/alf/alf.h
+++ b/alf/alf.h
@@ -53,13 +53,6 @@ typedef struct {
} ALFWindowClassParams;
typedef struct {
- void *closure;
- HWND hwndParent;
- UINT windowStyle;
- UINT windowExStyle;
-} ALFWindowInstanceParams;
-
-typedef struct {
HWND hwnd;
UINT x;
UINT y;
@@ -93,7 +86,7 @@ void
ALF_UnregisterWindowClass(ALFAPP app, LPCTSTR className);
HWND
-ALF_InstantiateWindow(ALFAPP app, LPCTSTR className, const ALFWindowInstanceParams *params);
+ALF_InstantiateWindow(ALFAPP app, LPCTSTR className, HWND hwndParent, void *closure);
ALFAPP
ALF_ApplicationFromWindow(HWND hwnd);
diff --git a/widgetfactory.cpp b/widgetfactory.cpp
index 5599404..a6c4a81 100644
--- a/widgetfactory.cpp
+++ b/widgetfactory.cpp
@@ -69,11 +69,7 @@ wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCm
ALF_RegisterWindowClass(app, &cparams);
- ALFWindowInstanceParams params;
- ZeroMemory(&params, sizeof(params));
- params.windowStyle = WS_OVERLAPPEDWINDOW;
-
- HWND win = ALF_InstantiateWindow(app, TEXT("DummyClass"), &params);
+ HWND win = ALF_InstantiateWindow(app, TEXT("DummyClass"), NULL, NULL);
ALF_AddLabel(win, ID_LBL2, 1, 0, L"Hello, 2!\nblub");