1 /* -------- radio.c -------- */
3 #include "dflat32/dflat.h"
5 static CTLWINDOW
*rct
[MAXRADIOS
];
7 int RadioButtonProc(DFWINDOW wnd
, DFMESSAGE msg
, PARAM p1
, PARAM p2
)
10 DBOX
*db
= GetParent(wnd
)->extension
;
11 CTLWINDOW
*ct
= GetControl(wnd
);
16 DfSendMessage(NULL
, HIDE_CURSOR
, 0, 0);
18 rtn
= BaseWndProc(RADIOBUTTON
,wnd
,msg
,p1
,p2
);
25 DfSendMessage(wnd
, CLEARTEXT
, 0, 0);
26 DfSendMessage(wnd
, ADDTEXT
, (PARAM
) rb
, 0);
34 SetRadioButton(db
, ct
);
40 return BaseWndProc(RADIOBUTTON
, wnd
, msg
, p1
, p2
);
43 static BOOL Setting
= TRUE
;
45 void SetRadioButton(DBOX
*db
, CTLWINDOW
*ct
)
48 PushRadioButton(db
, ct
->command
);
52 void PushRadioButton(DBOX
*db
, enum commands cmd
)
54 CTLWINDOW
*ctt
= db
->ctl
;
55 CTLWINDOW
*ct
= FindCommand(db
, cmd
, 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
< MAXRADIOS
; i
++)
69 if (ctt
->class == 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
< MAXRADIOS
&& rct
[i
] != NULL
)
87 /* ---- ignore everthing past the group ------ */
91 for (i
= 0; i
< MAXRADIOS
; i
++) {
93 int wason
= rct
[i
]->setting
;
94 rct
[i
]->setting
= OFF
;
96 rct
[i
]->isetting
= OFF
;
98 DfSendMessage(rct
[i
]->wnd
, PAINT
, 0, 0);
101 /* ----- set the specified radio button on ----- */
105 DfSendMessage(ct
->wnd
, PAINT
, 0, 0);
108 BOOL
RadioButtonSetting(DBOX
*db
, enum commands cmd
)
110 CTLWINDOW
*ct
= FindCommand(db
, cmd
, RADIOBUTTON
);
112 return (ct
->setting
== ON
);