/* * ui_request.h -- the request, error and QR dialogs of dtchat * * License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree. */ #ifndef _Dtchat_ui_request_h #define _Dtchat_ui_request_h #include #include "dc_internal.h" typedef struct DtRequestDialog DtRequestDialog; /* * Called exactly once: with the answer text, or with NULL for cancel, * timeout and window-manager close. The dialog destroys itself before the * callback returns, so the callback may open the next dialog. */ typedef void (*DtRequestAnswerFn)(const char *value, void *arg); /* * Build the dialog for one adapter "request" object of the v1 protocol * (kind code/password/notice/confirm/qr). TIMEOUT_MS <= 0 means no * timeout. Returns NULL for an unknown kind or an allocation failure. */ DtRequestDialog *dtchat_request_dialog_create(Widget parent, const DcJson *request, int timeout_ms, DtRequestAnswerFn answer, void *arg); void dtchat_request_dialog_destroy(DtRequestDialog *dialog); Widget dtchat_request_dialog_shell(const DtRequestDialog *dialog); /* Same path as the buttons: answers VALUE (NULL = cancel) once. */ void dtchat_request_dialog_answer(DtRequestDialog *dialog, const char *value); /* An error/notice window with one Dismiss button; it frees itself. */ void dtchat_error_dialog(Widget parent, const char *title, const char *text); #endif /* _Dtchat_ui_request_h */