set the default response */
| 259 | |
| 260 | /* set the default response */ |
| 261 | void |
| 262 | SetDialogResponse(Widget w, String s, unsigned ln) |
| 263 | { |
| 264 | Arg args[4]; |
| 265 | Widget response; |
| 266 | XFontStruct *font; |
| 267 | Dimension width, nwidth, leftMargin, rightMargin; |
| 268 | unsigned s_len = strlen(s); |
| 269 | |
| 270 | if (s_len < ln) |
| 271 | s_len = ln; |
| 272 | response = XtNameToWidget(w, "response"); |
| 273 | XtSetArg(args[0], nhStr(XtNfont), &font); |
| 274 | XtSetArg(args[1], nhStr(XtNleftMargin), &leftMargin); |
| 275 | XtSetArg(args[2], nhStr(XtNrightMargin), &rightMargin); |
| 276 | XtSetArg(args[3], nhStr(XtNwidth), &width); |
| 277 | XtGetValues(response, args, FOUR); |
| 278 | /* width includes margins as per Xaw documentation */ |
| 279 | nwidth = font->max_bounds.width * (s_len + 1) + leftMargin + rightMargin; |
| 280 | if (nwidth < width) |
| 281 | nwidth = width; |
| 282 | |
| 283 | XtSetArg(args[0], nhStr(XtNstring), s); |
| 284 | XtSetArg(args[1], nhStr(XtNwidth), nwidth); |
| 285 | XtSetValues(response, args, TWO); |
| 286 | XawTextSetInsertionPoint(response, strlen(s)); |
| 287 | } |
| 288 | |
| 289 | #if 0 |
| 290 | /* clear the response */ |
no outgoing calls
no test coverage detected