summaryrefslogtreecommitdiff
path: root/alf
diff options
context:
space:
mode:
Diffstat (limited to 'alf')
-rw-r--r--alf/alf.cpp19
-rw-r--r--alf/alf.h15
-rw-r--r--alf/alflayout.cpp20
-rw-r--r--alf/alfpriv.h7
4 files changed, 52 insertions, 9 deletions
diff --git a/alf/alf.cpp b/alf/alf.cpp
index 0d50f4a..40b4156 100644
--- a/alf/alf.cpp
+++ b/alf/alf.cpp
@@ -343,6 +343,7 @@ ALF_CreateApplication(HINSTANCE hInstance)
app->compatFn = ALF_CreateCompatFuncTable();
ALF_RegisterComboClass(app);
+ ALF_RegisterPanelClass(app);
return app;
}
@@ -351,6 +352,7 @@ void
ALF_TeardownApplication(ALFAPP app)
{
UnregisterClass(app->comboClass, app->hInstance);
+ UnregisterClass(app->panelClass, app->hInstance);
HeapFree(GetProcessHeap(), 0, app->compatFn);
HeapFree(GetProcessHeap(), 0, app);
}
@@ -695,3 +697,20 @@ ALF_WidgetAtLayoutPosition(HWND parent, UINT x, UINT y)
return (HWND)SendMessage(parent, ALF_WM_GETWIDGETATPOS, 0, (LPARAM)&xy);
}
+
+BOOL
+ALF_ShouldMessageBubble(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
+{
+ (void)wparam;
+ (void)lparam;
+
+ if (!GetParent(hwnd))
+ return FALSE;
+
+ return msg == ALF_WM_GETAPPLICATION || msg == ALF_WM_CENTIPOINTTOPX
+ || msg == WM_COMMAND || msg == WM_NOTIFY
+ || msg == WM_MEASUREITEM || msg == WM_DRAWITEM
+ || msg == WM_CTLCOLORBTN || msg == WM_CTLCOLOREDIT
+ || msg == WM_CTLCOLORLISTBOX || msg == WM_CTLCOLORSCROLLBAR
+ || msg == WM_CTLCOLORSTATIC;
+}
diff --git a/alf/alf.h b/alf/alf.h
index 3388b48..d264e93 100644
--- a/alf/alf.h
+++ b/alf/alf.h
@@ -26,10 +26,14 @@ typedef struct {
// layout flags
#define ALF_QUERYSIZE 0x01
-#define ALF_HEXPAND 0x02
-#define ALF_VEXPAND 0x04
-#define ALF_MESSAGEFONT 0x08
-#define ALF_APPLYSIZE 0x10
+#define ALF_APPLYSIZE 0x02
+#define ALF_HEXPAND 0x04
+#define ALF_VEXPAND 0x08
+#define ALF_MESSAGEFONT 0x10
+#define ALF_STATUSFONT 0x20
+#define ALF_ICONTITLEFONT 0x40
+// special value, means "send ALF_WM_APPLYFONTS message with full fonts struct"
+#define ALF_ALLFONTS (ALF_MESSAGEFONT | ALF_STATUSFONT | ALF_ICONTITLEFONT)
// messages
#define ALF_WM__BASE 0x2800
@@ -242,6 +246,9 @@ ALF_ComboBoxCurrentText(HWND combo);
void
ALF_ComboBoxSetText(HWND combo, const TCHAR *text);
+// panel
+HWND
+ALF_AddPanel(HWND parent, WORD id, UINT x, UINT y);
#ifdef __cplusplus
} // extern C
diff --git a/alf/alflayout.cpp b/alf/alflayout.cpp
index 5e207d8..caf9857 100644
--- a/alf/alflayout.cpp
+++ b/alf/alflayout.cpp
@@ -20,12 +20,17 @@ ALF_Layout_Clear(ALFLayout *layout)
static void
ALF_ApplyFontForWidget(ALFWidgetPriv *widget, const ALFWindowFonts *fonts)
{
- if (widget->hwnd && (widget->flags & ALF_MESSAGEFONT) == ALF_MESSAGEFONT) {
- SendMessage(widget->hwnd, WM_SETFONT, (WPARAM)fonts->hMessageFont, (LPARAM)NULL);
+ if (widget->hwnd) {
+ if (widget->flags & ALF_MESSAGEFONT) {
+ SendMessage(widget->hwnd, WM_SETFONT, (WPARAM)fonts->hMessageFont, (LPARAM)NULL);
- // XXX: Invalidating should IMHO be the decision of the control, but at
- // least the commctl32 V5 static control doesn't do it.
- InvalidateRect(widget->hwnd, NULL, TRUE);
+ // XXX: Invalidating should IMHO be the decision of the control, but at
+ // least the commctl32 V5 static control doesn't do it.
+ InvalidateRect(widget->hwnd, NULL, TRUE);
+ }
+ if ((widget->flags & ALF_ALLFONTS) == ALF_ALLFONTS) {
+ SendMessage(widget->hwnd, ALF_WM_APPLYFONTS, 0, (LPARAM)fonts);
+ }
}
}
@@ -329,6 +334,11 @@ ALF_Layout_HandleMessage(ALFLayout *layout, HWND hwnd, UINT msg, WPARAM wparam,
return TRUE;
}
+ if (msg == ALF_WM_APPLYFONTS && lparam != 0) {
+ ALF_Layout_ApplyFonts(layout, hwnd, (const ALFWindowFonts *)lparam);
+ return TRUE;
+ }
+
if (msg == ALF_WM_APPLYLAYOUT) {
ALF_Layout_Apply(layout, hwnd);
return TRUE;
diff --git a/alf/alfpriv.h b/alf/alfpriv.h
index c41e24f..8f28b59 100644
--- a/alf/alfpriv.h
+++ b/alf/alfpriv.h
@@ -32,6 +32,7 @@ struct ALFAppPriv {
HINSTANCE hInstance;
ALFCompatFunctions *compatFn;
TCHAR *comboClass;
+ TCHAR *panelClass;
};
int
@@ -47,4 +48,10 @@ void
ALF_RegisterComboClass(ALFAPP app);
void
+ALF_RegisterPanelClass(ALFAPP app);
+
+void
ALF_BuildRandomClassName(ALFAPP app, const TCHAR *prefix, TCHAR *buf);
+
+BOOL
+ALF_ShouldMessageBubble(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);