1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-14 09:37:34 -05:00

Expose the structure tag 'dlgparam'.

This continues my ongoing crusade against dangerous 'void *'
parameters.
This commit is contained in:
Simon Tatham
2018-09-13 12:58:44 +01:00
parent fc375c0b6a
commit 3aae1f9d76
10 changed files with 150 additions and 207 deletions

View File

@ -103,7 +103,7 @@ enum {
EVENT_SELCHANGE,
EVENT_CALLBACK
};
typedef void (*handler_fn)(union control *ctrl, void *dlg,
typedef void (*handler_fn)(union control *ctrl, dlgparam *dp,
void *data, int event);
#define STANDARD_PREFIX \
@ -534,16 +534,16 @@ union control *ctrl_tabdelay(struct controlset *, union control *);
* Routines the platform-independent dialog code can call to read
* and write the values of controls.
*/
void dlg_radiobutton_set(union control *ctrl, void *dlg, int whichbutton);
int dlg_radiobutton_get(union control *ctrl, void *dlg);
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);
char *dlg_editbox_get(union control *ctrl, void *dlg); /* result must be freed by caller */
void dlg_radiobutton_set(union control *ctrl, dlgparam *dp, int whichbutton);
int dlg_radiobutton_get(union control *ctrl, dlgparam *dp);
void dlg_checkbox_set(union control *ctrl, dlgparam *dp, int checked);
int dlg_checkbox_get(union control *ctrl, dlgparam *dp);
void dlg_editbox_set(union control *ctrl, dlgparam *dp, char const *text);
char *dlg_editbox_get(union control *ctrl, dlgparam *dp); /* 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);
void dlg_listbox_add(union control *ctrl, void *dlg, char const *text);
void dlg_listbox_clear(union control *ctrl, dlgparam *dp);
void dlg_listbox_del(union control *ctrl, dlgparam *dp, int index);
void dlg_listbox_add(union control *ctrl, dlgparam *dp, char const *text);
/*
* Each listbox entry may have a numeric id associated with it.
* Note that some front ends only permit a string to be stored at
@ -551,53 +551,53 @@ void dlg_listbox_add(union control *ctrl, void *dlg, char const *text);
* strings in any listbox then you MUST not assign them different
* IDs and expect to get meaningful results back.
*/
void dlg_listbox_addwithid(union control *ctrl, void *dlg,
void dlg_listbox_addwithid(union control *ctrl, dlgparam *dp,
char const *text, int id);
int dlg_listbox_getid(union control *ctrl, void *dlg, int index);
int dlg_listbox_getid(union control *ctrl, dlgparam *dp, int index);
/* dlg_listbox_index returns <0 if no single element is selected. */
int dlg_listbox_index(union control *ctrl, void *dlg);
int dlg_listbox_issel(union control *ctrl, void *dlg, int index);
void dlg_listbox_select(union control *ctrl, void *dlg, int index);
void dlg_text_set(union control *ctrl, void *dlg, char const *text);
void dlg_filesel_set(union control *ctrl, void *dlg, Filename *fn);
Filename *dlg_filesel_get(union control *ctrl, void *dlg);
void dlg_fontsel_set(union control *ctrl, void *dlg, FontSpec *fn);
FontSpec *dlg_fontsel_get(union control *ctrl, void *dlg);
int dlg_listbox_index(union control *ctrl, dlgparam *dp);
int dlg_listbox_issel(union control *ctrl, dlgparam *dp, int index);
void dlg_listbox_select(union control *ctrl, dlgparam *dp, int index);
void dlg_text_set(union control *ctrl, dlgparam *dp, char const *text);
void dlg_filesel_set(union control *ctrl, dlgparam *dp, Filename *fn);
Filename *dlg_filesel_get(union control *ctrl, dlgparam *dp);
void dlg_fontsel_set(union control *ctrl, dlgparam *dp, FontSpec *fn);
FontSpec *dlg_fontsel_get(union control *ctrl, dlgparam *dp);
/*
* Bracketing a large set of updates in these two functions will
* cause the front end (if possible) to delay updating the screen
* until it's all complete, thus avoiding flicker.
*/
void dlg_update_start(union control *ctrl, void *dlg);
void dlg_update_done(union control *ctrl, void *dlg);
void dlg_update_start(union control *ctrl, dlgparam *dp);
void dlg_update_done(union control *ctrl, dlgparam *dp);
/*
* Set input focus into a particular control.
*/
void dlg_set_focus(union control *ctrl, void *dlg);
void dlg_set_focus(union control *ctrl, dlgparam *dp);
/*
* Change the label text on a control.
*/
void dlg_label_change(union control *ctrl, void *dlg, char const *text);
void dlg_label_change(union control *ctrl, dlgparam *dp, 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(union control *ctrl, void *dlg);
union control *dlg_last_focused(union control *ctrl, dlgparam *dp);
/*
* During event processing, you might well want to give an error
* indication to the user. dlg_beep() is a quick and easy generic
* error; dlg_error() puts up a message-box or equivalent.
*/
void dlg_beep(void *dlg);
void dlg_error_msg(void *dlg, const char *msg);
void dlg_beep(dlgparam *dp);
void dlg_error_msg(dlgparam *dp, const char *msg);
/*
* This function signals to the front end that the dialog's
* processing is completed, and passes an integer value (typically
* a success status).
*/
void dlg_end(void *dlg, int value);
void dlg_end(dlgparam *dp, int value);
/*
* Routines to manage a (per-platform) colour selector.
@ -612,9 +612,9 @@ void dlg_end(void *dlg, int value);
* dlg_coloursel_start() accepts an RGB triple which is used to
* initialise the colour selector to its starting value.
*/
void dlg_coloursel_start(union control *ctrl, void *dlg,
void dlg_coloursel_start(union control *ctrl, dlgparam *dp,
int r, int g, int b);
int dlg_coloursel_results(union control *ctrl, void *dlg,
int dlg_coloursel_results(union control *ctrl, dlgparam *dp,
int *r, int *g, int *b);
/*
@ -626,7 +626,7 @@ int dlg_coloursel_results(union control *ctrl, void *dlg,
* If `ctrl' is NULL, _all_ controls in the dialog get refreshed
* (for loading or saving entire sets of settings).
*/
void dlg_refresh(union control *ctrl, void *dlg);
void dlg_refresh(union control *ctrl, dlgparam *dp);
/*
* Standard helper functions for reading a controlbox structure.