eiffel-iup.c 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051
  1. // The MIT License (MIT)
  2. // Copyright (c) 2016, 2017 by German A. Arias
  3. // Permission is hereby granted, free of charge, to any person obtaining a copy
  4. // of this software and associated documentation files (the "Software"), to deal
  5. // in the Software without restriction, including without limitation the rights
  6. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. // copies of the Software, and to permit persons to whom the Software is
  8. // furnished to do so, subject to the following conditions:
  9. //
  10. // The above copyright notice and this permission notice shall be included in
  11. // all copies or substantial portions of the Software.
  12. //
  13. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  19. // SOFTWARE.
  20. #include "eiffel-iup-cecil.h"
  21. int iup_init(int argc, char *argv[]) {
  22. /* This is called in all IUP applications. Arguments are parsed
  23. * from the command line and are returned to the application. */
  24. IupOpen(&argc, &argv);
  25. return argc;
  26. }
  27. void iup_main_loop() {
  28. IupMainLoop();
  29. }
  30. void iup_close() {
  31. IupClose();
  32. }
  33. int get_param_dialog (const char* title, void* user_data, const char* format, int param_count, int param_extra, void** param_data) {
  34. return IupGetParamv(title, param_action, user_data, format, param_count, param_extra, param_data);
  35. }
  36. int param_action(Ihandle* dialog, int param_index, void* user_data) {
  37. return param_cb_FniV(iup_object(0), dialog, param_index, user_data);
  38. }
  39. void config_recent_init (Ihandle* ih, Ihandle* menu, int max_recent) {
  40. IupConfigRecentInit(ih, menu, (Icallback) callback_recent_cb, max_recent);
  41. }
  42. void connect_function (const char *name, int operation) {
  43. if (strcmp("IDLE_ACTION",name) == 0)
  44. {
  45. if (operation == 1)
  46. {
  47. IupSetFunction(name, (Icallback) callback_idle_action);
  48. }
  49. else
  50. {
  51. IupSetFunction(name, NULL);
  52. }
  53. }
  54. else
  55. {
  56. printf("Unknown function.");
  57. }
  58. }
  59. void connect_callback (Ihandle* ih, const char *name, const char *type, int operation) {
  60. if (operation == 0)
  61. {
  62. IupSetCallback(ih, name, NULL);
  63. return;
  64. }
  65. if (strcmp("HELP_CB",name) == 0)
  66. {
  67. IupSetCallback(ih, name, (Icallback) callback_map_cb);
  68. }
  69. else if (strcmp("MAP_CB",name) == 0)
  70. {
  71. IupSetCallback(ih, name, (Icallback) callback_map_cb);
  72. }
  73. else if (strcmp("UNMAP_CB",name) == 0)
  74. {
  75. IupSetCallback(ih, name, (Icallback) callback_unmap_cb);
  76. }
  77. else if (strcmp("DESTROY_CB",name) == 0)
  78. {
  79. IupSetCallback(ih, name, (Icallback) callback_destroy_cb);
  80. }
  81. else if (strcmp("LDESTROY_CB",name) == 0)
  82. {
  83. IupSetCallback(ih, name, (Icallback) callback_ldestroy_cb);
  84. }
  85. else if (strcmp("GETFOCUS_CB",name) == 0)
  86. {
  87. IupSetCallback(ih, name, (Icallback) callback_getfocus_cb);
  88. }
  89. else if (strcmp("KILLFOCUS_CB",name) == 0)
  90. {
  91. IupSetCallback(ih, name, (Icallback) callback_killfocus_cb);
  92. }
  93. else if (strcmp("ENTERWINDOW_CB",name) == 0)
  94. {
  95. IupSetCallback(ih, name, (Icallback) callback_enterwindow_cb);
  96. }
  97. else if (strcmp("LEAVEWINDOW_CB",name) == 0)
  98. {
  99. IupSetCallback(ih, name, (Icallback) callback_leavewindow_cb);
  100. }
  101. else if (strcmp("K_ANY",name) == 0)
  102. {
  103. IupSetCallback(ih, name, (Icallback) callback_k_any);
  104. }
  105. else if (strcmp("ACTION",name) == 0)
  106. {
  107. if (strcmp("Fn", type) == 0)
  108. {
  109. IupSetCallback(ih, name, (Icallback) callback_action_Fn);
  110. }
  111. else if (strcmp("Fnff", type) == 0)
  112. {
  113. IupSetCallback(ih, name, (Icallback) callback_action_Fnff);
  114. }
  115. else if (strcmp("Fns", type) == 0)
  116. {
  117. IupSetCallback(ih, name, (Icallback) callback_click_cb);
  118. }
  119. else if (strcmp("Fnsii", type) == 0)
  120. {
  121. IupSetCallback(ih, name, (Icallback) callback_action_Fnsii);
  122. }
  123. else if (strcmp("Fnis", type) == 0)
  124. {
  125. IupSetCallback(ih, name, (Icallback) callback_action_Fnis);
  126. }
  127. else if (strcmp("Fni", type) == 0)
  128. {
  129. IupSetCallback(ih, name, (Icallback) callback_action_Fni);
  130. }
  131. }
  132. else if (strcmp("CLOSE_CB",name) == 0)
  133. {
  134. IupSetCallback(ih, name, (Icallback) callback_close_cb);
  135. }
  136. else if (strcmp("COPYDATA_CB",name) == 0)
  137. {
  138. IupSetCallback(ih, name, (Icallback) callback_copydata_cb);
  139. }
  140. else if (strcmp("DROPFILES_CB",name) == 0)
  141. {
  142. IupSetCallback(ih, name, (Icallback) callback_dropfiles_cb);
  143. }
  144. // Skeep CUSTOMFRAME_CB
  145. else if (strcmp("MDIACTIVATE_CB",name) == 0)
  146. {
  147. IupSetCallback(ih, name, (Icallback) callback_mdiactivate_cb);
  148. }
  149. else if (strcmp("MOVE_CB",name) == 0)
  150. {
  151. IupSetCallback(ih, name, (Icallback) callback_move_cb);
  152. }
  153. else if (strcmp("RESIZE_CB",name) == 0)
  154. {
  155. IupSetCallback(ih, name, (Icallback) callback_resize_cb);
  156. }
  157. else if (strcmp("SHOW_CB",name) == 0)
  158. {
  159. IupSetCallback(ih, name, (Icallback) callback_show_cb);
  160. }
  161. else if (strcmp("TRAYCLICK_CB",name) == 0)
  162. {
  163. IupSetCallback(ih, name, (Icallback) callback_trayclick_cb);
  164. }
  165. else if (strcmp("FILE_CB",name) == 0)
  166. {
  167. IupSetCallback(ih, name, (Icallback) callback_file_cb);
  168. }
  169. else if (strcmp("COLORUPDATE_CB",name) == 0)
  170. {
  171. IupSetCallback(ih, name, (Icallback) callback_colorupdate_cb);
  172. }
  173. else if (strcmp("CANCEL_CB",name) == 0)
  174. {
  175. IupSetCallback(ih, name, (Icallback) callback_cancel_cb);
  176. }
  177. else if (strcmp("GETPARAM",name) == 0)
  178. {
  179. }
  180. else if (strcmp("TABCHANGE_CB",name) == 0)
  181. {
  182. IupSetCallback(ih, name, (Icallback) callback_tabchange_cb);
  183. }
  184. else if (strcmp("TABCHANGEPOS_CB",name) == 0)
  185. {
  186. IupSetCallback(ih, name, (Icallback) callback_tabchangepos_cb);
  187. }
  188. else if (strcmp("TABCLOSE_CB",name) == 0)
  189. {
  190. IupSetCallback(ih, name, (Icallback) callback_tabclose_cb);
  191. }
  192. else if (strcmp("RIGHTCLICK_CB",name) == 0)
  193. {
  194. IupSetCallback(ih, name, (Icallback) callback_rightclick_cb);
  195. }
  196. else if (strcmp("DETACHED_CB",name) == 0)
  197. {
  198. IupSetCallback(ih, name, (Icallback) callback_detached_cb);
  199. }
  200. else if (strcmp("RESTORED_CB",name) == 0)
  201. {
  202. IupSetCallback(ih, name, (Icallback) callback_restored_cb);
  203. }
  204. else if (strcmp("OPENCLOSE_CB",name) == 0)
  205. {
  206. IupSetCallback(ih, name, (Icallback) callback_openclose_cb);
  207. }
  208. else if (strcmp("EXTRABUTTON_CB",name) == 0)
  209. {
  210. IupSetCallback(ih, name, (Icallback) callback_extrabutton_cb);
  211. }
  212. else if (strcmp("VALUECHANGED_CB",name) == 0)
  213. {
  214. IupSetCallback(ih, name, (Icallback) callback_valuechanged_cb);
  215. }
  216. else if (strcmp("BUTTON_CB",name) == 0)
  217. {
  218. IupSetCallback(ih, name, (Icallback) callback_button_cb);
  219. }
  220. else if (strcmp("FOCUS_CB",name) == 0)
  221. {
  222. IupSetCallback(ih, name, (Icallback) callback_focus_cb);
  223. }
  224. else if (strcmp("MOTION_CB",name) == 0)
  225. {
  226. IupSetCallback(ih, name, (Icallback) callback_motion_cb);
  227. }
  228. else if (strcmp("KEYPRESS_CB",name) == 0)
  229. {
  230. IupSetCallback(ih, name, (Icallback) callback_keypress_cb);
  231. }
  232. else if (strcmp("SCROLL_CB",name) == 0)
  233. {
  234. IupSetCallback(ih, name, (Icallback) callback_scroll_cb);
  235. }
  236. // TOUCH_CB and MULTITOUCH_CB
  237. else if (strcmp("WHEEL_CB",name) == 0)
  238. {
  239. IupSetCallback(ih, name, (Icallback) callback_wheel_cb);
  240. }
  241. // WOM_CB
  242. else if (strcmp("CARET_CB",name) == 0)
  243. {
  244. IupSetCallback(ih, name, (Icallback) callback_caret_cb);
  245. }
  246. else if (strcmp("DBLCLICK_CB",name) == 0)
  247. {
  248. IupSetCallback(ih, name, (Icallback) callback_dblclick_cb);
  249. }
  250. else if (strcmp("DRAGDROP_CB",name) == 0)
  251. {
  252. IupSetCallback(ih, name, (Icallback) callback_dragdrop_cb);
  253. }
  254. else if (strcmp("DROPDOWN_CB",name) == 0)
  255. {
  256. IupSetCallback(ih, name, (Icallback) callback_dropdown_cb);
  257. }
  258. else if (strcmp("EDIT_CB",name) == 0)
  259. {
  260. IupSetCallback(ih, name, (Icallback) callback_edit_cb);
  261. }
  262. else if (strcmp("MULTISELECT_CB",name) == 0)
  263. {
  264. IupSetCallback(ih, name, (Icallback) callback_multiselect_cb);
  265. }
  266. else if (strcmp("SPIN_CB",name) == 0)
  267. {
  268. IupSetCallback(ih, name, (Icallback) callback_spin_cb);
  269. }
  270. else if (strcmp("SELECTION_CB",name) == 0)
  271. {
  272. IupSetCallback(ih, name, (Icallback) callback_selection_cb);
  273. }
  274. else if (strcmp("MULTISELECTION_CB",name) == 0)
  275. {
  276. IupSetCallback(ih, name, (Icallback) callback_multiselection_cb);
  277. }
  278. else if (strcmp("MULTIUNSELECTION_CB",name) == 0)
  279. {
  280. IupSetCallback(ih, name, (Icallback) callback_multiunselection_cb);
  281. }
  282. else if (strcmp("BRANCHOPEN_CB",name) == 0)
  283. {
  284. IupSetCallback(ih, name, (Icallback) callback_branchopen_cb);
  285. }
  286. else if (strcmp("BRANCHCLOSE_CB",name) == 0)
  287. {
  288. IupSetCallback(ih, name, (Icallback) callback_branchclose_cb);
  289. }
  290. else if (strcmp("EXECUTELEAF_CB",name) == 0)
  291. {
  292. IupSetCallback(ih, name, (Icallback) callback_executeleaf_cb);
  293. }
  294. else if (strcmp("SHOWRENAME_CB",name) == 0)
  295. {
  296. IupSetCallback(ih, name, (Icallback) callback_showrename_cb);
  297. }
  298. else if (strcmp("RENAME_CB",name) == 0)
  299. {
  300. IupSetCallback(ih, name, (Icallback) callback_rename_cb);
  301. }
  302. else if (strcmp("NODEREMOVED_CB",name) == 0)
  303. {
  304. IupSetCallback(ih, name, (Icallback) callback_noderemoved_cb);
  305. }
  306. else if (strcmp("TOGGLEVALUE_CB",name) == 0)
  307. {
  308. if (strcmp("Fnii", type) == 0)
  309. {
  310. IupSetCallback(ih, name, (Icallback) callback_togglevalue_cb_Fnii);
  311. }
  312. // Matrix
  313. else if (strcmp("Fniii", type) == 0)
  314. {
  315. IupSetCallback(ih, name, (Icallback) callback_togglevalue_cb_Fniii);
  316. }
  317. }
  318. else if (strcmp("HIGHLIGHT_CB",name) == 0)
  319. {
  320. IupSetCallback(ih, name, (Icallback) callback_highlight_cb);
  321. }
  322. else if (strcmp("OPEN_CB",name) == 0)
  323. {
  324. IupSetCallback(ih, name, (Icallback) callback_open_cb);
  325. }
  326. else if (strcmp("MENUCLOSE_CB",name) == 0)
  327. {
  328. IupSetCallback(ih, name, (Icallback) callback_menuclose_cb);
  329. }
  330. else if (strcmp("DRAGBEGIN_CB",name) == 0)
  331. {
  332. IupSetCallback(ih, name, (Icallback) callback_dragbegin_cb);
  333. }
  334. else if (strcmp("DRAGDATASIZE_CB",name) == 0)
  335. {
  336. IupSetCallback(ih, name, (Icallback) callback_dragdatasize_cb);
  337. }
  338. else if (strcmp("DRAGDATA_CB",name) == 0)
  339. {
  340. IupSetCallback(ih, name, (Icallback) callback_dragdata_cb);
  341. }
  342. else if (strcmp("DRAGEND_CB",name) == 0)
  343. {
  344. IupSetCallback(ih, name, (Icallback) callback_dragend_cb);
  345. }
  346. else if (strcmp("DROPDATA_CB",name) == 0)
  347. {
  348. IupSetCallback(ih, name, (Icallback) callback_dropdata_cb);
  349. }
  350. else if (strcmp("DROPMOTION_CB",name) == 0)
  351. {
  352. IupSetCallback(ih, name, (Icallback) callback_dropmotion_cb);
  353. }
  354. else if (strcmp("FLAT_ACTION",name) == 0)
  355. {
  356. IupSetCallback(ih, name, (Icallback) callback_flat_action_Fn);
  357. }
  358. else if (strcmp("FLAT_BUTTON_CB",name) == 0)
  359. {
  360. IupSetCallback(ih, name, (Icallback) callback_flat_button_cb);
  361. }
  362. else if (strcmp("FLAT_FOCUS_CB",name) == 0)
  363. {
  364. IupSetCallback(ih, name, (Icallback) callback_flat_focus_cb);
  365. }
  366. else if (strcmp("FLAT_ENTERWINDOW_CB",name) == 0)
  367. {
  368. IupSetCallback(ih, name, (Icallback) callback_flat_enterwindow_cb);
  369. }
  370. else if (strcmp("FLAT_LEAVEWINDOW_CB",name) == 0)
  371. {
  372. IupSetCallback(ih, name, (Icallback) callback_flat_leavewindow_cb);
  373. }
  374. // Cells
  375. else if (strcmp("DRAW_CB",name) == 0) // Also Matrix
  376. {
  377. IupSetCallback(ih, name, (Icallback) callback_draw_cb);
  378. }
  379. else if (strcmp("HEIGHT_CB",name) == 0)
  380. {
  381. IupSetCallback(ih, name, (Icallback) callback_height_cb);
  382. }
  383. else if (strcmp("HSPAN_CB",name) == 0)
  384. {
  385. IupSetCallback(ih, name, (Icallback) callback_hspan_cb);
  386. }
  387. else if (strcmp("MOUSECLICK_CB",name) == 0)
  388. {
  389. IupSetCallback(ih, name, (Icallback) callback_mouseclick_cb);
  390. }
  391. else if (strcmp("MOUSEMOTION_CB",name) == 0)
  392. {
  393. IupSetCallback(ih, name, (Icallback) callback_mousemotion_cb);
  394. }
  395. else if (strcmp("NCOLS_CB",name) == 0)
  396. {
  397. IupSetCallback(ih, name, (Icallback) callback_ncols_cb);
  398. }
  399. else if (strcmp("NLINES_CB",name) == 0)
  400. {
  401. IupSetCallback(ih, name, (Icallback) callback_nlines_cb);
  402. }
  403. else if (strcmp("SCROLLING_CB",name) == 0)
  404. {
  405. IupSetCallback(ih, name, (Icallback) callback_scrolling_cb);
  406. }
  407. else if (strcmp("VSPAN_CB",name) == 0)
  408. {
  409. IupSetCallback(ih, name, (Icallback) callback_vspan_cb);
  410. }
  411. else if (strcmp("WIDTH_CB",name) == 0)
  412. {
  413. IupSetCallback(ih, name, (Icallback) callback_width_cb);
  414. }
  415. else if (strcmp("CELL_CB",name) == 0)
  416. {
  417. IupSetCallback(ih, name, (Icallback) callback_cell_cb);
  418. }
  419. else if (strcmp("EXTENDED_CB",name) == 0)
  420. {
  421. IupSetCallback(ih, name, (Icallback) callback_extended_cb);
  422. }
  423. else if (strcmp("SELECT_CB",name) == 0)
  424. {
  425. IupSetCallback(ih, name, (Icallback) callback_select_cb);
  426. }
  427. else if (strcmp("SWITCH_CB",name) == 0)
  428. {
  429. IupSetCallback(ih, name, (Icallback) callback_switch_cb);
  430. }
  431. // Matrix (Interaction)
  432. else if (strcmp("ACTION_CB", name) == 0)
  433. {
  434. IupSetCallback(ih, name, (Icallback) callback_action_Fniiiis);
  435. }
  436. else if (strcmp("CLICK_CB",name) == 0)
  437. {
  438. IupSetCallback(ih, name, (Icallback) callback_click_cb_Fniis);
  439. }
  440. else if (strcmp("COLRESIZE_CB",name) == 0)
  441. {
  442. IupSetCallback(ih, name, (Icallback) callback_colresize_cb);
  443. }
  444. else if (strcmp("RELEASE_CB",name) == 0)
  445. {
  446. IupSetCallback(ih, name, (Icallback) callback_release_cb);
  447. }
  448. else if (strcmp("RESIZEMATRIX_CB",name) == 0)
  449. {
  450. IupSetCallback(ih, name, (Icallback) callback_resizematrix_cb);
  451. }
  452. else if (strcmp("MOUSEMOVE_CB",name) == 0)
  453. {
  454. IupSetCallback(ih, name, (Icallback) callback_mousemove_cb);
  455. }
  456. else if (strcmp("ENTERITEM_CB",name) == 0)
  457. {
  458. IupSetCallback(ih, name, (Icallback) callback_enteritem_cb);
  459. }
  460. else if (strcmp("LEAVEITEM_CB",name) == 0)
  461. {
  462. IupSetCallback(ih, name, (Icallback) callback_leaveitem_cb);
  463. }
  464. else if (strcmp("SCROLLTOP_CB",name) == 0)
  465. {
  466. IupSetCallback(ih, name, (Icallback) callback_scrolltop_cb);
  467. }
  468. else if (strcmp("BGCOLOR_CB",name) == 0)
  469. {
  470. IupSetCallback(ih, name, (Icallback) callback_bgcolor_cb);
  471. }
  472. else if (strcmp("FGCOLOR_CB",name) == 0)
  473. {
  474. IupSetCallback(ih, name, (Icallback) callback_fgcolor_cb);
  475. }
  476. else if (strcmp("FONT_CB",name) == 0)
  477. {
  478. IupSetCallback(ih, name, (Icallback) callback_font_cb);
  479. }
  480. else if (strcmp("TYPE_CB",name) == 0)
  481. {
  482. IupSetCallback(ih, name, (Icallback) callback_type_cb);
  483. }
  484. else if (strcmp("DROPCHECK_CB",name) == 0)
  485. {
  486. IupSetCallback(ih, name, (Icallback) callback_dropcheck_cb);
  487. }
  488. else if (strcmp("TRANSLATEVALUE_CB",name) == 0)
  489. {
  490. IupSetCallback(ih, name, (Icallback) callback_translatevalue_cb);
  491. }
  492. else if (strcmp("DROP_CB",name) == 0)
  493. {
  494. IupSetCallback(ih, name, (Icallback) callback_drop_cb);
  495. }
  496. else if (strcmp("MENUDROP_CB",name) == 0)
  497. {
  498. IupSetCallback(ih, name, (Icallback) callback_menudrop_cb);
  499. }
  500. else if (strcmp("DROPSELECT_CB",name) == 0)
  501. {
  502. IupSetCallback(ih, name, (Icallback) callback_dropselect_cb);
  503. }
  504. else if (strcmp("EDITION_CB",name) == 0)
  505. {
  506. IupSetCallback(ih, name, (Icallback) callback_edition_cb);
  507. }
  508. else if (strcmp("VALUE_CB",name) == 0)
  509. {
  510. IupSetCallback(ih, name, (Icallback) callback_value_cb);
  511. }
  512. else if (strcmp("VALUE_EDIT_CB",name) == 0)
  513. {
  514. IupSetCallback(ih, name, (Icallback) callback_value_edit_cb);
  515. }
  516. else if (strcmp("MARK_CB",name) == 0)
  517. {
  518. IupSetCallback(ih, name, (Icallback) callback_mark_cb);
  519. }
  520. else if (strcmp("MARKEDIT_CB",name) == 0)
  521. {
  522. IupSetCallback(ih, name, (Icallback) callback_markedit_cb);
  523. }
  524. // Flat tabs
  525. else if (strcmp("FLAT_MOTION_CB",name) == 0)
  526. {
  527. IupSetCallback(ih, name, (Icallback) callback_flat_motion_cb);
  528. }
  529. else
  530. {
  531. printf("Unknown function.");
  532. }
  533. }
  534. // One function for each type of event
  535. // Common callbacks
  536. int callback_idle_action(void) {
  537. return idle_action_Fidle(iup_object(0));
  538. }
  539. void callback_help_cb(Ihandle *ih) {
  540. help_cb_Fn(iup_object(0), ih);
  541. }
  542. int callback_map_cb(Ihandle *ih) {
  543. return map_cb_Fn(iup_object(0), ih);
  544. }
  545. int callback_unmap_cb(Ihandle *ih) {
  546. return unmap_cb_Fn(iup_object(0), ih);
  547. }
  548. int callback_destroy_cb(Ihandle *ih) {
  549. return destroy_cb_Fn(iup_object(0), ih);
  550. }
  551. int callback_ldestroy_cb(Ihandle *ih) {
  552. return ldestroy_cb_Fn(iup_object(0), ih);
  553. }
  554. int callback_getfocus_cb(Ihandle *ih) {
  555. return getfocus_cb_Fn(iup_object(0), ih);
  556. }
  557. int callback_killfocus_cb(Ihandle *ih) {
  558. return killfocus_cb_Fn(iup_object(0), ih);
  559. }
  560. int callback_enterwindow_cb(Ihandle *ih) {
  561. return enterwindow_cb_Fn(iup_object(0), ih);
  562. }
  563. int callback_leavewindow_cb(Ihandle *ih) {
  564. return leavewindow_cb_Fn(iup_object(0), ih);
  565. }
  566. int callback_k_any(Ihandle *ih, int c) {
  567. return k_any_Fni(iup_object(0), ih, c);
  568. }
  569. // Action callbacks
  570. int callback_action_Fn(Ihandle *ih) {
  571. return action_Fn(iup_object(0), ih);
  572. }
  573. // Dialog and progress dialog callback
  574. int callback_close_cb(Ihandle *ih) {
  575. return close_cb_Fn(iup_object(0), ih);
  576. }
  577. int callback_copydata_cb(Ihandle *ih, char* cmdLine, int size) {
  578. return copydata_cb_Fnsi(iup_object(0), ih, cmdLine, size);
  579. }
  580. int callback_dropfiles_cb(Ihandle *ih, char* filename, int num, int x, int y) {
  581. return dropfiles_cb_Fnsiii(iup_object(0), ih, filename, num, x, y);
  582. }
  583. int callback_mdiactivate_cb(Ihandle *ih) {
  584. return mdiactivate_cb_Fn(iup_object(0), ih);
  585. }
  586. int callback_move_cb(Ihandle *ih, int x, int y) {
  587. return move_cb_Fnii(iup_object(0), ih, x, y);
  588. }
  589. int callback_resize_cb(Ihandle *ih, int width, int height) {
  590. return resize_cb_Fnii(iup_object(0), ih, width, height);
  591. }
  592. int callback_show_cb(Ihandle *ih, int state) {
  593. return show_cb_Fni(iup_object(0), ih, state);
  594. }
  595. int callback_trayclick_cb(Ihandle *ih, int but, int pressed, int dclick) {
  596. return trayclick_cb_Fniii(iup_object(0), ih, but, pressed, dclick);
  597. }
  598. // File dialog callback
  599. int callback_file_cb(Ihandle *ih, char* file_name, char* status) {
  600. return file_cb_Fnss(iup_object(0), ih, file_name, status);
  601. }
  602. // Color dialog callback
  603. int callback_colorupdate_cb (Ihandle* ih) {
  604. return colorupdate_cb_Fn(iup_object(0), ih);
  605. }
  606. // Progress dialog callback
  607. int callback_cancel_cb (Ihandle* ih) {
  608. return cancel_cb_Fn(iup_object(0), ih);
  609. }
  610. /*
  611. // Get param dialog callback
  612. int callback_getparam(Ihandle* dialog, int param_index, void* user_data) {
  613. return getparam_FniV(iup_object(0), dialog, param_index, user_data);
  614. }
  615. */
  616. // Tabs callbacks
  617. int callback_tabchange_cb(Ihandle *ih, Ihandle* new_tab, Ihandle* old_tab) {
  618. return tabchange_cb_Fnnn(iup_object(0), ih, new_tab, old_tab);
  619. }
  620. int callback_tabchangepos_cb(Ihandle *ih, int new_pos, int old_pos) {
  621. return tabchangepos_cb_Fnii(iup_object(0), ih, new_pos, old_pos);
  622. }
  623. int callback_tabclose_cb(Ihandle *ih, int pos) {
  624. return tabclose_cb_Fni(iup_object(0), ih, pos);
  625. }
  626. int callback_rightclick_cb(Ihandle *ih, int pos) {
  627. return rightclick_cb_Fni(iup_object(0), ih, pos);
  628. }
  629. // Detach box callback
  630. int callback_detached_cb(Ihandle *ih, Ihandle *new_parent, int x, int y) {
  631. return detached_cb_Fnnii(iup_object(0), ih, new_parent, x, y);
  632. }
  633. int callback_restored_cb(Ihandle *ih, Ihandle *old_parent, int x, int y) {
  634. return restored_cb_Fnnii(iup_object(0), ih, old_parent, x, y);
  635. }
  636. // Expander callbacks
  637. int callback_openclose_cb(Ihandle *ih, int state) {
  638. return openclose_cb_Fni(iup_object(0), ih, state);
  639. }
  640. int callback_extrabutton_cb(Ihandle *ih, Ihandle *new_parent, int button, int pressed) {
  641. return extrabutton_cb_Fnii(iup_object(0), ih, button, pressed);
  642. }
  643. // Val callback
  644. int callback_valuechanged_cb(Ihandle *ih) {
  645. return valuechanged_cb_Fn(iup_object(0), ih); // Also matrix
  646. }
  647. // Button callback
  648. int callback_button_cb(Ihandle *ih, int button, int pressed, int x, int y, char* status) {
  649. return button_cb_Fniiiis(iup_object(0), ih, button, pressed, x, y, status);
  650. }
  651. // Canvas callbacks
  652. int callback_action_Fnff(Ihandle *ih, float posx, float posy) {
  653. return action_Fnff(iup_object(0), ih, posx, posy);
  654. }
  655. // Also Dialog
  656. int callback_focus_cb(Ihandle *ih, int focus) {
  657. return focus_cb_Fni(iup_object(0), ih, focus);
  658. }
  659. int callback_motion_cb(Ihandle *ih, int x, int y, char *status) {
  660. return motion_cb_Fniis(iup_object(0), ih, x, y, status);
  661. }
  662. int callback_keypress_cb(Ihandle *ih, int c, int press) {
  663. return keypress_cb_Fnii(iup_object(0), ih, c, press);
  664. }
  665. int callback_scroll_cb(Ihandle *ih, int op, float posx, float posy) {
  666. return scroll_cb_Fniff(iup_object(0), ih, op, posx, posy);
  667. }
  668. int callback_wheel_cb(Ihandle *ih, float delta, int x, int y, char *status) {
  669. return wheel_cb_Fndiis(iup_object(0), ih, delta, x, y, status);
  670. }
  671. int callback_click_cb(Ihandle *ih, char *url) {
  672. return click_cb_Fns(iup_object(0), ih, url);
  673. }
  674. // List callbacks
  675. int callback_action_Fnsii(Ihandle *ih, char *text, int item, int state) {
  676. return action_Fnsii(iup_object(0), ih, text, item, state);
  677. }
  678. int callback_caret_cb(Ihandle *ih, int lin, int col, int pos) {
  679. return caret_cb_Fniii(iup_object(0), ih, lin, col, pos);
  680. }
  681. int callback_dblclick_cb(Ihandle *ih, int item, char *text) {
  682. return dblclick_cb_Fnis(iup_object(0), ih, item, text);
  683. }
  684. int callback_dragdrop_cb(Ihandle *ih, int drag_id, int drop_id, int isshift, int iscontrol) {
  685. return dragdrop_cb_Fniiii(iup_object(0), ih, drag_id, drop_id, isshift, iscontrol);
  686. }
  687. int callback_dropdown_cb(Ihandle *ih, int state) {
  688. return dropdown_cb_Fni(iup_object(0), ih, state);
  689. }
  690. int callback_edit_cb(Ihandle *ih, int c, char *new_value) {
  691. return edit_cb_Fnis(iup_object(0), ih, c, new_value);
  692. }
  693. int callback_multiselect_cb(Ihandle *ih, char *value) {
  694. return multiselect_cb_Fns(iup_object(0), ih, value);
  695. }
  696. // Spin callback
  697. int callback_spin_cb(Ihandle *ih, int inc) {
  698. return spin_cb_Fni(iup_object(0), ih, inc);
  699. }
  700. // Text callback
  701. int callback_action_Fnis(Ihandle *ih, int c, char *new_value) {
  702. return action_Fnis(iup_object(0), ih, c, new_value);
  703. }
  704. // Toggle callback
  705. int callback_action_Fni(Ihandle* ih, int state) {
  706. return action_Fni(iup_object(0), ih, state);
  707. }
  708. // Tree callbacks
  709. int callback_selection_cb (Ihandle *ih, int id, int status) {
  710. return selection_cb_Fnii(iup_object(0), ih, id, status);
  711. }
  712. int callback_multiselection_cb (Ihandle *ih, int* ids, int n) {
  713. return multiselection_cb_Fnpi(iup_object(0), ih, ids, n);
  714. }
  715. int callback_multiunselection_cb (Ihandle *ih, int* ids, int n) {
  716. return multiunselection_cb_Fnpi(iup_object(0), ih, ids, n);
  717. }
  718. int callback_branchopen_cb (Ihandle *ih, int id) {
  719. return branchopen_cb_Fni(iup_object(0), ih, id);
  720. }
  721. int callback_branchclose_cb (Ihandle *ih, int id) {
  722. return branchclose_cb_Fni(iup_object(0), ih, id);
  723. }
  724. int callback_executeleaf_cb (Ihandle *ih, int id) {
  725. return executeleaf_Cb_Fni(iup_object(0), ih, id);
  726. }
  727. int callback_showrename_cb (Ihandle *ih, int id) {
  728. return showrename_cb_Fni(iup_object(0), ih, id);
  729. }
  730. int callback_rename_cb (Ihandle *ih, int id, char *title) {
  731. return rename_cb_Fnis(iup_object(0), ih, id, title);
  732. }
  733. int callback_noderemoved_cb (Ihandle *ih, void* userdata) {
  734. return noderemoved_cb_Fns(iup_object(0), ih, userdata);
  735. }
  736. int callback_togglevalue_cb_Fnii (Ihandle *ih, int id, int state) {
  737. return togglevalue_cb_Fnii(iup_object(0), ih, id, state);
  738. }
  739. // Menu callbacks
  740. int callback_highlight_cb (Ihandle *ih) {
  741. return highlight_cb_Fn(iup_object(0), ih);
  742. }
  743. int callback_open_cb (Ihandle *ih) {
  744. return open_cb_Fn(iup_object(0), ih);
  745. }
  746. int callback_menuclose_cb (Ihandle *ih) {
  747. return menuclose_cb_Fn(iup_object(0), ih);
  748. }
  749. // Drag&Drop callbacks
  750. int callback_dragbegin_cb (Ihandle* ih, int x, int y) {
  751. return dragbegin_cb_Fnii(iup_object(0), ih, x, y);
  752. }
  753. int callback_dragdatasize_cb (Ihandle* ih, char* type) {
  754. return dragdatasize_cb_Fns(iup_object(0), ih, type);
  755. }
  756. int callback_dragdata_cb (Ihandle* ih, char* type, void* data, int size) {
  757. return dragdata_cb_FnsVi(iup_object(0), ih, type, data, size);
  758. }
  759. int callback_dragend_cb (Ihandle* ih, int action) {
  760. return dragend_cb_Fni(iup_object(0), ih, action);
  761. }
  762. int callback_dropdata_cb (Ihandle* ih, char* type, void* data, int size, int x, int y) {
  763. return dropdata_cb_FnsViii(iup_object(0), ih, type, data, size, x, y);
  764. }
  765. int callback_dropmotion_cb (Ihandle *ih, int x, int y, char *status) {
  766. return dropmotion_cb_Fniis(iup_object(0), ih, x, y, status);
  767. }
  768. // Menu recent files
  769. int callback_recent_cb (Ihandle *ih) {
  770. return recent_cb_Fn (iup_object(0), ih);
  771. }
  772. // Flat button
  773. int callback_flat_action_Fn(Ihandle *object) {
  774. return flat_action_Fn (iup_object(0), object);
  775. }
  776. int callback_flat_button_cb(Ihandle *ih, int button, int pressed, int x, int y, char* status) {
  777. return flat_button_cb_Fniiiis(iup_object(0), ih, button, pressed, x, y, status);
  778. }
  779. int callback_flat_focus_cb(Ihandle *ih, int focus) {
  780. return flat_focus_cb_Fni(iup_object(0), ih, focus);
  781. }
  782. int callback_flat_enterwindow_cb(Ihandle *ih) {
  783. return flat_enterwindow_cb_Fn(iup_object(0), ih);
  784. }
  785. int callback_flat_leavewindow_cb(Ihandle *ih) {
  786. return flat_leavewindow_cb_Fn(iup_object(0), ih);
  787. }
  788. // Cells
  789. int callback_draw_cb(Ihandle* ih, int line, int column, int xmin, int xmax, int ymin, int ymax, cdCanvas* canvas) {
  790. return draw_cb_Fniiiiiic(iup_object(0), ih, line, column, xmin, xmax, ymin, ymax, canvas);
  791. }
  792. int callback_height_cb(Ihandle* ih, int line) {
  793. return height_cb_Fni(iup_object(0), ih, line);
  794. }
  795. int callback_hspan_cb(Ihandle* ih, int line, int column) {
  796. return hspan_cb_Fnii(iup_object(0), ih, line, column);
  797. }
  798. int callback_mouseclick_cb(Ihandle* ih, int button, int pressed, int line, int column, int x, int y, char* status) {
  799. return mouseclick_cb_Fniiiiiis(iup_object(0), ih, button, pressed, line, column, x, y, status);
  800. }
  801. int callback_mousemotion_cb(Ihandle *ih, int line, int column, int x, int y, char *r) {
  802. return mousemotion_cb_Fniiiis(iup_object(0), ih, line, column, x, y, r);
  803. }
  804. int callback_ncols_cb(Ihandle* ih) {
  805. return ncols_cb_Fn(iup_object(0), ih);
  806. }
  807. int callback_nlines_cb(Ihandle* ih) {
  808. return nlines_cb_Fn(iup_object(0), ih);
  809. }
  810. int callback_scrolling_cb(Ihandle* ih, int line, int column) {
  811. return scrolling_cb_Fnii(iup_object(0), ih, line, column);
  812. }
  813. int callback_vspan_cb(Ihandle* ih, int line, int column) {
  814. return vspan_cb_Fnii(iup_object(0), ih, line, column);
  815. }
  816. int callback_width_cb(Ihandle* ih, int column) {
  817. return width_cb_Fni(iup_object(0), ih, column);
  818. }
  819. // Color bar
  820. char* callback_cell_cb(Ihandle* ih, int cell) {
  821. unsigned char r, g, b;
  822. long int cl;
  823. static char str[30];
  824. cl = cell_cb_Fni(iup_object(0), ih, cell);
  825. cdDecodeColor(cl, &r, &g, &b);
  826. sprintf(str, "%d %d %d", (int)r, (int)g, (int)b);
  827. return str;
  828. }
  829. int callback_extended_cb(Ihandle* ih, int cell) {
  830. return extended_cb_Fni(iup_object(0), ih, cell);
  831. }
  832. int callback_select_cb(Ihandle* ih, int cell, int type) {
  833. return select_cb_Fnii(iup_object(0), ih, cell, type);
  834. }
  835. int callback_switch_cb(Ihandle* ih, int prim_cell, int sec_cell) {
  836. return switch_cb_Fnii(iup_object(0), ih, prim_cell, sec_cell);
  837. }
  838. // Matrix
  839. int callback_action_Fniiiis(Ihandle *ih, int key, int lin, int col, int edition, char* value) {
  840. return action_Fniiiis(iup_object(0), ih, key, lin, col, edition, value);
  841. }
  842. int callback_click_cb_Fniis (Ihandle *ih, int lin, int col, char *status) {
  843. return click_cb_Fniis(iup_object(0), ih, lin, col, status);
  844. }
  845. int callback_colresize_cb (Ihandle *ih, int col) {
  846. return colresize_cb_Fni(iup_object(0), ih, col);
  847. }
  848. int callback_release_cb (Ihandle *ih, int lin, int col, char *status) {
  849. return release_cb_Fniis(iup_object(0), ih, lin, col, status);
  850. }
  851. int callback_resizematrix_cb (Ihandle *ih, int width, int height) {
  852. return resizematrix_cb_Fnii(iup_object(0), ih, width, height);
  853. }
  854. int callback_mousemove_cb (Ihandle *ih, int lin, int col) {
  855. return mousemove_cb_Fnii(iup_object(0), ih, lin, col);
  856. }
  857. int callback_enteritem_cb (Ihandle *ih, int lin, int col) {
  858. return enteritem_cb_Fnii(iup_object(0), ih, lin, col);
  859. }
  860. int callback_leaveitem_cb (Ihandle *ih, int lin, int col) {
  861. return leaveitem_cb_Fnii(iup_object(0), ih, lin, col);
  862. }
  863. int callback_scrolltop_cb (Ihandle *ih, int lin, int col) {
  864. return scrolltop_cb_Fnii(iup_object(0), ih, lin, col);
  865. }
  866. int callback_bgcolor_cb (Ihandle *ih, int lin, int col, int *red, int *green, int *blue) {
  867. return bgcolor_cb_FniiVVV(iup_object(0), ih, lin, col, red, green, blue);
  868. }
  869. int callback_fgcolor_cb (Ihandle *ih, int lin, int col, int *red, int *green, int *blue) {
  870. return fgcolor_cb_FniiVVV(iup_object(0), ih, lin, col, red, green, blue);
  871. }
  872. char* callback_font_cb (Ihandle* ih, int lin, int col) {
  873. return font_cb_Fnii (iup_object(0), ih, lin, col);
  874. }
  875. char* callback_type_cb (Ihandle* ih, int lin, int col) {
  876. return type_cb_Fnii (iup_object(0), ih, lin, col);
  877. }
  878. int callback_dropcheck_cb (Ihandle *ih, int lin, int col) {
  879. return dropcheck_cb_Fnii (iup_object(0), ih, lin, col);
  880. }
  881. char* callback_translatevalue_cb (Ihandle* ih, int lin, int col, char* value) {
  882. return translatevalue_cb_Fniis (iup_object(0), ih, lin, col, value);
  883. }
  884. int callback_togglevalue_cb_Fniii (Ihandle *ih, int lin, int col, int status) {
  885. return togglevalue_cb_Fniii (iup_object(0), ih, lin, col, status);
  886. }
  887. int callback_drop_cb (Ihandle *ih, Ihandle *drop, int lin, int col) {
  888. return drop_cb_Fnnii (iup_object(0), ih, drop, lin, col);
  889. }
  890. int callback_menudrop_cb (Ihandle *ih, Ihandle *drop, int lin, int col) {
  891. return menudrop_cb_Fnnii (iup_object(0), ih, drop, lin, col);
  892. }
  893. int callback_dropselect_cb (Ihandle *ih, int lin, int col, Ihandle *drop, char *t, int i, int v) {
  894. return dropselect_cb_Fniinsii (iup_object(0), ih, lin, col, drop, t, i, v);
  895. }
  896. int callback_edition_cb (Ihandle *ih, int lin, int col, int mode, int update) {
  897. return edition_cb_Fniiii (iup_object(0), ih, lin, col, mode, update);
  898. }
  899. char* callback_value_cb (Ihandle* ih, int lin, int col) {
  900. return value_cb_Fnii (iup_object(0), ih, lin, col);
  901. }
  902. int callback_value_edit_cb (Ihandle *ih, int lin, int col, char* newval) {
  903. return value_edit_cb_Fniis (iup_object(0), ih, lin, col, newval);
  904. }
  905. int callback_mark_cb (Ihandle* ih, int lin, int col) {
  906. return mark_cb_Fnii (iup_object(0), ih, lin, col);
  907. }
  908. int callback_markedit_cb (Ihandle *ih, int lin, int col, int marked) {
  909. return markedit_cb_Fniii (iup_object(0), ih, lin, col, marked);
  910. }
  911. // Flat tabs
  912. int callback_flat_motion_cb(Ihandle *ih, int x, int y, char *status) {
  913. return flat_motion_cb_Fniis(iup_object(0), ih, x, y, status);
  914. }