*/
typedef union { void *p; int i; } intorptr;
+#ifndef INLINE
+intorptr I(int i);
+intorptr P(void *p);
+#endif
+
#if defined DEFINE_INTORPTR_FNS || defined INLINE
#ifdef INLINE
#define PREFIX INLINE
PREFIX intorptr I(int i) { intorptr ret; ret.i = i; return ret; }
PREFIX intorptr P(void *p) { intorptr ret; ret.p = p; return ret; }
#undef PREFIX
-#else
-intorptr I(int i);
-intorptr P(void *p);
#endif
/*
*
* The `data' parameter points to the writable data being
* modified as a result of the configuration activity; for
- * example, the PuTTY `Config' structure, although not
+ * example, the PuTTY `Conf' structure, although not
* necessarily.
*
* The `dlg' parameter is passed back to the platform-
* has a drop-down list built in. (Note that a _non_-
* editable drop-down list is done as a special case of a
* list box.)
+ *
+ * Don't try setting has_list and password on the same
+ * control; front ends are not required to support that
+ * combination.
*/
int has_list;
/*
* Return even if it doesn't have the input focus.
*/
int isdefault;
+ /*
+ * Also, the reverse of this: a default cancel-type button,
+ * which is implicitly pressed when you hit Escape.
+ */
+ int iscancel;
} button;
struct {
STANDARD_PREFIX;
*/
int draglist;
/*
- * If this is set, the list can have more than one element
- * selected at a time. This is not guaranteed to work on a
- * drop-down list, so don't try it!
+ * If this is non-zero, the list can have more than one
+ * element selected at a time. This is not guaranteed to
+ * work on a drop-down list, so don't try it!
+ *
+ * Different non-zero values request slightly different
+ * types of multi-selection (this may well be meaningful
+ * only in GTK, so everyone else can ignore it if they
+ * want). 1 means the list box expects to have individual
+ * items selected, whereas 2 means it expects the user to
+ * want to select a large contiguous range at a time.
*/
int multisel;
/*
* the respective widths of `ncols' columns, which together
* will exactly fit the width of the list box. Otherwise
* `percentages' must be NULL.
+ *
+ * There should never be more than one column in a
+ * drop-down list (one with height==0), because front ends
+ * may have to implement it as a special case of an
+ * editable combo box.
*/
int ncols; /* number of columns */
int *percentages; /* % width of each column */
union control *ctrl_tabdelay(struct controlset *, union control *);
/*
- * Standard handler routines to cover most of the common cases in
- * the config box.
- */
-/*
- * The standard radio-button handler expects the main `context'
- * field to contain the `offsetof' of an int field in the structure
- * pointed to by `data', and expects each of the individual button
- * data to give a value for that int field.
- */
-void dlg_stdradiobutton_handler(union control *ctrl, void *dlg,
- void *data, int event);
-/*
- * The standard checkbox handler expects the main `context' field
- * to contain the `offsetof' an int field in the structure pointed
- * to by `data', optionally ORed with CHECKBOX_INVERT to indicate
- * that the sense of the datum is opposite to the sense of the
- * checkbox.
- */
-#define CHECKBOX_INVERT (1<<30)
-void dlg_stdcheckbox_handler(union control *ctrl, void *dlg,
- void *data, int event);
-/*
- * The standard edit-box handler expects the main `context' field
- * to contain the `offsetof' a field in the structure pointed to by
- * `data'. The secondary `context2' field indicates the type of
- * this field:
- *
- * - if context2 > 0, the field is a char array and context2 gives
- * its size.
- * - if context2 == -1, the field is an int and the edit box is
- * numeric.
- * - if context2 < -1, the field is an int and the edit box is
- * _floating_, and (-context2) gives the scale. (E.g. if
- * context2 == -1000, then typing 1.2 into the box will set the
- * field to 1200.)
- */
-void dlg_stdeditbox_handler(union control *ctrl, void *dlg,
- void *data, int event);
-/*
* The standard file-selector handler expects the main `context'
* field to contain the `offsetof' a Filename field in the
* structure pointed to by `data'.
void dlg_checkbox_set(union control *ctrl, void *dlg, int checked);
int dlg_checkbox_get(union control *ctrl, void *dlg);
void dlg_editbox_set(union control *ctrl, void *dlg, char const *text);
-void dlg_editbox_get(union control *ctrl, void *dlg, char *buffer, int length);
+char *dlg_editbox_get(union control *ctrl, void *dlg); /* result must be freed by caller */
/* The `listbox' functions can also apply to combo boxes. */
void dlg_listbox_clear(union control *ctrl, void *dlg);
void dlg_listbox_del(union control *ctrl, void *dlg, int index);
* strings in any listbox then you MUST not assign them different
* IDs and expect to get meaningful results back.
*/
-void dlg_listbox_addwithindex(union control *ctrl, void *dlg,
- char const *text, int id);
+void dlg_listbox_addwithid(union control *ctrl, void *dlg,
+ char const *text, int id);
int dlg_listbox_getid(union control *ctrl, void *dlg, int index);
/* dlg_listbox_index returns <0 if no single element is selected. */
int dlg_listbox_index(union control *ctrl, void *dlg);
*/
void dlg_set_focus(union control *ctrl, void *dlg);
/*
- * Return the `ctrl' structure for the control that had the input
- * focus before this one. This is NOT GUARANTEED to work on all
- * platforms, so don't base any critical functionality on it!
+ * Change the label text on a control.
+ */
+void dlg_label_change(union control *ctrl, void *dlg, char const *text);
+/*
+ * Return the `ctrl' structure for the most recent control that had
+ * the input focus apart from the one mentioned. This is NOT
+ * GUARANTEED to work on all platforms, so don't base any critical
+ * functionality on it!
*/
-union control *dlg_last_focused(void *dlg);
+union control *dlg_last_focused(union control *ctrl, void *dlg);
/*
* During event processing, you might well want to give an error
* indication to the user. dlg_beep() is a quick and easy generic