tttk.h 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /* $XConsortium: tttk.h /main/3 1995/10/23 10:33:00 rswiston $ */
  24. /*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
  25. /*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
  26. /*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
  27. /*%% (c) Copyright 1993, 1994 Novell, Inc. */
  28. /*
  29. * @(#)tttk.h 1.11 93/09/29
  30. */
  31. #ifndef tttk_h
  32. #define tttk_h
  33. #include <Tt/tt_c.h>
  34. #include <X11/Intrinsic.h>
  35. #if defined(__cplusplus)
  36. extern "C" {
  37. #endif
  38. typedef enum {
  39. TTDT_OP_NONE,
  40. TTDT_CREATED,
  41. TTDT_DELETED,
  42. TTDT_DO_COMMAND,
  43. TTDT_SET_ENVIRONMENT,
  44. TTDT_GET_ENVIRONMENT,
  45. TTDT_SET_GEOMETRY,
  46. TTDT_GET_GEOMETRY,
  47. TTDT_SET_ICONIFIED,
  48. TTDT_GET_ICONIFIED,
  49. TTDT_SET_LOCALE,
  50. TTDT_GET_LOCALE,
  51. TTDT_SET_MAPPED,
  52. TTDT_GET_MAPPED,
  53. TTDT_MODIFIED,
  54. TTDT_REVERTED,
  55. TTDT_GET_MODIFIED,
  56. TTDT_MOVED,
  57. TTDT_PAUSE,
  58. TTDT_RESUME,
  59. TTDT_QUIT,
  60. TTDT_RAISE,
  61. TTDT_LOWER,
  62. TTDT_SAVE,
  63. TTDT_REVERT,
  64. TTDT_SAVED,
  65. TTDT_SET_SITUATION,
  66. TTDT_GET_SITUATION,
  67. TTDT_SIGNAL,
  68. TTDT_STARTED,
  69. TTDT_STOPPED,
  70. TTDT_STATUS,
  71. TTDT_GET_STATUS,
  72. TTDT_GET_SYSINFO,
  73. TTDT_SET_XINFO,
  74. TTDT_GET_XINFO,
  75. TTME_ABSTRACT,
  76. TTME_DEPOSIT,
  77. TTME_DISPLAY,
  78. TTME_EDIT,
  79. TTME_COMPOSE,
  80. TTME_INTERPRET,
  81. TTME_PRINT,
  82. TTME_TRANSLATE,
  83. TTME_MAIL,
  84. TTME_MAIL_COMPOSE,
  85. TTME_MAIL_EDIT,
  86. TTME_INSTANTIATE,
  87. TTDT_OP_LAST
  88. } Tttk_op;
  89. /*
  90. * Standard vtype names
  91. */
  92. extern const char *Tttk_integer;
  93. extern const char *Tttk_string;
  94. extern const char *Tttk_boolean;
  95. extern const char *Tttk_file;
  96. extern const char *Tttk_message_id;
  97. extern const char *Tttk_title;
  98. extern const char *Tttk_width;
  99. extern const char *Tttk_height;
  100. extern const char *Tttk_xoffset;
  101. extern const char *Tttk_yoffset;
  102. /*
  103. **********************************************************************
  104. *
  105. * Procid lifecycle
  106. *
  107. **********************************************************************
  108. */
  109. char *ttdt_open(
  110. int *tt_fd,
  111. const char *toolname,
  112. const char *vendor,
  113. const char *version,
  114. int sendStarted
  115. );
  116. Tt_status ttdt_sender_imprint_on(
  117. const char *handler,
  118. Tt_message commission,
  119. char **display,
  120. int *width,
  121. int *height,
  122. int *xoffset,
  123. int *yoffset,
  124. XtAppContext app2run,
  125. int ms_timeout
  126. );
  127. Tt_status ttdt_close(
  128. const char *procid,
  129. const char *newprocid,
  130. int sendStopped
  131. );
  132. /*
  133. **********************************************************************
  134. *
  135. * Sessions
  136. *
  137. **********************************************************************
  138. */
  139. typedef Tt_message (*Ttdt_contract_cb)(
  140. Tt_message msg,
  141. void *clientdata,
  142. Tt_message contract
  143. );
  144. Tt_pattern *ttdt_session_join(
  145. const char *sessid,
  146. Ttdt_contract_cb cb,
  147. Widget shell,
  148. void *clientdata,
  149. int join
  150. );
  151. Tt_status ttdt_session_quit(
  152. const char *sessid,
  153. Tt_pattern *sess_pats,
  154. int quit
  155. );
  156. /*
  157. **********************************************************************
  158. *
  159. * Contracts
  160. *
  161. **********************************************************************
  162. */
  163. Tt_pattern *ttdt_message_accept(
  164. Tt_message contract,
  165. Ttdt_contract_cb cb,
  166. Widget shell,
  167. void *clientdata,
  168. int accept,
  169. int sendStatus
  170. );
  171. Tt_pattern *ttdt_subcontract_manage(
  172. Tt_message subcontract,
  173. Ttdt_contract_cb cb,
  174. Widget shell,
  175. void *clientdata
  176. );
  177. /*
  178. **********************************************************************
  179. *
  180. * Desktop: Files
  181. *
  182. **********************************************************************
  183. */
  184. typedef Tt_message (*Ttdt_file_cb)(
  185. Tt_message msg,
  186. Tttk_op op,
  187. char *pathname,
  188. void *clientdata,
  189. int same_euid_egid,
  190. int same_procid
  191. );
  192. Tt_pattern *ttdt_file_join(
  193. const char *pathname,
  194. Tt_scope scope,
  195. int join,
  196. Ttdt_file_cb cb,
  197. void *clientdata
  198. );
  199. Tt_status ttdt_file_event(
  200. Tt_message context,
  201. Tttk_op event,
  202. Tt_pattern *patterns,
  203. int send
  204. );
  205. Tt_status ttdt_file_quit(
  206. Tt_pattern *patterns,
  207. int quit
  208. );
  209. int ttdt_Get_Modified(
  210. Tt_message context,
  211. const char *pathname,
  212. Tt_scope scope,
  213. XtAppContext app2run,
  214. int ms_timeout
  215. );
  216. Tt_status ttdt_Save(
  217. Tt_message context,
  218. const char *pathname,
  219. Tt_scope scope,
  220. XtAppContext app2run,
  221. int ms_timeout
  222. );
  223. Tt_status ttdt_Revert(
  224. Tt_message context,
  225. const char *pathname,
  226. Tt_scope scope,
  227. XtAppContext app2run,
  228. int ms_timeout
  229. );
  230. Tt_message ttdt_file_notice(
  231. Tt_message context,
  232. Tttk_op op,
  233. Tt_scope scope,
  234. const char *file,
  235. int send_and_destroy
  236. );
  237. Tt_message ttdt_file_request(
  238. Tt_message context,
  239. Tttk_op op,
  240. Tt_scope scope,
  241. const char *file,
  242. Ttdt_file_cb cb,
  243. void *clientdata,
  244. int send
  245. );
  246. /*
  247. **********************************************************************
  248. *
  249. * Media Exchange
  250. *
  251. **********************************************************************
  252. */
  253. typedef Tt_message (*Ttmedia_load_pat_cb)(
  254. Tt_message msg,
  255. void *clientdata,
  256. Tttk_op op,
  257. Tt_status diagnosis,
  258. unsigned char *contents,
  259. int len,
  260. char *file,
  261. char *docname
  262. );
  263. Tt_status ttmedia_ptype_declare(
  264. const char *ptype,
  265. int base_opnum,
  266. Ttmedia_load_pat_cb cb,
  267. void *clientdata,
  268. int declare
  269. );
  270. typedef Tt_message (*Ttmedia_load_msg_cb)(
  271. Tt_message msg,
  272. void *clientdata,
  273. Tttk_op op,
  274. unsigned char *contents,
  275. int len,
  276. char *file
  277. );
  278. Tt_message ttmedia_load(
  279. Tt_message context,
  280. Ttmedia_load_msg_cb cb,
  281. void *clientdata,
  282. Tttk_op op,
  283. const char *media_type,
  284. const unsigned char *contents,
  285. int len,
  286. const char *file,
  287. const char *docname,
  288. int send
  289. );
  290. Tt_status ttmedia_load_reply(
  291. Tt_message contract,
  292. const unsigned char *new_contents,
  293. int new_len,
  294. int reply_and_destroy
  295. );
  296. Tt_status ttmedia_Deposit(
  297. Tt_message contract,
  298. const char *buffer_id,
  299. const char *media_type,
  300. const unsigned char *new_contents,
  301. int new_len,
  302. const char *file,
  303. XtAppContext app2run,
  304. int ms_timeout
  305. );
  306. /*
  307. **********************************************************************
  308. *
  309. * ToolTalk Toolkit
  310. *
  311. **********************************************************************
  312. */
  313. void tttk_Xt_input_handler(
  314. XtPointer procid,
  315. int *,
  316. XtInputId *
  317. );
  318. Tt_status tttk_block_while(
  319. XtAppContext app2run,
  320. const int *blocked,
  321. int ms_timeout
  322. );
  323. Tt_message tttk_message_create(
  324. Tt_message context,
  325. Tt_class the_class,
  326. Tt_scope the_scope,
  327. const char *handler,
  328. const char *op,
  329. Tt_message_callback callback
  330. );
  331. Tt_status tttk_message_destroy(
  332. Tt_message msg
  333. );
  334. Tt_status tttk_message_reject(
  335. Tt_message msg,
  336. Tt_status status,
  337. const char *status_string,
  338. int destroy
  339. );
  340. Tt_status tttk_message_fail(
  341. Tt_message msg,
  342. Tt_status status,
  343. const char *status_string,
  344. int destroy
  345. );
  346. Tt_status tttk_message_abandon(
  347. Tt_message msg
  348. );
  349. Tttk_op tttk_string_op(
  350. const char *s
  351. );
  352. char *tttk_op_string(
  353. Tttk_op op
  354. );
  355. #if defined(__cplusplus)
  356. }
  357. #endif
  358. #endif