From a06c7ff02ce50243cd1e4bef8bad25bd1978bcda Mon Sep 17 00:00:00 2001 From: Jonas Kümmerlin Date: Mon, 25 May 2020 21:35:28 +0200 Subject: add explicit functions for adding native buttons --- alf/alfnativebtn.cpp | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 alf/alfnativebtn.cpp (limited to 'alf/alfnativebtn.cpp') diff --git a/alf/alfnativebtn.cpp b/alf/alfnativebtn.cpp new file mode 100644 index 0000000..23997b5 --- /dev/null +++ b/alf/alfnativebtn.cpp @@ -0,0 +1,55 @@ +#include "alfpriv.h" + +HWND +ALF_AddNativeButton(HWND win, WORD id, int x, int y, const TCHAR *text) +{ + HWND hwndBtn = CreateWindowEx(0, + TEXT("BUTTON"), + text, + WS_CHILD | WS_TABSTOP | WS_VISIBLE | BS_PUSHBUTTON, + 0, 0, 100, 100, + win, + (HMENU)(ULONG_PTR)id, + ALF_HINSTANCE, + NULL); + ALF_AddWidget(win, x, y, hwndBtn, 5625, 1725, ALF_LAYOUT_INHERITFONT | ALF_LAYOUT_TRANSPARENTBG | ALF_LAYOUT_SIZE_PUSHBUTTON); + + return hwndBtn; +} + +HWND +ALF_AddNativeCheckbox(HWND parent, WORD id, int x, int y, const TCHAR *text) +{ + HWND hwnd = CreateWindowEx(0, + TEXT("BUTTON"), + text, + WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX, + 0, 0, 100, 100, + parent, + (HMENU)(ULONG_PTR)id, + ALF_HINSTANCE, + NULL); + + ALF_AddWidget(parent, x, y, hwnd, 0, 0, ALF_LAYOUT_SIZE_CHECKBOX | ALF_LAYOUT_INHERITFONT | ALF_LAYOUT_TRANSPARENTBG); + + return hwnd; +} + +HWND +ALF_AddNativeRadioButton(HWND parent, WORD id, int x, int y, const TCHAR *text) +{ + HWND hwnd = CreateWindowEx(0, + TEXT("BUTTON"), + text, + WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTORADIOBUTTON, + 0, 0, 100, 100, + parent, + (HMENU)(ULONG_PTR)id, + ALF_HINSTANCE, + NULL); + + ALF_AddWidget(parent, x, y, hwnd, 0, 0, ALF_LAYOUT_SIZE_CHECKBOX | ALF_LAYOUT_INHERITFONT | ALF_LAYOUT_TRANSPARENTBG); + + return hwnd; +} + -- cgit v1.2.3