-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheckbox.c
More file actions
61 lines (54 loc) · 1.93 KB
/
Copy pathcheckbox.c
File metadata and controls
61 lines (54 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "checkbox.h"
extern FILE *fp;
wwCheckbox* wwCheckbox_Create(wwWindowAndRenderer *windowAndRenderer, wchar_t *text, int x, int y, int width, int height)
{
wwCheckbox *checkbox = (wwCheckbox*) malloc(sizeof(wwCheckbox));
if(windowAndRenderer->checkboxes == NULL)
{
windowAndRenderer->checkboxes = wwList_CreateEmpty(sizeof(wwCheckbox), TRUE, wwWidget_FreeFunc);
fprintf(fp, "created checkbox list %p\n", windowAndRenderer->checkboxes);
}
fprintf(fp, "creating checkbox %p\n", checkbox);
wwWidget_Create(&checkbox->widget, text, x, y, width, height);
wwList_Append(windowAndRenderer->checkboxes, checkbox);
return checkbox;
}
void wwCheckbox_SetCallback(wwCheckbox *checkbox, wwCheckboxCallback callback, void *userData)
{
wwWidget_SetCallback((wwWidget*) checkbox, (wwWidgetCallback) callback, userData);
}
int wwCheckbox_IsChecked(wwCheckbox *checkBox, wwWindowAndRenderer *windowAndRenderer)
{
return IsDlgButtonChecked(windowAndRenderer->hwnd, checkBox->widget.id);
}
void wwCheckbox_SetChecked(wwCheckbox *checkBox, wwWindowAndRenderer *windowAndRenderer, int checked)
{
if(checked == 0)
CheckDlgButton(windowAndRenderer->hwnd, checkBox->widget.id, BST_UNCHECKED);
else
CheckDlgButton(windowAndRenderer->hwnd, checkBox->widget.id, BST_CHECKED);
}
void wwCheckbox_SetText(wwCheckbox *checkbox, wchar_t *text)
{
wwWidget_SetText(&checkbox->widget, text);
}
void wwCheckbox_SetX(wwCheckbox *checkbox, int x)
{
wwWidget_SetX(&checkbox->widget, x);
}
void wwCheckbox_SetY(wwCheckbox *checkbox, int y)
{
wwWidget_SetY(&checkbox->widget, y);
}
void wwCheckbox_SetWidth(wwCheckbox *checkbox, int width)
{
wwWidget_SetWidth(&checkbox->widget, width);
}
void wwCheckbox_SetHeight(wwCheckbox *checkbox, int height)
{
wwWidget_SetHeight(&checkbox->widget, height);
}
wchar_t* wwCheckbox_GetText(wwCheckbox *checkbox)
{
return wwWidget_GetText(&checkbox->widget);
}