1 /* -------- radio.c -------- */
5 static DF_CTLWINDOW
*rct
[DF_MAXRADIOS
];
7 int DfRadioButtonProc(DFWINDOW wnd
, DFMESSAGE msg
, DF_PARAM p1
, DF_PARAM p2
)
10 DF_DBOX
*db
= DfGetParent(wnd
)->extension
;
11 DF_CTLWINDOW
*ct
= DfGetControl(wnd
);
16 DfSendMessage(NULL
, DFM_HIDE_CURSOR
, 0, 0);
18 rtn
= DfBaseWndProc(DF_RADIOBUTTON
,wnd
,msg
,p1
,p2
);
19 DfSetFocusCursor(wnd
);
25 DfSendMessage(wnd
, DFM_CLEARTEXT
, 0, 0);
26 DfSendMessage(wnd
, DFM_ADDTEXT
, (DF_PARAM
) rb
, 0);
27 DfSetFocusCursor(wnd
);
34 DfSetRadioButton(db
, ct
);
40 return DfBaseWndProc(DF_RADIOBUTTON
, wnd
, msg
, p1
, p2
);
43 static BOOL Setting
= TRUE
;
45 void DfSetRadioButton(DF_DBOX
*db
, DF_CTLWINDOW
*ct
)
48 DfPushRadioButton(db
, ct
->command
);
52 void DfPushRadioButton(DF_DBOX
*db
, enum DfCommands cmd
)
54 DF_CTLWINDOW
*ctt
= db
->ctl
;
55 DF_CTLWINDOW
*ct
= DfFindCommand(db
, cmd
, DF_RADIOBUTTON
);
61 /* --- clear all the radio buttons
62 in this group on the dialog box --- */
64 /* -------- build a table of all radio buttons at the
65 same x vector ---------- */
66 for (i
= 0; i
< DF_MAXRADIOS
; i
++)
69 if (ctt
->class == DF_RADIOBUTTON
)
70 if (ct
->dwnd
.x
== ctt
->dwnd
.x
)
71 rct
[ctt
->dwnd
.y
] = ctt
;
75 /* ----- find the start of the radiobutton group ---- */
77 while (i
>= 0 && rct
[i
] != NULL
)
79 /* ---- ignore everthing before the group ------ */
83 /* ----- find the end of the radiobutton group ---- */
85 while (i
< DF_MAXRADIOS
&& rct
[i
] != NULL
)
87 /* ---- ignore everthing past the group ------ */
88 while (i
< DF_MAXRADIOS
)
91 for (i
= 0; i
< DF_MAXRADIOS
; i
++) {
93 int wason
= rct
[i
]->setting
;
94 rct
[i
]->setting
= DF_OFF
;
96 rct
[i
]->isetting
= DF_OFF
;
98 DfSendMessage(rct
[i
]->wnd
, DFM_PAINT
, 0, 0);
101 /* ----- set the specified radio button on ----- */
104 ct
->isetting
= DF_ON
;
105 DfSendMessage(ct
->wnd
, DFM_PAINT
, 0, 0);
108 BOOL
DfRadioButtonSetting(DF_DBOX
*db
, enum DfCommands cmd
)
110 DF_CTLWINDOW
*ct
= DfFindCommand(db
, cmd
, DF_RADIOBUTTON
);
112 return (ct
->setting
== DF_ON
);