summaryrefslogtreecommitdiff
path: root/alf
diff options
context:
space:
mode:
Diffstat (limited to 'alf')
-rw-r--r--alf/alf.h26
-rw-r--r--alf/alflabel.cpp12
-rw-r--r--alf/alfpanel.cpp45
-rw-r--r--alf/alfpriv.h3
4 files changed, 67 insertions, 19 deletions
diff --git a/alf/alf.h b/alf/alf.h
index 037f478..faeb177 100644
--- a/alf/alf.h
+++ b/alf/alf.h
@@ -21,12 +21,20 @@ typedef struct {
} ALFWindowVTable;
typedef struct {
- void (*create)(void * /*closure*/, HWND /*panel*/);
+ void (*attachvtbl)(void * /*closure*/, HWND /*panel*/);
void (*destroy)(void * /*closure*/, HWND /*panel*/);
LRESULT (*message)(void * /*closure*/, HWND, UINT, WPARAM, LPARAM);
+ LRESULT (*command)(void * /*closure*/, HWND /*window*/, WORD /*notificationcode*/, WORD /*sourceid*/, HWND /*control*/);
+ LRESULT (*notify)(void * /*closure*/, HWND /*window*/, WPARAM /*sourceid*/, NMHDR *);
void (*paint)(void * /*closure*/, HWND, HDC, RECT * /*rcPaint*/);
+ void (*windowposchanged)(void * /*closure*/, HWND, WINDOWPOS *);
} ALFPanelVTable;
+typedef struct {
+ const ALFPanelVTable *vtbl;
+ void *closure;
+} ALFPanelSetVtblParams;
+
// layout flags
#define ALF_LAYOUT_SIZE_FIXED 0x00
#define ALF_LAYOUT_SIZE_QUERY 0x01
@@ -111,6 +119,8 @@ typedef struct {
#define ALF_WM_NTBK_GETFLAGS (ALF_WM__BASE + 201)
#define ALF_WM_NTBK_SETFLAGS (ALF_WM__BASE + 202)
+#define ALF_WM_USER (ALF_WM__BASE + 300)
+
typedef DWORD ALFColor;
#define ALF_COLOR_TRANSPARENT ((ALFColor)-1)
@@ -180,6 +190,12 @@ ALF_DefWindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
HWND
ALF_AddLabel(HWND win, WORD id, int x, int y, const TCHAR *text);
+DWORD
+ALF_LabelStyle(HWND hwndLabel);
+
+void
+ALF_LabelSetStyle(HWND hwndLabel, DWORD style);
+
HWND
ALF_AddEdit(HWND win, WORD id, int x, int y, const TCHAR *text);
@@ -328,6 +344,11 @@ ALF_LayoutColumnExpandNumerator(HWND parent, int colno);
BOOL
ALF_LayoutSetColumnExpandNumerator(HWND parent, int colno, int expand);
+
+void
+ALF_FillRect(HDC dc, const RECT *rc, ALFColor color);
+
+
// combo box
HWND
@@ -370,6 +391,9 @@ ALF_Panel_SetVTable(HWND panel, const ALFPanelVTable *vtbl, void *closure);
LRESULT
ALF_Panel_DefWindowProc(HWND panel, UINT msg, WPARAM wparam, LPARAM lparam);
+void
+ALF_Panel_DefPaint(HWND panel, HDC hDC, RECT *rcPaint);
+
// tab control
HWND
ALF_AddNotebook(HWND parent, WORD id, int x, int y);
diff --git a/alf/alflabel.cpp b/alf/alflabel.cpp
index 13c86ae..87d5baa 100644
--- a/alf/alflabel.cpp
+++ b/alf/alflabel.cpp
@@ -338,3 +338,15 @@ ALF_RegisterLabelClass(void)
_alf_labelClass = MAKEINTATOM(classatom);
}
+
+DWORD
+ALF_LabelStyle(HWND hwndLabel)
+{
+ return (DWORD)SendMessage(hwndLabel, ALF_WM_LBL_GETSTYLE, 0, 0);
+}
+
+void
+ALF_LabelSetStyle(HWND hwndLabel, DWORD style)
+{
+ SendMessage(hwndLabel, ALF_WM_LBL_SETSTYLE, 0, (LPARAM)style);
+}
diff --git a/alf/alfpanel.cpp b/alf/alfpanel.cpp
index 965264e..2f2ee68 100644
--- a/alf/alfpanel.cpp
+++ b/alf/alfpanel.cpp
@@ -21,21 +21,38 @@ ALF_Panel_ClearPriv(ALFPanelPriv *priv)
}
static void
+ALF_Panel_InternalDefPaint(ALFPanelPriv *priv, HWND hwnd, HDC dc, RECT *r)
+{
+ if (priv->layout.bgcolor == ALF_COLOR_TRANSPARENT) {
+ ALF_Compat_DrawThemeParentBackground(hwnd, dc, r);
+ } else {
+ ALF_FillRect(dc, r, priv->layout.bgcolor);
+ }
+}
+
+
+void
+ALF_Panel_DefPaint(HWND panel, HDC hDC, RECT *rcPaint)
+{
+ ALFPanelPriv *priv = (ALFPanelPriv*)GetWindowLongPtr(panel, 0);
+ ALF_Panel_InternalDefPaint(priv, panel, hDC, rcPaint);
+}
+
+static void
ALF_Panel_Paint(ALFPanelPriv *priv, HWND hwnd, HDC dc, RECT *r)
{
if (priv->vtbl && priv->vtbl->paint) {
priv->vtbl->paint(priv->closure, hwnd, dc, r);
- } else if (priv->layout.bgcolor == ALF_COLOR_TRANSPARENT) {
- ALF_Compat_DrawThemeParentBackground(hwnd, dc, r);
} else {
- ALF_FillRect(dc, r, priv->layout.bgcolor);
+ ALF_Panel_InternalDefPaint(priv, hwnd, dc, r);
}
}
void
ALF_Panel_SetVTable(HWND panel, const ALFPanelVTable *vtbl, void *closure)
{
- SendMessage(panel, ALF_WM_PANEL_SETVTABLE, (WPARAM)vtbl, (LPARAM)closure);
+ ALFPanelSetVtblParams p = { vtbl, closure };
+ SendMessage(panel, ALF_WM_PANEL_SETVTABLE, 0, (LPARAM)&p);
}
LRESULT
@@ -43,11 +60,6 @@ ALF_Panel_DefWindowProc(HWND window, UINT msg, WPARAM wparam, LPARAM lparam)
{
ALFPanelPriv *priv = (ALFPanelPriv *)GetWindowLongPtr(window, 0);
- if (msg == WM_CREATE) {
- if (priv->vtbl && priv->vtbl->create)
- priv->vtbl->create(priv->closure, window);
- }
-
if (msg == WM_DESTROY) {
if (priv->vtbl && priv->vtbl->destroy)
priv->vtbl->destroy(priv->closure, window);
@@ -57,10 +69,6 @@ ALF_Panel_DefWindowProc(HWND window, UINT msg, WPARAM wparam, LPARAM lparam)
return TRUE;
}
- if (msg == WM_SETTEXT) {
- InvalidateRect(window, NULL, TRUE);
- }
-
if (msg == WM_PRINTCLIENT) {
RECT r = { 0, 0, 0, 0 };
GetClientRect(window, &r);
@@ -82,8 +90,15 @@ ALF_Panel_DefWindowProc(HWND window, UINT msg, WPARAM wparam, LPARAM lparam)
}
if (msg == ALF_WM_PANEL_SETVTABLE) {
- priv->vtbl = (const ALFPanelVTable *)wparam;
- priv->closure = (void *)lparam;
+ const ALFPanelSetVtblParams *params = (const ALFPanelSetVtblParams *)lparam;
+ if (!params)
+ return FALSE;
+
+ priv->vtbl = params->vtbl;
+ priv->closure = params->closure;
+ if (priv->vtbl->attachvtbl) {
+ priv->vtbl->attachvtbl(priv->closure, window);
+ }
return TRUE;
}
diff --git a/alf/alfpriv.h b/alf/alfpriv.h
index c2ab557..2c79fcd 100644
--- a/alf/alfpriv.h
+++ b/alf/alfpriv.h
@@ -49,6 +49,3 @@ ALF_BuildUniqueNameW(WCHAR *buf, const WCHAR *prefix, ULONG_PTR uniquifier);
BOOL
ALF_ShouldMessageBubble(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
-
-void
-ALF_FillRect(HDC dc, const RECT *rc, ALFColor color);