Files
mcde/programs/dtchat/ui_main.h
T
lotherk 0e5f00dd1e dtchat: add the local file dialogs (T5.8, second part)
ui_file.c adds the incoming-file dialog (peer, name, human size; Accept/Reject, close counts as reject) and a Motif file selection box for sending to the selected Nearby peer. Conversation > Send File now opens it when a peer is selected and reports 'local mode is not connected' without a manager; the UI exposes dtchat_ui_set_file_send() for the local manager. The smoke opens and destroys the offer dialog. Standalone Motif build and both Xvfb smokes PASS. The transfer wiring (localui) is still open. make mcde-host still blocked by pid 2126511 (sourcesets, ~35 min).
2026-11-16 20:53:23 +00:00

73 lines
2.6 KiB
C

/*
* ui_main.h -- dtchat's main window
*
* License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree.
*/
#ifndef _Dtchat_ui_main_h
#define _Dtchat_ui_main_h
#include <X11/Intrinsic.h>
#include "dc_internal.h"
typedef struct DtChatUi DtChatUi;
/* Send text to CONV. Return 0 when it was accepted. */
typedef int (*DtChatSendFn)(void *arg, const char *conv, const char *text);
/* MODEL is borrowed; the caller keeps it alive until dtchat_ui_destroy(). */
DtChatUi *dtchat_ui_create(Widget shell, DcModel *model);
void dtchat_ui_destroy(DtChatUi *ui);
/* The toplevel shell, for dialog parents. */
Widget dtchat_ui_shell(const DtChatUi *ui);
/* True when the shell is realized and its map state is IsViewable. */
int dtchat_ui_is_viewable(DtChatUi *ui);
/* Select ACCOUNT/CONV in the roster and show it in the chat. */
void dtchat_ui_select(DtChatUi *ui, const char *account, const char *conv);
/* The local peers shown in the Nearby section (borrowed). */
void dtchat_ui_set_peers(DtChatUi *ui, DcPeers *peers);
void dtchat_ui_select_peer(DtChatUi *ui, const char *id);
int dtchat_ui_is_peer(const DtChatUi *ui, const char *id);
/* The local manager supplies the file sender (T5.8). */
typedef void (*DtChatFileSendFn)(const char *peer_id, const char *path,
void *arg);
void dtchat_ui_set_file_send(DtChatUi *ui, DtChatFileSendFn fn, void *arg);
/* T2.3 runtime binding. */
void dtchat_ui_refresh(DtChatUi *ui);
void dtchat_ui_message_added(DtChatUi *ui, const char *account,
const char *conv);
int dtchat_ui_send_text(DtChatUi *ui, const char *text);
size_t dtchat_ui_shown_messages(const DtChatUi *ui);
int dtchat_ui_contains(const DtChatUi *ui, const char *needle);
/* T2.2/T2.3 smoke: a conversation is selected, its title and transcript exist. */
int dtchat_ui_smoke(DtChatUi *ui);
/* Route sends through FN (the demo/adapter path); NULL restores the local echo. */
void dtchat_ui_set_send_hook(DtChatUi *ui, DtChatSendFn fn, void *arg);
/* T2.8 input helpers (the key handler uses them too). */
void dtchat_ui_clear_input(DtChatUi *ui);
int dtchat_ui_history(DtChatUi *ui, int direction); /* -1 up, +1 down */
int dtchat_ui_complete(DtChatUi *ui);
void dtchat_ui_set_input(DtChatUi *ui, const char *text);
int dtchat_ui_input_equals(const DtChatUi *ui, const char *text);
/* The status line. */
void dtchat_ui_set_status(DtChatUi *ui, const char *text);
/* True when the current conversation is ACCOUNT/CONV. */
int dtchat_ui_is_current(const DtChatUi *ui, const char *account,
const char *conv);
/* Append a system line to the transcript. */
void dtchat_ui_append_system(DtChatUi *ui, const char *text);
#endif /* _Dtchat_ui_main_h */