Take care of one BSOD in NtGdiDdCreateDirectDrawObject, it is not correct fix, it...
[reactos.git] / rosapps / lib / dflat32 / checkbox.c
1 /* -------------- checkbox.c ------------ */
2
3 #include "dflat32/dflat.h"
4
5 int CheckBoxProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2)
6 {
7 int rtn;
8 CTLWINDOW *ct = GetControl(wnd);
9 if (ct != NULL) {
10 switch (msg) {
11 case SETFOCUS:
12 if (!(int)p1)
13 DfSendMessage(NULL, HIDE_CURSOR, 0, 0);
14 case MOVE:
15 rtn = BaseWndProc(CHECKBOX, wnd, msg, p1, p2);
16 SetFocusCursor(wnd);
17 return rtn;
18 case PAINT: {
19 char cb[] = "[ ]";
20 if (ct->setting)
21 cb[1] = 'X';
22 DfSendMessage(wnd, CLEARTEXT, 0, 0);
23 DfSendMessage(wnd, ADDTEXT, (PARAM) cb, 0);
24 SetFocusCursor(wnd);
25 break;
26 }
27 case KEYBOARD:
28 if ((int)p1 != ' ')
29 break;
30 case LEFT_BUTTON:
31 ct->setting ^= ON;
32 DfSendMessage(wnd, PAINT, 0, 0);
33 return TRUE;
34 default:
35 break;
36 }
37 }
38 return BaseWndProc(CHECKBOX, wnd, msg, p1, p2);
39 }
40
41 BOOL CheckBoxSetting(DBOX *db, enum commands cmd)
42 {
43 CTLWINDOW *ct = FindCommand(db, cmd, CHECKBOX);
44 if (ct != NULL)
45 return (ct->isetting == ON);
46 return FALSE;
47 }
48
49 /* EOF */