ruby-iup 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (478) hide show
  1. data/CHANGES +3 -0
  2. data/MANIFEST +8 -0
  3. data/MIT-LICENSE +18 -0
  4. data/README +12 -0
  5. data/Rakefile +68 -80
  6. data/doc/build_install.txt +9 -12
  7. data/examples/ctrl/cbox.rb +14 -15
  8. data/examples/ctrl/checkboard.rb +1 -1
  9. data/examples/ctrl/example1.rb +53 -53
  10. data/examples/ctrl/example2.rb +39 -39
  11. data/examples/ctrl/iupcolorbar.rb +95 -95
  12. data/examples/ctrl/iupcolorbrowser.rb +45 -45
  13. data/examples/ctrl/iupdial.rb +117 -117
  14. data/examples/ctrl/iupgetcolor.rb +7 -7
  15. data/examples/ctrl/iupgetparam.rb +62 -62
  16. data/examples/ctrl/iupglcanvas.rb +172 -172
  17. data/examples/ctrl/iupmask.rb +1 -3
  18. data/examples/ctrl/iupmatrix.rb +39 -39
  19. data/examples/ctrl/iupplot2.rb +2 -1
  20. data/examples/ctrl/iuptabs.rb +22 -22
  21. data/examples/ctrl/iuptree.rb +190 -190
  22. data/examples/ctrl/iupval.rb +71 -71
  23. data/examples/ctrl/numbering.rb +46 -46
  24. data/examples/ctrl/sample.rb +166 -166
  25. data/examples/dlg/iupfiledlg.rb +19 -19
  26. data/examples/dlg/iupgetfile.rb +19 -19
  27. data/examples/dlg/iuplistdialog.rb +26 -26
  28. data/examples/dlg/iupmessage.rb +5 -5
  29. data/examples/dlg/iupscanf.rb +17 -17
  30. data/examples/elem/iupdialog2.rb +25 -25
  31. data/examples/elem/iupfill.rb +51 -51
  32. data/examples/elem/iupframe.rb +25 -25
  33. data/examples/elem/iuphbox.rb +68 -68
  34. data/examples/elem/iupimage.rb +113 -113
  35. data/examples/elem/iupitem.rb +60 -60
  36. data/examples/elem/iuplabel.rb +57 -57
  37. data/examples/elem/iuplist.rb +41 -41
  38. data/examples/elem/iuplist2.rb +125 -125
  39. data/examples/elem/iupmenu.rb +32 -32
  40. data/examples/elem/iupmultiline.rb +24 -24
  41. data/examples/elem/iupmultiline2.rb +156 -156
  42. data/examples/elem/iupradio.rb +32 -32
  43. data/examples/elem/iupseparator.rb +81 -81
  44. data/examples/elem/iupsubmenu.rb +85 -85
  45. data/examples/elem/iuptext.rb +61 -61
  46. data/examples/elem/iuptimer.rb +36 -36
  47. data/examples/elem/iuptoggle.rb +110 -110
  48. data/examples/elem/iupvbox.rb +87 -87
  49. data/examples/elem/iupzbox.rb +60 -60
  50. data/examples/elem/mdisample.rb +377 -376
  51. data/examples/elem/scrollbar.rb +66 -66
  52. data/examples/elem/tray.rb +90 -90
  53. data/examples/func/iupgetattribute.rb +32 -32
  54. data/examples/func/iupidle.rb +48 -48
  55. data/ext/extconf.rb +62 -27
  56. data/ext/iup-linux/include/cd.h +9 -5
  57. data/ext/iup-linux/include/cd_private.h +13 -6
  58. data/ext/iup-linux/include/cdsvg.h +22 -0
  59. data/ext/iup-linux/include/im.h +287 -282
  60. data/ext/iup-linux/include/im_attrib.h +120 -116
  61. data/ext/iup-linux/include/im_attrib_flat.h +39 -39
  62. data/ext/iup-linux/include/im_binfile.h +224 -214
  63. data/ext/iup-linux/include/im_capture.h +365 -365
  64. data/ext/iup-linux/include/im_color.h +465 -465
  65. data/ext/iup-linux/include/im_colorhsi.h +56 -61
  66. data/ext/iup-linux/include/im_complex.h +180 -160
  67. data/ext/iup-linux/include/im_convert.h +142 -127
  68. data/ext/iup-linux/include/im_counter.h +69 -69
  69. data/ext/iup-linux/include/im_dib.h +195 -195
  70. data/ext/iup-linux/include/im_file.h +115 -111
  71. data/ext/iup-linux/include/im_format.h +97 -79
  72. data/ext/iup-linux/include/im_format_all.h +575 -576
  73. data/ext/iup-linux/include/im_format_avi.h +88 -87
  74. data/ext/iup-linux/include/im_format_ecw.h +93 -93
  75. data/ext/iup-linux/include/im_format_jp2.h +79 -78
  76. data/ext/iup-linux/include/im_format_raw.h +74 -64
  77. data/ext/iup-linux/include/im_format_wmv.h +101 -100
  78. data/ext/iup-linux/include/im_image.h +425 -403
  79. data/ext/iup-linux/include/im_kernel.h +315 -315
  80. data/ext/iup-linux/include/im_lib.h +191 -191
  81. data/ext/iup-linux/include/im_math.h +368 -368
  82. data/ext/iup-linux/include/im_math_op.h +214 -219
  83. data/ext/iup-linux/include/im_palette.h +172 -172
  84. data/ext/iup-linux/include/im_plus.h +73 -73
  85. data/ext/iup-linux/include/im_process.h +36 -35
  86. data/ext/iup-linux/include/im_process_ana.h +222 -221
  87. data/ext/iup-linux/include/im_process_glo.h +170 -170
  88. data/ext/iup-linux/include/im_process_loc.h +608 -577
  89. data/ext/iup-linux/include/im_process_pon.h +734 -712
  90. data/ext/iup-linux/include/im_raw.h +34 -34
  91. data/ext/iup-linux/include/im_util.h +277 -277
  92. data/ext/iup-linux/include/imlua.h +75 -83
  93. data/ext/iup-linux/include/iup.h +86 -40
  94. data/ext/iup-linux/include/iupcb.h +1 -25
  95. data/ext/iup-linux/include/iupcbox.h +1 -0
  96. data/ext/iup-linux/include/iupcbs.h +1 -1
  97. data/ext/iup-linux/include/iupcells.h +1 -130
  98. data/ext/iup-linux/include/iupcolorbar.h +1 -126
  99. data/ext/iup-linux/include/iupcontrols.h +26 -16
  100. data/ext/iup-linux/include/iupdef.h +205 -0
  101. data/ext/iup-linux/include/iupdial.h +1 -63
  102. data/ext/iup-linux/include/iupgauge.h +1 -57
  103. data/ext/iup-linux/include/iupgc.h +1 -0
  104. data/ext/iup-linux/include/iupgetparam.h +1 -27
  105. data/ext/iup-linux/include/iupgl.h +2 -7
  106. data/ext/iup-linux/include/iupim.h +7 -1
  107. data/ext/iup-linux/include/iupkey.h +4 -4
  108. data/ext/iup-linux/include/iupmask.h +2 -1
  109. data/ext/iup-linux/include/iupmatrix.h +1 -63
  110. data/ext/iup-linux/include/iupsbox.h +1 -0
  111. data/ext/iup-linux/include/iupspin.h +1 -21
  112. data/ext/iup-linux/include/iuptabs.h +1 -75
  113. data/ext/iup-linux/include/iuptree.h +1 -93
  114. data/ext/iup-linux/include/iupval.h +1 -46
  115. data/ext/iup-linux/include/old_im.h +59 -59
  116. data/ext/iup-linux/include/wd.h +5 -0
  117. data/ext/iup-linux/libcd.a +0 -0
  118. data/ext/iup-linux/libcdcontextplus.a +0 -0
  119. data/ext/iup-linux/libcdgdk.a +0 -0
  120. data/ext/iup-linux/libcdpdf.a +0 -0
  121. data/ext/iup-linux/libfreetype.a +0 -0
  122. data/ext/iup-linux/libim.a +0 -0
  123. data/ext/iup-linux/libim_fftw.a +0 -0
  124. data/ext/iup-linux/libim_jp2.a +0 -0
  125. data/ext/iup-linux/libim_process.a +0 -0
  126. data/ext/iup-linux/libiup.a +0 -0
  127. data/ext/iup-linux/libiup_pplot.a +0 -0
  128. data/ext/iup-linux/libiupcd.a +0 -0
  129. data/ext/iup-linux/libiupcontrols.a +0 -0
  130. data/ext/iup-linux/libiupgl.a +0 -0
  131. data/ext/iup-linux/libiupim.a +0 -0
  132. data/ext/iup-linux/libiupimglib.a +0 -0
  133. data/ext/iup-linux/libiupmot.a +0 -0
  134. data/ext/iup-linux/libpdflib.a +0 -0
  135. data/ext/{iup-win32 → iup-mingw32}/include/cd.h +9 -5
  136. data/ext/{iup-win32 → iup-mingw32}/include/cd_canvas.hpp +0 -0
  137. data/ext/{iup-win32 → iup-mingw32}/include/cd_old.h +0 -0
  138. data/ext/{iup-win32 → iup-mingw32}/include/cd_private.h +13 -6
  139. data/ext/{iup-win32 → iup-mingw32}/include/cdcgm.h +0 -0
  140. data/ext/{iup-win32 → iup-mingw32}/include/cdclipbd.h +0 -0
  141. data/ext/{iup-win32 → iup-mingw32}/include/cddbuf.h +0 -0
  142. data/ext/{iup-win32 → iup-mingw32}/include/cddebug.h +0 -0
  143. data/ext/{iup-win32 → iup-mingw32}/include/cddgn.h +0 -0
  144. data/ext/{iup-win32 → iup-mingw32}/include/cddxf.h +0 -0
  145. data/ext/{iup-win32 → iup-mingw32}/include/cdemf.h +0 -0
  146. data/ext/{iup-win32 → iup-mingw32}/include/cdgdiplus.h +0 -0
  147. data/ext/{iup-win32 → iup-mingw32}/include/cdimage.h +0 -0
  148. data/ext/{iup-win32 → iup-mingw32}/include/cdirgb.h +0 -0
  149. data/ext/{iup-win32 → iup-mingw32}/include/cdiup.h +0 -0
  150. data/ext/{iup-win32 → iup-mingw32}/include/cdlua.h +0 -0
  151. data/ext/{iup-win32 → iup-mingw32}/include/cdlua3_private.h +0 -0
  152. data/ext/{iup-win32 → iup-mingw32}/include/cdlua5_private.h +0 -0
  153. data/ext/{iup-win32 → iup-mingw32}/include/cdluaim.h +0 -0
  154. data/ext/{iup-win32 → iup-mingw32}/include/cdluaiup.h +0 -0
  155. data/ext/{iup-win32 → iup-mingw32}/include/cdluapdf.h +0 -0
  156. data/ext/{iup-win32 → iup-mingw32}/include/cdmf.h +0 -0
  157. data/ext/{iup-win32 → iup-mingw32}/include/cdmf_private.h +0 -0
  158. data/ext/{iup-win32 → iup-mingw32}/include/cdnative.h +0 -0
  159. data/ext/{iup-win32 → iup-mingw32}/include/cdpdf.h +0 -0
  160. data/ext/{iup-win32 → iup-mingw32}/include/cdpicture.h +0 -0
  161. data/ext/{iup-win32 → iup-mingw32}/include/cdprint.h +0 -0
  162. data/ext/{iup-win32 → iup-mingw32}/include/cdps.h +0 -0
  163. data/ext/iup-mingw32/include/cdsvg.h +22 -0
  164. data/ext/{iup-win32 → iup-mingw32}/include/cdwmf.h +0 -0
  165. data/ext/iup-mingw32/include/im.h +287 -0
  166. data/ext/iup-mingw32/include/im_attrib.h +120 -0
  167. data/ext/iup-mingw32/include/im_attrib_flat.h +39 -0
  168. data/ext/iup-mingw32/include/im_binfile.h +224 -0
  169. data/ext/iup-mingw32/include/im_capture.h +365 -0
  170. data/ext/iup-mingw32/include/im_color.h +465 -0
  171. data/ext/iup-mingw32/include/im_colorhsi.h +56 -0
  172. data/ext/iup-mingw32/include/im_complex.h +180 -0
  173. data/ext/iup-mingw32/include/im_convert.h +142 -0
  174. data/ext/iup-mingw32/include/im_counter.h +69 -0
  175. data/ext/iup-mingw32/include/im_dib.h +195 -0
  176. data/ext/iup-mingw32/include/im_file.h +115 -0
  177. data/ext/iup-mingw32/include/im_format.h +97 -0
  178. data/ext/iup-mingw32/include/im_format_all.h +575 -0
  179. data/ext/iup-mingw32/include/im_format_avi.h +88 -0
  180. data/ext/iup-mingw32/include/im_format_ecw.h +93 -0
  181. data/ext/iup-mingw32/include/im_format_jp2.h +79 -0
  182. data/ext/iup-mingw32/include/im_format_raw.h +74 -0
  183. data/ext/iup-mingw32/include/im_format_wmv.h +101 -0
  184. data/ext/iup-mingw32/include/im_image.h +425 -0
  185. data/ext/iup-mingw32/include/im_kernel.h +315 -0
  186. data/ext/iup-mingw32/include/im_lib.h +191 -0
  187. data/ext/iup-mingw32/include/im_math.h +368 -0
  188. data/ext/iup-mingw32/include/im_math_op.h +214 -0
  189. data/ext/iup-mingw32/include/im_palette.h +172 -0
  190. data/ext/iup-mingw32/include/im_plus.h +73 -0
  191. data/ext/iup-mingw32/include/im_process.h +36 -0
  192. data/ext/iup-mingw32/include/im_process_ana.h +222 -0
  193. data/ext/iup-mingw32/include/im_process_glo.h +170 -0
  194. data/ext/iup-mingw32/include/im_process_loc.h +608 -0
  195. data/ext/iup-mingw32/include/im_process_pon.h +734 -0
  196. data/ext/iup-mingw32/include/im_raw.h +34 -0
  197. data/ext/iup-mingw32/include/im_util.h +277 -0
  198. data/ext/iup-mingw32/include/imlua.h +75 -0
  199. data/ext/{iup-win32 → iup-mingw32}/include/iup.h +86 -40
  200. data/ext/{iup-win32 → iup-mingw32}/include/iup_pplot.h +0 -0
  201. data/ext/iup-mingw32/include/iupcb.h +1 -0
  202. data/ext/iup-mingw32/include/iupcbox.h +1 -0
  203. data/ext/{iup-win32 → iup-mingw32}/include/iupcbs.h +1 -1
  204. data/ext/iup-mingw32/include/iupcells.h +1 -0
  205. data/ext/iup-mingw32/include/iupcolorbar.h +1 -0
  206. data/ext/iup-mingw32/include/iupcontrols.h +46 -0
  207. data/ext/{iup-win32 → iup-mingw32}/include/iupdef.h +205 -0
  208. data/ext/iup-mingw32/include/iupdial.h +1 -0
  209. data/ext/iup-mingw32/include/iupgauge.h +1 -0
  210. data/ext/iup-mingw32/include/iupgc.h +1 -0
  211. data/ext/iup-mingw32/include/iupgetparam.h +1 -0
  212. data/ext/{iup-win32 → iup-mingw32}/include/iupgl.h +2 -7
  213. data/ext/{iup-win32 → iup-mingw32}/include/iupim.h +7 -1
  214. data/ext/{iup-win32 → iup-mingw32}/include/iupkey.h +4 -4
  215. data/ext/{iup-win32 → iup-mingw32}/include/iuplua.h +0 -0
  216. data/ext/{iup-win32 → iup-mingw32}/include/iuplua_pplot.h +0 -0
  217. data/ext/{iup-win32 → iup-mingw32}/include/iupluacontrols.h +0 -0
  218. data/ext/{iup-win32 → iup-mingw32}/include/iupluagl.h +0 -0
  219. data/ext/{iup-win32 → iup-mingw32}/include/iupluaim.h +0 -0
  220. data/ext/{iup-win32 → iup-mingw32}/include/iupluaole.h +0 -0
  221. data/ext/{iup-win32 → iup-mingw32}/include/iupmask.h +2 -1
  222. data/ext/iup-mingw32/include/iupmatrix.h +1 -0
  223. data/ext/{iup-win32 → iup-mingw32}/include/iupole.h +0 -0
  224. data/ext/iup-mingw32/include/iupsbox.h +1 -0
  225. data/ext/iup-mingw32/include/iupspin.h +1 -0
  226. data/ext/iup-mingw32/include/iuptabs.h +1 -0
  227. data/ext/iup-mingw32/include/iuptree.h +1 -0
  228. data/ext/iup-mingw32/include/iupval.h +1 -0
  229. data/ext/iup-mingw32/include/old_im.h +59 -0
  230. data/ext/{iup-win32 → iup-mingw32}/include/wd.h +5 -0
  231. data/ext/{iup-win32 → iup-mingw32}/include/wd_old.h +0 -0
  232. data/ext/iup-mingw32/libcd.a +0 -0
  233. data/ext/iup-mingw32/libcdpdf.a +0 -0
  234. data/ext/iup-mingw32/libfreetype6.a +0 -0
  235. data/ext/iup-mingw32/libim.a +0 -0
  236. data/ext/iup-mingw32/libim_avi.a +0 -0
  237. data/ext/iup-mingw32/libim_fftw.a +0 -0
  238. data/ext/iup-mingw32/libim_jp2.a +0 -0
  239. data/ext/iup-mingw32/libim_process.a +0 -0
  240. data/ext/iup-mingw32/libiup.a +0 -0
  241. data/ext/iup-mingw32/libiup_pplot.a +0 -0
  242. data/ext/iup-mingw32/libiupcd.a +0 -0
  243. data/ext/iup-mingw32/libiupcontrols.a +0 -0
  244. data/ext/iup-mingw32/libiupgl.a +0 -0
  245. data/ext/iup-mingw32/libiupim.a +0 -0
  246. data/ext/iup-mingw32/libiupimglib.a +0 -0
  247. data/ext/iup-mingw32/libiupole.a +0 -0
  248. data/ext/iup-mingw32/libpdflib.a +0 -0
  249. data/ext/iup-mswin32/cd.lib +0 -0
  250. data/ext/iup-mswin32/cdcontextplus.lib +0 -0
  251. data/ext/iup-mswin32/cdgdk.lib +0 -0
  252. data/ext/iup-mswin32/cdpdf.lib +0 -0
  253. data/ext/iup-mswin32/freetype6.lib +0 -0
  254. data/ext/iup-mswin32/im.lib +0 -0
  255. data/ext/iup-mswin32/im_avi.lib +0 -0
  256. data/ext/iup-mswin32/im_capture.lib +0 -0
  257. data/ext/iup-mswin32/im_fftw.lib +0 -0
  258. data/ext/iup-mswin32/im_jp2.lib +0 -0
  259. data/ext/iup-mswin32/im_process.lib +0 -0
  260. data/ext/iup-mswin32/im_wmv.lib +0 -0
  261. data/ext/iup-mswin32/include/cd.h +498 -0
  262. data/ext/iup-mswin32/include/cd_canvas.hpp +358 -0
  263. data/ext/iup-mswin32/include/cd_old.h +158 -0
  264. data/ext/iup-mswin32/include/cd_private.h +369 -0
  265. data/ext/iup-mswin32/include/cdcgm.h +34 -0
  266. data/ext/iup-mswin32/include/cdclipbd.h +22 -0
  267. data/ext/iup-mswin32/include/cddbuf.h +23 -0
  268. data/ext/iup-mswin32/include/cddebug.h +24 -0
  269. data/ext/iup-mswin32/include/cddgn.h +23 -0
  270. data/ext/iup-mswin32/include/cddxf.h +22 -0
  271. data/ext/iup-mswin32/include/cdemf.h +22 -0
  272. data/ext/iup-mswin32/include/cdgdiplus.h +29 -0
  273. data/ext/iup-mswin32/include/cdimage.h +23 -0
  274. data/ext/iup-mswin32/include/cdirgb.h +30 -0
  275. data/ext/iup-mswin32/include/cdiup.h +22 -0
  276. data/ext/iup-mswin32/include/cdlua.h +39 -0
  277. data/ext/iup-mswin32/include/cdlua3_private.h +120 -0
  278. data/ext/iup-mswin32/include/cdlua5_private.h +141 -0
  279. data/ext/iup-mswin32/include/cdluaim.h +24 -0
  280. data/ext/iup-mswin32/include/cdluaiup.h +27 -0
  281. data/ext/iup-mswin32/include/cdluapdf.h +27 -0
  282. data/ext/iup-mswin32/include/cdmf.h +24 -0
  283. data/ext/iup-mswin32/include/cdmf_private.h +32 -0
  284. data/ext/iup-mswin32/include/cdnative.h +26 -0
  285. data/ext/iup-mswin32/include/cdpdf.h +38 -0
  286. data/ext/iup-mswin32/include/cdpicture.h +22 -0
  287. data/ext/iup-mswin32/include/cdprint.h +23 -0
  288. data/ext/iup-mswin32/include/cdps.h +37 -0
  289. data/ext/iup-mswin32/include/cdsvg.h +22 -0
  290. data/ext/iup-mswin32/include/cdwmf.h +22 -0
  291. data/ext/iup-mswin32/include/im.h +287 -0
  292. data/ext/iup-mswin32/include/im_attrib.h +120 -0
  293. data/ext/iup-mswin32/include/im_attrib_flat.h +39 -0
  294. data/ext/iup-mswin32/include/im_binfile.h +224 -0
  295. data/ext/iup-mswin32/include/im_capture.h +365 -0
  296. data/ext/iup-mswin32/include/im_color.h +465 -0
  297. data/ext/iup-mswin32/include/im_colorhsi.h +56 -0
  298. data/ext/iup-mswin32/include/im_complex.h +180 -0
  299. data/ext/iup-mswin32/include/im_convert.h +142 -0
  300. data/ext/iup-mswin32/include/im_counter.h +69 -0
  301. data/ext/iup-mswin32/include/im_dib.h +195 -0
  302. data/ext/iup-mswin32/include/im_file.h +115 -0
  303. data/ext/iup-mswin32/include/im_format.h +97 -0
  304. data/ext/iup-mswin32/include/im_format_all.h +575 -0
  305. data/ext/iup-mswin32/include/im_format_avi.h +88 -0
  306. data/ext/iup-mswin32/include/im_format_ecw.h +93 -0
  307. data/ext/iup-mswin32/include/im_format_jp2.h +79 -0
  308. data/ext/iup-mswin32/include/im_format_raw.h +74 -0
  309. data/ext/iup-mswin32/include/im_format_wmv.h +101 -0
  310. data/ext/iup-mswin32/include/im_image.h +425 -0
  311. data/ext/iup-mswin32/include/im_kernel.h +315 -0
  312. data/ext/iup-mswin32/include/im_lib.h +191 -0
  313. data/ext/iup-mswin32/include/im_math.h +368 -0
  314. data/ext/iup-mswin32/include/im_math_op.h +214 -0
  315. data/ext/iup-mswin32/include/im_palette.h +172 -0
  316. data/ext/iup-mswin32/include/im_plus.h +73 -0
  317. data/ext/iup-mswin32/include/im_process.h +36 -0
  318. data/ext/iup-mswin32/include/im_process_ana.h +222 -0
  319. data/ext/iup-mswin32/include/im_process_glo.h +170 -0
  320. data/ext/iup-mswin32/include/im_process_loc.h +608 -0
  321. data/ext/iup-mswin32/include/im_process_pon.h +734 -0
  322. data/ext/iup-mswin32/include/im_raw.h +34 -0
  323. data/ext/iup-mswin32/include/im_util.h +277 -0
  324. data/ext/iup-mswin32/include/imlua.h +75 -0
  325. data/ext/iup-mswin32/include/iup.h +364 -0
  326. data/ext/iup-mswin32/include/iup_pplot.h +40 -0
  327. data/ext/iup-mswin32/include/iupcb.h +1 -0
  328. data/ext/iup-mswin32/include/iupcbox.h +1 -0
  329. data/ext/iup-mswin32/include/iupcbs.h +43 -0
  330. data/ext/iup-mswin32/include/iupcells.h +1 -0
  331. data/ext/iup-mswin32/include/iupcolorbar.h +1 -0
  332. data/ext/iup-mswin32/include/iupcontrols.h +46 -0
  333. data/ext/iup-mswin32/include/iupdef.h +725 -0
  334. data/ext/iup-mswin32/include/iupdial.h +1 -0
  335. data/ext/iup-mswin32/include/iupgauge.h +1 -0
  336. data/ext/iup-mswin32/include/iupgc.h +1 -0
  337. data/ext/iup-mswin32/include/iupgetparam.h +1 -0
  338. data/ext/iup-mswin32/include/iupgl.h +96 -0
  339. data/ext/iup-mswin32/include/iupim.h +27 -0
  340. data/ext/iup-mswin32/include/iupkey.h +457 -0
  341. data/ext/iup-mswin32/include/iuplua.h +41 -0
  342. data/ext/iup-mswin32/include/iuplua_pplot.h +26 -0
  343. data/ext/iup-mswin32/include/iupluacontrols.h +27 -0
  344. data/ext/iup-mswin32/include/iupluagl.h +26 -0
  345. data/ext/iup-mswin32/include/iupluaim.h +26 -0
  346. data/ext/iup-mswin32/include/iupluaole.h +26 -0
  347. data/ext/iup-mswin32/include/iupmask.h +41 -0
  348. data/ext/iup-mswin32/include/iupmatrix.h +1 -0
  349. data/ext/iup-mswin32/include/iupole.h +24 -0
  350. data/ext/iup-mswin32/include/iupsbox.h +1 -0
  351. data/ext/iup-mswin32/include/iupspin.h +1 -0
  352. data/ext/iup-mswin32/include/iuptabs.h +1 -0
  353. data/ext/iup-mswin32/include/iuptree.h +1 -0
  354. data/ext/iup-mswin32/include/iupval.h +1 -0
  355. data/ext/iup-mswin32/include/old_im.h +59 -0
  356. data/ext/iup-mswin32/include/wd.h +83 -0
  357. data/ext/iup-mswin32/include/wd_old.h +85 -0
  358. data/ext/iup-mswin32/iup.lib +0 -0
  359. data/ext/iup-mswin32/iup_pplot.lib +0 -0
  360. data/ext/iup-mswin32/iupcd.lib +0 -0
  361. data/ext/iup-mswin32/iupcontrols.lib +0 -0
  362. data/ext/iup-mswin32/iupgl.lib +0 -0
  363. data/ext/iup-mswin32/iupgtk.lib +0 -0
  364. data/ext/iup-mswin32/iupim.lib +0 -0
  365. data/ext/{iup-win32/iupimglib.dll → iup-mswin32/iupimglib.lib} +0 -0
  366. data/ext/iup-mswin32/iupole.lib +0 -0
  367. data/ext/iup-mswin32/pdflib.lib +0 -0
  368. data/ext/iup.c +6 -37
  369. data/ext/{rb_cd.h → rb_cd.c} +300 -302
  370. data/ext/rb_iup.c +2485 -0
  371. data/ext/rb_iup.h +400 -2475
  372. data/ext/{rb_iup_pplot.h → rb_iup_pplot.c} +21 -22
  373. data/ext/{rb_iupcb.h → rb_iupcb.c} +2 -3
  374. data/ext/{rb_iupcells.h → rb_iupcells.c} +5 -5
  375. data/ext/{rb_iupcolorbar.h → rb_iupcolorbar.c} +2 -3
  376. data/ext/{rb_iupcontrols.h → rb_iupcontrols.c} +1 -1
  377. data/ext/{rb_iupdial.h → rb_iupdial.c} +3 -4
  378. data/ext/{rb_iupgauge.h → rb_iupgauge.c} +2 -3
  379. data/ext/{rb_iupgc.h → rb_iupgc.c} +1 -1
  380. data/ext/{rb_iupgetparam.h → rb_iupgetparam.c} +12 -10
  381. data/ext/{rb_iupgl.h → rb_iupgl.c} +10 -10
  382. data/ext/{rb_iupim.h → rb_iupim.c} +6 -6
  383. data/ext/{rb_iupmatrix.h → rb_iupmatrix.c} +15 -16
  384. data/ext/{rb_iupole.h → rb_iupole.c} +4 -4
  385. data/ext/{rb_iupsbox.h → rb_iupsbox.c} +3 -3
  386. data/ext/{rb_iupspin.h → rb_iupspin.c} +4 -5
  387. data/ext/{rb_iuptabs.h → rb_iuptabs.c} +5 -6
  388. data/ext/{rb_iuptree.h → rb_iuptree.c} +20 -21
  389. data/ext/{rb_iupval.h → rb_iupval.c} +3 -4
  390. data/ruby-iup.gemspec +26 -0
  391. data/test/test_ruby_iup.rb +25 -0
  392. metadata +395 -270
  393. data/ext/iup-linux/include/lauxlib.h +0 -174
  394. data/ext/iup-linux/include/lua.h +0 -388
  395. data/ext/iup-linux/include/lua.hpp +0 -9
  396. data/ext/iup-linux/include/luaconf.h +0 -763
  397. data/ext/iup-linux/include/lualib.h +0 -53
  398. data/ext/iup-linux/libcd.so +0 -0
  399. data/ext/iup-linux/libcdcontextplus.so +0 -0
  400. data/ext/iup-linux/libcdpdf.so +0 -0
  401. data/ext/iup-linux/libfreetype.so +0 -0
  402. data/ext/iup-linux/libim.so +0 -0
  403. data/ext/iup-linux/libim_fftw.so +0 -0
  404. data/ext/iup-linux/libim_jp2.so +0 -0
  405. data/ext/iup-linux/libim_process.so +0 -0
  406. data/ext/iup-linux/libiup.so +0 -0
  407. data/ext/iup-linux/libiup_pplot.so +0 -0
  408. data/ext/iup-linux/libiupcd.so +0 -0
  409. data/ext/iup-linux/libiupcontrols.so +0 -0
  410. data/ext/iup-linux/libiupgl.so +0 -0
  411. data/ext/iup-linux/libiupim.so +0 -0
  412. data/ext/iup-linux/libiupimglib.so +0 -0
  413. data/ext/iup-linux/libiupmot.so +0 -0
  414. data/ext/iup-linux/libpdflib.so +0 -0
  415. data/ext/iup-win32/cd.dll +0 -0
  416. data/ext/iup-win32/cd.lib +0 -0
  417. data/ext/iup-win32/cdcontextplus.dll +0 -0
  418. data/ext/iup-win32/cdcontextplus.lib +0 -0
  419. data/ext/iup-win32/cdpdf.dll +0 -0
  420. data/ext/iup-win32/cdpdf.lib +0 -0
  421. data/ext/iup-win32/freetype6.dll +0 -0
  422. data/ext/iup-win32/freetype6.lib +0 -0
  423. data/ext/iup-win32/im.dll +0 -0
  424. data/ext/iup-win32/im.lib +0 -0
  425. data/ext/iup-win32/im_avi.dll +0 -0
  426. data/ext/iup-win32/im_avi.lib +0 -0
  427. data/ext/iup-win32/im_capture.dll +0 -0
  428. data/ext/iup-win32/im_capture.lib +0 -0
  429. data/ext/iup-win32/im_ecw.dll +0 -0
  430. data/ext/iup-win32/im_fftw.dll +0 -0
  431. data/ext/iup-win32/im_fftw.lib +0 -0
  432. data/ext/iup-win32/im_jp2.dll +0 -0
  433. data/ext/iup-win32/im_jp2.lib +0 -0
  434. data/ext/iup-win32/im_process.dll +0 -0
  435. data/ext/iup-win32/im_process.lib +0 -0
  436. data/ext/iup-win32/im_wmv.dll +0 -0
  437. data/ext/iup-win32/im_wmv.lib +0 -0
  438. data/ext/iup-win32/imlua_capture51.dll +0 -0
  439. data/ext/iup-win32/imlua_capture51.lib +0 -0
  440. data/ext/iup-win32/imlua_wmv51.dll +0 -0
  441. data/ext/iup-win32/imlua_wmv51.lib +0 -0
  442. data/ext/iup-win32/include/iupcb.h +0 -25
  443. data/ext/iup-win32/include/iupcells.h +0 -130
  444. data/ext/iup-win32/include/iupcolorbar.h +0 -126
  445. data/ext/iup-win32/include/iupcontrols.h +0 -36
  446. data/ext/iup-win32/include/iupdial.h +0 -63
  447. data/ext/iup-win32/include/iupgauge.h +0 -57
  448. data/ext/iup-win32/include/iupgetparam.h +0 -27
  449. data/ext/iup-win32/include/iupmatrix.h +0 -63
  450. data/ext/iup-win32/include/iupspin.h +0 -21
  451. data/ext/iup-win32/include/iuptabs.h +0 -75
  452. data/ext/iup-win32/include/iuptree.h +0 -93
  453. data/ext/iup-win32/include/iupval.h +0 -46
  454. data/ext/iup-win32/iup.dll +0 -0
  455. data/ext/iup-win32/iup.lib +0 -0
  456. data/ext/iup-win32/iup_pplot.dll +0 -0
  457. data/ext/iup-win32/iup_pplot.lib +0 -0
  458. data/ext/iup-win32/iupcd.dll +0 -0
  459. data/ext/iup-win32/iupcd.lib +0 -0
  460. data/ext/iup-win32/iupcontrols.dll +0 -0
  461. data/ext/iup-win32/iupcontrols.lib +0 -0
  462. data/ext/iup-win32/iupgl.dll +0 -0
  463. data/ext/iup-win32/iupgl.lib +0 -0
  464. data/ext/iup-win32/iupgtk.dll +0 -0
  465. data/ext/iup-win32/iupgtk.lib +0 -0
  466. data/ext/iup-win32/iupim.dll +0 -0
  467. data/ext/iup-win32/iupim.lib +0 -0
  468. data/ext/iup-win32/iupimglib.lib +0 -0
  469. data/ext/iup-win32/iupole.dll +0 -0
  470. data/ext/iup-win32/iupole.lib +0 -0
  471. data/ext/iup-win32/iupstub.lib +0 -0
  472. data/ext/iup-win32/pdflib.dll +0 -0
  473. data/ext/iup-win32/pdflib.lib +0 -0
  474. data/ext/mkrf_conf.rb +0 -72
  475. data/ext/rb_iupcompat.h +0 -237
  476. data/ext/rb_iupdef.h +0 -3
  477. data/ext/rb_iupmask.h +0 -189
  478. data/lib/README +0 -1
@@ -0,0 +1,2485 @@
1
+ #include <ruby.h>
2
+ #include "rb_iup.h"
3
+
4
+ extern VALUE rb_eIupError;
5
+ static char IdleAction[100];
6
+ static VALUE IdleProc = Qnil;
7
+
8
+ VALUE rb_mIup;
9
+ VALUE rb_mCd;
10
+ VALUE rb_eIupError;
11
+ VALUE rb_cIupImage;
12
+ VALUE rb_cIupButton;
13
+ VALUE rb_cIupCanvas;
14
+ VALUE rb_cIupDialog;
15
+ VALUE rb_cIupFill;
16
+ VALUE rb_cIupFrame;
17
+ VALUE rb_cIupHbox;
18
+ VALUE rb_cIupItem;
19
+ VALUE rb_cIupSeparator;
20
+ VALUE rb_cIupSubmenu;
21
+ VALUE rb_cIupLabel;
22
+ VALUE rb_cIupList;
23
+ VALUE rb_cIupMenu;
24
+ VALUE rb_cIupRadio;
25
+ VALUE rb_cIupText;
26
+ VALUE rb_cIupToggle;
27
+ VALUE rb_cIupToggle;
28
+ VALUE rb_cIupVbox;
29
+ VALUE rb_cIupZbox;
30
+ VALUE rb_cIupMultiLine;
31
+ VALUE rb_cIupUser;
32
+ VALUE rb_cIupControl;
33
+ VALUE rb_cIupTimer;
34
+ VALUE rb_cIupProgressBar;
35
+ VALUE rb_cIupFileDlg;
36
+ VALUE rb_cIupTree;
37
+ VALUE rb_cIupNode;
38
+ VALUE rb_cIupTabs;
39
+ VALUE rb_cIupGLCanvas;
40
+ VALUE rb_cIupSpin;
41
+ VALUE rb_cIupSpinbox;
42
+ VALUE rb_cIupSbox;
43
+ VALUE rb_cIupCbox;
44
+ VALUE rb_cIupMatrix;
45
+ VALUE rb_cIupGauge;
46
+ VALUE rb_cIupDial;
47
+ VALUE rb_cIupColorbar;
48
+ VALUE rb_cIupColorBrowser;
49
+ VALUE rb_cIupCells;
50
+ VALUE rb_cIupPPlot;
51
+ VALUE rb_cIupVal;
52
+ VALUE rb_cCdCanvas;
53
+
54
+ extern VALUE rb_IupSetCallback(VALUE node,VALUE v_name,VALUE v_func);
55
+
56
+ void exit_handler(void)
57
+ {
58
+ IupControlsClose();
59
+ IupClose();
60
+ }
61
+
62
+ char* rb_str_upper(char* s)
63
+ {
64
+ char* temp=s;
65
+ if(isupper(*temp)) return s;
66
+ for(;*temp;temp++)
67
+ *temp=toupper(*temp);
68
+ return s;
69
+ }
70
+
71
+ VALUE rb_method_missing(int argc,VALUE *argv, VALUE self)
72
+ {
73
+ static char mname[100];
74
+ static char pname[100];
75
+ int n;
76
+ char *value = NULL;
77
+ ID id = rb_to_id(argv[0]);
78
+ VALUE v_ih = rb_iv_get(self,"@ihandle");
79
+ strcpy(mname,rb_id2name(id));
80
+ rb_str_upper(mname);
81
+ if(!*mname) {
82
+ rb_raise(rb_eRuntimeError, "fail: unknown method or property");
83
+ }
84
+ n = strlen(mname);
85
+ if(mname[n-1] == '=')
86
+ mname[n-1] = 0;
87
+ if(argc==2) {
88
+ if(TYPE(argv[1])==T_OBJECT) {
89
+ VALUE v_ih_named = rb_iv_get(argv[1],"@ihandle");
90
+ IupSetAttributeHandle((Ihandle*)NUM2ULONG(v_ih),mname,(Ihandle*)NUM2ULONG(v_ih_named));
91
+ }
92
+ else if(TYPE(argv[1])==T_DATA) {
93
+ rb_IupSetCallback(self,rb_str_new2(mname),rb_str_new2("Proc"));
94
+ sprintf(pname,"RB_PROC_%s",mname);
95
+ IupSetAttribute((Ihandle*)NUM2ULONG(v_ih),pname,(char*)argv[1]);
96
+ } else {
97
+ if(strcmp(mname,"ATTR")==0) {
98
+ VALUE v_arr;
99
+ int j;
100
+ v_arr = rb_funcall(argv[1],rb_intern("split"),1,rb_reg_new("[,=]",4,0));
101
+ for(j=0;j<RARRAY_LEN(v_arr);j+=2) {
102
+ rb_funcall(RARRAY_PTR(v_arr)[j],rb_intern("strip!"),0,0);
103
+ rb_funcall(RARRAY_PTR(v_arr)[j+1],rb_intern("strip!"),0,0);
104
+ strcpy(mname,RSTRING_PTR(RARRAY_PTR(v_arr)[j]));
105
+ rb_str_upper(mname);
106
+ value = RSTRING_PTR(RARRAY_PTR(v_arr)[j+1]);
107
+ if(value[0]=='"') {
108
+ value[strlen(value)-1]=0;
109
+ strcpy(pname,&value[1]);
110
+ value = pname;
111
+ }
112
+ IupStoreAttribute((Ihandle*)NUM2ULONG(v_ih),mname,value);
113
+ }
114
+ }
115
+ else {
116
+ if(argv[1]!=Qnil && TYPE(argv[1])!=T_STRING) {
117
+ VALUE v_value = rb_funcall(argv[1],rb_intern("to_s"),0);
118
+ value = RSTRING_PTR(v_value);
119
+ } else if(argv[1]!=Qnil)
120
+ value = RSTRING_PTR(argv[1]);
121
+ IupStoreAttribute((Ihandle*)NUM2ULONG(v_ih),mname,value);
122
+ }
123
+ }
124
+ return Qnil;
125
+ }
126
+ else {
127
+ Ihandle *ih = IupGetAttributeHandle((Ihandle*)NUM2ULONG(v_ih),mname);
128
+ if(ih) {
129
+ return (VALUE)IupGetAttribute(ih,"RB_CLASS");
130
+ }
131
+ else {
132
+ value = IupGetAttribute((Ihandle*)NUM2ULONG(v_ih),mname);
133
+ if(value==NULL) return Qnil;
134
+ return rb_str_new2(value);
135
+ }
136
+ }
137
+ }
138
+
139
+ void rb_set_attribute(Ihandle *v,VALUE arg)
140
+ {
141
+ static char key[100];
142
+ static char pkey[100];
143
+ static char value[1024];
144
+ int i;
145
+ VALUE v_value;
146
+ VALUE klass;
147
+ VALUE v_keys = rb_funcall(arg,rb_intern("keys"),0);
148
+ for(i=0;i<RARRAY_LEN(v_keys);i++) {
149
+ if(TYPE(RARRAY_PTR(v_keys)[i])==T_SYMBOL) {
150
+ strcpy(key,rb_id2name(SYM2ID(RARRAY_PTR(v_keys)[i])));
151
+ rb_str_upper(key);
152
+ } else if(TYPE(RARRAY_PTR(v_keys)[i])==T_STRING) {
153
+ strcpy(key,RSTRING_PTR(RARRAY_PTR(v_keys)[i]));
154
+ rb_str_upper(key);
155
+ }
156
+ v_value = rb_hash_aref(arg,RARRAY_PTR(v_keys)[i]);
157
+ if(TYPE(v_value)==T_OBJECT) {
158
+ VALUE v_ih_named = rb_iv_get(v_value,"@ihandle");
159
+ IupSetAttributeHandle(v,key,(Ihandle*)NUM2ULONG(v_ih_named));
160
+ }
161
+ else if(TYPE(v_value)==T_DATA) {
162
+ klass = (VALUE)IupGetAttribute(v,"RB_CLASS");
163
+ if(klass) {
164
+ IupSetAttribute(v,key,(char*)v_value);
165
+ rb_IupSetCallback(klass,rb_str_new2(key),rb_str_new2("Proc"));
166
+ }
167
+ } else {
168
+ if(TYPE(v_value)!=T_STRING)
169
+ v_value = rb_funcall(v_value,rb_intern("to_s"),0);
170
+ strcpy(value,RSTRING_PTR(v_value));
171
+ if(strcmp(key,"ATTR")==0) {
172
+ VALUE v_arr;
173
+ int j;
174
+ v_arr = rb_funcall(v_value,rb_intern("split"),1,rb_reg_new("[,=\\s]+",7,0));
175
+ for(j=0;j<RARRAY_LEN(v_arr);j+=2) {
176
+ rb_funcall(RARRAY_PTR(v_arr)[j],rb_intern("strip!"),0,0);
177
+ rb_funcall(RARRAY_PTR(v_arr)[j+1],rb_intern("strip!"),0,0);
178
+ strcpy(key,RSTRING_PTR(RARRAY_PTR(v_arr)[j]));
179
+ rb_str_upper(key);
180
+ strcpy(value,RSTRING_PTR(RARRAY_PTR(v_arr)[j+1]));
181
+ if(value[0]=='"') {
182
+ value[strlen(value)-1]=0;
183
+ strcpy(pkey,&value[1]);
184
+ strcpy(value,pkey);
185
+ }
186
+ IupStoreAttribute(v,key,value);
187
+ }
188
+ }
189
+ else
190
+ IupStoreAttribute(v,key,value);
191
+ }
192
+ }
193
+ }
194
+
195
+ VALUE rb_isxkey(VALUE self,VALUE s)
196
+ {
197
+ return isxkey(NUM2INT(s))?Qtrue:Qfalse;
198
+ }
199
+
200
+ VALUE rb_isshift(VALUE self,VALUE s)
201
+ {
202
+ return isshift(RSTRING_PTR(s))?Qtrue:Qfalse;
203
+ }
204
+
205
+ VALUE rb_iscontrol(VALUE self,VALUE s)
206
+ {
207
+ return iscontrol(RSTRING_PTR(s))?Qtrue:Qfalse;
208
+ }
209
+
210
+ VALUE rb_isbutton1(VALUE self,VALUE s)
211
+ {
212
+ return isbutton1(RSTRING_PTR(s))?Qtrue:Qfalse;
213
+ }
214
+
215
+ VALUE rb_isbutton2(VALUE self,VALUE s)
216
+ {
217
+ return isbutton2(RSTRING_PTR(s))?Qtrue:Qfalse;
218
+ }
219
+
220
+ VALUE rb_isbutton3(VALUE self,VALUE s)
221
+ {
222
+ return isbutton3(RSTRING_PTR(s))?Qtrue:Qfalse;
223
+ }
224
+
225
+ VALUE rb_isdouble(VALUE self,VALUE s)
226
+ {
227
+ return isdouble(RSTRING_PTR(s))?Qtrue:Qfalse;
228
+ }
229
+
230
+ VALUE rb_isalt(VALUE self,VALUE s)
231
+ {
232
+ return isalt(RSTRING_PTR(s))?Qtrue:Qfalse;
233
+ }
234
+
235
+ VALUE rb_issys(VALUE self,VALUE s)
236
+ {
237
+ return issys(RSTRING_PTR(s))?Qtrue:Qfalse;
238
+ }
239
+
240
+ VALUE rb_isbutton4(VALUE self,VALUE s)
241
+ {
242
+ return isbutton4(RSTRING_PTR(s))?Qtrue:Qfalse;
243
+ }
244
+
245
+ VALUE rb_isbutton5(VALUE self,VALUE s)
246
+ {
247
+ return isbutton5(RSTRING_PTR(s))?Qtrue:Qfalse;
248
+ }
249
+
250
+ VALUE rb_IupFileDlg(int argc,VALUE *argv,VALUE self)
251
+ {
252
+ Ihandle* v;
253
+ v = IupFileDlg();
254
+ if(argc==1 && TYPE(argv[0])==T_HASH)
255
+ rb_set_attribute(v,argv[0]);
256
+ if(v)
257
+ return rb_funcall(rb_cIupFileDlg,rb_intern("new"),1,ULONG2NUM((unsigned long)v));
258
+ return Qnil;
259
+ }
260
+
261
+ VALUE rb_IupGetFile(VALUE self,VALUE v_arq)
262
+ {
263
+ char *arq = RSTRING_PTR(v_arq);
264
+ char filename[256];
265
+ int v;
266
+ VALUE v_r;
267
+ strcpy(filename,arq);
268
+ v = IupGetFile(filename);
269
+ v_r = rb_ary_new3(2,rb_str_new2(filename),INT2NUM(v));
270
+ return v_r;
271
+ }
272
+
273
+ VALUE rb_IupNode_initialize(int argc,VALUE *argv,VALUE self)
274
+ {
275
+ VALUE v_ih,v_action;
276
+ rb_scan_args(argc,argv,"11",&v_ih,&v_action);
277
+ IupSetAttribute((Ihandle*)NUM2ULONG(v_ih),"RB_CLASS",(char*)self);
278
+ rb_iv_set(self,"@ihandle",v_ih);
279
+ if(TYPE(v_action)==T_DATA) {
280
+ IupSetAttribute((Ihandle*)NUM2ULONG(v_ih),"RB_PROC_ACTION",(char*)v_action);
281
+ rb_IupSetCallback(self,rb_str_new2("ACTION"),rb_str_new2("Proc"));
282
+ }
283
+ return self;
284
+ }
285
+
286
+ VALUE rb_IupMessage(VALUE self,VALUE v_title,VALUE v_msg)
287
+ {
288
+ const char *title = RSTRING_PTR(v_title);
289
+ const char *msg = RSTRING_PTR(v_msg);
290
+ IupMessage(title,msg);
291
+ return Qnil;
292
+ }
293
+
294
+ VALUE rb_IupMessagef(int argc,VALUE *argv,VALUE self)
295
+ {
296
+ VALUE v;
297
+ const char *title = RSTRING_PTR(argv[0]);
298
+ const char *msg = RSTRING_PTR(argv[1]);
299
+ if(argc==2) {
300
+ IupMessage(title,msg);
301
+ return Qnil;
302
+ }
303
+ v = rb_f_sprintf(argc-1,argv+1);
304
+ msg = RSTRING_PTR(v);
305
+ IupMessage(title,msg);
306
+ return Qnil;
307
+ }
308
+
309
+ VALUE rb_IupAlarm(VALUE self,VALUE v_title,VALUE v_msg,VALUE v_b1,VALUE v_b2,VALUE v_b3)
310
+ {
311
+ const char *title = RSTRING_PTR(v_title);
312
+ const char *msg = RSTRING_PTR(v_msg);
313
+ const char *b1 = RSTRING_PTR(v_b1);
314
+ const char *b2 = RSTRING_PTR(v_b2);
315
+ const char *b3 = RSTRING_PTR(v_b3);
316
+ int v;
317
+ v = IupAlarm(title,msg,b1,b2,b3);
318
+ return INT2NUM(v);
319
+ }
320
+
321
+ VALUE rb_IupScanf(int argc,VALUE *argv,VALUE self)
322
+ {
323
+ VALUE v_format = argv[0];
324
+ char args[5][256];
325
+ const char *format = RSTRING_PTR(v_format);
326
+ int v;
327
+ int i;
328
+ int t_n;
329
+ float t_f;
330
+ char *t_s;
331
+ VALUE v_r = Qnil;
332
+ for(i=1;i<argc && i<=5;i++) {
333
+ switch(TYPE(argv[i])) {
334
+ case T_FIXNUM:
335
+ t_n = NUM2INT(argv[i]);
336
+ memcpy(args[i-1],&t_n,sizeof(t_n));
337
+ break;
338
+ case T_STRING:
339
+ t_s = RSTRING_PTR(argv[i]);
340
+ memcpy(args[i-1],t_s,RSTRING_LEN(argv[i])+1);
341
+ break;
342
+ case T_FLOAT:
343
+ t_f = RFLOAT_VALUE(argv[i]);
344
+ memcpy(args[i-1],&t_f,sizeof(t_f));
345
+ break;
346
+ default:
347
+ rb_raise(rb_eIupError,"Invalid Type");
348
+ }
349
+ }
350
+ switch(argc) {
351
+ case 2:
352
+ v = IupScanf(format,args[0]);
353
+ break;
354
+ case 3:
355
+ v = IupScanf(format,args[0],args[1]);
356
+ break;
357
+ case 4:
358
+ v = IupScanf(format,args[0],args[1],args[2]);
359
+ break;
360
+ case 5:
361
+ v = IupScanf(format,args[0],args[1],args[2],args[3]);
362
+ break;
363
+ case 6:
364
+ v = IupScanf(format,args[0],args[1],args[2],args[3],args[4]);
365
+ break;
366
+ default:
367
+ rb_raise(rb_eIupError,"Too many arguments");
368
+ }
369
+ v_r = rb_ary_new();
370
+ for(i=1;i<argc && i<=v;i++) {
371
+ switch(TYPE(argv[i])) {
372
+ case T_FIXNUM:
373
+ case T_BIGNUM:
374
+ memcpy(&t_n,args[i-1],sizeof(t_n));
375
+ rb_ary_push(v_r,INT2NUM(t_n));
376
+ break;
377
+ case T_STRING:
378
+ rb_ary_push(v_r,rb_str_new2(args[i-1]));
379
+ break;
380
+ case T_FLOAT:
381
+ memcpy(&t_f,args[i-1],sizeof(t_f));
382
+ sprintf(args[i-1],"%g",t_f);
383
+ rb_ary_push(v_r,rb_float_new(atof(args[i-1])));
384
+ break;
385
+ default:
386
+ rb_raise(rb_eIupError,"Invalid Type");
387
+ }
388
+ }
389
+ return v_r;
390
+ }
391
+
392
+ VALUE rb_IupListDialog (VALUE self,VALUE v_type, VALUE v_title, VALUE v_size, VALUE v_lst,
393
+ VALUE v_op, VALUE v_col, VALUE v_line, VALUE v_marks)
394
+ {
395
+ int type = NUM2INT(v_type);
396
+ const char* title = RSTRING_PTR(v_title);
397
+ int size = NUM2INT(v_size);
398
+ char *lst[256];
399
+ int op = NUM2INT(v_op);
400
+ int col = NUM2INT(v_col);
401
+ int line = NUM2INT(v_line);
402
+ int marks[256];
403
+ int v;
404
+ int i;
405
+ VALUE v_r;
406
+ for(i=0;i<size;i++) {
407
+ lst[i] = RSTRING_PTR(RARRAY_PTR(v_lst)[i]);
408
+ marks[i] = NUM2INT(RARRAY_PTR(v_marks)[i]);
409
+ }
410
+ v = IupListDialog(type,title,size,(const char**)lst,op,col,line,marks);
411
+ v_marks = rb_ary_new();
412
+ if(type==2) {
413
+ for(i=0;i<size;i++) {
414
+ rb_ary_push(v_marks,INT2FIX(marks[i]));
415
+ }
416
+ } else {
417
+ for(i=0;i<size;i++) {
418
+ if(v==i)
419
+ rb_ary_push(v_marks,INT2FIX(1));
420
+ else
421
+ rb_ary_push(v_marks,INT2FIX(0));
422
+ }
423
+ }
424
+ v_r = rb_ary_new3(2,v_marks,INT2FIX(v));
425
+ return v_r;
426
+ }
427
+
428
+ VALUE rb_IupGetText(VALUE self,VALUE v_title,VALUE v_text)
429
+ {
430
+ const char* title = RSTRING_PTR(v_title);
431
+ char* text = RSTRING_PTR(v_text);
432
+ int v;
433
+ v = IupGetText(title,text);
434
+ return INT2NUM(v);
435
+ }
436
+
437
+ VALUE rb_IupOpen(VALUE self)
438
+ {
439
+ int argc = 1;
440
+ char *name = "iupruby";
441
+ char **argv = &name;
442
+ int v;
443
+ v = IupOpen(&argc,&argv);
444
+
445
+ if(v==IUP_ERROR)
446
+ rb_raise(rb_eIupError, "Error Opening IUP.");
447
+ IupControlsOpen();
448
+ return INT2NUM(v);
449
+ }
450
+
451
+ VALUE rb_IupClose(VALUE self)
452
+ {
453
+ IupClose();
454
+ return Qnil;
455
+ }
456
+
457
+ int def_idle(void) {
458
+ rb_funcall(Qnil,rb_intern("sleep"),1,INT2NUM(0));
459
+ return IupLoopStep();
460
+ }
461
+
462
+ VALUE rb_IupMainLoop(VALUE self)
463
+ {
464
+ int v;
465
+ if(IupGetFunction("IDLE_ACTION")==NULL) {
466
+ IupSetFunction("IDLE_ACTION",def_idle);
467
+ }
468
+ v = IupMainLoop();
469
+ return INT2NUM(v);
470
+ }
471
+
472
+ VALUE rb_IupLoopStep(VALUE self)
473
+ {
474
+ int v;
475
+ v = IupLoopStep();
476
+ return INT2NUM(v);
477
+ }
478
+
479
+ VALUE rb_IupFlush(VALUE self)
480
+ {
481
+ IupFlush();
482
+ return Qnil;
483
+ }
484
+
485
+ VALUE rb_IupExitLoop(VALUE self)
486
+ {
487
+ IupExitLoop();
488
+ return Qnil;
489
+ }
490
+
491
+ VALUE rb_IupUpdate(VALUE self,VALUE node)
492
+ {
493
+ VALUE v_ih = rb_iv_get(node,"@ihandle");
494
+ IupUpdate((Ihandle*)NUM2ULONG(v_ih));
495
+ return Qnil;
496
+ }
497
+
498
+ VALUE rb_IupRefresh(VALUE self,VALUE node)
499
+ {
500
+ VALUE v_ih = rb_iv_get(node,"@ihandle");
501
+ IupRefresh((Ihandle*)NUM2ULONG(v_ih));
502
+ return Qnil;
503
+ }
504
+
505
+ VALUE rb_IupMapFont(VALUE self,VALUE v_iupfont)
506
+ {
507
+ const char *iupfont = RSTRING_PTR(v_iupfont);
508
+ char* v;
509
+ v = IupMapFont(iupfont);
510
+ return rb_str_new2(v);
511
+ }
512
+
513
+ VALUE rb_IupUnMapFont(VALUE self,VALUE v_driverfont)
514
+ {
515
+ const char *driverfont = RSTRING_PTR(v_driverfont);
516
+ char* v;
517
+ v = IupUnMapFont(driverfont);
518
+ return rb_str_new2(v);
519
+ }
520
+
521
+ VALUE rb_IupHelp(VALUE self,VALUE v_url)
522
+ {
523
+ const char* url = RSTRING_PTR(v_url);
524
+ int v;
525
+ v = IupHelp(url);
526
+ return INT2NUM(v);
527
+ }
528
+
529
+ VALUE rb_IupVersion(VALUE self)
530
+ {
531
+ char* v;
532
+ v = IupVersion();
533
+ return rb_str_new2(v);
534
+ }
535
+
536
+ VALUE rb_IupVersionDate(VALUE self)
537
+ {
538
+ char* v;
539
+ v = IupVersionDate();
540
+ return rb_str_new2(v);
541
+ }
542
+
543
+ VALUE rb_IupVersionNumber(VALUE self)
544
+ {
545
+ int v;
546
+ v = IupVersionNumber();
547
+ return INT2NUM(v);
548
+ }
549
+
550
+ VALUE rb_IupSetLanguage(VALUE self,VALUE v_lng)
551
+ {
552
+ const char *lng = RSTRING_PTR(v_lng);
553
+ IupSetLanguage(lng);
554
+ return Qnil;
555
+ }
556
+
557
+ VALUE rb_IupGetLanguage(VALUE self)
558
+ {
559
+ char* v;
560
+ v = IupGetLanguage();
561
+ return rb_str_new2(v);
562
+ }
563
+
564
+ VALUE rb_IupDestroy(VALUE node)
565
+ {
566
+ VALUE v_ih = rb_iv_get(node,"@ihandle");
567
+ IupDestroy((Ihandle*)NUM2ULONG(v_ih));
568
+ return Qnil;
569
+ }
570
+
571
+ VALUE rb_IupDetach(VALUE self,VALUE vchild)
572
+ {
573
+ VALUE v_child = rb_iv_get(vchild,"@ihandle");
574
+ IupDetach((Ihandle*)NUM2ULONG(v_child));
575
+ return Qnil;
576
+ }
577
+
578
+ VALUE rb_IupAppend(VALUE self,VALUE node,VALUE vchild)
579
+ {
580
+ Ihandle* v;
581
+ VALUE v_ih = rb_iv_get(node,"@ihandle");
582
+ VALUE v_child = rb_iv_get(vchild,"@ihandle");
583
+ v = IupAppend((Ihandle*)NUM2ULONG(v_ih),(Ihandle*)NUM2ULONG(v_child));
584
+ return (VALUE)IupGetAttribute(v,"RB_CLASS");
585
+ }
586
+
587
+ VALUE rb_IupGetNextChild(VALUE self,VALUE node,VALUE vchild)
588
+ {
589
+ Ihandle* child = NULL;
590
+ Ihandle* v;
591
+ VALUE v_ih = rb_iv_get(node,"@ihandle");
592
+ VALUE v_child = rb_iv_get(vchild,"@ihandle");
593
+ if(v_child!=Qnil) child = (Ihandle*)NUM2ULONG(v_child);
594
+ v = IupGetNextChild((Ihandle*)NUM2ULONG(v_ih),child);
595
+ if(v==NULL) return Qnil;
596
+ return (VALUE)IupGetAttribute(v,"RB_CLASS");
597
+ }
598
+
599
+ VALUE rb_IupGetBrother(VALUE self,VALUE node)
600
+ {
601
+ Ihandle* v;
602
+ VALUE v_ih = rb_iv_get(node,"@ihandle");
603
+ v = IupGetBrother((Ihandle*)NUM2ULONG(v_ih));
604
+ if(v==NULL) return Qnil;
605
+ return (VALUE)IupGetAttribute(v,"RB_CLASS");
606
+ }
607
+
608
+ VALUE rb_IupGetParent(VALUE self,VALUE node)
609
+ {
610
+ Ihandle* v;
611
+ VALUE v_ih = rb_iv_get(node,"@ihandle");
612
+ v = IupGetParent((Ihandle*)NUM2ULONG(v_ih));
613
+ if(v==NULL) return Qnil;
614
+ return (VALUE)IupGetAttribute(v,"RB_CLASS");
615
+ }
616
+
617
+ VALUE rb_IupGetDialog(VALUE self,VALUE node)
618
+ {
619
+ Ihandle* v;
620
+ VALUE v_ih = rb_iv_get(node,"@ihandle");
621
+ v = IupGetDialog((Ihandle*)NUM2ULONG(v_ih));
622
+ if(v==NULL) return Qnil;
623
+ return (VALUE)IupGetAttribute(v,"RB_CLASS");
624
+ }
625
+
626
+ VALUE rb_IupPopup(VALUE node,VALUE v_x,VALUE v_y)
627
+ {
628
+ int x = NUM2INT(v_x);
629
+ int y = NUM2INT(v_y);
630
+ int v;
631
+ VALUE v_ih = rb_iv_get(node,"@ihandle");
632
+ v = IupPopup((Ihandle*)NUM2ULONG(v_ih),x,y);
633
+ return INT2NUM(v);
634
+ }
635
+
636
+ VALUE rb_IupShow(VALUE node)
637
+ {
638
+ int v;
639
+ VALUE v_ih = rb_iv_get(node,"@ihandle");
640
+ v = IupShow((Ihandle*)NUM2ULONG(v_ih));
641
+ return INT2NUM(v);
642
+ }
643
+
644
+ VALUE rb_IupShowXY(VALUE node,VALUE v_x,VALUE v_y)
645
+ {
646
+ int x = NUM2INT(v_x);
647
+ int y = NUM2INT(v_y);
648
+ int v;
649
+ VALUE v_ih = rb_iv_get(node,"@ihandle");
650
+ v = IupShowXY((Ihandle*)NUM2ULONG(v_ih),x,y);
651
+ return INT2NUM(v);
652
+ }
653
+
654
+ VALUE rb_IupHide(VALUE node)
655
+ {
656
+ int v;
657
+ VALUE v_ih = rb_iv_get(node,"@ihandle");
658
+ v = IupHide((Ihandle*)NUM2ULONG(v_ih));
659
+ return ULONG2NUM((unsigned long)v);
660
+ }
661
+
662
+ VALUE rb_IupMap(VALUE node)
663
+ {
664
+ int v;
665
+ VALUE v_ih = rb_iv_get(node,"@ihandle");
666
+ v = IupMap((Ihandle*)NUM2ULONG(v_ih));
667
+ return INT2NUM(v);
668
+ }
669
+
670
+ VALUE rb_IupSetAttribute(VALUE node,VALUE v_name,VALUE v_value)
671
+ {
672
+ static char name[100];
673
+ static char pname[100];
674
+ const char* value = NULL;
675
+ VALUE v_ih = rb_iv_get(node,"@ihandle");
676
+ strcpy(name,RSTRING_PTR(v_name));
677
+ rb_str_upper(name);
678
+ if(v_value!=Qnil) {
679
+ if(TYPE(v_value)==T_OBJECT) {
680
+ VALUE v_ih_named = rb_iv_get(v_value,"@ihandle");
681
+ IupSetAttributeHandle((Ihandle*)NUM2ULONG(v_ih),name,(Ihandle*)NUM2ULONG(v_ih_named));
682
+ }
683
+ else if(TYPE(v_value)==T_DATA) {
684
+ rb_IupSetCallback(node,rb_str_new2(name),rb_str_new2("Proc"));
685
+ sprintf(pname,"RB_PROC_%s",name);
686
+ IupSetAttribute((Ihandle*)NUM2ULONG(v_ih),pname,(char*)v_value);
687
+ return Qnil;
688
+ } else {
689
+ if(TYPE(v_value)!=T_STRING)
690
+ v_value = rb_funcall(v_value,rb_intern("to_s"),0);
691
+ value = RSTRING_PTR(v_value);
692
+ }
693
+ }
694
+ IupSetAttribute((Ihandle*)NUM2ULONG(v_ih),name,value);
695
+ return Qnil;
696
+ }
697
+
698
+ VALUE rb_IupSetAttributePtr(VALUE node,VALUE v_name,VALUE v_value)
699
+ {
700
+ extern VALUE rb_IupSetCallback(VALUE node,VALUE v_name,VALUE v_func);
701
+ char name[100];
702
+ const char* value = NULL;
703
+ VALUE v_ih = rb_iv_get(node,"@ihandle");
704
+ strcpy(name,RSTRING_PTR(v_name));
705
+ rb_str_upper(name);
706
+ if(v_value!=Qnil) {
707
+ if(TYPE(v_value)==T_DATA) {
708
+ IupSetAttribute((Ihandle*)NUM2ULONG(v_ih),name,(char*)v_value);
709
+ rb_IupSetCallback(node,rb_str_new2(name),rb_str_new2("Proc"));
710
+ return Qnil;
711
+ } else {
712
+ if(TYPE(v_value)==T_FIXNUM)
713
+ value = (char*)NUM2ULONG(v_value);
714
+ }
715
+ }
716
+ IupSetAttribute((Ihandle*)NUM2ULONG(v_ih),name,value);
717
+ return Qnil;
718
+ }
719
+
720
+ VALUE rb_IupStoreAttribute(VALUE node,VALUE v_name,VALUE v_value)
721
+ {
722
+ const char* name = RSTRING_PTR(v_name);
723
+ const char* value = NULL;
724
+ VALUE v_ih = rb_iv_get(node,"@ihandle");
725
+ if(v_value!=Qnil)
726
+ value = RSTRING_PTR(v_value);
727
+ IupStoreAttribute((Ihandle*)NUM2ULONG(v_ih),name,value);
728
+ return Qnil;
729
+ }
730
+
731
+ VALUE rb_IupSetAttributes(VALUE node,VALUE v_str)
732
+ {
733
+ const char *str = RSTRING_PTR(v_str);
734
+ Ihandle* v;
735
+ VALUE v_ih = rb_iv_get(node,"@ihandle");
736
+ v = IupSetAttributes((Ihandle*)NUM2ULONG(v_ih),str);
737
+ if(v==NULL) return Qnil;
738
+ return (VALUE)IupGetAttribute(v,"RB_CLASS");
739
+ }
740
+
741
+ VALUE rb_IupGetAttribute(VALUE node,VALUE v_name)
742
+ {
743
+ char name[100];
744
+ char* v;
745
+ Ihandle *ih;
746
+ VALUE v_ih = rb_iv_get(node,"@ihandle");
747
+ strcpy(name,RSTRING_PTR(v_name));
748
+ rb_str_upper(name);
749
+ ih = IupGetAttributeHandle((Ihandle*)NUM2ULONG(v_ih),name);
750
+ if(ih) {
751
+ return (VALUE)IupGetAttribute(ih,"RB_CLASS");
752
+ }
753
+ v = IupGetAttribute((Ihandle*)NUM2ULONG(v_ih),name);
754
+ if(v==NULL)
755
+ return Qnil;
756
+ else
757
+ return rb_str_new2(v);
758
+ }
759
+
760
+ VALUE rb_IupGetAttributePtr(VALUE node,VALUE v_name)
761
+ {
762
+ char name[100];
763
+ char* v;
764
+ VALUE klass;
765
+ VALUE v_ih = rb_iv_get(node,"@ihandle");
766
+ strcpy(name,RSTRING_PTR(v_name));
767
+ rb_str_upper(name);
768
+ v = IupGetAttribute((Ihandle*)NUM2ULONG(v_ih),name);
769
+ klass = rb_funcall(rb_cIupNode,rb_intern("new"),1,ULONG2NUM((unsigned long)v));
770
+ if(v==NULL)
771
+ return Qnil;
772
+ else
773
+ return klass;
774
+ }
775
+
776
+ VALUE rb_IupGetAttributes(VALUE node)
777
+ {
778
+ char* v;
779
+ VALUE v_ih = rb_iv_get(node,"@ihandle");
780
+ v = IupGetAttributes((Ihandle*)NUM2ULONG(v_ih));
781
+ return rb_str_new2(v);
782
+ }
783
+
784
+ VALUE rb_IupGetInt(VALUE node,VALUE v_name)
785
+ {
786
+ const char* name = RSTRING_PTR(v_name);
787
+ int v;
788
+ VALUE v_ih = rb_iv_get(node,"@ihandle");
789
+ v = IupGetInt((Ihandle*)NUM2ULONG(v_ih),name);
790
+ return INT2NUM(v);
791
+ }
792
+
793
+ VALUE rb_IupGetFloat(VALUE node,VALUE v_name)
794
+ {
795
+ const char* name = RSTRING_PTR(v_name);
796
+ float v;
797
+ VALUE v_ih = rb_iv_get(node,"@ihandle");
798
+ v = IupGetFloat((Ihandle*)NUM2ULONG(v_ih),name);
799
+ return rb_float_new(v);
800
+ }
801
+
802
+ VALUE rb_IupSetGlobal(VALUE self,VALUE v_name,VALUE v_value)
803
+ {
804
+ const char* name = RSTRING_PTR(v_name);
805
+ const char* value = RSTRING_PTR(v_value);
806
+ IupSetGlobal(name,value);
807
+ return Qnil;
808
+ }
809
+
810
+ VALUE rb_IupStoreGlobal(VALUE self,VALUE v_name,VALUE v_value)
811
+ {
812
+ const char* name = RSTRING_PTR(v_name);
813
+ const char* value = RSTRING_PTR(v_value);
814
+ IupStoreGlobal(name,value);
815
+ return Qnil;
816
+ }
817
+
818
+ VALUE rb_IupGetGlobal(VALUE self,VALUE v_name)
819
+ {
820
+ const char* name = RSTRING_PTR(v_name);
821
+ char* v;
822
+ v = IupGetGlobal(name);
823
+ return rb_str_new2(v);
824
+ }
825
+
826
+ VALUE rb_IupSetFocus(VALUE self,VALUE node)
827
+ {
828
+ Ihandle* v;
829
+ VALUE v_ih = rb_iv_get(node,"@ihandle");
830
+ v = IupSetFocus((Ihandle*)NUM2ULONG(v_ih));
831
+ return ULONG2NUM((unsigned long)v);
832
+ }
833
+
834
+ VALUE rb_IupGetFocus(VALUE self)
835
+ {
836
+ Ihandle* v;
837
+ v = IupGetFocus();
838
+ if(v==NULL) return Qnil;
839
+ return (VALUE)IupGetAttribute(v,"RB_CLASS");
840
+ }
841
+
842
+ VALUE rb_IupPreviousField(VALUE self,VALUE node)
843
+ {
844
+ Ihandle* v;
845
+ VALUE v_ih = rb_iv_get(node,"@ihandle");
846
+ v = IupPreviousField((Ihandle*)NUM2ULONG(v_ih));
847
+ if(v==NULL) return Qnil;
848
+ return (VALUE)IupGetAttribute(v,"RB_CLASS");
849
+ }
850
+
851
+ VALUE rb_IupNextField(VALUE self,VALUE node)
852
+ {
853
+ Ihandle* v;
854
+ VALUE v_ih = rb_iv_get(node,"@ihandle");
855
+ v = IupNextField((Ihandle*)NUM2ULONG(v_ih));
856
+ if(v==NULL) return Qnil;
857
+ return (VALUE)IupGetAttribute(v,"RB_CLASS");
858
+ }
859
+
860
+ static int _canvas_action(Ihandle* ih, float posx, float posy)
861
+ {
862
+ char* func = (char*)IupGetAttribute(ih,"RB_ACTION");
863
+ VALUE v;
864
+ if(func) {
865
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
866
+ if(strcmp(func,"Proc")==0) {
867
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_ACTION");
868
+ v = rb_funcall(proc,rb_intern("call"),3,node,rb_float_new(posx),rb_float_new(posy));
869
+ } else {
870
+ v = rb_funcall(Qnil,rb_intern(func),3,node,rb_float_new(posx),rb_float_new(posy));
871
+ }
872
+ return NUM2INT(v);
873
+ }
874
+ return IUP_DEFAULT;
875
+ }
876
+
877
+ static int _toggle_action(Ihandle* ih, int state)
878
+ {
879
+ char* func = (char*)IupGetAttribute(ih,"RB_ACTION");
880
+ VALUE v;
881
+ if(func) {
882
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
883
+ if(strcmp(func,"Proc")==0) {
884
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_ACTION");
885
+ v = rb_funcall(proc,rb_intern("call"),2,node,INT2FIX(state));
886
+ } else {
887
+ v = rb_funcall(rb_cObject,rb_intern(func),2,node,INT2FIX(state));
888
+ }
889
+ return NUM2INT(v);
890
+ }
891
+ return IUP_DEFAULT;
892
+ }
893
+
894
+ static int _button_action(Ihandle* ih)
895
+ {
896
+ char* func = (char*)IupGetAttribute(ih,"RB_ACTION");
897
+ VALUE v;
898
+ if(func) {
899
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
900
+ if(strcmp(func,"Proc")==0) {
901
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_ACTION");
902
+ v = rb_funcall(proc,rb_intern("call"),1,node);
903
+ } else {
904
+ v = rb_funcall(rb_cObject,rb_intern(func),1,node);
905
+ }
906
+ return NUM2INT(v);
907
+ }
908
+ return IUP_DEFAULT;
909
+ }
910
+
911
+ static int _list_action(Ihandle* ih, char *text, int pos, int state)
912
+ {
913
+ char* func = (char*)IupGetAttribute(ih,"RB_ACTION");
914
+ VALUE v;
915
+ if(func) {
916
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
917
+ if(strcmp(func,"Proc")==0) {
918
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_ACTION");
919
+ v = rb_funcall(proc,rb_intern("call"),4,node,rb_str_new2(text),INT2FIX(pos),INT2FIX(state));
920
+ } else {
921
+ v = rb_funcall(rb_cObject,rb_intern(func),4,node,rb_str_new2(text),INT2FIX(pos),INT2FIX(state));
922
+ }
923
+ return NUM2INT(v);
924
+ }
925
+ return IUP_DEFAULT;
926
+ }
927
+
928
+ static int _idle_cb()
929
+ {
930
+ VALUE v;
931
+ if(IdleProc!=Qnil) {
932
+ v = rb_funcall(IdleProc,rb_intern("call"),0);
933
+ return NUM2INT(v);
934
+ }
935
+ else if(*IdleAction) {
936
+ v = rb_funcall(rb_cObject,rb_intern(IdleAction),0);
937
+ return NUM2INT(v);
938
+ }
939
+ return IUP_DEFAULT;
940
+ }
941
+
942
+ static int _postdraw_cb(Ihandle* ih,void *cnv)
943
+ {
944
+ char* func = (char*)IupGetAttribute(ih,"RB_POSTDRAW_CB");
945
+ VALUE v;
946
+ if(func) {
947
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
948
+ if(strcmp(func,"Proc")==0) {
949
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_POSTDRAW_CB");
950
+ v = rb_funcall(proc,rb_intern("call"),2,node,rb_funcall(rb_cCdCanvas,rb_intern("new"),1,ULONG2NUM((unsigned long)cnv)));
951
+ } else {
952
+ v = rb_funcall(rb_cObject,rb_intern(func),2,node,rb_funcall(rb_cCdCanvas,rb_intern("new"),1,ULONG2NUM((unsigned long)cnv)));
953
+ }
954
+ return NUM2INT(v);
955
+ }
956
+ return IUP_DEFAULT;
957
+ }
958
+
959
+ static int _predraw_cb(Ihandle* ih,void *cnv)
960
+ {
961
+ char* func = (char*)IupGetAttribute(ih,"RB_PREDRAW_CB");
962
+ VALUE v;
963
+ if(func) {
964
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
965
+ if(strcmp(func,"Proc")==0) {
966
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_PREDRAW_CB");
967
+ v = rb_funcall(proc,rb_intern("call"),2,node,rb_funcall(rb_cCdCanvas,rb_intern("new"),1,ULONG2NUM((unsigned long)cnv)));
968
+ } else {
969
+ v = rb_funcall(rb_cObject,rb_intern(func),2,node,rb_funcall(rb_cCdCanvas,rb_intern("new"),1,ULONG2NUM((unsigned long)cnv)));
970
+ }
971
+ return NUM2INT(v);
972
+ }
973
+ return IUP_DEFAULT;
974
+ }
975
+
976
+ static int _change_cb(Ihandle* ih, unsigned char r, unsigned char g, unsigned char b)
977
+ {
978
+ char* func = (char*)IupGetAttribute(ih,"RB_CHANGE_CB");
979
+ VALUE v;
980
+ if(func) {
981
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
982
+ if(strcmp(func,"Proc")==0) {
983
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_CHANGE_CB");
984
+ v = rb_funcall(proc,rb_intern("call"),4,node,INT2FIX(r),INT2FIX(g),INT2FIX(b));
985
+ } else {
986
+ v = rb_funcall(rb_cObject,rb_intern(func),4,node,INT2FIX(r),INT2FIX(g),INT2FIX(b));
987
+ }
988
+ return NUM2INT(v);
989
+ }
990
+ return IUP_DEFAULT;
991
+ }
992
+
993
+ static int _drag_cb(Ihandle* ih, unsigned char r, unsigned char g, unsigned char b)
994
+ {
995
+ char* func = (char*)IupGetAttribute(ih,"RB_DRAG_CB");
996
+ VALUE v;
997
+ if(func) {
998
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
999
+ if(strcmp(func,"Proc")==0) {
1000
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_DRAG_CB");
1001
+ v = rb_funcall(proc,rb_intern("call"),4,node,INT2FIX(r),INT2FIX(g),INT2FIX(b));
1002
+ } else {
1003
+ v = rb_funcall(rb_cObject,rb_intern(func),4,node,INT2FIX(r),INT2FIX(g),INT2FIX(b));
1004
+ }
1005
+ return NUM2INT(v);
1006
+ }
1007
+ return IUP_DEFAULT;
1008
+ }
1009
+
1010
+ static int _tabchange_cb(Ihandle* ih, Ihandle* newtab, Ihandle* oldtab)
1011
+ {
1012
+ char* func = (char*)IupGetAttribute(ih,"RB_TABCHANGE_CB");
1013
+ VALUE v;
1014
+ if(func) {
1015
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1016
+ VALUE node_old = (VALUE)IupGetAttribute(oldtab,"RB_CLASS");
1017
+ VALUE node_new = (VALUE)IupGetAttribute(newtab,"RB_CLASS");
1018
+ if(strcmp(func,"Proc")==0) {
1019
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_TABCHANGE_CB");
1020
+ v = rb_funcall(proc,rb_intern("call"),3,node,node_new,node_old);
1021
+ } else {
1022
+ v = rb_funcall(rb_cObject,rb_intern(func),3,node,node_new,node_old);
1023
+ }
1024
+ return NUM2INT(v);
1025
+ }
1026
+ return IUP_DEFAULT;
1027
+ }
1028
+
1029
+ static int _button_press_cb(Ihandle* ih, double angle)
1030
+ {
1031
+ char* func = (char*)IupGetAttribute(ih,"RB_BUTTON_PRESS_CB");
1032
+ VALUE v;
1033
+ if(func) {
1034
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1035
+ if(strcmp(func,"Proc")==0) {
1036
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_BUTTON_PRESS_CB");
1037
+ v = rb_funcall(proc,rb_intern("call"),2,node,rb_float_new(angle));
1038
+ } else {
1039
+ v = rb_funcall(rb_cObject,rb_intern(func),2,node,rb_float_new(angle));
1040
+ }
1041
+ return NUM2INT(v);
1042
+ }
1043
+ return IUP_DEFAULT;
1044
+ }
1045
+
1046
+ static int _button_release_cb(Ihandle* ih, double angle)
1047
+ {
1048
+ char* func = (char*)IupGetAttribute(ih,"RB_BUTTON_RELEASE_CB");
1049
+ VALUE v;
1050
+ if(func) {
1051
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1052
+ if(strcmp(func,"Proc")==0) {
1053
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_BUTTON_RELEASE_CB");
1054
+ v = rb_funcall(proc,rb_intern("call"),2,node,rb_float_new(angle));
1055
+ } else {
1056
+ v = rb_funcall(rb_cObject,rb_intern(func),2,node,rb_float_new(angle));
1057
+ }
1058
+ return NUM2INT(v);
1059
+ }
1060
+ return IUP_DEFAULT;
1061
+ }
1062
+
1063
+ static int _mousemove_cb(Ihandle* ih, double angle)
1064
+ {
1065
+ char* func = (char*)IupGetAttribute(ih,"RB_MOUSEMOVE_CB");
1066
+ VALUE v;
1067
+ if(func) {
1068
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1069
+ if(strcmp(func,"Proc")==0) {
1070
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_MOUSEMOVE_CB");
1071
+ v = rb_funcall(proc,rb_intern("call"),2,node,rb_float_new(angle));
1072
+ } else {
1073
+ v = rb_funcall(rb_cObject,rb_intern(func),2,node,rb_float_new(angle));
1074
+ }
1075
+ return NUM2INT(v);
1076
+ }
1077
+ return IUP_DEFAULT;
1078
+ }
1079
+
1080
+ static int _draw_cb(Ihandle* ih, void* cnv)
1081
+ {
1082
+ char* func = (char*)IupGetAttribute(ih,"RB_DRAW_CB");
1083
+ VALUE v;
1084
+ if(func) {
1085
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1086
+ if(strcmp(func,"Proc")==0) {
1087
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_DRAW_CB");
1088
+ v = rb_funcall(proc,rb_intern("call"),2,node,
1089
+ rb_funcall(rb_cCdCanvas,rb_intern("new"),1,ULONG2NUM((unsigned long)cnv)));
1090
+ } else {
1091
+ v = rb_funcall(rb_cObject,rb_intern(func),2,node,
1092
+ rb_funcall(rb_cCdCanvas,rb_intern("new"),1,ULONG2NUM((unsigned long)cnv)));
1093
+ }
1094
+ return NUM2INT(v);
1095
+ }
1096
+ return IUP_DEFAULT;
1097
+ }
1098
+
1099
+ static char* _cell_cb(Ihandle* ih, int cell)
1100
+ {
1101
+ char* func = (char*)IupGetAttribute(ih,"RB_CELL_CB");
1102
+ VALUE v;
1103
+ if(func) {
1104
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1105
+ if(strcmp(func,"Proc")==0) {
1106
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_CELL_CB");
1107
+ v = rb_funcall(proc,rb_intern("call"),2,node,INT2FIX(cell));
1108
+ } else {
1109
+ v = rb_funcall(rb_cObject,rb_intern(func),2,node,INT2FIX(cell));
1110
+ }
1111
+ if(v==Qnil)
1112
+ return NULL;
1113
+ else
1114
+ return RSTRING_PTR(v);
1115
+ }
1116
+ return NULL;
1117
+ }
1118
+
1119
+ static int _extended_cb(Ihandle* ih, int cell)
1120
+ {
1121
+ char* func = (char*)IupGetAttribute(ih,"RB_EXTENDED_CB");
1122
+ VALUE v;
1123
+ if(func) {
1124
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1125
+ if(strcmp(func,"Proc")==0) {
1126
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_EXTENDED_CB");
1127
+ v = rb_funcall(proc,rb_intern("call"),2,node,INT2FIX(cell));
1128
+ } else {
1129
+ v = rb_funcall(rb_cObject,rb_intern(func),2,node,INT2FIX(cell));
1130
+ }
1131
+ return NUM2INT(v);
1132
+ }
1133
+ return IUP_DEFAULT;
1134
+ }
1135
+
1136
+ static int _colorbar_select_cb(Ihandle* ih, int cell,int type)
1137
+ {
1138
+ char* func = (char*)IupGetAttribute(ih,"RB_SELECT_CB");
1139
+ VALUE v;
1140
+ if(func) {
1141
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1142
+ if(strcmp(func,"Proc")==0) {
1143
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_SELECT_CB");
1144
+ v = rb_funcall(proc,rb_intern("call"),3,node,INT2FIX(cell),INT2FIX(type));
1145
+ } else {
1146
+ v = rb_funcall(rb_cObject,rb_intern(func),3,node,INT2FIX(cell),INT2FIX(type));
1147
+ }
1148
+ return NUM2INT(v);
1149
+ }
1150
+ return IUP_DEFAULT;
1151
+ }
1152
+
1153
+ static int _switch_cb(Ihandle* ih, int prim_cell,int sec_cell)
1154
+ {
1155
+ char* func = (char*)IupGetAttribute(ih,"RB_SWITCH_CB");
1156
+ VALUE v;
1157
+ if(func) {
1158
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1159
+ if(strcmp(func,"Proc")==0) {
1160
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_SWITCH_CB");
1161
+ v = rb_funcall(proc,rb_intern("call"),3,node,INT2FIX(prim_cell),INT2FIX(sec_cell));
1162
+ } else {
1163
+ v = rb_funcall(rb_cObject,rb_intern(func),3,node,INT2FIX(prim_cell),INT2FIX(sec_cell));
1164
+ }
1165
+ return NUM2INT(v);
1166
+ }
1167
+ return IUP_DEFAULT;
1168
+ }
1169
+
1170
+ static int _height_cb(Ihandle* ih, int line)
1171
+ {
1172
+ char* func = (char*)IupGetAttribute(ih,"RB_HEIGHT_CB");
1173
+ VALUE v;
1174
+ if(func) {
1175
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1176
+ if(strcmp(func,"Proc")==0) {
1177
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_HEIGHT_CB");
1178
+ v = rb_funcall(proc,rb_intern("call"),2,node,INT2FIX(line));
1179
+ } else {
1180
+ v = rb_funcall(rb_cObject,rb_intern(func),2,node,INT2FIX(line));
1181
+ }
1182
+ return NUM2INT(v);
1183
+ }
1184
+ return IUP_DEFAULT;
1185
+ }
1186
+
1187
+ static int _width_cb(Ihandle* ih, int column)
1188
+ {
1189
+ char* func = (char*)IupGetAttribute(ih,"RB_WIDTH_CB");
1190
+ VALUE v;
1191
+ if(func) {
1192
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1193
+ if(strcmp(func,"Proc")==0) {
1194
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_WIDTH_CB");
1195
+ v = rb_funcall(proc,rb_intern("call"),2,node,INT2FIX(column));
1196
+ } else {
1197
+ v = rb_funcall(rb_cObject,rb_intern(func),2,node,INT2FIX(column));
1198
+ }
1199
+ return NUM2INT(v);
1200
+ }
1201
+ return IUP_DEFAULT;
1202
+ }
1203
+
1204
+ static int _hspan_cb(Ihandle* ih, int line, int column)
1205
+ {
1206
+ char* func = (char*)IupGetAttribute(ih,"RB_HSPAN_CB");
1207
+ VALUE v;
1208
+ if(func) {
1209
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1210
+ if(strcmp(func,"Proc")==0) {
1211
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_HSPAN_CB");
1212
+ v = rb_funcall(proc,rb_intern("call"),3,node,INT2FIX(line),INT2FIX(column));
1213
+ } else {
1214
+ v = rb_funcall(rb_cObject,rb_intern(func),3,node,INT2FIX(line),INT2FIX(column));
1215
+ }
1216
+ return NUM2INT(v);
1217
+ }
1218
+ return IUP_DEFAULT;
1219
+ }
1220
+
1221
+ static int _scrolling_cb(Ihandle* ih, int line, int column)
1222
+ {
1223
+ char* func = (char*)IupGetAttribute(ih,"RB_SCROLLING_CB");
1224
+ VALUE v;
1225
+ if(func) {
1226
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1227
+ if(strcmp(func,"Proc")==0) {
1228
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_SCROLLING_CB");
1229
+ v = rb_funcall(proc,rb_intern("call"),3,node,INT2FIX(line),INT2FIX(column));
1230
+ } else {
1231
+ v = rb_funcall(rb_cObject,rb_intern(func),3,node,INT2FIX(line),INT2FIX(column));
1232
+ }
1233
+ return NUM2INT(v);
1234
+ }
1235
+ return IUP_DEFAULT;
1236
+ }
1237
+
1238
+ static int _vspan_cb(Ihandle* ih, int line, int column)
1239
+ {
1240
+ char* func = (char*)IupGetAttribute(ih,"RB_VSPAN_CB");
1241
+ VALUE v;
1242
+ if(func) {
1243
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1244
+ if(strcmp(func,"Proc")==0) {
1245
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_VSPAN_CB");
1246
+ v = rb_funcall(proc,rb_intern("call"),3,node,INT2FIX(line),INT2FIX(column));
1247
+ } else {
1248
+ v = rb_funcall(rb_cObject,rb_intern(func),3,node,INT2FIX(line),INT2FIX(column));
1249
+ }
1250
+ return NUM2INT(v);
1251
+ }
1252
+ return IUP_DEFAULT;
1253
+ }
1254
+
1255
+ static int _ncols_cb(Ihandle* ih)
1256
+ {
1257
+ char* func = (char*)IupGetAttribute(ih,"RB_NCOLS_CB");
1258
+ VALUE v;
1259
+ if(func) {
1260
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1261
+ if(strcmp(func,"Proc")==0) {
1262
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_NCOLS_CB");
1263
+ v = rb_funcall(proc,rb_intern("call"),1,node);
1264
+ } else {
1265
+ v = rb_funcall(rb_cObject,rb_intern(func),1,node);
1266
+ }
1267
+ return NUM2INT(v);
1268
+ }
1269
+ return IUP_DEFAULT;
1270
+ }
1271
+
1272
+ static int _nlines_cb(Ihandle* ih)
1273
+ {
1274
+ char* func = (char*)IupGetAttribute(ih,"RB_NLINES_CB");
1275
+ VALUE v;
1276
+ if(func) {
1277
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1278
+ if(strcmp(func,"Proc")==0) {
1279
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_NLINES_CB");
1280
+ v = rb_funcall(proc,rb_intern("call"),1,node);
1281
+ } else {
1282
+ v = rb_funcall(rb_cObject,rb_intern(func),1,node);
1283
+ }
1284
+ return NUM2INT(v);
1285
+ }
1286
+ return IUP_DEFAULT;
1287
+ }
1288
+
1289
+ static int _mouseclick_cb(Ihandle* ih,int button, int pressed, int line, int column, int x, int y, char* status)
1290
+ {
1291
+ char* func = (char*)IupGetAttribute(ih,"RB_MOUSECLICK_CB");
1292
+ VALUE v;
1293
+ if(func) {
1294
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1295
+ if(strcmp(func,"Proc")==0) {
1296
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_MOUSECLICK_CB");
1297
+ v = rb_funcall(proc,rb_intern("call"),8,node,INT2FIX(button),INT2FIX(pressed),
1298
+ INT2FIX(line),INT2FIX(column),INT2FIX(x),INT2FIX(y),rb_str_new2(status));
1299
+ } else {
1300
+ v = rb_funcall(rb_cObject,rb_intern(func),8,node,INT2FIX(button),INT2FIX(pressed),
1301
+ INT2FIX(line),INT2FIX(column),INT2FIX(x),INT2FIX(y),rb_str_new2(status));
1302
+ }
1303
+ return NUM2INT(v);
1304
+ }
1305
+ return IUP_DEFAULT;
1306
+ }
1307
+
1308
+ static int _mousemotion_cb(Ihandle* ih,int line, int column, int x, int y, char* r)
1309
+ {
1310
+ char* func = (char*)IupGetAttribute(ih,"RB_MOUSEMOTION_CB");
1311
+ VALUE v;
1312
+ if(func) {
1313
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1314
+ if(strcmp(func,"Proc")==0) {
1315
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_MOUSEMOTION_CB");
1316
+ v = rb_funcall(proc,rb_intern("call"),8,node,
1317
+ INT2FIX(line),INT2FIX(column),INT2FIX(x),INT2FIX(y),rb_str_new2(r));
1318
+ } else {
1319
+ v = rb_funcall(rb_cObject,rb_intern(func),8,node,
1320
+ INT2FIX(line),INT2FIX(column),INT2FIX(x),INT2FIX(y),rb_str_new2(r));
1321
+ }
1322
+ return NUM2INT(v);
1323
+ }
1324
+ return IUP_DEFAULT;
1325
+ }
1326
+
1327
+ static int _motion_cb(Ihandle* ih,int x, int y, char* status)
1328
+ {
1329
+ char* func = (char*)IupGetAttribute(ih,"RB_MOTION_CB");
1330
+ VALUE v;
1331
+ if(func) {
1332
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1333
+ if(strcmp(func,"Proc")==0) {
1334
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_MOTION_CB");
1335
+ v = rb_funcall(proc,rb_intern("call"),4,node,
1336
+ INT2FIX(x),INT2FIX(y),rb_str_new2(status));
1337
+ } else {
1338
+ v = rb_funcall(rb_cObject,rb_intern(func),4,node,
1339
+ INT2FIX(x),INT2FIX(y),rb_str_new2(status));
1340
+ }
1341
+ return NUM2INT(v);
1342
+ }
1343
+ return IUP_DEFAULT;
1344
+ }
1345
+
1346
+ static int _cell_draw_cb(Ihandle* ih,int line, int column, int xmin, int xmax, int ymin, int ymax)
1347
+ {
1348
+ char* func = (char*)IupGetAttribute(ih,"RB_DRAW_CB");
1349
+ VALUE v;
1350
+ void *cnv = (void*)cdActiveCanvas();
1351
+ if(func) {
1352
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1353
+ if(strcmp(func,"Proc")==0) {
1354
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_DRAW_CB");
1355
+ v = rb_funcall(proc,rb_intern("call"),8,node,
1356
+ INT2FIX(line),INT2FIX(column),INT2FIX(xmin),INT2FIX(xmax),INT2FIX(ymin),INT2FIX(ymax),
1357
+ rb_funcall(rb_cCdCanvas,rb_intern("new"),1,ULONG2NUM((unsigned long)cnv)));
1358
+ } else {
1359
+ v = rb_funcall(rb_cObject,rb_intern(func),8,node,
1360
+ INT2FIX(line),INT2FIX(column),INT2FIX(xmin),INT2FIX(xmax),INT2FIX(ymin),INT2FIX(ymax),rb_funcall(rb_cCdCanvas,rb_intern("new"),1,ULONG2NUM((unsigned long)cnv)));
1361
+ }
1362
+ return NUM2INT(v);
1363
+ }
1364
+ return IUP_DEFAULT;
1365
+ }
1366
+
1367
+ static int _delete_cb(Ihandle* ih, int index, int sample_index, float x, float y)
1368
+ {
1369
+ char* func = (char*)IupGetAttribute(ih,"RB_DELETE_CB");
1370
+ VALUE v;
1371
+ if(func) {
1372
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1373
+ if(strcmp(func,"Proc")==0) {
1374
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_DELETE_CB");
1375
+ v = rb_funcall(proc,rb_intern("call"),5,node,INT2FIX(index),
1376
+ INT2FIX(sample_index),rb_float_new(x),rb_float_new(y));
1377
+ } else {
1378
+ v = rb_funcall(rb_cObject,rb_intern(func),5,node,INT2FIX(index),
1379
+ INT2FIX(sample_index),rb_float_new(x),rb_float_new(y));
1380
+ }
1381
+ return NUM2INT(v);
1382
+ }
1383
+ return IUP_DEFAULT;
1384
+ }
1385
+
1386
+ static int _select_cb(Ihandle* ih, int index, int sample_index, float x, float y, int select)
1387
+ {
1388
+ char* func = (char*)IupGetAttribute(ih,"RB_SELECT_CB");
1389
+ VALUE v;
1390
+ if(func) {
1391
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1392
+ if(strcmp(func,"Proc")==0) {
1393
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_SELECT_CB");
1394
+ v = rb_funcall(proc,rb_intern("call"),6,node,INT2FIX(index),
1395
+ INT2FIX(sample_index),rb_float_new(x),rb_float_new(y),INT2FIX(select));
1396
+ } else {
1397
+ v = rb_funcall(rb_cObject,rb_intern(func),6,node,INT2FIX(index),
1398
+ INT2FIX(sample_index),rb_float_new(x),rb_float_new(y),INT2FIX(select));
1399
+ }
1400
+ return NUM2INT(v);
1401
+ }
1402
+ return IUP_DEFAULT;
1403
+ }
1404
+
1405
+ static int _edit_cb(Ihandle* ih, int index, int sample_index, float x, float y, float* new_x, float* new_y)
1406
+ {
1407
+ char* func = (char*)IupGetAttribute(ih,"RB_EDIT_CB");
1408
+ VALUE v;
1409
+ if(func) {
1410
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1411
+ if(strcmp(func,"Proc")==0) {
1412
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_EDIT_CB");
1413
+ v = rb_funcall(proc,rb_intern("call"),7,node,INT2FIX(index),
1414
+ INT2FIX(sample_index),rb_float_new(x),rb_float_new(y),rb_float_new(*new_x),rb_float_new(*new_y));
1415
+ } else {
1416
+ v = rb_funcall(rb_cObject,rb_intern(func),7,node,INT2FIX(index),
1417
+ INT2FIX(sample_index),rb_float_new(x),rb_float_new(y),rb_float_new(*new_x),rb_float_new(*new_y));
1418
+ }
1419
+ return NUM2INT(v);
1420
+ }
1421
+ return IUP_DEFAULT;
1422
+ }
1423
+
1424
+ static int _list_edit_cb(Ihandle *ih, int c, char *new_value)
1425
+ {
1426
+ char* func = (char*)IupGetAttribute(ih,"RB_EDIT_CB");
1427
+ VALUE v;
1428
+ if(func) {
1429
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1430
+ if(strcmp(func,"Proc")==0) {
1431
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_EDIT_CB");
1432
+ v = rb_funcall(proc,rb_intern("call"),3,node,INT2FIX(c),rb_str_new2(new_value));
1433
+ } else {
1434
+ v = rb_funcall(rb_cObject,rb_intern(func),3,node,INT2FIX(c),rb_str_new2(new_value));
1435
+ }
1436
+ return NUM2INT(v);
1437
+ }
1438
+ return IUP_DEFAULT;
1439
+ }
1440
+
1441
+ static int _text_action(Ihandle *ih, int c, char *new_value)
1442
+ {
1443
+ char* func = (char*)IupGetAttribute(ih,"RB_ACTION");
1444
+ VALUE v;
1445
+ if(func) {
1446
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1447
+ if(strcmp(func,"Proc")==0) {
1448
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_ACTION");
1449
+ v = rb_funcall(proc,rb_intern("call"),3,node,INT2FIX(c),rb_str_new2(new_value));
1450
+ } else {
1451
+ v = rb_funcall(rb_cObject,rb_intern(func),3,node,INT2FIX(c),rb_str_new2(new_value));
1452
+ }
1453
+ return NUM2INT(v);
1454
+ }
1455
+ return IUP_DEFAULT;
1456
+ }
1457
+
1458
+ static int _button_cb(Ihandle* ih, int button, int pressed, int x, int y, char* status)
1459
+ {
1460
+ char* func = (char*)IupGetAttribute(ih,"RB_BUTTON_CB");
1461
+ VALUE v;
1462
+ if(func) {
1463
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1464
+ if(strcmp(func,"Proc")==0) {
1465
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_BUTTON_CB");
1466
+ v = rb_funcall(proc,rb_intern("call"),6,node,INT2FIX(button),INT2FIX(pressed),
1467
+ INT2FIX(x),INT2FIX(y),rb_str_new2(status));
1468
+ } else {
1469
+ v = rb_funcall(rb_cObject,rb_intern(func),6,node,INT2FIX(button),INT2FIX(pressed),
1470
+ INT2FIX(x),INT2FIX(y),rb_str_new2(status));
1471
+ }
1472
+ return NUM2INT(v);
1473
+ }
1474
+ return IUP_DEFAULT;
1475
+ }
1476
+
1477
+ static int _executeleaf_cb(Ihandle* ih, int id)
1478
+ {
1479
+ char* func = (char*)IupGetAttribute(ih,"RB_EXECUTELEAF_CB");
1480
+ VALUE v;
1481
+ if(func) {
1482
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1483
+ if(strcmp(func,"Proc")==0) {
1484
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_EXECUTELEAF_CB");
1485
+ v = rb_funcall(proc,rb_intern("call"),2,node,INT2FIX(id));
1486
+ } else {
1487
+ v = rb_funcall(rb_cObject,rb_intern(func),2,node,INT2FIX(id));
1488
+ }
1489
+ return NUM2INT(v);
1490
+ }
1491
+ return IUP_DEFAULT;
1492
+ }
1493
+
1494
+ static int _branchopen_cb(Ihandle* ih, int id)
1495
+ {
1496
+ char* func = (char*)IupGetAttribute(ih,"RB_BRANCHOPEN_CB");
1497
+ VALUE v;
1498
+ if(func) {
1499
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1500
+ if(strcmp(func,"Proc")==0) {
1501
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_BRANCHOPEN_CB");
1502
+ v = rb_funcall(proc,rb_intern("call"),2,node,INT2FIX(id));
1503
+ } else {
1504
+ v = rb_funcall(rb_cObject,rb_intern(func),2,node,INT2FIX(id));
1505
+ }
1506
+ return NUM2INT(v);
1507
+ }
1508
+ return IUP_DEFAULT;
1509
+ }
1510
+
1511
+ static int _branchclose_cb(Ihandle* ih, int id)
1512
+ {
1513
+ char* func = (char*)IupGetAttribute(ih,"RB_BRANCHCLOSE_CB");
1514
+ VALUE v;
1515
+ if(func) {
1516
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1517
+ if(strcmp(func,"Proc")==0) {
1518
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_BRANCHCLOSE_CB");
1519
+ v = rb_funcall(proc,rb_intern("call"),2,node,INT2FIX(id));
1520
+ } else {
1521
+ v = rb_funcall(rb_cObject,rb_intern(func),2,node,INT2FIX(id));
1522
+ }
1523
+ return NUM2INT(v);
1524
+ }
1525
+ return IUP_DEFAULT;
1526
+ }
1527
+
1528
+ static int _rightclick_cb(Ihandle* ih, int id)
1529
+ {
1530
+ char* func = (char*)IupGetAttribute(ih,"RB_RIGHTCLICK_CB");
1531
+ VALUE v;
1532
+ if(func) {
1533
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1534
+ if(strcmp(func,"Proc")==0) {
1535
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_RIGHTCLICK_CB");
1536
+ v = rb_funcall(proc,rb_intern("call"),2,node,INT2FIX(id));
1537
+ } else {
1538
+ v = rb_funcall(rb_cObject,rb_intern(func),2,node,INT2FIX(id));
1539
+ }
1540
+ return NUM2INT(v);
1541
+ }
1542
+ return IUP_DEFAULT;
1543
+ }
1544
+
1545
+ static int _k_any_cb(Ihandle* ih, int c)
1546
+ {
1547
+ extern char *iupKeyCodeToName(int c);
1548
+ char* func = NULL;
1549
+ VALUE v;
1550
+ static char key[100];
1551
+ static char pkey[100];
1552
+ sprintf(key,"RB_%s",(char*)iupKeyCodeToName(c));
1553
+ func = (char*)IupGetAttribute(ih,key);
1554
+ if(func==NULL) {
1555
+ func = (char*)IupGetAttribute(ih,"RB_K_ANY");
1556
+ strcpy(key,"RB_K_ANY");
1557
+ }
1558
+ if(func) {
1559
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1560
+ if(strcmp(func,"Proc")==0) {
1561
+ VALUE proc;
1562
+ sprintf(pkey,"RB_PROC_%s",&key[3]);
1563
+ proc = (VALUE)IupGetAttribute(ih,pkey);
1564
+ v = rb_funcall(proc,rb_intern("call"),2,node,INT2FIX(c));
1565
+ } else {
1566
+ v = rb_funcall(rb_cObject,rb_intern(func),2,node,INT2FIX(c));
1567
+ }
1568
+ return NUM2INT(v);
1569
+ }
1570
+ return IUP_DEFAULT;
1571
+ }
1572
+
1573
+ static int _renamenode_cb(Ihandle* ih, int id, char *name)
1574
+ {
1575
+ char* func = (char*)IupGetAttribute(ih,"RB_RENAMENODE_CB");
1576
+ VALUE v;
1577
+ if(func) {
1578
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1579
+ if(strcmp(func,"Proc")==0) {
1580
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_RENAMENODE_CB");
1581
+ v = rb_funcall(proc,rb_intern("call"),3,node,INT2FIX(id),rb_str_new2(name));
1582
+ } else {
1583
+ v = rb_funcall(rb_cObject,rb_intern(func),3,node,INT2FIX(id),rb_str_new2(name));
1584
+ }
1585
+ return NUM2INT(v);
1586
+ }
1587
+ return IUP_DEFAULT;
1588
+ }
1589
+
1590
+ static int _rename_cb(Ihandle* ih, int id, char *name)
1591
+ {
1592
+ char* func = (char*)IupGetAttribute(ih,"RB_RENAME_CB");
1593
+ VALUE v;
1594
+ if(func) {
1595
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1596
+ if(strcmp(func,"Proc")==0) {
1597
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_RENAME_CB");
1598
+ v = rb_funcall(proc,rb_intern("call"),3,node,INT2FIX(id),rb_str_new2(name));
1599
+ } else {
1600
+ v = rb_funcall(rb_cObject,rb_intern(func),3,node,INT2FIX(id),rb_str_new2(name));
1601
+ }
1602
+ return NUM2INT(v);
1603
+ }
1604
+ return IUP_DEFAULT;
1605
+ }
1606
+
1607
+ static int _dragdrop_cb(Ihandle *ih, int drag_id, int drop_id, int isshift, int iscontrol)
1608
+ {
1609
+ char* func = (char*)IupGetAttribute(ih,"RB_DRAGDROP_CB");
1610
+ VALUE v;
1611
+ if(func) {
1612
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1613
+ if(strcmp(func,"Proc")==0) {
1614
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_DRAGDROP_CB");
1615
+ v = rb_funcall(proc,rb_intern("call"),5,node,
1616
+ INT2FIX(drag_id),INT2FIX(drop_id),INT2FIX(isshift),INT2FIX(iscontrol));
1617
+ } else {
1618
+ v = rb_funcall(rb_cObject,rb_intern(func),5,node,
1619
+ INT2FIX(drag_id),INT2FIX(drop_id),INT2FIX(isshift),INT2FIX(iscontrol));
1620
+ }
1621
+ return NUM2INT(v);
1622
+ }
1623
+ return IUP_DEFAULT;
1624
+ }
1625
+
1626
+ static int _action_cb(Ihandle* ih)
1627
+ {
1628
+ char *key = "RB_PROC_ACTION";
1629
+ char* func = (char*)IupGetAttribute(ih,"RB_ACTION");
1630
+ VALUE v;
1631
+ if(func==NULL) {
1632
+ func = (char*)IupGetAttribute(ih,"RB_ACTION_CB");
1633
+ key = "RB_PROC_ACTION_CB";
1634
+ }
1635
+ if(func) {
1636
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1637
+ if(strcmp(func,"Proc")==0) {
1638
+ VALUE proc = (VALUE)IupGetAttribute(ih,key);
1639
+ v = rb_funcall(proc,rb_intern("call"),1,node);
1640
+ } else {
1641
+ v = rb_funcall(rb_cObject,rb_intern(func),1,node);
1642
+ }
1643
+ return NUM2INT(v);
1644
+ }
1645
+ return IUP_DEFAULT;
1646
+ }
1647
+
1648
+ static int _mdiactivate_cb(Ihandle* ih)
1649
+ {
1650
+ char* func = (char*)IupGetAttribute(ih,"RB_MDIACTIVATE_CB");
1651
+ VALUE v;
1652
+ if(func) {
1653
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1654
+ if(strcmp(func,"Proc")==0) {
1655
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_MDIACTIVATE_CB");
1656
+ v = rb_funcall(proc,rb_intern("call"),1,node);
1657
+ } else {
1658
+ v = rb_funcall(rb_cObject,rb_intern(func),1,node);
1659
+ }
1660
+ return NUM2INT(v);
1661
+ }
1662
+ return IUP_DEFAULT;
1663
+ }
1664
+
1665
+ static int _getfocus_cb(Ihandle* ih)
1666
+ {
1667
+ char* func = (char*)IupGetAttribute(ih,"RB_GETFOCUS_CB");
1668
+ VALUE v;
1669
+ if(func) {
1670
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1671
+ if(strcmp(func,"Proc")==0) {
1672
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_GETFOCUS_CB");
1673
+ v = rb_funcall(proc,rb_intern("call"),1,node);
1674
+ } else {
1675
+ v = rb_funcall(rb_cObject,rb_intern(func),1,node);
1676
+ }
1677
+ return NUM2INT(v);
1678
+ }
1679
+ return IUP_DEFAULT;
1680
+ }
1681
+
1682
+ static int _killfocus_cb(Ihandle* ih)
1683
+ {
1684
+ char* func = (char*)IupGetAttribute(ih,"RB_KILLFOCUS_CB");
1685
+ VALUE v;
1686
+ if(func) {
1687
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1688
+ if(strcmp(func,"Proc")==0) {
1689
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_KILLFOCUS_CB");
1690
+ v = rb_funcall(proc,rb_intern("call"),1,node);
1691
+ } else {
1692
+ v = rb_funcall(rb_cObject,rb_intern(func),1,node);
1693
+ }
1694
+ return NUM2INT(v);
1695
+ }
1696
+ return IUP_DEFAULT;
1697
+ }
1698
+
1699
+ static int _trayclick_cb(Ihandle* ih, int b, int press, int dclick)
1700
+ {
1701
+ char* func = (char*)IupGetAttribute(ih,"RB_TRAYCLICK_CB");
1702
+ VALUE v;
1703
+ if(func) {
1704
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1705
+ if(strcmp(func,"Proc")==0) {
1706
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_TRAYCLICK_CB");
1707
+ v = rb_funcall(proc,rb_intern("call"),4,node,INT2FIX(b),rb_float_new(press),rb_float_new(dclick));
1708
+ } else {
1709
+ v = rb_funcall(rb_cObject,rb_intern(func),4,node,INT2FIX(b),rb_float_new(press),rb_float_new(dclick));
1710
+ }
1711
+ return NUM2INT(v);
1712
+ }
1713
+ return IUP_DEFAULT;
1714
+ }
1715
+
1716
+ static int _scroll_cb(Ihandle* ih, int op, float posx, float posy)
1717
+ {
1718
+ char* func = (char*)IupGetAttribute(ih,"RB_SCROLL_CB");
1719
+ VALUE v;
1720
+ if(func) {
1721
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1722
+ if(strcmp(func,"Proc")==0) {
1723
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_SCROLL_CB");
1724
+ v = rb_funcall(proc,rb_intern("call"),4,node,INT2FIX(op),rb_float_new(posx),rb_float_new(posy));
1725
+ } else {
1726
+ v = rb_funcall(rb_cObject,rb_intern(func),4,node,INT2FIX(op),rb_float_new(posx),rb_float_new(posy));
1727
+ }
1728
+ return NUM2INT(v);
1729
+ }
1730
+ return IUP_DEFAULT;
1731
+ }
1732
+
1733
+ static int _resize_cb(Ihandle* ih, int width, int height)
1734
+ {
1735
+ char* func = (char*)IupGetAttribute(ih,"RB_RESIZE_CB");
1736
+ VALUE v;
1737
+ if(func) {
1738
+ VALUE node = (VALUE)IupGetAttribute(ih,"RB_CLASS");
1739
+ if(strcmp(func,"Proc")==0) {
1740
+ VALUE proc = (VALUE)IupGetAttribute(ih,"RB_PROC_RESIZE_CB");
1741
+ v = rb_funcall(proc,rb_intern("call"),3,node,INT2FIX(width),INT2FIX(height));
1742
+ } else {
1743
+ v = rb_funcall(rb_cObject,rb_intern(func),3,node,INT2FIX(width),INT2FIX(height));
1744
+ }
1745
+ return NUM2INT(v);
1746
+ }
1747
+ return IUP_DEFAULT;
1748
+ }
1749
+
1750
+ VALUE rb_IupGetCallback(VALUE node,VALUE v_name)
1751
+ {
1752
+ const char *name = RSTRING_PTR(v_name);
1753
+ Icallback v;
1754
+ VALUE v_ih = rb_iv_get(node,"@ihandle");
1755
+ v = IupGetCallback((Ihandle*)NUM2ULONG(v_ih),name);
1756
+ return ULONG2NUM((unsigned long)v);
1757
+ }
1758
+
1759
+ VALUE rb_IupSetCallback(VALUE node,VALUE v_name,VALUE v_func)
1760
+ {
1761
+ const char *name = RSTRING_PTR(v_name);
1762
+ const char *func = NULL;
1763
+ char cb_name[100] = "RB_";
1764
+ VALUE klass = Qnil;
1765
+ Icallback v = (Icallback)NULL;
1766
+ VALUE v_ih = rb_iv_get(node,"@ihandle");
1767
+ if(v_func!=Qnil) func = RSTRING_PTR(v_func);
1768
+ strcat(cb_name,name);
1769
+ IupStoreAttribute((Ihandle*)NUM2ULONG(v_ih),cb_name,func);
1770
+ klass = rb_funcall(node,rb_intern("class"),0,0);
1771
+ if(strcmp(name,"DRAW_CB")==0)
1772
+ if(klass==rb_cIupCells)
1773
+ v = (Icallback)_cell_draw_cb;
1774
+ else
1775
+ v = (Icallback)_draw_cb;
1776
+ else if(strcmp(name,"HEIGHT_CB")==0)
1777
+ v = (Icallback)_height_cb;
1778
+ else if(strcmp(name,"HSPAN_CB")==0)
1779
+ v = (Icallback)_hspan_cb;
1780
+ else if(strcmp(name,"MOUSECLICK_CB")==0)
1781
+ v = (Icallback)_mouseclick_cb;
1782
+ else if(strcmp(name,"MOUSEMOTION_CB")==0)
1783
+ v = (Icallback)_mousemotion_cb;
1784
+ else if(strcmp(name,"MOTION_CB")==0)
1785
+ v = (Icallback)_motion_cb;
1786
+ else if(strcmp(name,"NCOLS_CB")==0)
1787
+ v = (Icallback)_ncols_cb;
1788
+ else if(strcmp(name,"NLINES_CB")==0)
1789
+ v = (Icallback)_nlines_cb;
1790
+ else if(strcmp(name,"SCROLLING_CB")==0)
1791
+ v = (Icallback)_scrolling_cb;
1792
+ else if(strcmp(name,"VSPAN_CB")==0)
1793
+ v = (Icallback)_vspan_cb;
1794
+ else if(strcmp(name,"WIDTH_CB")==0)
1795
+ v = (Icallback)_width_cb;
1796
+ else if(strcmp(name,"DELETE_CB")==0)
1797
+ v = (Icallback)_delete_cb;
1798
+ else if(strcmp(name,"SELECT_CB")==0) {
1799
+ if(klass==rb_cIupColorbar)
1800
+ v = (Icallback)_colorbar_select_cb;
1801
+ else
1802
+ v = (Icallback)_select_cb;
1803
+ }
1804
+ else if(strcmp(name,"EDIT_CB")==0) {
1805
+ if(klass==rb_cIupList)
1806
+ v = (Icallback)_list_edit_cb;
1807
+ else
1808
+ v = (Icallback)_edit_cb;
1809
+ }
1810
+ else if(strcmp(name,"BUTTON_CB")==0)
1811
+ v = (Icallback)_button_cb;
1812
+ else if(strcmp(name,"BUTTON_PRESS_CB")==0)
1813
+ v = (Icallback)_button_press_cb;
1814
+ else if(strcmp(name,"BUTTON_RELEASE_CB")==0)
1815
+ v = (Icallback)_button_release_cb;
1816
+ else if(strcmp(name,"MOUSEMOVE_CB")==0)
1817
+ v = (Icallback)_mousemove_cb;
1818
+ else if(strcmp(name,"SCROLL_CB")==0)
1819
+ v = (Icallback)_scroll_cb;
1820
+ else if(strcmp(name,"RESIZE_CB")==0)
1821
+ v = (Icallback)_resize_cb;
1822
+ else if(strcmp(name,"ACTION")==0) {
1823
+ if(rb_class_inherited_p(klass,rb_cIupCanvas)==Qtrue)
1824
+ v = (Icallback)_canvas_action;
1825
+ else if(klass==rb_cIupToggle)
1826
+ v = (Icallback)_toggle_action;
1827
+ else if(klass==rb_cIupButton)
1828
+ v = (Icallback)_button_action;
1829
+ else if(klass==rb_cIupText||klass==rb_cIupMultiLine)
1830
+ v = (Icallback)_text_action;
1831
+ else if(klass==rb_cIupList)
1832
+ v = (Icallback)_list_action;
1833
+ else
1834
+ v = (Icallback)_action_cb;
1835
+ }
1836
+ else if(strcmp(name,"ACTION_CB")==0)
1837
+ v = (Icallback)_action_cb;
1838
+ else if(strcmp(name,"MDIACTIVATE_CB")==0)
1839
+ v = (Icallback)_mdiactivate_cb;
1840
+ else if(strcmp(name,"GETFOCUS_CB")==0)
1841
+ v = (Icallback)_getfocus_cb;
1842
+ else if(strcmp(name,"KILLFOCUS_CB")==0)
1843
+ v = (Icallback)_killfocus_cb;
1844
+ else if(strcmp(name,"TRAYCLICK_CB")==0)
1845
+ v = (Icallback)_trayclick_cb;
1846
+ else if(strcmp(name,"DRAG_CB")==0)
1847
+ v = (Icallback)_drag_cb;
1848
+ else if(strcmp(name,"CHANGE_CB")==0)
1849
+ v = (Icallback)_change_cb;
1850
+ else if(strcmp(name,"TABCHANGE_CB")==0)
1851
+ v = (Icallback)_tabchange_cb;
1852
+ else if(strcmp(name,"POSTDRAW_CB")==0)
1853
+ v = (Icallback)_postdraw_cb;
1854
+ else if(strcmp(name,"PREDRAW_CB")==0)
1855
+ v = (Icallback)_predraw_cb;
1856
+ else if(strcmp(name,"CELL_CB")==0)
1857
+ v = (Icallback)_cell_cb;
1858
+ else if(strcmp(name,"EXTENDED_CB")==0)
1859
+ v = (Icallback)_extended_cb;
1860
+ else if(strcmp(name,"SWITCH_CB")==0)
1861
+ v = (Icallback)_switch_cb;
1862
+ else if(strcmp(name,"EXECUTELEAF_CB")==0)
1863
+ v = (Icallback)_executeleaf_cb;
1864
+ else if(strcmp(name,"RENAMENODE_CB")==0)
1865
+ v = (Icallback)_renamenode_cb;
1866
+ else if(strcmp(name,"RENAME_CB")==0)
1867
+ v = (Icallback)_rename_cb;
1868
+ else if(strcmp(name,"BRANCHCLOSE_CB")==0)
1869
+ v = (Icallback)_branchclose_cb;
1870
+ else if(strcmp(name,"BRANCHOPEN_CB")==0)
1871
+ v = (Icallback)_branchopen_cb;
1872
+ else if(strcmp(name,"DRAGDROP_CB")==0)
1873
+ v = (Icallback)_dragdrop_cb;
1874
+ else if(strcmp(name,"RIGHTCLICK_CB")==0)
1875
+ v = (Icallback)_rightclick_cb;
1876
+ else if(strcmp(name,"K_ANY")==0)
1877
+ v = (Icallback)_k_any_cb;
1878
+ else if(strncmp(name,"K_",2)==0)
1879
+ v = (Icallback)_k_any_cb;
1880
+ v = IupSetCallback((Ihandle*)NUM2ULONG(v_ih),name,v);
1881
+ return ULONG2NUM((unsigned long)v);
1882
+ }
1883
+
1884
+ VALUE rb_IupGetIdle(VALUE self)
1885
+ {
1886
+ Icallback v;
1887
+ v = IupGetFunction("IDLE_ACTION");
1888
+ if(v)
1889
+ return ULONG2NUM((unsigned long)v);
1890
+ return Qnil;
1891
+ }
1892
+
1893
+ VALUE rb_IupGetFunction(VALUE self,VALUE v_name)
1894
+ {
1895
+ const char *name = RSTRING_PTR(v_name);
1896
+ Icallback v;
1897
+ v = IupGetFunction(name);
1898
+ return ULONG2NUM((unsigned long)v);
1899
+ }
1900
+
1901
+ VALUE rb_IupSetIdle(VALUE self,VALUE v_func)
1902
+ {
1903
+ Icallback func = NULL;
1904
+ Icallback v;
1905
+ if(v_func==Qnil) {
1906
+ *IdleAction=0;
1907
+ IdleProc = Qnil;
1908
+ }
1909
+ else if(TYPE(v_func)==T_DATA) {
1910
+ IdleProc = v_func;
1911
+ func = (Icallback)_idle_cb;
1912
+ }
1913
+ else if(TYPE(v_func)==T_STRING) {
1914
+ strcpy(IdleAction,RSTRING_PTR(v_func));
1915
+ func = (Icallback)_idle_cb;
1916
+ }
1917
+ v = IupSetFunction("IDLE_ACTION",func);
1918
+ return ULONG2NUM((unsigned long)v);
1919
+ }
1920
+
1921
+ VALUE rb_IupSetFunction(VALUE self,VALUE v_name,VALUE v_func)
1922
+ {
1923
+ const char *name = RSTRING_PTR(v_name);
1924
+ Icallback func = NULL;
1925
+ Icallback v;
1926
+ if(strcmp(name,"IDLE_ACTION")==0) {
1927
+ if(v_func==Qnil) {
1928
+ *IdleAction=0;
1929
+ IdleProc = Qnil;
1930
+ }
1931
+ else if(TYPE(v_func)==T_DATA) {
1932
+ IdleProc = v_func;
1933
+ func = (Icallback)_idle_cb;
1934
+ }
1935
+ else if(TYPE(v_func)==T_STRING) {
1936
+ strcpy(IdleAction,RSTRING_PTR(v_func));
1937
+ func = (Icallback)_idle_cb;
1938
+ }
1939
+ } else {
1940
+ func = (Icallback)_action_cb;
1941
+ }
1942
+ v = IupSetFunction(name,func);
1943
+ return ULONG2NUM((unsigned long)v);
1944
+ }
1945
+
1946
+ VALUE rb_IupGetActionName(VALUE self)
1947
+ {
1948
+ const char* v;
1949
+ v = IupGetActionName();
1950
+ return rb_str_new2(v);
1951
+ }
1952
+
1953
+ VALUE rb_IupGetHandle(VALUE self,VALUE v_name)
1954
+ {
1955
+ const char *name = RSTRING_PTR(v_name);
1956
+ Ihandle* v;
1957
+ v = IupGetHandle(name);
1958
+ if(v==NULL) return Qnil;
1959
+ return (VALUE)IupGetAttribute(v,"RB_CLASS");
1960
+ }
1961
+
1962
+ VALUE rb_IupSetHandle(VALUE self,VALUE v_name,VALUE node)
1963
+ {
1964
+ const char *name = RSTRING_PTR(v_name);
1965
+ Ihandle* v;
1966
+ VALUE v_ih = rb_iv_get(node,"@ihandle");
1967
+ v = IupSetHandle(name,(Ihandle*)NUM2ULONG(v_ih));
1968
+ if(v==NULL) return Qnil;
1969
+ return (VALUE)IupGetAttribute(v,"RB_CLASS");
1970
+ }
1971
+
1972
+ VALUE rb_IupGetAllNames(VALUE self,VALUE v_n)
1973
+ {
1974
+ int n = NUM2INT(v_n);
1975
+ int i;
1976
+ VALUE v_r;
1977
+ int v;
1978
+ char **names = xmalloc(n*(sizeof(char*)));
1979
+ v_r = rb_ary_new();
1980
+ v = IupGetAllNames(names,n);
1981
+ for(i=0;i<n && i<v;i++)
1982
+ rb_ary_push(v_r,rb_str_new2(names[i]));
1983
+ free(names);
1984
+ return v_r;
1985
+ }
1986
+
1987
+ VALUE rb_IupGetAllDialogs(VALUE self,VALUE v_n)
1988
+ {
1989
+ int n = NUM2INT(v_n);
1990
+ int i;
1991
+ VALUE v_r;
1992
+ int v;
1993
+ char **names = xmalloc(n*(sizeof(char*)));
1994
+ v_r = rb_ary_new();
1995
+ v = IupGetAllDialogs(names,n);
1996
+ for(i=0;i<n && i<v;i++)
1997
+ rb_ary_push(v_r,rb_str_new2(names[i]));
1998
+ free(names);
1999
+ return v_r;
2000
+ }
2001
+
2002
+ VALUE rb_IupGetName(VALUE self,VALUE node)
2003
+ {
2004
+ char* v;
2005
+ VALUE v_ih = rb_iv_get(node,"@ihandle");
2006
+ v = IupGetName((Ihandle*)NUM2ULONG(v_ih));
2007
+ return rb_str_new2(v);
2008
+ }
2009
+
2010
+ VALUE rb_IupSetAttributeHandle(VALUE node,VALUE v_name,VALUE v_node_named)
2011
+ {
2012
+ const char* name = RSTRING_PTR(v_name);
2013
+ VALUE v_ih = rb_iv_get(node,"@ihandle");
2014
+ VALUE v_ih_named = rb_iv_get(v_node_named,"@ihandle");
2015
+ IupSetAttributeHandle((Ihandle*)NUM2ULONG(v_ih),name,(Ihandle*)NUM2ULONG(v_ih_named));
2016
+ return Qnil;
2017
+ }
2018
+
2019
+ VALUE rb_IupGetAttributeHandle(VALUE node,VALUE v_name)
2020
+ {
2021
+ const char* name = RSTRING_PTR(v_name);
2022
+ VALUE v_ih = rb_iv_get(node,"@ihandle");
2023
+ Ihandle* v;
2024
+ v = IupGetAttributeHandle((Ihandle*)NUM2ULONG(v_ih),name);
2025
+ if(v==NULL) return Qnil;
2026
+ return (VALUE)IupGetAttribute(v,"RB_CLASS");
2027
+ }
2028
+
2029
+ VALUE rb_IupGetClassName(VALUE node)
2030
+ {
2031
+ char* v;
2032
+ VALUE v_ih = rb_iv_get(node,"@ihandle");
2033
+ v = IupGetClassName((Ihandle*)NUM2ULONG(v_ih));
2034
+ return rb_str_new2(v);
2035
+ }
2036
+ /*
2037
+ VALUE rb_IupCreate(VALUE self,VALUE v_name)
2038
+ {
2039
+ const char *name = RSTRING_PTR(v_name);
2040
+ Ihandle* v;
2041
+ v = IupCreate(name);
2042
+ if(v==NULL) return Qnil;
2043
+ return (VALUE)IupGetAttribute(v,"RB_CLASS");
2044
+ }
2045
+
2046
+ VALUE rb_IupCreatev(int argc,VALUE *argv,VALUE self)
2047
+ {
2048
+ const char *name = RSTRING_PTR(argv[0]);
2049
+ Ihandle* v;
2050
+ int i;
2051
+ void **params = (void**)xmalloc(sizeof(void*)*(argc));
2052
+ for(i=0;i<argc-1;i++)
2053
+ params[i] = (void*)NUM2INT(argv[i+1]);
2054
+ params[i] = NULL;
2055
+ v = IupCreatev(name,params);
2056
+ free(params);
2057
+ if(v==NULL) return Qnil;
2058
+ return (VALUE)IupGetAttribute(v,"RB_CLASS");
2059
+ }
2060
+ */
2061
+ VALUE rb_IupFill(int argc,VALUE *argv,VALUE self)
2062
+ {
2063
+ Ihandle* v;
2064
+ v = IupFill();
2065
+ if(argc==1 && TYPE(argv[0])==T_HASH)
2066
+ rb_set_attribute(v,argv[0]);
2067
+ if(v)
2068
+ return rb_funcall(rb_cIupFill,rb_intern("new"),1,ULONG2NUM((unsigned long)v));
2069
+ return Qnil;
2070
+ }
2071
+
2072
+ VALUE rb_IupRadio(int argc,VALUE *argv,VALUE self)
2073
+ {
2074
+ Ihandle* v;
2075
+ VALUE child_node,v_hash;
2076
+ VALUE v_child;
2077
+ rb_scan_args(argc,argv,"11",&child_node,&v_hash);
2078
+ v_child = rb_iv_get(child_node,"@ihandle");
2079
+ v = IupRadio((Ihandle*)NUM2ULONG(v_child));
2080
+ if(TYPE(v_hash)==T_HASH)
2081
+ rb_set_attribute(v,v_hash);
2082
+ if(v)
2083
+ return rb_funcall(rb_cIupRadio,rb_intern("new"),1,ULONG2NUM((unsigned long)v));
2084
+ return Qnil;
2085
+ }
2086
+
2087
+ VALUE rb_IupVboxv(int argc,VALUE *argv,VALUE self)
2088
+ {
2089
+ Ihandle* v;
2090
+ int i;
2091
+ Ihandle *children[100];
2092
+ VALUE node;
2093
+ VALUE v_children,v_hash;
2094
+ rb_scan_args(argc,argv,"11",&v_children,&v_hash);
2095
+ for(i=0;i<RARRAY_LEN(v_children);i++) {
2096
+ node = RARRAY_PTR(v_children)[i];
2097
+ children[i] = (Ihandle*)NUM2ULONG(rb_iv_get(node,"@ihandle"));
2098
+ }
2099
+ children[i] = NULL;
2100
+
2101
+ v = IupVboxv(children);
2102
+ if(TYPE(v_hash)==T_HASH)
2103
+ rb_set_attribute(v,v_hash);
2104
+ if(v)
2105
+ return rb_funcall(rb_cIupVbox,rb_intern("new"),1,ULONG2NUM((unsigned long)v));
2106
+ return Qnil;
2107
+ }
2108
+
2109
+ VALUE rb_IupZboxv(int argc,VALUE *argv,VALUE self)
2110
+ {
2111
+ Ihandle* v;
2112
+ int i;
2113
+ Ihandle *children[100];
2114
+ VALUE node;
2115
+ VALUE v_children,v_hash;
2116
+ rb_scan_args(argc,argv,"11",&v_children,&v_hash);
2117
+ for(i=0;i<RARRAY_LEN(v_children);i++) {
2118
+ node = RARRAY_PTR(v_children)[i];
2119
+ children[i] = (Ihandle*)NUM2ULONG(rb_iv_get(node,"@ihandle"));
2120
+ }
2121
+ children[i] = NULL;
2122
+ v = IupZboxv(children);
2123
+ if(TYPE(v_hash)==T_HASH)
2124
+ rb_set_attribute(v,v_hash);
2125
+ if(v)
2126
+ return rb_funcall(rb_cIupZbox,rb_intern("new"),1,ULONG2NUM((unsigned long)v));
2127
+ return Qnil;
2128
+ }
2129
+
2130
+ VALUE rb_IupHboxv(int argc,VALUE *argv,VALUE self)
2131
+ {
2132
+ Ihandle* v;
2133
+ int i;
2134
+ Ihandle *children[100];
2135
+ VALUE node;
2136
+ VALUE v_children,v_hash;
2137
+ rb_scan_args(argc,argv,"11",&v_children,&v_hash);
2138
+ for(i=0;i<RARRAY_LEN(v_children);i++) {
2139
+ node = RARRAY_PTR(v_children)[i];
2140
+ children[i] = (Ihandle*)NUM2ULONG(rb_iv_get(node,"@ihandle"));
2141
+ }
2142
+ children[i] = NULL;
2143
+ v = IupHboxv(children);
2144
+ if(TYPE(v_hash)==T_HASH)
2145
+ rb_set_attribute(v,v_hash);
2146
+ if(v)
2147
+ return rb_funcall(rb_cIupHbox,rb_intern("new"),1,ULONG2NUM((unsigned long)v));
2148
+ return Qnil;
2149
+ }
2150
+
2151
+ VALUE rb_IupFrame(int argc,VALUE *argv,VALUE self)
2152
+ {
2153
+ Ihandle* v;
2154
+ VALUE child_node,v_hash,v_child;
2155
+ rb_scan_args(argc,argv,"11",&child_node,&v_hash);
2156
+ v_child = rb_iv_get(child_node,"@ihandle");
2157
+ v = IupFrame((Ihandle*)NUM2ULONG(v_child));
2158
+ if(TYPE(v_hash)==T_HASH)
2159
+ rb_set_attribute(v,v_hash);
2160
+ if(v)
2161
+ return rb_funcall(rb_cIupFrame,rb_intern("new"),1,ULONG2NUM((unsigned long)v));
2162
+ return Qnil;
2163
+ }
2164
+
2165
+ VALUE rb_IupImage(int argc,VALUE *argv,VALUE self)
2166
+ {
2167
+ int width;
2168
+ int height;
2169
+ int i;
2170
+ Ihandle* v;
2171
+ VALUE v_width;
2172
+ VALUE v_height;
2173
+ VALUE v_pixmap;
2174
+ unsigned char *pixmap = NULL;
2175
+ if(argc==1 && TYPE(argv[0])==T_HASH) {
2176
+ v_width = rb_hash_delete(argv[0],ID2SYM(rb_intern("width")));
2177
+ v_height = rb_hash_delete(argv[0],ID2SYM(rb_intern("height")));
2178
+ v_pixmap = rb_hash_delete(argv[0],ID2SYM(rb_intern("pixmap")));
2179
+ } else {
2180
+ rb_scan_args(argc,argv,"30",&v_width,&v_height,&v_pixmap);
2181
+ }
2182
+ if(v_width==Qnil||v_height==Qnil||v_pixmap==Qnil) {
2183
+ rb_raise(rb_eIupError,"Invalid Argument");
2184
+ }
2185
+ width = NUM2INT(v_width);
2186
+ height = NUM2INT(v_height);
2187
+ pixmap = xmalloc(RARRAY_LEN(v_pixmap));
2188
+ for(i=0;i<RARRAY_LEN(v_pixmap);i++)
2189
+ pixmap[i] = NUM2INT(RARRAY_PTR(v_pixmap)[i]);
2190
+ v = IupImage(width,height,pixmap);
2191
+ free(pixmap);
2192
+ if(argc==1 && TYPE(argv[0])==T_HASH)
2193
+ rb_set_attribute(v,argv[0]);
2194
+ if(v)
2195
+ return rb_funcall(rb_cIupImage,rb_intern("new"),1,ULONG2NUM((unsigned long)v));
2196
+ return Qnil;
2197
+ }
2198
+
2199
+ VALUE rb_IupButton(int argc,VALUE *argv,VALUE self)
2200
+ {
2201
+ const char* title = NULL;
2202
+ const char* action = NULL;
2203
+ Ihandle* v;
2204
+ VALUE v_title,v_action;
2205
+ if(argc==1 && TYPE(argv[0])==T_HASH) {
2206
+ v_title = rb_hash_delete(argv[0],ID2SYM(rb_intern("title")));
2207
+ v_action = rb_hash_delete(argv[0],ID2SYM(rb_intern("action")));
2208
+ } else {
2209
+ rb_scan_args(argc,argv,"11",&v_title,&v_action);
2210
+ }
2211
+ if(v_title!=Qnil)
2212
+ title = RSTRING_PTR(v_title);
2213
+ if(v_action!=Qnil)
2214
+ action = RSTRING_PTR(v_action);
2215
+ v = IupButton(title,action);
2216
+ if(argc==1 && TYPE(argv[0])==T_HASH)
2217
+ rb_set_attribute(v,argv[0]);
2218
+ if(v)
2219
+ return rb_funcall(rb_cIupButton,rb_intern("new"),2,ULONG2NUM((unsigned long)v),v_action);
2220
+ return Qnil;
2221
+ }
2222
+
2223
+ VALUE rb_IupCanvas(int argc,VALUE *argv,VALUE self)
2224
+ {
2225
+ const char* action = NULL;
2226
+ Ihandle* v;
2227
+ VALUE v_action;
2228
+ if(argc==1 && TYPE(argv[0])==T_HASH) {
2229
+ v_action = rb_hash_delete(argv[0],ID2SYM(rb_intern("action")));
2230
+ } else {
2231
+ rb_scan_args(argc,argv,"01",&v_action);
2232
+ }
2233
+ if(v_action!=Qnil)
2234
+ action = RSTRING_PTR(v_action);
2235
+ v = IupCanvas(action);
2236
+ if(argc==1 && TYPE(argv[0])==T_HASH)
2237
+ rb_set_attribute(v,argv[0]);
2238
+ if(v)
2239
+ return rb_funcall(rb_cIupCanvas,rb_intern("new"),2,ULONG2NUM((unsigned long)v),v_action);
2240
+ return Qnil;
2241
+ }
2242
+
2243
+ VALUE rb_IupDialog(int argc,VALUE *argv,VALUE self)
2244
+ {
2245
+ Ihandle* v;
2246
+ VALUE child_node,v_hash;
2247
+ VALUE v_child;
2248
+ rb_scan_args(argc,argv,"11",&child_node,&v_hash);
2249
+ v_child = rb_iv_get(child_node,"@ihandle");
2250
+ v = IupDialog((Ihandle*)NUM2ULONG(v_child));
2251
+ if(TYPE(v_hash)==T_HASH)
2252
+ rb_set_attribute(v,v_hash);
2253
+ if(v)
2254
+ return rb_funcall(rb_cIupDialog,rb_intern("new"),1,ULONG2NUM((unsigned long)v));
2255
+ return Qnil;
2256
+ }
2257
+
2258
+ VALUE rb_IupUser(VALUE self)
2259
+ {
2260
+ Ihandle* v;
2261
+ v = IupUser();
2262
+ if(v)
2263
+ return rb_funcall(rb_cIupUser,rb_intern("new"),1,ULONG2NUM((unsigned long)v));
2264
+ return Qnil;
2265
+ }
2266
+
2267
+ VALUE rb_IupItem(int argc,VALUE *argv,VALUE self)
2268
+ {
2269
+ const char* title = NULL;
2270
+ const char* action = NULL;
2271
+ Ihandle* v;
2272
+ VALUE v_title,v_action;
2273
+ if(argc==1 && TYPE(argv[0])==T_HASH) {
2274
+ v_title = rb_hash_delete(argv[0],ID2SYM(rb_intern("title")));
2275
+ v_action = rb_hash_delete(argv[0],ID2SYM(rb_intern("action")));
2276
+ } else {
2277
+ rb_scan_args(argc,argv,"11",&v_title,&v_action);
2278
+ }
2279
+ if(v_title!=Qnil)
2280
+ title = RSTRING_PTR(v_title);
2281
+ if(v_action!=Qnil)
2282
+ action = RSTRING_PTR(v_action);
2283
+ v = IupItem(title,action);
2284
+ if(action)
2285
+ IupStoreAttribute(v,"RB_ACTION",action);
2286
+ if(argc==1 && TYPE(argv[0])==T_HASH)
2287
+ rb_set_attribute(v,argv[0]);
2288
+ if(v)
2289
+ return rb_funcall(rb_cIupItem,rb_intern("new"),2,ULONG2NUM((unsigned long)v),v_action);
2290
+ return Qnil;
2291
+ }
2292
+
2293
+ VALUE rb_IupSubmenu(int argc,VALUE *argv,VALUE self)
2294
+ {
2295
+ const char* title = NULL;
2296
+ Ihandle* v;
2297
+ VALUE v_title,child_node;
2298
+ VALUE v_child;
2299
+ if(argc==1 && TYPE(argv[0])==T_HASH) {
2300
+ v_title = rb_hash_delete(argv[0],ID2SYM(rb_intern("title")));
2301
+ child_node = rb_hash_delete(argv[0],ID2SYM(rb_intern("menu")));
2302
+ } else {
2303
+ rb_scan_args(argc,argv,"20",&v_title,&child_node);
2304
+ }
2305
+ if(v_title!=Qnil)
2306
+ title = RSTRING_PTR(v_title);
2307
+ v_child = rb_iv_get(child_node,"@ihandle");
2308
+ v = IupSubmenu(title,(Ihandle*)NUM2ULONG(v_child));
2309
+ if(argc==1 && TYPE(argv[0])==T_HASH)
2310
+ rb_set_attribute(v,argv[0]);
2311
+ if(v)
2312
+ return rb_funcall(rb_cIupSubmenu,rb_intern("new"),1,ULONG2NUM((unsigned long)v));
2313
+ return Qnil;
2314
+ }
2315
+
2316
+ VALUE rb_IupSeparator(VALUE self)
2317
+ {
2318
+ Ihandle* v;
2319
+ v = IupSeparator();
2320
+ if(v)
2321
+ return rb_funcall(rb_cIupSeparator,rb_intern("new"),1,ULONG2NUM((unsigned long)v));
2322
+ return Qnil;
2323
+ }
2324
+
2325
+ VALUE rb_IupLabel(int argc,VALUE *argv,VALUE self)
2326
+ {
2327
+ const char* title = NULL;
2328
+ Ihandle* v;
2329
+ VALUE v_title;
2330
+ if(argc==1 && TYPE(argv[0])==T_HASH) {
2331
+ v_title = rb_hash_delete(argv[0],ID2SYM(rb_intern("title")));
2332
+ } else {
2333
+ rb_scan_args(argc,argv,"10",&v_title);
2334
+ }
2335
+ title = RSTRING_PTR(v_title);
2336
+ v = IupLabel(title);
2337
+ if(argc==1 && TYPE(argv[0])==T_HASH)
2338
+ rb_set_attribute(v,argv[0]);
2339
+ if(v)
2340
+ return rb_funcall(rb_cIupLabel,rb_intern("new"),1,ULONG2NUM((unsigned long)v));
2341
+ return Qnil;
2342
+ }
2343
+
2344
+ VALUE rb_IupList(int argc,VALUE *argv,VALUE self)
2345
+ {
2346
+ const char* action = NULL;
2347
+ Ihandle* v;
2348
+ VALUE v_action;
2349
+ if(argc==1 && TYPE(argv[0])==T_HASH) {
2350
+ v_action = rb_hash_delete(argv[0],ID2SYM(rb_intern("action")));
2351
+ } else {
2352
+ rb_scan_args(argc,argv,"01",&v_action);
2353
+ }
2354
+ if(v_action!=Qnil)
2355
+ action = RSTRING_PTR(v_action);
2356
+ v = IupList(action);
2357
+ if(argc==1 && TYPE(argv[0])==T_HASH)
2358
+ rb_set_attribute(v,argv[0]);
2359
+ if(v)
2360
+ return rb_funcall(rb_cIupList,rb_intern("new"),2,ULONG2NUM((unsigned long)v),v_action);
2361
+ return Qnil;
2362
+ }
2363
+
2364
+ VALUE rb_IupMenuv(VALUE self,VALUE v_children)
2365
+ {
2366
+ Ihandle* v;
2367
+ int i;
2368
+ Ihandle *children[100];
2369
+ VALUE node;
2370
+ for(i=0;i<RARRAY_LEN(v_children);i++) {
2371
+ node = RARRAY_PTR(v_children)[i];
2372
+ children[i] = (Ihandle*)NUM2ULONG(rb_iv_get(node,"@ihandle"));
2373
+ }
2374
+ children[i] = NULL;
2375
+ v = IupMenuv(children);
2376
+ if(v)
2377
+ return rb_funcall(rb_cIupMenu,rb_intern("new"),1,ULONG2NUM((unsigned long)v));
2378
+ return Qnil;
2379
+ }
2380
+
2381
+ VALUE rb_IupText(int argc,VALUE *argv,VALUE self)
2382
+ {
2383
+ const char* action = NULL;
2384
+ Ihandle* v;
2385
+ VALUE v_action;
2386
+ if(argc==1 && TYPE(argv[0])==T_HASH) {
2387
+ v_action = rb_hash_delete(argv[0],ID2SYM(rb_intern("action")));
2388
+ } else {
2389
+ rb_scan_args(argc,argv,"01",&v_action);
2390
+ }
2391
+ if(v_action!=Qnil)
2392
+ action = RSTRING_PTR(v_action);
2393
+ v = IupText(action);
2394
+ if(action)
2395
+ IupStoreAttribute(v,"RB_ACTION",action);
2396
+ if(argc==1 && TYPE(argv[0])==T_HASH)
2397
+ rb_set_attribute(v,argv[0]);
2398
+ if(v)
2399
+ return rb_funcall(rb_cIupText,rb_intern("new"),2,ULONG2NUM((unsigned long)v),v_action);
2400
+ return Qnil;
2401
+ }
2402
+
2403
+ VALUE rb_IupMultiLine(int argc,VALUE *argv,VALUE self)
2404
+ {
2405
+ const char* action = NULL;
2406
+ Ihandle* v;
2407
+ VALUE v_action;
2408
+ if(argc==1 && TYPE(argv[0])==T_HASH) {
2409
+ v_action = rb_hash_delete(argv[0],ID2SYM(rb_intern("action")));
2410
+ } else {
2411
+ rb_scan_args(argc,argv,"01",&v_action);
2412
+ }
2413
+ if(v_action!=Qnil)
2414
+ action = RSTRING_PTR(v_action);
2415
+ v = IupMultiLine(action);
2416
+ if(argc==1 && TYPE(argv[0])==T_HASH)
2417
+ rb_set_attribute(v,argv[0]);
2418
+ if(v)
2419
+ return rb_funcall(rb_cIupMultiLine,rb_intern("new"),2,ULONG2NUM((unsigned long)v),v_action);
2420
+ return Qnil;
2421
+ }
2422
+
2423
+ VALUE rb_IupToggle(int argc,VALUE *argv,VALUE self)
2424
+ {
2425
+ const char* title = NULL;
2426
+ const char* action = NULL;
2427
+ Ihandle* v;
2428
+ VALUE v_title,v_action;
2429
+ if(argc==1 && TYPE(argv[0])==T_HASH) {
2430
+ v_title = rb_hash_delete(argv[0],ID2SYM(rb_intern("title")));
2431
+ v_action = rb_hash_delete(argv[0],ID2SYM(rb_intern("action")));
2432
+ } else {
2433
+ rb_scan_args(argc,argv,"02",&v_title,&v_action);
2434
+ }
2435
+ if(v_title!=Qnil)
2436
+ title = RSTRING_PTR(v_title);
2437
+ if(v_action!=Qnil)
2438
+ action = RSTRING_PTR(v_action);
2439
+ v = IupToggle(title,action);
2440
+ if(argc==1 && TYPE(argv[0])==T_HASH)
2441
+ rb_set_attribute(v,argv[0]);
2442
+ if(v)
2443
+ return rb_funcall(rb_cIupToggle,rb_intern("new"),2,ULONG2NUM((unsigned long)v),v_action);
2444
+ return Qnil;
2445
+ }
2446
+
2447
+ VALUE rb_IupTimer(VALUE self)
2448
+ {
2449
+ Ihandle* v;
2450
+ v = IupTimer();
2451
+ if(v)
2452
+ return rb_funcall(rb_cIupTimer,rb_intern("new"),1,ULONG2NUM((unsigned long)v));
2453
+ return Qnil;
2454
+ }
2455
+
2456
+ VALUE rb_IupProgressBar(VALUE self)
2457
+ {
2458
+ Ihandle* v;
2459
+ v = IupProgressBar();
2460
+ if(v)
2461
+ return rb_funcall(rb_cIupProgressBar,rb_intern("new"),1,ULONG2NUM((unsigned long)v));
2462
+ return Qnil;
2463
+ }
2464
+
2465
+ VALUE rb_IupCboxv(int argc,VALUE *argv,VALUE self)
2466
+ {
2467
+ extern VALUE rb_cIupCbox;
2468
+ Ihandle* v;
2469
+ int i;
2470
+ Ihandle *params[100];
2471
+ VALUE v_params,v_hash;
2472
+ VALUE node;
2473
+ rb_scan_args(argc,argv,"11",&v_params,&v_hash);
2474
+ for(i=0;i<RARRAY_LEN(v_params);i++) {
2475
+ node = RARRAY_PTR(v_params)[i];
2476
+ params[i] = (Ihandle*)NUM2ULONG(rb_iv_get(node,"@ihandle"));
2477
+ }
2478
+ params[i] = NULL;
2479
+ v = IupCboxv(params);
2480
+ if(TYPE(v_hash)==T_HASH)
2481
+ rb_set_attribute(v,v_hash);
2482
+ if(v)
2483
+ return rb_funcall(rb_cIupCbox,rb_intern("new"),1,ULONG2NUM((unsigned long)v));
2484
+ return Qnil;
2485
+ }