From cc94c0b5f8f18364e75c838ba9b5cfb0a9529274 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Thu, 9 Apr 2015 13:10:32 -0400 Subject: [PATCH] Implemented uiCheckbox(Set)Checked() on Windows. --- checkbox_windows.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/checkbox_windows.c b/checkbox_windows.c index ffb78f86..8c042686 100644 --- a/checkbox_windows.c +++ b/checkbox_windows.c @@ -107,3 +107,23 @@ void uiCheckboxOnToggled(uiControl *c, void (*f)(uiControl *, void *), void *dat cc->onToggled = f; cc->onToggledData = data; } + +int uiCheckboxChecked(uiControl *c) +{ + HWND hwnd; + + hwnd = (HWND) uiControlHandle(c); + return SendMessage(hwnd, BM_GETCHECK, 0, 0) == BST_CHECKED; +} + +void uiCheckboxSetChecked(uiControl *c, int checked) +{ + HWND hwnd; + WPARAM check; + + hwnd = (HWND) uiControlHandle(c); + check = BST_CHECKED; + if (!checked) + check = BST_UNCHECKED; + SendMessage(hwnd, BM_SETCHECK, check, 0); +}