/* * copy the temp buffers to the real ones */ static void wdg_input_consolidate(struct wdg_object *wo) { WDG_WO_EXT(struct wdg_input_handle, ww); char *buf; int i = 0, j; size_t buflen; void (*callback)(void); WDG_DEBUG_MSG("wdg_input_consolidate"); while(ww->fields[i] != NULL) { /* get the buffer */ buf = field_buffer(ww->fields[i+1], 0); buflen = strlen(buf); /* trim out the trailing spaces */ for (j = buflen - 1; j >= 0; j--) if (buf[j] == ' ') buf[j] = 0; else break; /* copy the buffer in the real one */ strcpy(ww->buffers[i/2], buf); /* skip the label */ i += 2; } /* execute the callback */ callback = ww->callback; wdg_destroy_object(&wo); wdg_redraw_all(); WDG_EXECUTE(callback); }
/* * destroy the dialog and * call the function associated to the button */ static void wdg_dialog_callback(struct wdg_object *wo) { WDG_WO_EXT(struct wdg_dialog, ww); void (*callback)(void); WDG_DEBUG_MSG("wdg_dialog_callback"); callback = ww->buttons[ww->focus_button].callback; wdg_destroy_object(&wo); wdg_redraw_all(); WDG_EXECUTE(callback); }
/* * destroy the dialog and * call the function associated to the file open dialog */ static void wdg_file_callback(struct wdg_object *wo, const char *path, char *file) { WDG_WO_EXT(struct wdg_file_handle, ww); void (*callback)(const char *, char *); char *p, *f; WDG_DEBUG_MSG("wdg_file_callback"); /* save the values before destroying the object */ callback = ww->callback; WDG_SAFE_STRDUP(p, path); WDG_SAFE_STRDUP(f, file); /* destroy the object */ wdg_destroy_object(&wo); wdg_redraw_all(); /* call the callback */ WDG_EXECUTE(callback, p, f); /* free saved data */ WDG_SAFE_FREE(f); WDG_SAFE_FREE(p); }