2000-03-05 19:58:08 +00:00
|
|
|
/* -------------- checkbox.c ------------ */
|
|
|
|
|
|
|
|
#include "dflat.h"
|
|
|
|
|
2003-06-19 02:48:13 +00:00
|
|
|
int DfCheckBoxProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2)
|
2000-03-05 19:58:08 +00:00
|
|
|
{
|
|
|
|
int rtn;
|
2003-06-19 02:48:13 +00:00
|
|
|
DF_CTLWINDOW *ct = DfGetControl(wnd);
|
2000-03-05 19:58:08 +00:00
|
|
|
if (ct != NULL) {
|
|
|
|
switch (msg) {
|
2003-06-19 02:48:13 +00:00
|
|
|
case DFM_SETFOCUS:
|
2000-03-05 19:58:08 +00:00
|
|
|
if (!(int)p1)
|
2003-06-19 02:48:13 +00:00
|
|
|
DfSendMessage(NULL, DFM_HIDE_CURSOR, 0, 0);
|
|
|
|
case DFM_MOVE:
|
|
|
|
rtn = DfBaseWndProc(DF_CHECKBOX, wnd, msg, p1, p2);
|
|
|
|
DfSetFocusCursor(wnd);
|
2000-03-05 19:58:08 +00:00
|
|
|
return rtn;
|
2003-06-19 02:48:13 +00:00
|
|
|
case DFM_PAINT: {
|
2000-03-05 19:58:08 +00:00
|
|
|
char cb[] = "[ ]";
|
|
|
|
if (ct->setting)
|
|
|
|
cb[1] = 'X';
|
2003-06-19 02:48:13 +00:00
|
|
|
DfSendMessage(wnd, DFM_CLEARTEXT, 0, 0);
|
|
|
|
DfSendMessage(wnd, DFM_ADDTEXT, (DF_PARAM) cb, 0);
|
|
|
|
DfSetFocusCursor(wnd);
|
2000-03-05 19:58:08 +00:00
|
|
|
break;
|
|
|
|
}
|
2003-06-19 02:48:13 +00:00
|
|
|
case DFM_KEYBOARD:
|
2000-03-05 19:58:08 +00:00
|
|
|
if ((int)p1 != ' ')
|
|
|
|
break;
|
2003-06-19 02:48:13 +00:00
|
|
|
case DFM_LEFT_BUTTON:
|
|
|
|
ct->setting ^= DF_ON;
|
|
|
|
DfSendMessage(wnd, DFM_PAINT, 0, 0);
|
2000-03-05 19:58:08 +00:00
|
|
|
return TRUE;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2003-06-19 02:48:13 +00:00
|
|
|
return DfBaseWndProc(DF_CHECKBOX, wnd, msg, p1, p2);
|
2000-03-05 19:58:08 +00:00
|
|
|
}
|
|
|
|
|
2003-06-19 02:48:13 +00:00
|
|
|
BOOL DfCheckBoxSetting(DF_DBOX *db, enum DfCommands cmd)
|
2000-03-05 19:58:08 +00:00
|
|
|
{
|
2003-06-19 02:48:13 +00:00
|
|
|
DF_CTLWINDOW *ct = DfFindCommand(db, cmd, DF_CHECKBOX);
|
2000-03-05 19:58:08 +00:00
|
|
|
if (ct != NULL)
|
2003-06-19 02:48:13 +00:00
|
|
|
return (ct->isetting == DF_ON);
|
2000-03-05 19:58:08 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* EOF */
|