From 88393dcbc2cfad14c8201959a6f97e64dafb4471 Mon Sep 17 00:00:00 2001 From: Jonas Kümmerlin Date: Thu, 27 Dec 2018 17:06:56 +0100 Subject: add win2k and VC6 (with PSDK2003) support --- widgetfactory.c | 111 -------------------------------------------------------- 1 file changed, 111 deletions(-) delete mode 100644 widgetfactory.c (limited to 'widgetfactory.c') 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(¶ms, sizeof(params)); - params.windowStyle = WS_OVERLAPPEDWINDOW; - - HWND win = ALF_InstantiateWindow(hInstance, TEXT("DummyClass"), ¶ms); - - 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; -} -- cgit v1.2.3