summaryrefslogtreecommitdiff
path: root/widgetfactory.c
diff options
context:
space:
mode:
authorJonas Kümmerlin <jonas@kuemmerlin.eu>2018-12-27 17:06:56 +0100
committerJonas Kümmerlin <jonas@kuemmerlin.eu>2018-12-27 17:06:56 +0100
commit88393dcbc2cfad14c8201959a6f97e64dafb4471 (patch)
tree4eeabb9674b1581e7b0592f76a2cf9341050a548 /widgetfactory.c
parent6f4b47c3d5ddb1eddbea1817d624443de1a4fbf9 (diff)
add win2k and VC6 (with PSDK2003) support
Diffstat (limited to 'widgetfactory.c')
-rw-r--r--widgetfactory.c111
1 files changed, 0 insertions, 111 deletions
diff --git a/widgetfactory.c b/widgetfactory.c
deleted file mode 100644
index 94c063f..0000000
--- a/widgetfactory.c
+++ /dev/null
@@ -1,111 +0,0 @@
-#include "alf/alf.h"
-
-enum {
- ID_LBLHELLO,
- ID_LBL2,
- ID_LBL3,
- ID_ED1,
- ID_B1,
- ID_B2,
- ID__MAX
-};
-
-static HBRUSH red;
-static HBRUSH green;
-static HBRUSH blue;
-static HBRUSH white;
-
-LRESULT
-handleMessage(void *closure, HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
-{
- (void)closure;
-
- if (msg == WM_CTLCOLORSTATIC) {
- DWORD id = GetDlgCtrlID((HWND)lparam);
- HDC hdcStatic = (HDC)wparam;
- if (id == ID_LBLHELLO) {
- SetTextColor(hdcStatic, RGB(0,0,0));
- SetBkColor(hdcStatic, RGB(255,0,0));
- return (LRESULT)red;
- } else if (id == ID_LBL2) {
- SetTextColor(hdcStatic, RGB(0,0,0));
- SetBkColor(hdcStatic, RGB(0,255,0));
- return (LRESULT)green;
- } /*else if (id == ID_LBL3) {
- SetTextColor(hdcStatic, RGB(255,255,255));
- SetBkColor(hdcStatic, RGB(0,0,255));
- return (LRESULT)blue;
- } else {
- SetTextColor(hdcStatic, RGB(0,0,0));
- SetBkColor(hdcStatic, RGB(255,255,255));
- return (LRESULT)white;
- }*/
- }
-
- return ALF_DefWindowProc(hwnd, msg, wparam, lparam);
-}
-
-int CALLBACK
-wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
-{
- (void)hPrevInstance;
- (void)lpCmdLine;
- (void)nCmdShow;
-
- BOOL (*pSetProcessDpiAware)(void);
- pSetProcessDpiAware = (BOOL (*)(void))GetProcAddress(GetModuleHandle(L"user32.dll"), "SetProcessDPIAware");
- if (pSetProcessDpiAware)
- pSetProcessDpiAware();
-
- red = CreateSolidBrush(RGB(255,0,0));
- green = CreateSolidBrush(RGB(0,255,0));
- blue = CreateSolidBrush(RGB(0,0,255));
- white = CreateSolidBrush(RGB(255,255,255));
-
- ALFWindowClassParams cparams;
- ZeroMemory(&cparams, sizeof(cparams));
-
- cparams.className = TEXT("DummyClass");
- cparams.vtbl.message = handleMessage;
-
- ALF_RegisterWindowClass(hInstance, &cparams);
-
- ALFWindowInstanceParams params;
- ZeroMemory(&params, sizeof(params));
- params.windowStyle = WS_OVERLAPPEDWINDOW;
-
- HWND win = ALF_InstantiateWindow(hInstance, TEXT("DummyClass"), &params);
-
- ALF_AddLabel(win, ID_LBL2, 1, 0, L"Hello, 2!\nblub");
-
- HWND hwndLabel = CreateWindow(
- L"STATIC",
- L"Hello World!",
- WS_CHILD | WS_VISIBLE | SS_LEFT,
- 0, 0, 50, 25,
- win,
- (HMENU)ID_LBLHELLO,
- hInstance,
- NULL);
- ALF_AddWidget(win, 0, 0, hwndLabel, 5000, 1000, ALF_MESSAGEFONT);
-
- ALF_AddLabel(win, ID_LBL3, 0, 1, L"Good Morning my &Angel!");
-
- ALF_AddEdit(win, ID_ED1, 1, 1, L"Happy Birthday!");
-
- ALF_AddButton(win, ID_B1, 2, 1, L"&Go!");
- ALF_AddButton(win, ID_B2, 0, 2, L"Oh m&y god,\r\nwho the hell cares?");
-
- ALF_RecalculateLayout(win);
- ALF_SetDefaultButton(win, ID_B1);
-
- //EnableWindow(ALF_WidgetHwndById(win, ID_LBL3), FALSE);
-
- ALF_ResizeWindow(win, 1, 1);
-
- ALF_ShowModal(win);
-
- DestroyWindow(win);
-
- return 0;
-}