summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.mingw5
-rw-r--r--Makefile.vc65
-rw-r--r--Makefile.vc6-ansi5
-rw-r--r--Makefile.vc6-ansi-315
-rw-r--r--Makefile.vc6-nt315
-rw-r--r--alf/alf.cpp19
-rw-r--r--alf/alf.h15
-rw-r--r--alf/alflayout.cpp20
-rw-r--r--alf/alfpriv.h7
-rw-r--r--widgetfactory.cpp8
10 files changed, 80 insertions, 14 deletions
diff --git a/Makefile.mingw b/Makefile.mingw
index 41b6440..60ef928 100644
--- a/Makefile.mingw
+++ b/Makefile.mingw
@@ -4,7 +4,7 @@ CXX = i686-w64-mingw32-c++
CFLAGS = -std=c++98 -Wall -Wextra -mwindows -municode -DUNICODE -D_UNICODE -fno-exceptions -fno-rtti -gstabs
LDFLAGS = -luser32 -lcomctl32 -lshell32 -lversion -static
-out/widgetfactory.exe: out/widgetfactory.o out/alfbutton.o out/alfcombobox.o out/alfcompat.o out/alf.o out/alfdpiaware.o out/alfedit.o out/alflabel.o out/alflayout.o
+out/widgetfactory.exe: out/widgetfactory.o out/alfbutton.o out/alfcombobox.o out/alfcompat.o out/alf.o out/alfdpiaware.o out/alfedit.o out/alflabel.o out/alflayout.o out/alfpanel.o
$(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS)
out/alfbutton.o: alf/alfbutton.cpp alf/alfcompat.h alf/alf.h alf/alflayout.h alf/alflist.h alf/alfpriv.h
@@ -31,6 +31,9 @@ out/alflabel.o: alf/alflabel.cpp alf/alfcompat.h alf/alf.h alf/alflayout.h alf/
out/alflayout.o: alf/alflayout.cpp alf/alfcompat.h alf/alf.h alf/alflayout.h alf/alflist.h alf/alfpriv.h
$(CXX) $(CFLAGS) -c -o $@ $<
+out/alfpanel.o: alf/alfpanel.cpp alf/alfcompat.h alf/alf.h alf/alflayout.h alf/alflist.h alf/alfpriv.h
+ $(CXX) $(CFLAGS) -c -o $@ $<
+
out/widgetfactory.o: widgetfactory.cpp alf/alf.h
$(CXX) $(CFLAGS) -c -o $@ $<
diff --git a/Makefile.vc6 b/Makefile.vc6
index 8f83703..1b63325 100644
--- a/Makefile.vc6
+++ b/Makefile.vc6
@@ -4,7 +4,7 @@ CXX = cl.exe
CFLAGS = -O2 -GA -W3 -DUNICODE -D_UNICODE -D_WIN32=0x0501 -D_WIN32_WINNT=0x0501 -D_WIN32_IE=0x0501 -nologo
LDFLAGS = /link unicows.lib kernel32.lib user32.lib comctl32.lib shell32.lib gdi32.lib version.lib
-out/widgetfactory.exe: out/widgetfactory.obj out/alfbutton.obj out/alfcombobox.obj out/alfcompat.obj out/alf.obj out/alfdpiaware.obj out/alfedit.obj out/alflabel.obj out/alflayout.obj
+out/widgetfactory.exe: out/widgetfactory.obj out/alfbutton.obj out/alfcombobox.obj out/alfcompat.obj out/alf.obj out/alfdpiaware.obj out/alfedit.obj out/alflabel.obj out/alflayout.obj out/alfpanel.obj
$(CXX) $(CFLAGS) -Fe$@ $** $(LDFLAGS)
out/alfbutton.obj: alf/alfbutton.cpp alf/alfcompat.h alf/alf.h alf/alflayout.h alf/alflist.h alf/alfpriv.h
@@ -31,6 +31,9 @@ out/alflabel.obj: alf/alflabel.cpp alf/alfcompat.h alf/alf.h alf/alflayout.h al
out/alflayout.obj: alf/alflayout.cpp alf/alfcompat.h alf/alf.h alf/alflayout.h alf/alflist.h alf/alfpriv.h
$(CXX) $(CFLAGS) -c -Fo$@ alf/alflayout.cpp
+out/alfpanel.obj: alf/alfpanel.cpp alf/alfcompat.h alf/alf.h alf/alflayout.h alf/alflist.h alf/alfpriv.h
+ $(CXX) $(CFLAGS) -c -Fo$@ alf/alfpanel.cpp
+
out/widgetfactory.obj: widgetfactory.cpp alf/alf.h
$(CXX) $(CFLAGS) -c -Fo$@ widgetfactory.cpp
diff --git a/Makefile.vc6-ansi b/Makefile.vc6-ansi
index 4a06b44..9d71e82 100644
--- a/Makefile.vc6-ansi
+++ b/Makefile.vc6-ansi
@@ -4,7 +4,7 @@ CXX = cl.exe
CFLAGS = -O2 -GA -W3 -D_WIN32=0x0501 -D_WIN32_WINNT=0x0501 -D_WIN32_IE=0x0501 -nologo
LDFLAGS = /link /entry:_entry kernel32.lib user32.lib comctl32.lib shell32.lib gdi32.lib version.lib
-out/widgetfactory.exe: out/widgetfactory.obj out/alfbutton.obj out/alfcombobox.obj out/alfcompat.obj out/alf.obj out/alfdpiaware.obj out/alfedit.obj out/alflabel.obj out/alflayout.obj
+out/widgetfactory.exe: out/widgetfactory.obj out/alfbutton.obj out/alfcombobox.obj out/alfcompat.obj out/alf.obj out/alfdpiaware.obj out/alfedit.obj out/alflabel.obj out/alflayout.obj out/alfpanel.obj
$(CXX) $(CFLAGS) -Fe$@ $** $(LDFLAGS)
out/alfbutton.obj: alf/alfbutton.cpp alf/alfcompat.h alf/alf.h alf/alflayout.h alf/alflist.h alf/alfpriv.h
@@ -31,6 +31,9 @@ out/alflabel.obj: alf/alflabel.cpp alf/alfcompat.h alf/alf.h alf/alflayout.h al
out/alflayout.obj: alf/alflayout.cpp alf/alfcompat.h alf/alf.h alf/alflayout.h alf/alflist.h alf/alfpriv.h
$(CXX) $(CFLAGS) -c -Fo$@ alf/alflayout.cpp
+out/alfpanel.obj: alf/alfpanel.cpp alf/alfcompat.h alf/alf.h alf/alflayout.h alf/alflist.h alf/alfpriv.h
+ $(CXX) $(CFLAGS) -c -Fo$@ alf/alfpanel.cpp
+
out/widgetfactory.obj: widgetfactory.cpp alf/alf.h
$(CXX) $(CFLAGS) -c -Fo$@ widgetfactory.cpp
diff --git a/Makefile.vc6-ansi-31 b/Makefile.vc6-ansi-31
index bb714d7..dfc9269 100644
--- a/Makefile.vc6-ansi-31
+++ b/Makefile.vc6-ansi-31
@@ -4,7 +4,7 @@ CXX = cl.exe
CFLAGS = -O2 -GA -W3 -D_WIN32=0x0501 -D_WIN32_WINNT=0x0501 -D_WIN32_IE=0x0501 -nologo
LDFLAGS = /link /subsystem:windows,3.10 /entry:_entry /fixed:no kernel32.lib user32.lib comctl32.lib shell32.lib gdi32.lib version.lib
-out/widgetfactory.exe: out/widgetfactory.obj out/alfbutton.obj out/alfcombobox.obj out/alfcompat.obj out/alf.obj out/alfdpiaware.obj out/alfedit.obj out/alflabel.obj out/alflayout.obj
+out/widgetfactory.exe: out/widgetfactory.obj out/alfbutton.obj out/alfcombobox.obj out/alfcompat.obj out/alf.obj out/alfdpiaware.obj out/alfedit.obj out/alflabel.obj out/alflayout.obj out/alfpanel.obj
$(CXX) $(CFLAGS) -Fe$@ $** $(LDFLAGS)
out/alfbutton.obj: alf/alfbutton.cpp alf/alfcompat.h alf/alf.h alf/alflayout.h alf/alflist.h alf/alfpriv.h
@@ -31,6 +31,9 @@ out/alflabel.obj: alf/alflabel.cpp alf/alfcompat.h alf/alf.h alf/alflayout.h al
out/alflayout.obj: alf/alflayout.cpp alf/alfcompat.h alf/alf.h alf/alflayout.h alf/alflist.h alf/alfpriv.h
$(CXX) $(CFLAGS) -c -Fo$@ alf/alflayout.cpp
+out/alfpanel.obj: alf/alfpanel.cpp alf/alfcompat.h alf/alf.h alf/alflayout.h alf/alflist.h alf/alfpriv.h
+ $(CXX) $(CFLAGS) -c -Fo$@ alf/alfpanel.cpp
+
out/widgetfactory.obj: widgetfactory.cpp alf/alf.h
$(CXX) $(CFLAGS) -c -Fo$@ widgetfactory.cpp
diff --git a/Makefile.vc6-nt31 b/Makefile.vc6-nt31
index e20a11d..63a0f80 100644
--- a/Makefile.vc6-nt31
+++ b/Makefile.vc6-nt31
@@ -4,7 +4,7 @@ CXX = cl.exe
CFLAGS = -O2 -GA -W3 -DUNICODE -D_UNICODE -D_WIN32=0x0501 -D_WIN32_WINNT=0x0501 -D_WIN32_IE=0x0501 -nologo
LDFLAGS = /link /subsystem:windows,3.10 /entry:_entry kernel32.lib user32.lib comctl32.lib shell32.lib gdi32.lib version.lib
-out/widgetfactory.exe: out/widgetfactory.obj out/alfbutton.obj out/alfcombobox.obj out/alfcompat.obj out/alf.obj out/alfdpiaware.obj out/alfedit.obj out/alflabel.obj out/alflayout.obj
+out/widgetfactory.exe: out/widgetfactory.obj out/alfbutton.obj out/alfcombobox.obj out/alfcompat.obj out/alf.obj out/alfdpiaware.obj out/alfedit.obj out/alflabel.obj out/alflayout.obj out/alfpanel.obj
$(CXX) $(CFLAGS) -Fe$@ $** $(LDFLAGS)
out/alfbutton.obj: alf/alfbutton.cpp alf/alfcompat.h alf/alf.h alf/alflayout.h alf/alflist.h alf/alfpriv.h
@@ -31,6 +31,9 @@ out/alflabel.obj: alf/alflabel.cpp alf/alfcompat.h alf/alf.h alf/alflayout.h al
out/alflayout.obj: alf/alflayout.cpp alf/alfcompat.h alf/alf.h alf/alflayout.h alf/alflist.h alf/alfpriv.h
$(CXX) $(CFLAGS) -c -Fo$@ alf/alflayout.cpp
+out/alfpanel.obj: alf/alfpanel.cpp alf/alfcompat.h alf/alf.h alf/alflayout.h alf/alflist.h alf/alfpriv.h
+ $(CXX) $(CFLAGS) -c -Fo$@ alf/alfpanel.cpp
+
out/widgetfactory.obj: widgetfactory.cpp alf/alf.h
$(CXX) $(CFLAGS) -c -Fo$@ widgetfactory.cpp
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);
diff --git a/widgetfactory.cpp b/widgetfactory.cpp
index f147982..efee767 100644
--- a/widgetfactory.cpp
+++ b/widgetfactory.cpp
@@ -14,6 +14,9 @@ enum {
ID_COMBO2,
ID_LBL5,
ID_LBL6,
+ ID_BC1,
+ ID_BC2,
+ ID_BC3,
ID__MAX
};
@@ -151,6 +154,11 @@ WinMain
//ALF_AddWidgetLayoutFlag(win, ALF_WidgetHwndById(win, ID_LBL6), ALF_VEXPAND);
//ALF_AddWidgetLayoutFlag(win, ALF_WidgetHwndById(win, ID_B1), ALF_HEXPAND);
+ HWND panel = ALF_AddPanel(win, (WORD)-1, 1, 2);
+ ALF_AddButton(panel, ID_BC1, 0, 0, TEXT("1"));
+ ALF_AddButton(panel, ID_BC2, 1, 0, TEXT("2"));
+ ALF_AddButton(panel, ID_BC3, 2, 0, TEXT("3"));
+
ALF_ApplyFonts(win);
ALF_RecalculateLayout(win);
ALF_SetDefaultButton(win, ID_B2);