fxruby 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (692) hide show
  1. data/ANNOUNCE +25 -0
  2. data/ChangeLog +10606 -0
  3. data/INSTALL +50 -0
  4. data/LICENSE +456 -0
  5. data/README +39 -0
  6. data/doc/apes02.html +21 -0
  7. data/doc/apes03.html +39 -0
  8. data/doc/book.html +3 -0
  9. data/doc/build.html +144 -0
  10. data/doc/ch03s02.html +24 -0
  11. data/doc/ch03s03.html +53 -0
  12. data/doc/ch03s04.html +37 -0
  13. data/doc/ch03s05.html +61 -0
  14. data/doc/ch04s02.html +72 -0
  15. data/doc/ch04s03.html +37 -0
  16. data/doc/ch04s04.html +72 -0
  17. data/doc/ch05s02.html +262 -0
  18. data/doc/ch05s03.html +128 -0
  19. data/doc/changes.html +75 -0
  20. data/doc/clipboardtut.html +68 -0
  21. data/doc/cvs.html +35 -0
  22. data/doc/differences.html +11 -0
  23. data/doc/dragdroptut.html +266 -0
  24. data/doc/events.html +36 -0
  25. data/doc/examples.html +104 -0
  26. data/doc/gems.html +73 -0
  27. data/doc/goals.html +39 -0
  28. data/doc/images/babelfish.png +0 -0
  29. data/doc/images/browser.png +0 -0
  30. data/doc/images/button.png +0 -0
  31. data/doc/images/call-chain-example.png +0 -0
  32. data/doc/images/colordialog.png +0 -0
  33. data/doc/images/datatarget.png +0 -0
  34. data/doc/images/dialog.png +0 -0
  35. data/doc/images/dilbert.png +0 -0
  36. data/doc/images/dirlist.png +0 -0
  37. data/doc/images/dropsite-droprejected.png +0 -0
  38. data/doc/images/foursplit.png +0 -0
  39. data/doc/images/gltest.png +0 -0
  40. data/doc/images/glviewer.png +0 -0
  41. data/doc/images/groupbox.png +0 -0
  42. data/doc/images/header.png +0 -0
  43. data/doc/images/hello-with-button.png +0 -0
  44. data/doc/images/hello-with-icon-1.png +0 -0
  45. data/doc/images/hello-with-icon-2.png +0 -0
  46. data/doc/images/hello-with-icon-3.png +0 -0
  47. data/doc/images/hello-with-tooltip.png +0 -0
  48. data/doc/images/hello-without-button.png +0 -0
  49. data/doc/images/hello.png +0 -0
  50. data/doc/images/hello2.png +0 -0
  51. data/doc/images/iconlist-bigicons.png +0 -0
  52. data/doc/images/iconlist-details.png +0 -0
  53. data/doc/images/image.png +0 -0
  54. data/doc/images/imageviewer.png +0 -0
  55. data/doc/images/inheritance.png +0 -0
  56. data/doc/images/mditest.png +0 -0
  57. data/doc/images/raabrowser.png +0 -0
  58. data/doc/images/scribble.png +0 -0
  59. data/doc/images/shutter.png +0 -0
  60. data/doc/images/splitter.png +0 -0
  61. data/doc/images/tabbook.png +0 -0
  62. data/doc/images/table.png +0 -0
  63. data/doc/images/tutorial1.png +0 -0
  64. data/doc/implementation.html +16 -0
  65. data/doc/infosources.html +33 -0
  66. data/doc/library.html +30 -0
  67. data/doc/opengl.html +73 -0
  68. data/doc/pt01.html +3 -0
  69. data/doc/pt02.html +3 -0
  70. data/doc/scintilla.html +36 -0
  71. data/doc/todo.html +40 -0
  72. data/doc/tutorial1.html +97 -0
  73. data/examples/RAA.rb +25 -0
  74. data/examples/README +53 -0
  75. data/examples/babelfish.rb +107 -0
  76. data/examples/bounce.rb +159 -0
  77. data/examples/browser.rb +191 -0
  78. data/examples/button.rb +160 -0
  79. data/examples/datatarget.rb +223 -0
  80. data/examples/dctest.rb +702 -0
  81. data/examples/dialog.rb +148 -0
  82. data/examples/dilbert.rb +105 -0
  83. data/examples/dirlist.rb +63 -0
  84. data/examples/dragdrop.rb +101 -0
  85. data/examples/dragsource.rb +81 -0
  86. data/examples/dropsite.rb +61 -0
  87. data/examples/foursplit.rb +103 -0
  88. data/examples/gltest.rb +342 -0
  89. data/examples/glviewer.rb +579 -0
  90. data/examples/groupbox.rb +422 -0
  91. data/examples/header.rb +150 -0
  92. data/examples/hello.rb +12 -0
  93. data/examples/hello2.rb +51 -0
  94. data/examples/iRAA.rb +153 -0
  95. data/examples/iconlist.rb +104 -0
  96. data/examples/icons/AngryGuyInBunnySuit.ico +0 -0
  97. data/examples/icons/FatBot.ico +0 -0
  98. data/examples/icons/FlippedySwitch.ico +0 -0
  99. data/examples/icons/LeGoon.ico +0 -0
  100. data/examples/icons/Net.ico +0 -0
  101. data/examples/icons/RedMacOS.ico +0 -0
  102. data/examples/icons/SawBlade.ico +0 -0
  103. data/examples/icons/backview.png +0 -0
  104. data/examples/icons/big.png +0 -0
  105. data/examples/icons/bigfolder.png +0 -0
  106. data/examples/icons/bigpenguin.png +0 -0
  107. data/examples/icons/bottomview.png +0 -0
  108. data/examples/icons/camera.png +0 -0
  109. data/examples/icons/capbutt.png +0 -0
  110. data/examples/icons/capnotlast.png +0 -0
  111. data/examples/icons/capproj.png +0 -0
  112. data/examples/icons/capround.png +0 -0
  113. data/examples/icons/colorpal.png +0 -0
  114. data/examples/icons/copy.png +0 -0
  115. data/examples/icons/cut.png +0 -0
  116. data/examples/icons/delimit.png +0 -0
  117. data/examples/icons/dippy.png +0 -0
  118. data/examples/icons/double_dash.png +0 -0
  119. data/examples/icons/filenew.png +0 -0
  120. data/examples/icons/fileopen.png +0 -0
  121. data/examples/icons/filesave.png +0 -0
  122. data/examples/icons/filesaveas.png +0 -0
  123. data/examples/icons/fonts.png +0 -0
  124. data/examples/icons/fox.png +0 -0
  125. data/examples/icons/foxicon.png +0 -0
  126. data/examples/icons/frontview.png +0 -0
  127. data/examples/icons/gem_big.png +0 -0
  128. data/examples/icons/gem_small.png +0 -0
  129. data/examples/icons/hello2.png +0 -0
  130. data/examples/icons/help.png +0 -0
  131. data/examples/icons/indent.png +0 -0
  132. data/examples/icons/jbevel.png +0 -0
  133. data/examples/icons/jmiter.png +0 -0
  134. data/examples/icons/jround.png +0 -0
  135. data/examples/icons/kill.png +0 -0
  136. data/examples/icons/leftview.png +0 -0
  137. data/examples/icons/light.png +0 -0
  138. data/examples/icons/minidoc.png +0 -0
  139. data/examples/icons/minifolder.png +0 -0
  140. data/examples/icons/minifolderopen.png +0 -0
  141. data/examples/icons/newfolder.png +0 -0
  142. data/examples/icons/nolight.png +0 -0
  143. data/examples/icons/onoff_dash.png +0 -0
  144. data/examples/icons/palette.png +0 -0
  145. data/examples/icons/parallel.png +0 -0
  146. data/examples/icons/paste.png +0 -0
  147. data/examples/icons/pattern.png +0 -0
  148. data/examples/icons/penguin.png +0 -0
  149. data/examples/icons/perspective.png +0 -0
  150. data/examples/icons/printicon.png +0 -0
  151. data/examples/icons/prop.png +0 -0
  152. data/examples/icons/redo.png +0 -0
  153. data/examples/icons/rightview.png +0 -0
  154. data/examples/icons/saveas.png +0 -0
  155. data/examples/icons/shutter1.png +0 -0
  156. data/examples/icons/shutter2.png +0 -0
  157. data/examples/icons/small.png +0 -0
  158. data/examples/icons/smoothlight.png +0 -0
  159. data/examples/icons/solid_line.png +0 -0
  160. data/examples/icons/tbuplevel.png +0 -0
  161. data/examples/icons/topview.png +0 -0
  162. data/examples/icons/undo.png +0 -0
  163. data/examples/icons/winapp.png +0 -0
  164. data/examples/icons/zoom.png +0 -0
  165. data/examples/image.rb +281 -0
  166. data/examples/imageviewer.rb +513 -0
  167. data/examples/inputs.rb +84 -0
  168. data/examples/mditest.rb +180 -0
  169. data/examples/pig.rb +77 -0
  170. data/examples/raabrowser.rb +132 -0
  171. data/examples/scintilla-test.rb +81 -0
  172. data/examples/scribble-orig.rb +186 -0
  173. data/examples/scribble.rb +166 -0
  174. data/examples/shutter.rb +158 -0
  175. data/examples/splitter.rb +211 -0
  176. data/examples/styledtext.rb +92 -0
  177. data/examples/tabbook.rb +124 -0
  178. data/examples/table.rb +187 -0
  179. data/examples/textedit/commands.rb +117 -0
  180. data/examples/textedit/helpwindow.rb +295 -0
  181. data/examples/textedit/prefdialog.rb +235 -0
  182. data/examples/textedit/textedit.rb +1767 -0
  183. data/ext/fox12/FXRbApp.cpp +127 -0
  184. data/ext/fox12/FXRbDataTarget.cpp +106 -0
  185. data/ext/fox12/FXRbGLViewer.cpp +89 -0
  186. data/ext/fox12/FXRuby.cpp +1818 -0
  187. data/ext/fox12/MANIFEST +189 -0
  188. data/ext/fox12/core_wrap.cpp +10119 -0
  189. data/ext/fox12/dc_wrap.cpp +2638 -0
  190. data/ext/fox12/dialogs_wrap.cpp +6244 -0
  191. data/ext/fox12/extconf.rb +176 -0
  192. data/ext/fox12/frames_wrap.cpp +8274 -0
  193. data/ext/fox12/fx3d_wrap.cpp +9315 -0
  194. data/ext/fox12/iconlist_wrap.cpp +3742 -0
  195. data/ext/fox12/icons_wrap.cpp +4040 -0
  196. data/ext/fox12/image_wrap.cpp +4026 -0
  197. data/ext/fox12/impl.cpp +1064 -0
  198. data/ext/fox12/include/FXMemoryBuffer.h +52 -0
  199. data/ext/fox12/include/FXRb4Splitter.h +54 -0
  200. data/ext/fox12/include/FXRbAccelTable.h +46 -0
  201. data/ext/fox12/include/FXRbApp.h +137 -0
  202. data/ext/fox12/include/FXRbAppVirtuals.h +15 -0
  203. data/ext/fox12/include/FXRbArrowButton.h +51 -0
  204. data/ext/fox12/include/FXRbBMPIcon.h +54 -0
  205. data/ext/fox12/include/FXRbBMPImage.h +54 -0
  206. data/ext/fox12/include/FXRbBitmap.h +115 -0
  207. data/ext/fox12/include/FXRbBitmapFrame.h +56 -0
  208. data/ext/fox12/include/FXRbBitmapView.h +52 -0
  209. data/ext/fox12/include/FXRbBitmapVirtuals.h +27 -0
  210. data/ext/fox12/include/FXRbButton.h +51 -0
  211. data/ext/fox12/include/FXRbCURCursor.h +60 -0
  212. data/ext/fox12/include/FXRbCanvas.h +51 -0
  213. data/ext/fox12/include/FXRbCheckButton.h +51 -0
  214. data/ext/fox12/include/FXRbColorBar.h +51 -0
  215. data/ext/fox12/include/FXRbColorDialog.h +53 -0
  216. data/ext/fox12/include/FXRbColorSelector.h +51 -0
  217. data/ext/fox12/include/FXRbColorWell.h +51 -0
  218. data/ext/fox12/include/FXRbColorWheel.h +51 -0
  219. data/ext/fox12/include/FXRbComboBox.h +56 -0
  220. data/ext/fox12/include/FXRbCommon.h +86 -0
  221. data/ext/fox12/include/FXRbComposite.h +51 -0
  222. data/ext/fox12/include/FXRbCursor.h +87 -0
  223. data/ext/fox12/include/FXRbCursorVirtuals.h +6 -0
  224. data/ext/fox12/include/FXRbDC.h +385 -0
  225. data/ext/fox12/include/FXRbDCPrint.h +49 -0
  226. data/ext/fox12/include/FXRbDCVirtuals.h +166 -0
  227. data/ext/fox12/include/FXRbDCWindow.h +64 -0
  228. data/ext/fox12/include/FXRbDataTarget.h +65 -0
  229. data/ext/fox12/include/FXRbDebugTarget.h +46 -0
  230. data/ext/fox12/include/FXRbDelegator.h +46 -0
  231. data/ext/fox12/include/FXRbDial.h +51 -0
  232. data/ext/fox12/include/FXRbDialogBox.h +68 -0
  233. data/ext/fox12/include/FXRbDialogBoxVirtuals.h +3 -0
  234. data/ext/fox12/include/FXRbDict.h +46 -0
  235. data/ext/fox12/include/FXRbDirBox.h +51 -0
  236. data/ext/fox12/include/FXRbDirDialog.h +53 -0
  237. data/ext/fox12/include/FXRbDirList.h +79 -0
  238. data/ext/fox12/include/FXRbDirSelector.h +51 -0
  239. data/ext/fox12/include/FXRbDocument.h +46 -0
  240. data/ext/fox12/include/FXRbDragCorner.h +51 -0
  241. data/ext/fox12/include/FXRbDrawable.h +64 -0
  242. data/ext/fox12/include/FXRbDrawableVirtuals.h +3 -0
  243. data/ext/fox12/include/FXRbDriveBox.h +51 -0
  244. data/ext/fox12/include/FXRbFileDialog.h +56 -0
  245. data/ext/fox12/include/FXRbFileDict.h +104 -0
  246. data/ext/fox12/include/FXRbFileDictVirtuals.h +9 -0
  247. data/ext/fox12/include/FXRbFileList.h +81 -0
  248. data/ext/fox12/include/FXRbFileSelector.h +51 -0
  249. data/ext/fox12/include/FXRbFoldingItemVirtuals.h +45 -0
  250. data/ext/fox12/include/FXRbFoldingList.h +183 -0
  251. data/ext/fox12/include/FXRbFont.h +70 -0
  252. data/ext/fox12/include/FXRbFontDialog.h +53 -0
  253. data/ext/fox12/include/FXRbFontSelector.h +51 -0
  254. data/ext/fox12/include/FXRbFrame.h +51 -0
  255. data/ext/fox12/include/FXRbGIFCursor.h +60 -0
  256. data/ext/fox12/include/FXRbGIFIcon.h +54 -0
  257. data/ext/fox12/include/FXRbGIFImage.h +54 -0
  258. data/ext/fox12/include/FXRbGLCanvas.h +92 -0
  259. data/ext/fox12/include/FXRbGLCanvasVirtuals.h +13 -0
  260. data/ext/fox12/include/FXRbGLContext.h +58 -0
  261. data/ext/fox12/include/FXRbGLObject.h +103 -0
  262. data/ext/fox12/include/FXRbGLObjectVirtuals.h +22 -0
  263. data/ext/fox12/include/FXRbGLShape.h +81 -0
  264. data/ext/fox12/include/FXRbGLShapeVirtuals.h +8 -0
  265. data/ext/fox12/include/FXRbGLViewer.h +83 -0
  266. data/ext/fox12/include/FXRbGLViewerVirtuals.h +6 -0
  267. data/ext/fox12/include/FXRbGLVisual.h +56 -0
  268. data/ext/fox12/include/FXRbGradientBar.h +55 -0
  269. data/ext/fox12/include/FXRbGroupBox.h +51 -0
  270. data/ext/fox12/include/FXRbHeader.h +125 -0
  271. data/ext/fox12/include/FXRbHeaderItemVirtuals.h +22 -0
  272. data/ext/fox12/include/FXRbHorizontalFrame.h +51 -0
  273. data/ext/fox12/include/FXRbICOIcon.h +54 -0
  274. data/ext/fox12/include/FXRbICOImage.h +54 -0
  275. data/ext/fox12/include/FXRbIcon.h +57 -0
  276. data/ext/fox12/include/FXRbIconItemVirtuals.h +71 -0
  277. data/ext/fox12/include/FXRbIconList.h +266 -0
  278. data/ext/fox12/include/FXRbIconListVirtuals.h +21 -0
  279. data/ext/fox12/include/FXRbId.h +74 -0
  280. data/ext/fox12/include/FXRbIdVirtuals.h +9 -0
  281. data/ext/fox12/include/FXRbImage.h +162 -0
  282. data/ext/fox12/include/FXRbImageFrame.h +56 -0
  283. data/ext/fox12/include/FXRbImageView.h +52 -0
  284. data/ext/fox12/include/FXRbImageVirtuals.h +51 -0
  285. data/ext/fox12/include/FXRbInputDialog.h +53 -0
  286. data/ext/fox12/include/FXRbJPGIcon.h +54 -0
  287. data/ext/fox12/include/FXRbJPGImage.h +54 -0
  288. data/ext/fox12/include/FXRbLabel.h +51 -0
  289. data/ext/fox12/include/FXRbList.h +204 -0
  290. data/ext/fox12/include/FXRbListBox.h +56 -0
  291. data/ext/fox12/include/FXRbListItemVirtuals.h +36 -0
  292. data/ext/fox12/include/FXRbListVirtuals.h +18 -0
  293. data/ext/fox12/include/FXRbMDIButton.h +162 -0
  294. data/ext/fox12/include/FXRbMDIChild.h +82 -0
  295. data/ext/fox12/include/FXRbMDIChildVirtuals.h +12 -0
  296. data/ext/fox12/include/FXRbMDIClient.h +80 -0
  297. data/ext/fox12/include/FXRbMDIClientVirtuals.h +12 -0
  298. data/ext/fox12/include/FXRbMainWindow.h +54 -0
  299. data/ext/fox12/include/FXRbMatrix.h +51 -0
  300. data/ext/fox12/include/FXRbMenuBar.h +63 -0
  301. data/ext/fox12/include/FXRbMenuButton.h +51 -0
  302. data/ext/fox12/include/FXRbMenuCaption.h +51 -0
  303. data/ext/fox12/include/FXRbMenuCascade.h +51 -0
  304. data/ext/fox12/include/FXRbMenuCheck.h +49 -0
  305. data/ext/fox12/include/FXRbMenuCommand.h +49 -0
  306. data/ext/fox12/include/FXRbMenuPane.h +52 -0
  307. data/ext/fox12/include/FXRbMenuRadio.h +49 -0
  308. data/ext/fox12/include/FXRbMenuSeparator.h +51 -0
  309. data/ext/fox12/include/FXRbMenuTitle.h +51 -0
  310. data/ext/fox12/include/FXRbMessageBox.h +56 -0
  311. data/ext/fox12/include/FXRbObject.h +67 -0
  312. data/ext/fox12/include/FXRbObjectVirtuals.h +9 -0
  313. data/ext/fox12/include/FXRbOptionMenu.h +73 -0
  314. data/ext/fox12/include/FXRbPCXIcon.h +54 -0
  315. data/ext/fox12/include/FXRbPCXImage.h +54 -0
  316. data/ext/fox12/include/FXRbPNGIcon.h +54 -0
  317. data/ext/fox12/include/FXRbPNGImage.h +54 -0
  318. data/ext/fox12/include/FXRbPPMIcon.h +54 -0
  319. data/ext/fox12/include/FXRbPPMImage.h +54 -0
  320. data/ext/fox12/include/FXRbPacker.h +51 -0
  321. data/ext/fox12/include/FXRbPicker.h +51 -0
  322. data/ext/fox12/include/FXRbPopup.h +70 -0
  323. data/ext/fox12/include/FXRbPopupVirtuals.h +6 -0
  324. data/ext/fox12/include/FXRbPrintDialog.h +53 -0
  325. data/ext/fox12/include/FXRbProgressBar.h +51 -0
  326. data/ext/fox12/include/FXRbProgressDialog.h +53 -0
  327. data/ext/fox12/include/FXRbRGBIcon.h +54 -0
  328. data/ext/fox12/include/FXRbRGBImage.h +54 -0
  329. data/ext/fox12/include/FXRbRadioButton.h +51 -0
  330. data/ext/fox12/include/FXRbRealSlider.h +51 -0
  331. data/ext/fox12/include/FXRbRealSpinner.h +64 -0
  332. data/ext/fox12/include/FXRbRealSpinnerVirtuals.h +3 -0
  333. data/ext/fox12/include/FXRbRecentFiles.h +49 -0
  334. data/ext/fox12/include/FXRbRegistry.h +46 -0
  335. data/ext/fox12/include/FXRbReplaceDialog.h +53 -0
  336. data/ext/fox12/include/FXRbRootWindow.h +51 -0
  337. data/ext/fox12/include/FXRbRuler.h +56 -0
  338. data/ext/fox12/include/FXRbScintilla.h +52 -0
  339. data/ext/fox12/include/FXRbScrollArea.h +82 -0
  340. data/ext/fox12/include/FXRbScrollAreaVirtuals.h +13 -0
  341. data/ext/fox12/include/FXRbScrollBar.h +73 -0
  342. data/ext/fox12/include/FXRbScrollPane.h +52 -0
  343. data/ext/fox12/include/FXRbScrollWindow.h +52 -0
  344. data/ext/fox12/include/FXRbSearchDialog.h +53 -0
  345. data/ext/fox12/include/FXRbSeparator.h +95 -0
  346. data/ext/fox12/include/FXRbSettings.h +46 -0
  347. data/ext/fox12/include/FXRbShell.h +56 -0
  348. data/ext/fox12/include/FXRbShutter.h +86 -0
  349. data/ext/fox12/include/FXRbShutterVirtuals.h +3 -0
  350. data/ext/fox12/include/FXRbSlider.h +51 -0
  351. data/ext/fox12/include/FXRbSpinner.h +64 -0
  352. data/ext/fox12/include/FXRbSpinnerVirtuals.h +3 -0
  353. data/ext/fox12/include/FXRbSplitter.h +54 -0
  354. data/ext/fox12/include/FXRbSpring.h +51 -0
  355. data/ext/fox12/include/FXRbStatusBar.h +51 -0
  356. data/ext/fox12/include/FXRbStatusLine.h +51 -0
  357. data/ext/fox12/include/FXRbStream.h +101 -0
  358. data/ext/fox12/include/FXRbStreamVirtuals.h +9 -0
  359. data/ext/fox12/include/FXRbStringDict.h +46 -0
  360. data/ext/fox12/include/FXRbSwitcher.h +51 -0
  361. data/ext/fox12/include/FXRbTGAIcon.h +54 -0
  362. data/ext/fox12/include/FXRbTGAImage.h +54 -0
  363. data/ext/fox12/include/FXRbTIFIcon.h +54 -0
  364. data/ext/fox12/include/FXRbTIFImage.h +54 -0
  365. data/ext/fox12/include/FXRbTabBar.h +64 -0
  366. data/ext/fox12/include/FXRbTabBarVirtuals.h +3 -0
  367. data/ext/fox12/include/FXRbTabBook.h +52 -0
  368. data/ext/fox12/include/FXRbTabItem.h +51 -0
  369. data/ext/fox12/include/FXRbTable.h +416 -0
  370. data/ext/fox12/include/FXRbTableItemVirtuals.h +68 -0
  371. data/ext/fox12/include/FXRbTableVirtuals.h +73 -0
  372. data/ext/fox12/include/FXRbText.h +89 -0
  373. data/ext/fox12/include/FXRbTextField.h +51 -0
  374. data/ext/fox12/include/FXRbTextVirtuals.h +9 -0
  375. data/ext/fox12/include/FXRbToggleButton.h +51 -0
  376. data/ext/fox12/include/FXRbToolBar.h +80 -0
  377. data/ext/fox12/include/FXRbToolBarGrip.h +51 -0
  378. data/ext/fox12/include/FXRbToolBarShell.h +52 -0
  379. data/ext/fox12/include/FXRbToolBarTab.h +51 -0
  380. data/ext/fox12/include/FXRbToolBarVirtuals.h +6 -0
  381. data/ext/fox12/include/FXRbToolTip.h +51 -0
  382. data/ext/fox12/include/FXRbTopWindow.h +91 -0
  383. data/ext/fox12/include/FXRbTopWindowVirtuals.h +15 -0
  384. data/ext/fox12/include/FXRbTreeItemVirtuals.h +42 -0
  385. data/ext/fox12/include/FXRbTreeList.h +249 -0
  386. data/ext/fox12/include/FXRbTreeListBox.h +53 -0
  387. data/ext/fox12/include/FXRbTreeListVirtuals.h +30 -0
  388. data/ext/fox12/include/FXRbTriStateButton.h +51 -0
  389. data/ext/fox12/include/FXRbVerticalFrame.h +51 -0
  390. data/ext/fox12/include/FXRbVisual.h +56 -0
  391. data/ext/fox12/include/FXRbWindow.h +200 -0
  392. data/ext/fox12/include/FXRbWindowVirtuals.h +69 -0
  393. data/ext/fox12/include/FXRbWizard.h +60 -0
  394. data/ext/fox12/include/FXRbXBMIcon.h +54 -0
  395. data/ext/fox12/include/FXRbXBMImage.h +54 -0
  396. data/ext/fox12/include/FXRbXPMIcon.h +54 -0
  397. data/ext/fox12/include/FXRbXPMImage.h +54 -0
  398. data/ext/fox12/include/FXRuby.h +728 -0
  399. data/ext/fox12/include/impl.h +201 -0
  400. data/ext/fox12/include/inlinestubs.h +1063 -0
  401. data/ext/fox12/label_wrap.cpp +4945 -0
  402. data/ext/fox12/layout_wrap.cpp +5061 -0
  403. data/ext/fox12/librb.c +636 -0
  404. data/ext/fox12/list_wrap.cpp +2212 -0
  405. data/ext/fox12/markfuncs.cpp +1568 -0
  406. data/ext/fox12/mdi_wrap.cpp +4521 -0
  407. data/ext/fox12/menu_wrap.cpp +4673 -0
  408. data/ext/fox12/scintilla_wrap.cpp +2245 -0
  409. data/ext/fox12/table_wrap.cpp +3581 -0
  410. data/ext/fox12/text_wrap.cpp +3539 -0
  411. data/ext/fox12/treelist_wrap.cpp +5609 -0
  412. data/ext/fox12/ui_wrap.cpp +10017 -0
  413. data/index.html +14 -0
  414. data/lib/fox12/aliases.rb +5211 -0
  415. data/lib/fox12/calendar.rb +218 -0
  416. data/lib/fox12/chore.rb +51 -0
  417. data/lib/fox12/colors.rb +282 -0
  418. data/lib/fox12/core.rb +249 -0
  419. data/lib/fox12/dict.rb +35 -0
  420. data/lib/fox12/glgroup.rb +165 -0
  421. data/lib/fox12/glshapes.rb +457 -0
  422. data/lib/fox12/input.rb +56 -0
  423. data/lib/fox12/irb.rb +179 -0
  424. data/lib/fox12/iterators.rb +331 -0
  425. data/lib/fox12/keys.rb +1376 -0
  426. data/lib/fox12/missingdep.rb +16 -0
  427. data/lib/fox12/pseudokeyboard.rb +36 -0
  428. data/lib/fox12/pseudomouse.rb +84 -0
  429. data/lib/fox12/responder.rb +72 -0
  430. data/lib/fox12/responder2.rb +122 -0
  431. data/lib/fox12/scintilla.rb +2629 -0
  432. data/lib/fox12/settings.rb +18 -0
  433. data/lib/fox12/signal.rb +68 -0
  434. data/lib/fox12/timeout.rb +58 -0
  435. data/lib/fox12/undolist.rb +456 -0
  436. data/lib/fox12/version.rb +11 -0
  437. data/rdoc-sources/FX4Splitter.rb +138 -0
  438. data/rdoc-sources/FXAccelTable.rb +67 -0
  439. data/rdoc-sources/FXApp.rb +557 -0
  440. data/rdoc-sources/FXArrowButton.rb +69 -0
  441. data/rdoc-sources/FXBMPIcon.rb +45 -0
  442. data/rdoc-sources/FXBMPImage.rb +20 -0
  443. data/rdoc-sources/FXBitmap.rb +78 -0
  444. data/rdoc-sources/FXBitmapFrame.rb +29 -0
  445. data/rdoc-sources/FXBitmapView.rb +41 -0
  446. data/rdoc-sources/FXButton.rb +43 -0
  447. data/rdoc-sources/FXCURCursor.rb +13 -0
  448. data/rdoc-sources/FXCanvas.rb +18 -0
  449. data/rdoc-sources/FXCheckButton.rb +57 -0
  450. data/rdoc-sources/FXColorBar.rb +43 -0
  451. data/rdoc-sources/FXColorDialog.rb +36 -0
  452. data/rdoc-sources/FXColorSelector.rb +65 -0
  453. data/rdoc-sources/FXColorWell.rb +57 -0
  454. data/rdoc-sources/FXColorWheel.rb +35 -0
  455. data/rdoc-sources/FXComboBox.rb +153 -0
  456. data/rdoc-sources/FXComposite.rb +34 -0
  457. data/rdoc-sources/FXCursor.rb +67 -0
  458. data/rdoc-sources/FXDC.rb +667 -0
  459. data/rdoc-sources/FXDCPrint.rb +127 -0
  460. data/rdoc-sources/FXDCWindow.rb +37 -0
  461. data/rdoc-sources/FXDataTarget.rb +41 -0
  462. data/rdoc-sources/FXDebugTarget.rb +25 -0
  463. data/rdoc-sources/FXDelegator.rb +23 -0
  464. data/rdoc-sources/FXDial.rb +68 -0
  465. data/rdoc-sources/FXDialogBox.rb +36 -0
  466. data/rdoc-sources/FXDict.rb +79 -0
  467. data/rdoc-sources/FXDirBox.rb +49 -0
  468. data/rdoc-sources/FXDirDialog.rb +18 -0
  469. data/rdoc-sources/FXDirList.rb +143 -0
  470. data/rdoc-sources/FXDirSelector.rb +30 -0
  471. data/rdoc-sources/FXDocument.rb +29 -0
  472. data/rdoc-sources/FXDragCorner.rb +19 -0
  473. data/rdoc-sources/FXDrawable.rb +27 -0
  474. data/rdoc-sources/FXDriveBox.rb +46 -0
  475. data/rdoc-sources/FXFileDialog.rb +132 -0
  476. data/rdoc-sources/FXFileDict.rb +168 -0
  477. data/rdoc-sources/FXFileList.rb +163 -0
  478. data/rdoc-sources/FXFileSelector.rb +148 -0
  479. data/rdoc-sources/FXFileStream.rb +24 -0
  480. data/rdoc-sources/FXFoldingList.rb +453 -0
  481. data/rdoc-sources/FXFont.rb +345 -0
  482. data/rdoc-sources/FXFontDialog.rb +14 -0
  483. data/rdoc-sources/FXFontSelector.rb +37 -0
  484. data/rdoc-sources/FXFrame.rb +47 -0
  485. data/rdoc-sources/FXGIFCursor.rb +38 -0
  486. data/rdoc-sources/FXGIFIcon.rb +21 -0
  487. data/rdoc-sources/FXGIFImage.rb +19 -0
  488. data/rdoc-sources/FXGLCanvas.rb +45 -0
  489. data/rdoc-sources/FXGLContext.rb +41 -0
  490. data/rdoc-sources/FXGLObject.rb +75 -0
  491. data/rdoc-sources/FXGLShape.rb +75 -0
  492. data/rdoc-sources/FXGLViewer.rb +309 -0
  493. data/rdoc-sources/FXGLVisual.rb +94 -0
  494. data/rdoc-sources/FXGradientBar.rb +291 -0
  495. data/rdoc-sources/FXGroupBox.rb +33 -0
  496. data/rdoc-sources/FXHeader.rb +377 -0
  497. data/rdoc-sources/FXHorizontalFrame.rb +29 -0
  498. data/rdoc-sources/FXICOIcon.rb +50 -0
  499. data/rdoc-sources/FXICOImage.rb +21 -0
  500. data/rdoc-sources/FXIcon.rb +38 -0
  501. data/rdoc-sources/FXIconList.rb +418 -0
  502. data/rdoc-sources/FXId.rb +34 -0
  503. data/rdoc-sources/FXImage.rb +198 -0
  504. data/rdoc-sources/FXImageFrame.rb +22 -0
  505. data/rdoc-sources/FXImageView.rb +35 -0
  506. data/rdoc-sources/FXInputDialog.rb +62 -0
  507. data/rdoc-sources/FXJPGIcon.rb +52 -0
  508. data/rdoc-sources/FXJPGImage.rb +25 -0
  509. data/rdoc-sources/FXLabel.rb +66 -0
  510. data/rdoc-sources/FXList.rb +412 -0
  511. data/rdoc-sources/FXListBox.rb +158 -0
  512. data/rdoc-sources/FXMDIButton.rb +67 -0
  513. data/rdoc-sources/FXMDIChild.rb +145 -0
  514. data/rdoc-sources/FXMDIClient.rb +67 -0
  515. data/rdoc-sources/FXMainWindow.rb +20 -0
  516. data/rdoc-sources/FXMat4.rb +171 -0
  517. data/rdoc-sources/FXMatrix.rb +57 -0
  518. data/rdoc-sources/FXMemoryBuffer.rb +19 -0
  519. data/rdoc-sources/FXMemoryStream.rb +45 -0
  520. data/rdoc-sources/FXMenuBar.rb +23 -0
  521. data/rdoc-sources/FXMenuButton.rb +84 -0
  522. data/rdoc-sources/FXMenuCaption.rb +47 -0
  523. data/rdoc-sources/FXMenuCascade.rb +18 -0
  524. data/rdoc-sources/FXMenuCheck.rb +30 -0
  525. data/rdoc-sources/FXMenuCommand.rb +27 -0
  526. data/rdoc-sources/FXMenuPane.rb +13 -0
  527. data/rdoc-sources/FXMenuRadio.rb +30 -0
  528. data/rdoc-sources/FXMenuSeparator.rb +21 -0
  529. data/rdoc-sources/FXMenuTitle.rb +27 -0
  530. data/rdoc-sources/FXMessageBox.rb +77 -0
  531. data/rdoc-sources/FXObject.rb +22 -0
  532. data/rdoc-sources/FXOptionMenu.rb +76 -0
  533. data/rdoc-sources/FXPCXIcon.rb +48 -0
  534. data/rdoc-sources/FXPCXImage.rb +21 -0
  535. data/rdoc-sources/FXPNGIcon.rb +48 -0
  536. data/rdoc-sources/FXPNGImage.rb +21 -0
  537. data/rdoc-sources/FXPPMIcon.rb +21 -0
  538. data/rdoc-sources/FXPPMImage.rb +21 -0
  539. data/rdoc-sources/FXPacker.rb +62 -0
  540. data/rdoc-sources/FXPicker.rb +27 -0
  541. data/rdoc-sources/FXPopup.rb +53 -0
  542. data/rdoc-sources/FXPrintDialog.rb +36 -0
  543. data/rdoc-sources/FXProgressBar.rb +57 -0
  544. data/rdoc-sources/FXProgressDialog.rb +36 -0
  545. data/rdoc-sources/FXQuatd.rb +1 -0
  546. data/rdoc-sources/FXQuatf.rb +1 -0
  547. data/rdoc-sources/FXRGBIcon.rb +49 -0
  548. data/rdoc-sources/FXRGBImage.rb +21 -0
  549. data/rdoc-sources/FXRadioButton.rb +64 -0
  550. data/rdoc-sources/FXRanged.rb +97 -0
  551. data/rdoc-sources/FXRangef.rb +97 -0
  552. data/rdoc-sources/FXRealSlider.rb +99 -0
  553. data/rdoc-sources/FXRealSpinner.rb +133 -0
  554. data/rdoc-sources/FXRecentFiles.rb +73 -0
  555. data/rdoc-sources/FXRectangle.rb +137 -0
  556. data/rdoc-sources/FXRegion.rb +64 -0
  557. data/rdoc-sources/FXRegistry.rb +39 -0
  558. data/rdoc-sources/FXReplaceDialog.rb +56 -0
  559. data/rdoc-sources/FXRootWindow.rb +17 -0
  560. data/rdoc-sources/FXRuler.rb +60 -0
  561. data/rdoc-sources/FXScintilla.rb +121 -0
  562. data/rdoc-sources/FXScrollArea.rb +86 -0
  563. data/rdoc-sources/FXScrollBar.rb +101 -0
  564. data/rdoc-sources/FXScrollPane.rb +23 -0
  565. data/rdoc-sources/FXScrollWindow.rb +38 -0
  566. data/rdoc-sources/FXSearchDialog.rb +24 -0
  567. data/rdoc-sources/FXSeparator.rb +64 -0
  568. data/rdoc-sources/FXSettings.rb +222 -0
  569. data/rdoc-sources/FXShell.rb +7 -0
  570. data/rdoc-sources/FXShutter.rb +97 -0
  571. data/rdoc-sources/FXSize.rb +30 -0
  572. data/rdoc-sources/FXSlider.rb +96 -0
  573. data/rdoc-sources/FXSphered.rb +65 -0
  574. data/rdoc-sources/FXSpheref.rb +65 -0
  575. data/rdoc-sources/FXSpinner.rb +132 -0
  576. data/rdoc-sources/FXSplitter.rb +88 -0
  577. data/rdoc-sources/FXSpring.rb +61 -0
  578. data/rdoc-sources/FXStatusBar.rb +42 -0
  579. data/rdoc-sources/FXStatusLine.rb +60 -0
  580. data/rdoc-sources/FXStream.rb +115 -0
  581. data/rdoc-sources/FXStringDict.rb +38 -0
  582. data/rdoc-sources/FXSwitcher.rb +78 -0
  583. data/rdoc-sources/FXTGAIcon.rb +48 -0
  584. data/rdoc-sources/FXTGAImage.rb +21 -0
  585. data/rdoc-sources/FXTIFIcon.rb +52 -0
  586. data/rdoc-sources/FXTIFImage.rb +24 -0
  587. data/rdoc-sources/FXTabBar.rb +76 -0
  588. data/rdoc-sources/FXTabBook.rb +38 -0
  589. data/rdoc-sources/FXTabItem.rb +51 -0
  590. data/rdoc-sources/FXTable.rb +654 -0
  591. data/rdoc-sources/FXText.rb +533 -0
  592. data/rdoc-sources/FXTextField.rb +141 -0
  593. data/rdoc-sources/FXToggleButton.rb +69 -0
  594. data/rdoc-sources/FXToolBar.rb +121 -0
  595. data/rdoc-sources/FXToolBarGrip.rb +55 -0
  596. data/rdoc-sources/FXToolBarShell.rb +44 -0
  597. data/rdoc-sources/FXToolTip.rb +36 -0
  598. data/rdoc-sources/FXTopWindow.rb +92 -0
  599. data/rdoc-sources/FXTreeList.rb +503 -0
  600. data/rdoc-sources/FXTreeListBox.rb +182 -0
  601. data/rdoc-sources/FXTriStateButton.rb +49 -0
  602. data/rdoc-sources/FXVec.rb +97 -0
  603. data/rdoc-sources/FXVec4.rb +91 -0
  604. data/rdoc-sources/FXVerticalFrame.rb +29 -0
  605. data/rdoc-sources/FXVisual.rb +79 -0
  606. data/rdoc-sources/FXWindow.rb +633 -0
  607. data/rdoc-sources/FXWizard.rb +63 -0
  608. data/rdoc-sources/FXXBMIcon.rb +22 -0
  609. data/rdoc-sources/FXXBMImage.rb +22 -0
  610. data/rdoc-sources/FXXPMIcon.rb +50 -0
  611. data/rdoc-sources/FXXPMImage.rb +21 -0
  612. data/rdoc-sources/README.rdoc +53 -0
  613. data/rdoc-sources/fxdefs.rb +90 -0
  614. data/tests/README +19 -0
  615. data/tests/TC_FXAccelTable.rb +43 -0
  616. data/tests/TC_FXApp.rb +15 -0
  617. data/tests/TC_FXArc.rb +26 -0
  618. data/tests/TC_FXButton.rb +72 -0
  619. data/tests/TC_FXCheckButton.rb +57 -0
  620. data/tests/TC_FXComboBox.rb +36 -0
  621. data/tests/TC_FXDC.rb +372 -0
  622. data/tests/TC_FXDCPrint.rb +102 -0
  623. data/tests/TC_FXDCWindow.rb +23 -0
  624. data/tests/TC_FXDataTarget.rb +24 -0
  625. data/tests/TC_FXDirList.rb +30 -0
  626. data/tests/TC_FXFileAssoc.rb +62 -0
  627. data/tests/TC_FXFileStream.rb +90 -0
  628. data/tests/TC_FXFont.rb +59 -0
  629. data/tests/TC_FXFontDesc.rb +62 -0
  630. data/tests/TC_FXGLGroup.rb +32 -0
  631. data/tests/TC_FXGLShape.rb +28 -0
  632. data/tests/TC_FXGLViewer.rb +18 -0
  633. data/tests/TC_FXGradientBar.rb +89 -0
  634. data/tests/TC_FXHeader.rb +82 -0
  635. data/tests/TC_FXIconDict.rb +52 -0
  636. data/tests/TC_FXIconList.rb +192 -0
  637. data/tests/TC_FXId.rb +19 -0
  638. data/tests/TC_FXImage.rb +144 -0
  639. data/tests/TC_FXLight.rb +33 -0
  640. data/tests/TC_FXList.rb +116 -0
  641. data/tests/TC_FXListBox.rb +49 -0
  642. data/tests/TC_FXMat4f.rb +228 -0
  643. data/tests/TC_FXMaterial.rb +75 -0
  644. data/tests/TC_FXMemoryStream.rb +87 -0
  645. data/tests/TC_FXMenuCommand.rb +26 -0
  646. data/tests/TC_FXPoint.rb +57 -0
  647. data/tests/TC_FXQuatf.rb +77 -0
  648. data/tests/TC_FXRadioButton.rb +57 -0
  649. data/tests/TC_FXRangef.rb +48 -0
  650. data/tests/TC_FXRectangle.rb +88 -0
  651. data/tests/TC_FXRegion.rb +54 -0
  652. data/tests/TC_FXRegistry.rb +27 -0
  653. data/tests/TC_FXScrollArea.rb +28 -0
  654. data/tests/TC_FXScrollWindow.rb +28 -0
  655. data/tests/TC_FXSegment.rb +22 -0
  656. data/tests/TC_FXShell.rb +26 -0
  657. data/tests/TC_FXSize.rb +54 -0
  658. data/tests/TC_FXStream.rb +11 -0
  659. data/tests/TC_FXTable.rb +468 -0
  660. data/tests/TC_FXTableItem.rb +48 -0
  661. data/tests/TC_FXText.rb +81 -0
  662. data/tests/TC_FXTopWindow.rb +32 -0
  663. data/tests/TC_FXTreeList.rb +83 -0
  664. data/tests/TC_FXTreeListBox.rb +23 -0
  665. data/tests/TC_FXUndoList.rb +43 -0
  666. data/tests/TC_FXVec2d.rb +142 -0
  667. data/tests/TC_FXVec2f.rb +137 -0
  668. data/tests/TC_FXVec3d.rb +150 -0
  669. data/tests/TC_FXVec3f.rb +150 -0
  670. data/tests/TC_FXVec4f.rb +158 -0
  671. data/tests/TC_FXViewport.rb +30 -0
  672. data/tests/TC_Misc.rb +157 -0
  673. data/tests/TC_downcast.rb +15 -0
  674. data/tests/TS_All.rb +25 -0
  675. data/tests/blankpage.ps +166 -0
  676. data/tests/doit.rb +5 -0
  677. data/tests/howdypage.ps +181 -0
  678. data/tests/stress1.rb +94 -0
  679. data/tests/stress2.rb +51 -0
  680. data/tests/stress3.rb +117 -0
  681. data/tests/testcase.rb +38 -0
  682. data/web/art/fxrubylogo.png +0 -0
  683. data/web/art/fxrubylogo_small.png +0 -0
  684. data/web/art/line.gif +0 -0
  685. data/web/art/oul_grey.gif +0 -0
  686. data/web/art/our.gif +0 -0
  687. data/web/downloads.html +91 -0
  688. data/web/home.html +109 -0
  689. data/web/menu.html +50 -0
  690. data/web/styles.css +167 -0
  691. data/web/top.html +15 -0
  692. metadata +737 -0
@@ -0,0 +1,127 @@
1
+ /***********************************************************************
2
+ * FXRuby -- the Ruby language bindings for the FOX GUI toolkit.
3
+ * Copyright (c) 2001-2003 by J. Lyle Johnson. All Rights Reserved.
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
+ *
19
+ * For further information please contact the author by e-mail
20
+ * at "lyle@users.sourceforge.net".
21
+ ***********************************************************************/
22
+
23
+ /***********************************************************************
24
+ * $Id: FXRbApp.cpp,v 1.1 2004/08/07 10:55:26 lyle Exp $
25
+ ***********************************************************************/
26
+
27
+ #include "FXRbCommon.h"
28
+
29
+ extern "C" {
30
+ #include "rubysig.h" /* For CHECK_INTS */
31
+ }
32
+
33
+ #ifdef HAVE_SYS_TIME_H
34
+ #include <sys/time.h> /* For struct timeval */
35
+ #endif
36
+
37
+ // Message map
38
+ FXDEFMAP(FXRbApp) FXRbAppMap[]={
39
+ FXMAPFUNC(SEL_CHORE,FXRbApp::ID_CHORE_THREADS,FXRbApp::onChoreThreads),
40
+ };
41
+
42
+ // Class implementation
43
+ FXRbIMPLEMENT(FXRbApp,FXApp,FXRbAppMap,ARRAYNUMBER(FXRbAppMap))
44
+
45
+ // Constructor
46
+ FXRbApp::FXRbApp(const FXchar* appname,const FXchar* vendor) : FXApp(appname,vendor),m_bThreadsEnabled(TRUE),sleepTime(100),threadsChore(0){
47
+ if(m_bThreadsEnabled){
48
+ FXASSERT(threadsChore==0);
49
+ threadsChore=addChore(this,ID_CHORE_THREADS);
50
+ }
51
+ }
52
+
53
+
54
+ // Constructor that also calls FXApp::init()
55
+ FXRbApp* FXRbApp::constructAndInit(const FXchar* appname,const FXchar* vendor){
56
+ int argc=1;
57
+ static char* argv[]={0,0};
58
+ FXRbApp* app=new FXRbApp(appname,vendor);
59
+ app->FXApp::init(argc,argv);
60
+ return app;
61
+ }
62
+
63
+
64
+ // Enable (or disable) threads
65
+ void FXRbApp::setThreadsEnabled(FXbool enabled){
66
+ if(enabled){
67
+ if(!m_bThreadsEnabled){
68
+ m_bThreadsEnabled=TRUE;
69
+ threadsChore=addChore(this,ID_CHORE_THREADS);
70
+ FXASSERT(threadsChore!=0);
71
+ }
72
+ }
73
+ else{
74
+ m_bThreadsEnabled=FALSE;
75
+ if(threadsChore!=0){
76
+ removeChore(threadsChore);
77
+ threadsChore=0;
78
+ }
79
+ }
80
+ }
81
+
82
+
83
+ // Set sleep time
84
+ void FXRbApp::setSleepTime(FXuint ms){
85
+ sleepTime=ms;
86
+ }
87
+
88
+
89
+ // Get sleep time
90
+ FXuint FXRbApp::getSleepTime() const {
91
+ return sleepTime;
92
+ }
93
+
94
+
95
+ // Process threads
96
+ long FXRbApp::onChoreThreads(FXObject*,FXSelector,void*){
97
+ // Pause for 'sleepTime' millseconds
98
+ struct timeval wait;
99
+ wait.tv_sec=0;
100
+ wait.tv_usec=100*sleepTime;
101
+
102
+ // Confirm that this thread can be interrupted, then go to sleep
103
+ CHECK_INTS;
104
+ if(!rb_thread_critical)
105
+ rb_thread_wait_for(wait);
106
+
107
+ // Re-register this chore for next time
108
+ threadsChore=addChore(this,ID_CHORE_THREADS);
109
+ FXASSERT(threadsChore!=0);
110
+
111
+ // Back to work...
112
+ return 1;
113
+ }
114
+
115
+
116
+ // Destructor
117
+ FXRbApp::~FXRbApp(){
118
+ FXTRACE((100,"FXRbApp::~FXRbApp()\n"));
119
+ VALUE myRegistry;
120
+ FXRbDestroyAppSensitiveObjects();
121
+ myRegistry=FXRbGetRubyObj(&(reg()),true);
122
+ if(!NIL_P(myRegistry)){
123
+ DATA_PTR(myRegistry)=0;
124
+ }
125
+ FXRbUnregisterRubyObj(this);
126
+ }
127
+
@@ -0,0 +1,106 @@
1
+ /***********************************************************************
2
+ * FXRuby -- the Ruby language bindings for the FOX GUI toolkit.
3
+ * Copyright (c) 2001-2003 by J. Lyle Johnson. All Rights Reserved.
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
+ *
19
+ * For further information please contact the author by e-mail
20
+ * at "lyle@users.sourceforge.net".
21
+ ***********************************************************************/
22
+
23
+ /***********************************************************************
24
+ * $Id: FXRbDataTarget.cpp,v 1.1 2004/08/07 10:55:26 lyle Exp $
25
+ ***********************************************************************/
26
+
27
+ #include "FXRbCommon.h"
28
+
29
+ /**
30
+ * Data targets for FXRuby are implemented slightly different from
31
+ * those in the C++ implementation since we don't have the concept
32
+ * of C++ references for immutable types (like integers, floats and
33
+ * strings).
34
+ */
35
+
36
+ // Initialize a data target with this value
37
+ FXRbDataTarget::FXRbDataTarget(VALUE value,FXObject* tgt,FXSelector sel) : FXDataTarget(tgt,sel), intValue(0), doubleValue(0.0), boolValue(FALSE) {
38
+ setValue(value);
39
+ }
40
+
41
+ // Set new value for data target
42
+ void FXRbDataTarget::setValue(VALUE value){
43
+ switch (TYPE(value)) {
44
+ case T_NIL:
45
+ connect();
46
+ break;
47
+ case T_FIXNUM:
48
+ intValue=NUM2LONG(value);
49
+ connect(intValue);
50
+ break;
51
+ case T_BIGNUM: /* still not sure about this conversion */
52
+ intValue=NUM2ULONG(value);
53
+ connect(intValue);
54
+ break;
55
+ case T_FLOAT:
56
+ doubleValue=NUM2DBL(value);
57
+ connect(doubleValue);
58
+ break;
59
+ case T_STRING:
60
+ stringValue=STR2CSTR(value);
61
+ connect(stringValue);
62
+ break;
63
+ case T_TRUE:
64
+ boolValue=TRUE;
65
+ connect(boolValue);
66
+ break;
67
+ case T_FALSE:
68
+ boolValue=FALSE;
69
+ connect(boolValue);
70
+ break;
71
+ default:
72
+ rb_raise(rb_eTypeError,
73
+ "can't initialize FXDataTarget with type %s.",
74
+ rb_class2name(CLASS_OF(value)));
75
+ }
76
+ }
77
+
78
+ // Return current value for this data target
79
+ VALUE FXRbDataTarget::getValue() const {
80
+ switch(type){
81
+ case DT_VOID:
82
+ return Qnil;
83
+ case DT_CHAR:
84
+ return to_ruby(*reinterpret_cast<FXchar*>(data));
85
+ case DT_UCHAR:
86
+ return to_ruby(*reinterpret_cast<FXuchar*>(data));
87
+ case DT_SHORT:
88
+ return to_ruby(*reinterpret_cast<FXshort*>(data));
89
+ case DT_USHORT:
90
+ return to_ruby(*reinterpret_cast<FXushort*>(data));
91
+ case DT_INT:
92
+ return to_ruby(*reinterpret_cast<FXint*>(data));
93
+ case DT_UINT:
94
+ return to_ruby(*reinterpret_cast<FXuint*>(data));
95
+ case DT_FLOAT:
96
+ return to_ruby(*reinterpret_cast<FXfloat*>(data));
97
+ case DT_DOUBLE:
98
+ return to_ruby(*reinterpret_cast<FXdouble*>(data));
99
+ case DT_STRING:
100
+ return to_ruby(*reinterpret_cast<FXString*>(data));
101
+ default:
102
+ fxerror("unknown data type in FXRbDataTarget::getValue()");
103
+ }
104
+ return Qnil;
105
+ }
106
+
@@ -0,0 +1,89 @@
1
+ /***********************************************************************
2
+ * FXRuby -- the Ruby language bindings for the FOX GUI toolkit.
3
+ * Copyright (c) 2001-2003 by J. Lyle Johnson. All Rights Reserved.
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
+ *
19
+ * For further information please contact the author by e-mail
20
+ * at "lyle@users.sourceforge.net".
21
+ ***********************************************************************/
22
+
23
+ /***********************************************************************
24
+ * $Id: FXRbGLViewer.cpp,v 1.1 2004/08/07 10:55:26 lyle Exp $
25
+ ***********************************************************************/
26
+
27
+ #include "FXRbCommon.h"
28
+
29
+ // Process picks
30
+ FXGLObject* FXRbGLViewer::processHits(FXuint *pickbuffer,FXint nhits){
31
+ FXuint d1,d2,i,n,zmin,zmax,sel=0,nnames=0;
32
+ if(0<=nhits){
33
+ for(i=0,zmin=zmax=4294967295U; nhits>0; i+=n+3,nhits--){
34
+ n=pickbuffer[i];
35
+ d1=pickbuffer[1+i];
36
+ d2=pickbuffer[2+i];
37
+ if(d1<zmin || (d1==zmin && d2<=zmax)){
38
+ zmin=d1;
39
+ zmax=d2;
40
+ sel=i;
41
+ nnames=n;
42
+ }
43
+ }
44
+ FXASSERT(scene->isMemberOf(FXMETACLASS(FXRbGLObject)) || scene->isMemberOf(FXMETACLASS(FXRbGLShape)));
45
+ if(scene->isMemberOf(FXMETACLASS(FXRbGLObject))){
46
+ FXRbGLObject* obj=dynamic_cast<FXRbGLObject*>(scene);
47
+ FXASSERT(obj!=0);
48
+ return obj->identify(&pickbuffer[4+sel],nnames-1);
49
+ }
50
+ else{
51
+ FXRbGLShape* shape=dynamic_cast<FXRbGLShape*>(scene);
52
+ FXASSERT(shape!=0);
53
+ return shape->identify(&pickbuffer[4+sel],nnames-1);
54
+ }
55
+ }
56
+ return NULL;
57
+ }
58
+
59
+
60
+ // Build NULL-terminated list of ALL picked objects overlapping rectangle
61
+ FXGLObject** FXRbGLViewer::_select(FXint x,FXint y,FXint w,FXint h){
62
+ FXGLObject *obj,**objects=NULL;
63
+ FXint nhits,i,j;
64
+ FXuint *hits;
65
+ FXint nnames;
66
+ if(scene && maxhits){
67
+ if(selectHits(hits,nhits,x,y,w,h)){ // FIXME leak
68
+ FXMALLOC(&objects,FXGLObject*,nhits+1);
69
+ FXASSERT(scene->isMemberOf(FXMETACLASS(FXRbGLObject)) || scene->isMemberOf(FXMETACLASS(FXRbGLShape)));
70
+ if(scene->isMemberOf(FXMETACLASS(FXRbGLObject))){
71
+ for(i=j=0; nhits>0; i+=hits[i]+3,nhits--){
72
+ nnames=hits[i];
73
+ obj=dynamic_cast<FXRbGLObject*>(scene)->identify(&hits[4+i],nnames-1);
74
+ if(obj!=NULL) objects[j++]=obj;
75
+ }
76
+ }
77
+ else{
78
+ for(i=j=0; nhits>0; i+=hits[i]+3,nhits--){
79
+ nnames=hits[i];
80
+ obj=dynamic_cast<FXRbGLShape*>(scene)->identify(&hits[4+i],nnames-1);
81
+ if(obj!=NULL) objects[j++]=obj;
82
+ }
83
+ }
84
+ objects[j]=NULL;
85
+ FXFREE(&hits);
86
+ }
87
+ }
88
+ return objects;
89
+ }
@@ -0,0 +1,1818 @@
1
+ /***********************************************************************
2
+ * FXRuby -- the Ruby language bindings for the FOX GUI toolkit.
3
+ * Copyright (c) 2001-2003 by J. Lyle Johnson. All Rights Reserved.
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
+ *
19
+ * For further information please contact the author by e-mail
20
+ * at "lyle@users.sourceforge.net".
21
+ ***********************************************************************/
22
+
23
+ /***********************************************************************
24
+ * $Id: FXRuby.cpp,v 1.2 2004/08/07 12:02:03 lyle Exp $
25
+ ***********************************************************************/
26
+
27
+ #ifdef _MSC_VER
28
+ #pragma warning (disable : 4786)
29
+ #endif
30
+
31
+ #include "FXRbCommon.h"
32
+
33
+ #include "version.h"
34
+
35
+ #if RUBY_VERSION_CODE < 167
36
+ #define RB_RESCUE2_BROKEN_PROTOTYPE 1
37
+ #endif
38
+
39
+ #include "impl.h"
40
+
41
+ #ifdef __CYGWIN__
42
+ #include <io.h> // for get_osf_handle()
43
+ #endif
44
+
45
+ #ifdef HAVE_SIGNAL_H
46
+ #include <signal.h> // for definitions of SIGINT, etc.
47
+ #endif
48
+
49
+ extern "C" {
50
+ #include "rubyio.h" // for GetOpenFile(), etc.
51
+ }
52
+
53
+ // Symbol table functions from Ruby. If we included "st.h" directly
54
+ // we'd be dealing with broken prototypes anyways, so just duplicate
55
+ // the needed declarations here with the correct prototypes.
56
+ extern "C" {
57
+ struct st_table;
58
+
59
+ st_table *st_init_strtable();
60
+ st_table *st_init_numtable();
61
+ int st_lookup(st_table *table, char *key, char **value);
62
+ int st_insert(st_table *table, char *key, char *value);
63
+ int st_delete(st_table *table, char **key, char **value);
64
+ void st_foreach(st_table *table, int (*func)(char *, char *, char *), char *arg);
65
+ }
66
+
67
+ // Opaque type declaration from SWIG runtime
68
+ struct swig_type_info;
69
+
70
+ // Wrapper around SWIG_TypeQuery() that caches results for performance
71
+ swig_type_info *FXRbTypeQuery(const char *desc){
72
+ FXASSERT(desc!=0);
73
+ static st_table *types=st_init_strtable();
74
+ swig_type_info *typeinfo=0;
75
+ if(st_lookup(types,const_cast<char*>(desc),(char**)&typeinfo)==0){
76
+ typeinfo=SWIG_Ruby_TypeQuery(desc);
77
+ st_insert(types,strdup(desc),(char*)typeinfo);
78
+ }
79
+ FXASSERT(typeinfo!=0);
80
+ return typeinfo;
81
+ }
82
+
83
+
84
+ /**
85
+ * The FXRuby_Objects hash table basically maps C++ objects to Ruby instances.
86
+ * Each key in the table is a pointer to a C++ object we've seen before, and
87
+ * the corresponding value is an FXRubyObjDesc struct (see below) that tells
88
+ * us which Ruby instance corresponds to that C++ object.
89
+ */
90
+
91
+ static st_table * FXRuby_Objects;
92
+
93
+ /**
94
+ * Each value in the FXRuby_Objects hash table is an instance of this
95
+ * struct. It identifies the Ruby instance associated with a C++ object.
96
+ * It also indicates whether this is merely a "borrowed" reference to
97
+ * some C++ object (i.e. it's not one we need to destroy later).
98
+ */
99
+
100
+ struct FXRubyObjDesc {
101
+ VALUE obj;
102
+ bool borrowed;
103
+ };
104
+
105
+
106
+ /**
107
+ * FXRbNewPointerObj() is a wrapper around SWIG_Ruby_NewPointerObj() that also
108
+ * registers this C++ object & Ruby instance pair in our FXRuby_Objects
109
+ * hash table. This function should only get called for methods that return
110
+ * a reference to an already-existing C++ object (i.e. one that FOX "owns")
111
+ * and for that reason we mark these objects as "borrowed".
112
+ */
113
+
114
+ VALUE FXRbNewPointerObj(void *ptr,swig_type_info* ty){
115
+ if(ptr!=0){
116
+ FXASSERT(ty!=0);
117
+ VALUE obj;
118
+ FXRubyObjDesc *desc;
119
+ int result;
120
+ if(FXMALLOC(&desc,FXRubyObjDesc,1)){
121
+ obj=SWIG_Ruby_NewPointerObj(ptr,ty,1);
122
+ desc->obj=obj;
123
+ desc->borrowed=true;
124
+ result=st_insert(FXRuby_Objects,reinterpret_cast<char*>(ptr),reinterpret_cast<char*>(desc));
125
+ FXASSERT(result==0);
126
+ return obj;
127
+ }
128
+ else{
129
+ FXASSERT(FALSE);
130
+ return Qnil;
131
+ }
132
+ }
133
+ else{
134
+ return Qnil;
135
+ }
136
+ }
137
+
138
+
139
+ /**
140
+ * FXRbIsBorrowed() returns true if the specified C++ object is one that
141
+ * FOX owns (i.e. it's borrowed).
142
+ */
143
+
144
+ bool FXRbIsBorrowed(void* ptr){
145
+ FXASSERT(ptr!=0);
146
+ FXRubyObjDesc *desc;
147
+ if(st_lookup(FXRuby_Objects,reinterpret_cast<char*>(ptr),reinterpret_cast<char**>(&desc))!=0){
148
+ return desc->borrowed;
149
+ }
150
+ else{
151
+ return true;
152
+ }
153
+ }
154
+
155
+
156
+ /**
157
+ * FXRbConvertPtr() is just a wrapper around SWIG_Ruby_ConvertPtr().
158
+ */
159
+
160
+ void* FXRbConvertPtr(VALUE obj,swig_type_info* ty){
161
+ void *ptr;
162
+ SWIG_Ruby_ConvertPtr(obj,&ptr,ty,1);
163
+ return ptr;
164
+ }
165
+
166
+
167
+ // Should we catch exceptions thrown by message handlers?
168
+ FXbool FXRbCatchExceptions=FALSE;
169
+
170
+ // Returns an FXInputHandle for this Ruby file object
171
+ FXInputHandle FXRbGetReadFileHandle(VALUE obj) {
172
+ OpenFile *fptr;
173
+ GetOpenFile(obj, fptr);
174
+ FILE *fpr=GetReadFile(fptr);
175
+ #ifdef WIN32
176
+ #ifdef __CYGWIN__
177
+ return (FXInputHandle) get_osfhandle(fileno(fpr));
178
+ #else
179
+ return (FXInputHandle) _get_osfhandle(_fileno(fpr));
180
+ #endif
181
+ #else
182
+ return (FXInputHandle) fileno(fpr);
183
+ #endif
184
+ }
185
+
186
+
187
+ // Returns an FXInputHandle for this Ruby file object
188
+ FXInputHandle FXRbGetWriteFileHandle(VALUE obj) {
189
+ OpenFile *fptr;
190
+ GetOpenFile(obj, fptr);
191
+ FILE *fpw=GetWriteFile(fptr);
192
+ #ifdef WIN32
193
+ #ifdef __CYGWIN__
194
+ return (FXInputHandle) get_osfhandle(fileno(fpw));
195
+ #else
196
+ return (FXInputHandle) _get_osfhandle(_fileno(fpw));
197
+ #endif
198
+ #else
199
+ return (FXInputHandle) fileno(fpw);
200
+ #endif
201
+ }
202
+
203
+
204
+ // Register this Ruby class instance
205
+ void FXRbRegisterRubyObj(VALUE rubyObj,const void* foxObj) {
206
+ FXASSERT(!NIL_P(rubyObj));
207
+ FXASSERT(foxObj!=0);
208
+ FXRubyObjDesc* desc;
209
+ FXTRACE((1,"FXRbRegisterRubyObj(rubyObj=%d,foxObj=0x%08x)\n",rubyObj,foxObj));
210
+ if(FXMALLOC(&desc,FXRubyObjDesc,1)){
211
+ desc->obj=rubyObj;
212
+ desc->borrowed=false;
213
+ st_insert(FXRuby_Objects,reinterpret_cast<char*>(const_cast<void*>(foxObj)),reinterpret_cast<char*>(desc));
214
+ }
215
+ else{
216
+ FXASSERT(FALSE);
217
+ }
218
+ FXASSERT(FXRbGetRubyObj(foxObj,false)==rubyObj);
219
+ }
220
+
221
+
222
+ /**
223
+ * Remove this mapping between a Ruby instance and a C++ object
224
+ */
225
+ void FXRbUnregisterRubyObj(const void* foxObj){
226
+ if(foxObj!=0){
227
+ FXRubyObjDesc* desc;
228
+ if(st_lookup(FXRuby_Objects,reinterpret_cast<char*>(const_cast<void*>(foxObj)),reinterpret_cast<char**>(&desc))!=0){
229
+ DATA_PTR(desc->obj)=0;
230
+ FXFREE(&desc);
231
+ st_delete(FXRuby_Objects,(char**)&foxObj,reinterpret_cast<char**>(0));
232
+ FXASSERT(st_lookup(FXRuby_Objects,reinterpret_cast<char*>(const_cast<void*>(foxObj)),reinterpret_cast<char**>(0))==0);
233
+ }
234
+ }
235
+ }
236
+
237
+
238
+ VALUE to_ruby(const FXObject* obj){
239
+ if(obj!=0){
240
+ FXString className=obj->getClassName();
241
+ if(className.length()>3){
242
+ if(className.left(4)=="FXRb"){ className.replace(0,4,"FX"); }
243
+ }
244
+ FXString desc=className+" *";
245
+ return FXRbGetRubyObj(obj,desc.text());
246
+ }
247
+ return Qnil;
248
+ }
249
+
250
+
251
+ /**
252
+ * Return the registered Ruby class instance associated with this
253
+ * FOX object, or Qnil if not found.
254
+ */
255
+ VALUE FXRbGetRubyObj(const void *foxObj,bool searchBoth){
256
+ FXRubyObjDesc* desc;
257
+ if(foxObj!=0 && st_lookup(FXRuby_Objects,reinterpret_cast<char*>(const_cast<void*>(foxObj)),reinterpret_cast<char**>(&desc))!=0){
258
+ FXASSERT(desc!=0);
259
+ if(searchBoth){
260
+ return desc->obj;
261
+ }
262
+ else{
263
+ return desc->borrowed ? Qnil : desc->obj;
264
+ }
265
+ }
266
+ else{
267
+ return Qnil;
268
+ }
269
+ }
270
+
271
+ /**
272
+ * Return the registered Ruby class instance associated with this
273
+ * FOX object, or a new registered instance if not found.
274
+ */
275
+ VALUE FXRbGetRubyObj(const void *foxObj,swig_type_info* ty){
276
+ if(foxObj!=0){
277
+ VALUE rbObj=FXRbGetRubyObj(foxObj,true);
278
+ return NIL_P(rbObj) ? FXRbNewPointerObj(const_cast<void*>(foxObj),ty) : rbObj;
279
+ }
280
+ else{
281
+ return Qnil;
282
+ }
283
+ }
284
+
285
+ VALUE FXRbGetRubyObj(const void *foxObj,const char *type){
286
+ if(foxObj!=0){
287
+ FXASSERT(type!=0);
288
+ VALUE rbObj=FXRbGetRubyObj(foxObj,true);
289
+ return NIL_P(rbObj) ? FXRbNewPointerObj(const_cast<void*>(foxObj),FXRbTypeQuery(type)) : rbObj;
290
+ }
291
+ else{
292
+ return Qnil;
293
+ }
294
+ }
295
+
296
+ /**
297
+ * Look up the Ruby instance associated with this C++ object, if any, and mark
298
+ * that instance as in use.
299
+ *
300
+ * We previously only marked those Ruby instances that were "non-borrowed"
301
+ * references to C++ objects, as a way to reduce the number of Ruby instances
302
+ * on the heap.
303
+ */
304
+ void FXRbGcMark(void *obj){
305
+ if(obj){
306
+ /**
307
+ * If the 2nd argument to FXRbGetRubyObj() is false, we only mark
308
+ * non-borrowed references. This has led to problems in the past
309
+ * (see e.g. SourceForge Bug #703721). I think the correct solution
310
+ * is to mark any Ruby reference this object, "borrowed" or not;
311
+ * so the 2nd argument to FXRbGetRubyObj() is now true.
312
+ *
313
+ * If you feel compelled to change this back to FXGetRubyObj(obj,false),
314
+ * please think about it first. Especially make sure that the shutter.rb
315
+ * example program works if you invoke the GC in ShutterWindow#create;
316
+ * make sure that the shutter items' contents don't get blown away!
317
+ */
318
+ VALUE value=FXRbGetRubyObj(obj,true);
319
+ if(!NIL_P(value)){
320
+ rb_gc_mark(value);
321
+ }
322
+ }
323
+ }
324
+
325
+ //----------------------------------------------------------------------
326
+
327
+ // Returns a Ruby array of floats
328
+ VALUE FXRbMakeArray(const FXfloat* values,FXint size){
329
+ VALUE result=rb_ary_new();
330
+ for(FXint i=0; i<size; i++)
331
+ rb_ary_push(result,rb_float_new(values[i]));
332
+ return result;
333
+ }
334
+
335
+ // Returns a Ruby array of floats
336
+ VALUE FXRbMakeArray(const FXdouble* values,FXint size){
337
+ VALUE result=rb_ary_new();
338
+ for(FXint i=0; i<size; i++)
339
+ rb_ary_push(result,rb_float_new(values[i]));
340
+ return result;
341
+ }
342
+
343
+ // Returns a Ruby array of integers
344
+ VALUE FXRbMakeArray(const FXint* values,FXint size){
345
+ VALUE result=rb_ary_new();
346
+ for(FXint i=0; i<size; i++)
347
+ rb_ary_push(result,INT2NUM(values[i]));
348
+ return result;
349
+ }
350
+
351
+ // Returns a Ruby array of integers
352
+ VALUE FXRbMakeArray(const FXuint* values,FXint size){
353
+ VALUE result=rb_ary_new();
354
+ for(FXint i=0; i<size; i++)
355
+ rb_ary_push(result,UINT2NUM(values[i]));
356
+ return result;
357
+ }
358
+
359
+ // Returns a Ruby array of integers
360
+ VALUE FXRbMakeArray(const FXchar* dashpattern,FXuint dashlength){
361
+ VALUE result=rb_ary_new();
362
+ for(FXuint i=0; i<dashlength; i++)
363
+ rb_ary_push(result,INT2NUM(dashpattern[i]));
364
+ return result;
365
+ }
366
+
367
+ // Returns a Ruby array of FXArcs
368
+ VALUE FXRbMakeArray(const FXArc* arcs,FXuint narcs){
369
+ VALUE result=rb_ary_new();
370
+ for(FXuint i=0; i<narcs; i++)
371
+ rb_ary_push(result,FXRbGetRubyObj(&arcs[i],"FXArc *"));
372
+ return result;
373
+ }
374
+
375
+ // Returns a Ruby array of FXPoints
376
+ VALUE FXRbMakeArray(const FXPoint* points,FXuint npoints){
377
+ VALUE result=rb_ary_new();
378
+ for(FXuint i=0; i<npoints; i++)
379
+ rb_ary_push(result,FXRbGetRubyObj(&points[i],"FXPoint *"));
380
+ return result;
381
+ }
382
+
383
+ // Returns a Ruby array of FXRectangles
384
+ VALUE FXRbMakeArray(const FXRectangle* rectangles,FXuint nrectangles){
385
+ VALUE result=rb_ary_new();
386
+ for(FXuint i=0; i<nrectangles; i++)
387
+ rb_ary_push(result,FXRbGetRubyObj(&rectangles[i],"FXRectangle *"));
388
+ return result;
389
+ }
390
+
391
+ // Returns a Ruby array of FXSegments
392
+ VALUE FXRbMakeArray(const FXSegment* segments,FXuint nsegments){
393
+ VALUE result=rb_ary_new();
394
+ for(FXuint i=0; i<nsegments; i++)
395
+ rb_ary_push(result,FXRbGetRubyObj(&segments[i],"FXSegment *"));
396
+ return result;
397
+ }
398
+
399
+ // Returns a Ruby array of FXColor values
400
+ VALUE FXRbMakeColorArray(const FXColor* colors,FXint w,FXint h){
401
+ VALUE result=rb_ary_new();
402
+ FXint size=w*h;
403
+ for(FXuint i=0; i<size; i++)
404
+ rb_ary_push(result,to_ruby(colors[i]));
405
+ return result;
406
+ }
407
+
408
+ //----------------------------------------------------------------------
409
+
410
+ /**
411
+ * Based on the sender object's class and the selector, convert the message
412
+ * data stored in the void pointer (ptr) to a suitable Ruby object.
413
+ */
414
+ static VALUE FXRbConvertMessageData(FXObject* sender,FXObject* recv,FXSelector sel,void* ptr){
415
+ FXTRACE((1,"FXRbConvertMessageData(%s(%p),FXSEL(%s,%d),%p)\n",sender->getClassName(),sender,FXDebugTarget::messageTypeName[FXSELTYPE(sel)],FXSELID(sel),ptr));
416
+ FXInputHandle fff;
417
+ FXushort type=FXSELTYPE(sel);
418
+ FXushort id=FXSELID(sel);
419
+
420
+ FXASSERT(type!=SEL_NONE);
421
+ FXASSERT(type!=SEL_LAST);
422
+
423
+ if(type==SEL_KEYPRESS ||
424
+ type==SEL_KEYRELEASE ||
425
+ type==SEL_LEFTBUTTONPRESS ||
426
+ type==SEL_LEFTBUTTONRELEASE ||
427
+ type==SEL_MIDDLEBUTTONPRESS ||
428
+ type==SEL_MIDDLEBUTTONRELEASE ||
429
+ type==SEL_RIGHTBUTTONPRESS ||
430
+ type==SEL_RIGHTBUTTONRELEASE ||
431
+ type==SEL_MOTION ||
432
+ type==SEL_ENTER ||
433
+ type==SEL_LEAVE ||
434
+ type==SEL_FOCUSIN ||
435
+ type==SEL_FOCUSOUT ||
436
+ type==SEL_KEYMAP ||
437
+ type==SEL_UNGRABBED ||
438
+ type==SEL_PAINT ||
439
+ type==SEL_CREATE ||
440
+ type==SEL_DESTROY ||
441
+ type==SEL_UNMAP ||
442
+ type==SEL_MAP ||
443
+ type==SEL_CONFIGURE ||
444
+ type==SEL_SELECTION_LOST ||
445
+ type==SEL_SELECTION_GAINED ||
446
+ type==SEL_SELECTION_REQUEST ||
447
+ type==SEL_RAISED ||
448
+ type==SEL_LOWERED ||
449
+ type==SEL_MOUSEWHEEL ||
450
+ type==SEL_BEGINDRAG ||
451
+ type==SEL_ENDDRAG ||
452
+ type==SEL_TIMEOUT ||
453
+ type==SEL_CLIPBOARD_LOST ||
454
+ type==SEL_CLIPBOARD_GAINED ||
455
+ type==SEL_CLIPBOARD_REQUEST ||
456
+ type==SEL_CHORE ||
457
+ type==SEL_FOCUS_SELF ||
458
+ type==SEL_FOCUS_RIGHT ||
459
+ type==SEL_FOCUS_LEFT ||
460
+ type==SEL_FOCUS_DOWN ||
461
+ type==SEL_FOCUS_UP ||
462
+ type==SEL_FOCUS_NEXT ||
463
+ type==SEL_FOCUS_PREV ||
464
+ type==SEL_DND_ENTER ||
465
+ type==SEL_DND_LEAVE ||
466
+ type==SEL_DND_DROP ||
467
+ type==SEL_DND_MOTION ||
468
+ type==SEL_DND_REQUEST ||
469
+ type==SEL_PICKED) {
470
+ return to_ruby(reinterpret_cast<FXEvent*>(ptr));
471
+ }
472
+ else if(type==SEL_DRAGGED && !sender->isMemberOf(FXMETACLASS(FXGLViewer))){
473
+ return to_ruby(reinterpret_cast<FXEvent*>(ptr));
474
+ }
475
+ else if(type==SEL_SIGNAL){
476
+ return to_ruby(static_cast<int>(reinterpret_cast<long>(ptr)));
477
+ }
478
+ else if(type==SEL_IO_READ ||
479
+ type==SEL_IO_WRITE ||
480
+ type==SEL_IO_EXCEPT){
481
+ #ifdef WIN32
482
+ fff=reinterpret_cast<FXInputHandle>(ptr);
483
+ #else
484
+ fff=static_cast<FXInputHandle>(reinterpret_cast<long>(ptr));
485
+ #endif
486
+ return Qnil;
487
+ }
488
+ else if(type==SEL_CLOSE ||
489
+ type==SEL_DELETE ||
490
+ type==SEL_MINIMIZE ||
491
+ type==SEL_RESTORE ||
492
+ type==SEL_MAXIMIZE ||
493
+ type==SEL_UPDATE){
494
+ FXASSERT(ptr==0);
495
+ return Qnil;
496
+ }
497
+ else if(sender->isMemberOf(FXMETACLASS(FXArrowButton))){
498
+ if(type==SEL_CLICKED||type==SEL_COMMAND) return to_ruby(static_cast<FXuint>(reinterpret_cast<FXuval>(ptr)));
499
+ }
500
+ else if(sender->isMemberOf(FXMETACLASS(FXButton))){
501
+ if(type==SEL_CLICKED ||
502
+ type==SEL_DOUBLECLICKED ||
503
+ type==SEL_TRIPLECLICKED ||
504
+ type==SEL_COMMAND) return to_ruby(static_cast<FXuint>(reinterpret_cast<FXuval>(ptr)));
505
+ }
506
+ else if(sender->isMemberOf(FXMETACLASS(FXCheckButton))){
507
+ if(type==SEL_COMMAND) return to_ruby(static_cast<FXuchar>(reinterpret_cast<FXuval>(ptr)));
508
+ }
509
+ else if(sender->isMemberOf(FXMETACLASS(FXColorSelector))){
510
+ if(type==SEL_CHANGED || type==SEL_COMMAND) return to_ruby(static_cast<FXColor>(reinterpret_cast<unsigned long>(ptr)));
511
+ }
512
+ else if(sender->isMemberOf(FXMETACLASS(FXColorWell))){
513
+ if(type==SEL_CHANGED ||
514
+ type==SEL_COMMAND ||
515
+ type==SEL_CLICKED ||
516
+ type==SEL_DOUBLECLICKED ||
517
+ type==SEL_TRIPLECLICKED) return to_ruby(static_cast<FXColor>(reinterpret_cast<unsigned long>(ptr)));
518
+ }
519
+ else if(sender->isMemberOf(FXMETACLASS(FXComboBox))){
520
+ if(type==SEL_CHANGED || type==SEL_COMMAND) return to_ruby(reinterpret_cast<FXchar*>(ptr));
521
+ }
522
+ else if(sender->isMemberOf(FXMETACLASS(FXDataTarget))){
523
+ if(type==SEL_COMMAND || type==SEL_CHANGED){
524
+ if(recv->isMemberOf(FXMETACLASS(FXWindow))){
525
+ switch(id){
526
+ case FXWindow::ID_SETINTVALUE:
527
+ return to_ruby(*reinterpret_cast<FXint*>(ptr));
528
+ case FXWindow::ID_SETREALVALUE:
529
+ return to_ruby(*reinterpret_cast<FXdouble*>(ptr));
530
+ case FXWindow::ID_SETSTRINGVALUE:
531
+ return to_ruby(*reinterpret_cast<FXString*>(ptr));
532
+ case FXWindow::ID_GETINTVALUE:
533
+ case FXWindow::ID_GETREALVALUE:
534
+ case FXWindow::ID_GETSTRINGVALUE:
535
+ FXASSERT(FALSE);
536
+ break;
537
+ default:
538
+ FXASSERT(FALSE);
539
+ }
540
+ }
541
+ else{
542
+ // It's not a window object...
543
+ FXASSERT(sender->isMemberOf(FXMETACLASS(FXRbDataTarget)));
544
+ return dynamic_cast<FXRbDataTarget*>(sender)->getValue();
545
+ }
546
+ }
547
+ }
548
+ else if(sender->isMemberOf(FXMETACLASS(FXDial))){
549
+ if(type==SEL_CHANGED || type==SEL_COMMAND) return to_ruby(static_cast<FXint>(reinterpret_cast<FXival>(ptr)));
550
+ }
551
+ else if(sender->isMemberOf(FXMETACLASS(FXDirBox))){
552
+ if(type==SEL_CHANGED || type==SEL_COMMAND) return to_ruby(reinterpret_cast<FXchar*>(ptr));
553
+ }
554
+ else if(sender->isMemberOf(FXMETACLASS(FXFileList))){
555
+ if (type==SEL_CHANGED ||
556
+ type==SEL_CLICKED ||
557
+ type==SEL_DOUBLECLICKED ||
558
+ type==SEL_TRIPLECLICKED ||
559
+ type==SEL_COMMAND) return to_ruby(static_cast<FXint>(reinterpret_cast<FXival>(ptr)));
560
+ }
561
+ else if(sender->isMemberOf(FXMETACLASS(FXFoldingList))){
562
+ if(type==SEL_COLLAPSED ||
563
+ type==SEL_EXPANDED ||
564
+ type==SEL_COMMAND ||
565
+ type==SEL_CHANGED ||
566
+ type==SEL_CLICKED ||
567
+ type==SEL_DOUBLECLICKED ||
568
+ type==SEL_TRIPLECLICKED ||
569
+ type==SEL_OPENED ||
570
+ type==SEL_CLOSED ||
571
+ type==SEL_SELECTED ||
572
+ type==SEL_DESELECTED ||
573
+ type==SEL_INSERTED ||
574
+ type==SEL_DELETED){
575
+ return FXRbGetRubyObj(ptr,FXRbTypeQuery("FXFoldingItem *"));
576
+ }
577
+ }
578
+ else if(sender->isMemberOf(FXMETACLASS(FXGLViewer))){
579
+ if(type==SEL_CHANGED ||
580
+ type==SEL_CLICKED ||
581
+ type==SEL_DOUBLECLICKED ||
582
+ type==SEL_TRIPLECLICKED ||
583
+ type==SEL_DRAGGED){
584
+ return FXRbGetRubyObj(ptr,FXRbTypeQuery("FXGLObject *"));
585
+ }
586
+ else if(type==SEL_COMMAND){
587
+ if(id==FXWindow::ID_QUERY_MENU)
588
+ return to_ruby(reinterpret_cast<FXEvent*>(ptr));
589
+ else
590
+ return FXRbGetRubyObj(ptr,FXRbTypeQuery("FXGLObject *"));
591
+ }
592
+ else if(type==SEL_LASSOED ||
593
+ type==SEL_INSERTED ||
594
+ type==SEL_DELETED ||
595
+ type==SEL_SELECTED ||
596
+ type==SEL_DESELECTED){
597
+ FXASSERT(FALSE); // FIXME
598
+ }
599
+ }
600
+ else if(sender->isMemberOf(FXMETACLASS(FXHeader))){
601
+ if(type==SEL_COMMAND ||
602
+ type==SEL_CHANGED ||
603
+ type==SEL_REPLACED ||
604
+ type==SEL_INSERTED ||
605
+ type==SEL_DELETED) return to_ruby(static_cast<FXint>(reinterpret_cast<FXival>(ptr)));
606
+ }
607
+ else if(sender->isMemberOf(FXMETACLASS(FXIconList))){
608
+ if(type==SEL_CHANGED ||
609
+ type==SEL_CLICKED ||
610
+ type==SEL_DOUBLECLICKED ||
611
+ type==SEL_TRIPLECLICKED ||
612
+ type==SEL_COMMAND ||
613
+ type==SEL_SELECTED ||
614
+ type==SEL_DESELECTED ||
615
+ type==SEL_REPLACED ||
616
+ type==SEL_INSERTED ||
617
+ type==SEL_DELETED) return to_ruby(static_cast<FXint>(reinterpret_cast<FXival>(ptr)));
618
+ }
619
+ else if(sender->isMemberOf(FXMETACLASS(FXList))){
620
+ if(type==SEL_CHANGED ||
621
+ type==SEL_CLICKED ||
622
+ type==SEL_DOUBLECLICKED ||
623
+ type==SEL_TRIPLECLICKED ||
624
+ type==SEL_SELECTED ||
625
+ type==SEL_DESELECTED ||
626
+ type==SEL_REPLACED ||
627
+ type==SEL_INSERTED ||
628
+ type==SEL_DELETED ||
629
+ type==SEL_COMMAND) return to_ruby(static_cast<FXint>(reinterpret_cast<FXival>(ptr)));
630
+ }
631
+ else if(sender->isMemberOf(FXMETACLASS(FXMDIChild))){
632
+ if(type==SEL_SELECTED || type==SEL_DESELECTED) return FXRbGetRubyObj(ptr,FXRbTypeQuery("FXMDIChild *"));
633
+ }
634
+ else if(sender->isMemberOf(FXMETACLASS(FXMDIClient))){
635
+ if(type==SEL_CHANGED) return FXRbGetRubyObj(ptr,FXRbTypeQuery("FXMDIChild *"));
636
+ }
637
+ else if(sender->isMemberOf(FXMETACLASS(FXMenuCheck))){
638
+ if(type==SEL_COMMAND) return to_ruby(reinterpret_cast<FXuval>(ptr));
639
+ }
640
+ else if(sender->isMemberOf(FXMETACLASS(FXMenuRadio))){
641
+ if(type==SEL_COMMAND) return to_ruby(reinterpret_cast<FXuval>(ptr));
642
+ }
643
+ else if(sender->isMemberOf(FXMETACLASS(FXMenuCommand))){
644
+ if(type==SEL_COMMAND) return to_ruby(true);
645
+ }
646
+ else if(sender->isMemberOf(FXMETACLASS(FXOption))){
647
+ if(type==SEL_COMMAND) return to_ruby(reinterpret_cast<FXEvent*>(ptr));
648
+ }
649
+ else if(sender->isMemberOf(FXMETACLASS(FXRadioButton))){
650
+ if(type==SEL_COMMAND) return to_ruby(static_cast<FXuchar>(reinterpret_cast<FXuval>(ptr)));
651
+ }
652
+ else if(sender->isMemberOf(FXMETACLASS(FXRecentFiles))){
653
+ if(type==SEL_COMMAND) return to_ruby(reinterpret_cast<FXchar*>(ptr));
654
+ }
655
+ else if(sender->isMemberOf(FXMETACLASS(FXScrollBar))){
656
+ if(type==SEL_CHANGED || type==SEL_COMMAND) return to_ruby(static_cast<FXint>(reinterpret_cast<FXival>(ptr)));
657
+ }
658
+ else if(sender->isMemberOf(FXMETACLASS(FXShutter))){
659
+ if(type==SEL_COMMAND) return to_ruby(static_cast<FXint>(reinterpret_cast<FXival>(ptr)));
660
+ }
661
+ else if(sender->isMemberOf(FXMETACLASS(FXSlider))){
662
+ if(type==SEL_CHANGED || type==SEL_COMMAND)
663
+ return to_ruby(static_cast<FXint>(reinterpret_cast<FXival>(ptr)));
664
+ }
665
+ else if(sender->isMemberOf(FXMETACLASS(FXSpinner))){
666
+ if(type==SEL_CHANGED || type==SEL_COMMAND)
667
+ return to_ruby(static_cast<FXint>(reinterpret_cast<long>(ptr)));
668
+ }
669
+ else if(sender->isMemberOf(FXMETACLASS(FXTabBar))){
670
+ if(type==SEL_COMMAND) return to_ruby(static_cast<FXint>(reinterpret_cast<FXival>(ptr)));
671
+ }
672
+ else if(sender->isMemberOf(FXMETACLASS(FXTabBook))){
673
+ if(type==SEL_COMMAND) return to_ruby(static_cast<FXint>(reinterpret_cast<FXival>(ptr)));
674
+ }
675
+ else if(sender->isMemberOf(FXMETACLASS(FXTable))){
676
+ if(type==SEL_CLICKED ||
677
+ type==SEL_DOUBLECLICKED ||
678
+ type==SEL_TRIPLECLICKED ||
679
+ type==SEL_CHANGED ||
680
+ type==SEL_COMMAND) return to_ruby(reinterpret_cast<FXTablePos*>(ptr));
681
+ else if(type==SEL_SELECTED ||
682
+ type == SEL_DESELECTED ||
683
+ type == SEL_INSERTED ||
684
+ type == SEL_DELETED){
685
+ return to_ruby(reinterpret_cast<FXTableRange*>(ptr));
686
+ }
687
+ }
688
+ else if(sender->isMemberOf(FXMETACLASS(FXText))){
689
+ if (type == SEL_COMMAND) {
690
+ switch(id){
691
+ case FXText::ID_COPY_SEL:
692
+ case FXText::ID_PASTE_SEL:
693
+ case FXText::ID_DELETE_SEL:
694
+ return Qnil;
695
+ break;
696
+ default:
697
+ FXASSERT(FALSE);
698
+ return reinterpret_cast<VALUE>(ptr); // pass-through as is
699
+ }
700
+ }
701
+ else if(type==SEL_CHANGED){
702
+ return to_ruby(static_cast<FXint>(reinterpret_cast<FXival>(ptr)));
703
+ }
704
+ else if(type==SEL_SELECTED ||
705
+ type == SEL_DESELECTED ||
706
+ type == SEL_INSERTED ||
707
+ type == SEL_DELETED) {
708
+ FXint* what=reinterpret_cast<FXint*>(ptr);
709
+ FXASSERT(what!=0);
710
+ VALUE ary=rb_ary_new();
711
+ rb_ary_push(ary,to_ruby(what[0])); // start position of text
712
+ rb_ary_push(ary,to_ruby(what[1])); // length of text
713
+ return ary;
714
+ }
715
+ else if(type==SEL_REPLACED) {
716
+ FXint* what=reinterpret_cast<FXint*>(ptr);
717
+ FXASSERT(what!=0);
718
+ VALUE ary=rb_ary_new();
719
+ rb_ary_push(ary,to_ruby(what[0])); // start position for replace
720
+ rb_ary_push(ary,to_ruby(what[1])); // length of old text
721
+ rb_ary_push(ary,to_ruby(what[2])); // length of new text
722
+ return ary;
723
+ }
724
+ }
725
+ else if(sender->isMemberOf(FXMETACLASS(FXTextField))){
726
+ if(type==SEL_CHANGED ||
727
+ type==SEL_COMMAND ||
728
+ type==SEL_VERIFY) return to_ruby(reinterpret_cast<FXchar*>(ptr));
729
+ }
730
+ else if(sender->isMemberOf(FXMETACLASS(FXToggleButton))){
731
+ if(type==SEL_COMMAND) return to_ruby(static_cast<FXuchar>(reinterpret_cast<FXuval>(ptr)));
732
+ }
733
+ else if(sender->isMemberOf(FXMETACLASS(FXToolBarTab))){
734
+ if (type==SEL_CLICKED ||
735
+ type==SEL_DOUBLECLICKED ||
736
+ type==SEL_TRIPLECLICKED ||
737
+ type==SEL_COMMAND) return to_ruby(static_cast<FXbool>(reinterpret_cast<FXuval>(ptr)));
738
+ }
739
+ else if(sender->isMemberOf(FXMETACLASS(FXTreeList))){
740
+ if(type==SEL_COLLAPSED ||
741
+ type==SEL_EXPANDED ||
742
+ type==SEL_COMMAND ||
743
+ type==SEL_CHANGED ||
744
+ type==SEL_CLICKED ||
745
+ type==SEL_DOUBLECLICKED ||
746
+ type==SEL_TRIPLECLICKED ||
747
+ type==SEL_OPENED ||
748
+ type==SEL_CLOSED ||
749
+ type==SEL_SELECTED ||
750
+ type==SEL_DESELECTED ||
751
+ type==SEL_INSERTED ||
752
+ type==SEL_DELETED){
753
+ return FXRbGetRubyObj(ptr,FXRbTypeQuery("FXTreeItem *"));
754
+ }
755
+ }
756
+ else if(sender->isMemberOf(FXMETACLASS(FXTreeListBox))){
757
+ if(type==SEL_CHANGED || type==SEL_COMMAND)
758
+ return FXRbGetRubyObj(ptr,FXRbTypeQuery("FXTreeItem *"));
759
+ }
760
+ #ifdef WITH_FXSCINTILLA
761
+ else if(sender->isMemberOf(FXMETACLASS(FXScintilla))){
762
+ if(type==SEL_COMMAND){
763
+ return FXRbGetRubyObj(ptr,FXRbTypeQuery("SCNotification *"));
764
+ }
765
+ }
766
+ #endif
767
+ else{
768
+ FXTRACE((100,"%s:%d: message data passed through as-is\n",__FILE__,__LINE__));
769
+ return reinterpret_cast<VALUE>(ptr); // pass-through as is
770
+ }
771
+ FXASSERT(FALSE);
772
+ return reinterpret_cast<VALUE>(ptr); // pass-through as is
773
+ }
774
+
775
+
776
+ /**
777
+ * When a Ruby instance (e.g. one of your widgets) calls handle() on another
778
+ * object, e.g.
779
+ *
780
+ * def onUpdAnswer(sender, sel, ptr)
781
+ * if theAnswerIsTwo?
782
+ * sender.handle(self, FXSEL(SEL_COMMAND,FXWindow::ID_SETVALUE), 2)
783
+ * else
784
+ * sender.handle(self, FXSEL(SEL_COMMAND,FXWindow::ID_SETVALUE), 3)
785
+ * end
786
+ * return 1
787
+ * end
788
+ *
789
+ * it's usually the case that this will get passed along to the underlying
790
+ * C++ object. In that case, we need to convert the message data (e.g. the
791
+ * Fixnums "2" or "3" in the example above) from Ruby objects back into
792
+ * the appropriate C++ objects. That's what this function is for.
793
+ */
794
+ void* FXRbGetExpectedData(VALUE recv,FXSelector key,VALUE value){
795
+ FXEvent* ev;
796
+ void *ptr;
797
+ static FXint intValue;
798
+ static FXint intRange[2];
799
+ static FXdouble realValue;
800
+ static FXdouble realRange[2];
801
+ static FXString stringValue;
802
+ static FXColor colorValue;
803
+ FXushort type=FXSELTYPE(key);
804
+ FXushort id=FXSELID(key);
805
+
806
+ // Extract the FOX object (the receiver) from this Ruby instance
807
+ FXObject* obj;
808
+ Data_Get_Struct(recv,FXObject,obj);
809
+
810
+ FXASSERT(type!=SEL_NONE);
811
+ FXASSERT(type!=SEL_LAST);
812
+ switch(type){
813
+ case SEL_KEYPRESS:
814
+ case SEL_KEYRELEASE:
815
+ case SEL_LEFTBUTTONPRESS:
816
+ case SEL_LEFTBUTTONRELEASE:
817
+ case SEL_MIDDLEBUTTONPRESS:
818
+ case SEL_MIDDLEBUTTONRELEASE:
819
+ case SEL_RIGHTBUTTONPRESS:
820
+ case SEL_RIGHTBUTTONRELEASE:
821
+ case SEL_MOTION:
822
+ case SEL_ENTER:
823
+ case SEL_LEAVE:
824
+ case SEL_FOCUSIN:
825
+ case SEL_FOCUSOUT:
826
+ case SEL_KEYMAP:
827
+ case SEL_UNGRABBED:
828
+ case SEL_PAINT:
829
+ case SEL_CREATE:
830
+ case SEL_DESTROY:
831
+ case SEL_UNMAP:
832
+ case SEL_MAP:
833
+ case SEL_CONFIGURE:
834
+ case SEL_SELECTION_LOST:
835
+ case SEL_SELECTION_GAINED:
836
+ case SEL_SELECTION_REQUEST:
837
+ case SEL_RAISED:
838
+ case SEL_LOWERED:
839
+ case SEL_MOUSEWHEEL:
840
+ case SEL_BEGINDRAG:
841
+ case SEL_ENDDRAG:
842
+ case SEL_LASSOED:
843
+ case SEL_TIMEOUT:
844
+ case SEL_CLIPBOARD_LOST:
845
+ case SEL_CLIPBOARD_GAINED:
846
+ case SEL_CLIPBOARD_REQUEST:
847
+ case SEL_CHORE:
848
+ case SEL_FOCUS_SELF:
849
+ case SEL_FOCUS_RIGHT:
850
+ case SEL_FOCUS_LEFT:
851
+ case SEL_FOCUS_DOWN:
852
+ case SEL_FOCUS_UP:
853
+ case SEL_FOCUS_NEXT:
854
+ case SEL_FOCUS_PREV:
855
+ case SEL_DND_ENTER:
856
+ case SEL_DND_LEAVE:
857
+ case SEL_DND_DROP:
858
+ case SEL_DND_MOTION:
859
+ case SEL_DND_REQUEST:
860
+ case SEL_PICKED:
861
+ SWIG_Ruby_ConvertPtr(value,&ptr,FXRbTypeQuery("FXEvent *"),1);
862
+ return ptr;
863
+ case SEL_IO_READ:
864
+ case SEL_IO_WRITE:
865
+ case SEL_IO_EXCEPT:
866
+ return 0; // should be an FXInputHandle?
867
+ case SEL_SIGNAL:
868
+ return reinterpret_cast<void*>(static_cast<long>(NUM2INT(value)));
869
+ case SEL_CLOSE:
870
+ case SEL_DELETE:
871
+ case SEL_MINIMIZE:
872
+ case SEL_RESTORE:
873
+ case SEL_MAXIMIZE:
874
+ case SEL_UPDATE:
875
+ return NULL;
876
+ case SEL_VERIFY:
877
+ return reinterpret_cast<void*>(STR2CSTR(value));
878
+ case SEL_CLICKED:
879
+ case SEL_DOUBLECLICKED:
880
+ case SEL_TRIPLECLICKED:
881
+ case SEL_CHANGED:
882
+ case SEL_DESELECTED:
883
+ case SEL_SELECTED:
884
+ case SEL_INSERTED:
885
+ case SEL_REPLACED:
886
+ case SEL_DELETED:
887
+ case SEL_OPENED:
888
+ case SEL_CLOSED:
889
+ case SEL_EXPANDED:
890
+ case SEL_COLLAPSED:
891
+ return NULL;
892
+ default:
893
+ /* Ignore */
894
+ break;
895
+ }
896
+ if(type==SEL_DRAGGED){
897
+ SWIG_Ruby_ConvertPtr(value,&ptr,FXRbTypeQuery("FXEvent *"),1);
898
+ return ptr;
899
+ }
900
+ if(type==SEL_COMMAND){
901
+ // Handle FXText-specific messages
902
+ if(obj->isMemberOf(FXMETACLASS(FXText))){
903
+ switch(id){
904
+ case FXText::ID_COPY_SEL:
905
+ case FXText::ID_PASTE_SEL:
906
+ case FXText::ID_DELETE_SEL:
907
+ return NULL;
908
+ default:
909
+ break;
910
+ }
911
+ }
912
+
913
+ // Handle messages applicable to all FXWindow descendants
914
+ if(obj->isMemberOf(FXMETACLASS(FXWindow))){
915
+ switch(id){
916
+ case FXWindow::ID_HIDE:
917
+ case FXWindow::ID_SHOW:
918
+ case FXWindow::ID_TOGGLESHOWN:
919
+ case FXWindow::ID_LOWER:
920
+ case FXWindow::ID_RAISE:
921
+ case FXWindow::ID_DELETE:
922
+ case FXWindow::ID_DISABLE:
923
+ case FXWindow::ID_ENABLE:
924
+ case FXWindow::ID_UNCHECK:
925
+ case FXWindow::ID_CHECK:
926
+ case FXWindow::ID_UNKNOWN:
927
+ case FXWindow::ID_UPDATE:
928
+ case FXWindow::ID_AUTOSCROLL:
929
+ case FXWindow::ID_QUERY_TIP:
930
+ case FXWindow::ID_QUERY_HELP:
931
+ case FXWindow::ID_QUERY_MENU:
932
+ case FXWindow::ID_HOTKEY:
933
+ case FXWindow::ID_ACCEL:
934
+ case FXWindow::ID_UNPOST:
935
+ case FXWindow::ID_POST:
936
+ case FXWindow::ID_MDI_TILEHORIZONTAL:
937
+ case FXWindow::ID_MDI_TILEVERTICAL:
938
+ case FXWindow::ID_MDI_CASCADE:
939
+ case FXWindow::ID_MDI_MAXIMIZE:
940
+ case FXWindow::ID_MDI_MINIMIZE:
941
+ case FXWindow::ID_MDI_RESTORE:
942
+ case FXWindow::ID_MDI_CLOSE:
943
+ case FXWindow::ID_MDI_WINDOW:
944
+ case FXWindow::ID_MDI_MENUWINDOW:
945
+ case FXWindow::ID_MDI_MENUMINIMIZE:
946
+ case FXWindow::ID_MDI_MENURESTORE:
947
+ case FXWindow::ID_MDI_MENUCLOSE:
948
+ case FXWindow::ID_MDI_NEXT:
949
+ case FXWindow::ID_MDI_PREV:
950
+ return NULL;
951
+ case FXWindow::ID_SETVALUE:
952
+ if(obj->isMemberOf(FXMETACLASS(FXButton)) ||
953
+ obj->isMemberOf(FXMETACLASS(FXCheckButton)) ||
954
+ obj->isMemberOf(FXMETACLASS(FXDial)) ||
955
+ obj->isMemberOf(FXMETACLASS(FXRadioButton)) ||
956
+ obj->isMemberOf(FXMETACLASS(FXShutter)) ||
957
+ obj->isMemberOf(FXMETACLASS(FXSpinner)) ||
958
+ obj->isMemberOf(FXMETACLASS(FXTabBar)) ||
959
+ obj->isMemberOf(FXMETACLASS(FXToggleButton)) ||
960
+ obj->isMemberOf(FXMETACLASS(FXScrollBar)) ||
961
+ obj->isMemberOf(FXMETACLASS(FXSlider)) ||
962
+ obj->isMemberOf(FXMETACLASS(FXSwitcher))){
963
+ return reinterpret_cast<void*>(static_cast<long>(NUM2INT(value)));
964
+ }
965
+ else if(obj->isMemberOf(FXMETACLASS(FXColorSelector)) ||
966
+ obj->isMemberOf(FXMETACLASS(FXColorWell))){
967
+ return reinterpret_cast<void*>(static_cast<unsigned long>(NUM2UINT(value)));
968
+ }
969
+ else if(obj->isMemberOf(FXMETACLASS(FXProgressBar))){
970
+ return reinterpret_cast<void*>(static_cast<unsigned long>(NUM2UINT(value)));
971
+ }
972
+ else if(obj->isMemberOf(FXMETACLASS(FXComboBox)) ||
973
+ obj->isMemberOf(FXMETACLASS(FXTextField)) ||
974
+ obj->isMemberOf(FXMETACLASS(FXDirBox)) ||
975
+ obj->isMemberOf(FXMETACLASS(FXDirList)) ||
976
+ obj->isMemberOf(FXMETACLASS(FXDriveBox)) ||
977
+ obj->isMemberOf(FXMETACLASS(FXFileList))){
978
+ return reinterpret_cast<void*>(STR2CSTR(value));
979
+ }
980
+ else if(obj->isMemberOf(FXMETACLASS(FXMenuCheck))){
981
+ return reinterpret_cast<void*>(static_cast<FXuval>(RTEST(value) ? 1 : 0));
982
+ }
983
+ else if(obj->isMemberOf(FXMETACLASS(FXMenuRadio))){
984
+ return reinterpret_cast<void*>(static_cast<FXuval>(RTEST(value) ? 1 : 0));
985
+ }
986
+ else if(obj->isMemberOf(FXMETACLASS(FXMenuCommand))){
987
+ return reinterpret_cast<void*>(static_cast<FXuval>(RTEST(value) ? 1 : 0));
988
+ }
989
+ return NULL;
990
+ case FXWindow::ID_HSCROLLED:
991
+ case FXWindow::ID_VSCROLLED:
992
+ return reinterpret_cast<void*>(static_cast<unsigned long>(NUM2UINT(value)));
993
+ case FXWindow::ID_SETINTVALUE:
994
+ if(obj->isMemberOf(FXMETACLASS(FXColorWell))){
995
+ colorValue=NUM2UINT(value);
996
+ return reinterpret_cast<void*>(&colorValue);
997
+ }
998
+ else{
999
+ intValue=NUM2INT(value);
1000
+ return reinterpret_cast<void*>(&intValue);
1001
+ }
1002
+ case FXWindow::ID_SETREALVALUE:
1003
+ realValue=NUM2DBL(value);
1004
+ return reinterpret_cast<void*>(&realValue);
1005
+ case FXWindow::ID_SETSTRINGVALUE:
1006
+ stringValue=FXString(STR2CSTR(value));
1007
+ return reinterpret_cast<void*>(&stringValue);
1008
+ case FXWindow::ID_SETINTRANGE:
1009
+ intRange[0]=NUM2INT(rb_ary_entry(value,0));
1010
+ intRange[1]=NUM2INT(rb_ary_entry(value,1));
1011
+ return reinterpret_cast<void*>(intRange);
1012
+ case FXWindow::ID_SETREALRANGE:
1013
+ realRange[0]=NUM2DBL(rb_ary_entry(value,0));
1014
+ realRange[1]=NUM2DBL(rb_ary_entry(value,1));
1015
+ return reinterpret_cast<void*>(realRange);
1016
+ case FXWindow::ID_GETINTVALUE:
1017
+ case FXWindow::ID_GETREALVALUE:
1018
+ case FXWindow::ID_GETSTRINGVALUE:
1019
+ case FXWindow::ID_GETINTRANGE:
1020
+ case FXWindow::ID_GETREALRANGE:
1021
+ return NULL;
1022
+ default:
1023
+ // Pass this data along as-is
1024
+ break;
1025
+ }
1026
+ }
1027
+ }
1028
+ // Pass through as-is
1029
+ return reinterpret_cast<void*>(value);
1030
+ }
1031
+
1032
+
1033
+ static ID id_assocs;
1034
+
1035
+
1036
+ /**
1037
+ * Look up the name of the message handler function for this
1038
+ * receiver and message (type, id) combination and return it;
1039
+ * or return zero if the designated receiver doesn't handle this
1040
+ * message.
1041
+ */
1042
+ ID FXRbLookupHandler(FXObject* recv,FXSelector key){
1043
+ FXTRACE((100,"FXRbLookupHandler(recv=0x%08x(%s),FXSEL(%d,%d))\n",recv,recv->getClassName(),FXSELTYPE(key),FXSELID(key)));
1044
+ ID id=0;
1045
+ VALUE rubyObj=to_ruby(recv);
1046
+ FXASSERT((recv==0 && rubyObj==Qnil) || (recv!=0 && rubyObj!=Qnil));
1047
+ if(rb_ivar_defined(rubyObj,id_assocs)==Qtrue){
1048
+ VALUE assocs=rb_ivar_get(rubyObj,id_assocs);
1049
+ VALUE entry;
1050
+ FXSelector keylo,keyhi;
1051
+ for(long i=0;i<RARRAY(assocs)->len;i++){
1052
+ entry=rb_ary_entry(assocs,i);
1053
+ keylo=NUM2UINT(rb_ary_entry(entry,0));
1054
+ keyhi=NUM2UINT(rb_ary_entry(entry,1));
1055
+ if(keylo<=key && key<=keyhi){
1056
+ id=SYM2ID(rb_ary_entry(entry,2));
1057
+ FXASSERT(id!=0);
1058
+ break;
1059
+ }
1060
+ }
1061
+ }
1062
+ return id;
1063
+ }
1064
+
1065
+
1066
+ struct FXRbHandleArgs {
1067
+ VALUE recv;
1068
+ VALUE id;
1069
+ int nargs;
1070
+ VALUE sender;
1071
+ VALUE key;
1072
+ VALUE data;
1073
+ };
1074
+
1075
+
1076
+ static VALUE handle_body(VALUE args){
1077
+ FXRbHandleArgs* hArgs=reinterpret_cast<FXRbHandleArgs*>(args);
1078
+ FXASSERT(hArgs!=0);
1079
+ return rb_funcall(hArgs->recv,hArgs->id,hArgs->nargs,hArgs->sender,hArgs->key,hArgs->data);
1080
+ }
1081
+
1082
+
1083
+ static ID id_backtrace;
1084
+
1085
+
1086
+ static VALUE handle_rescue(VALUE args,VALUE error){
1087
+ VALUE info=rb_gv_get("$!");
1088
+ VALUE errat=rb_funcall(info,id_backtrace,0);
1089
+ VALUE mesg=RARRAY(errat)->ptr[0];
1090
+ fprintf(stderr,"%s: %s (%s)\n",
1091
+ STR2CSTR(mesg),
1092
+ STR2CSTR(rb_obj_as_string(info)),
1093
+ rb_class2name(CLASS_OF(info)));
1094
+ for(int i=1;i<RARRAY(errat)->len;i++){
1095
+ if(TYPE(RARRAY(errat)->ptr[i])==T_STRING){
1096
+ fprintf(stderr,"\tfrom %s\n",STR2CSTR(RARRAY(errat)->ptr[i]));
1097
+ }
1098
+ }
1099
+ return Qnil;
1100
+ }
1101
+
1102
+
1103
+ // Call the designated function and return its result (which should be a long).
1104
+ long FXRbHandleMessage(FXObject* recv,ID func,FXObject* sender,FXSelector key,void* ptr){
1105
+ FXRbHandleArgs hArgs;
1106
+ hArgs.recv=to_ruby(recv);
1107
+ hArgs.sender=to_ruby(sender);
1108
+ hArgs.key=to_ruby(key);
1109
+ hArgs.data=FXRbConvertMessageData(sender,recv,key,ptr);
1110
+ hArgs.id=func;
1111
+ hArgs.nargs=3;
1112
+ VALUE retval;
1113
+
1114
+ FXTRACE((100,"FXRbHandleMessage(recv=0x%08x(%s),FXSEL(%s,%d)\n",recv,recv->getClassName(),FXDebugTarget::messageTypeName[FXSELTYPE(key)],FXSELID(key)));
1115
+
1116
+ if(FXRbCatchExceptions){
1117
+ #ifdef RB_RESCUE2_BROKEN_PROTOTYPE
1118
+ retval=rb_rescue2((VALUE(*)()) handle_body, reinterpret_cast<VALUE>(&hArgs),
1119
+ (VALUE(*)()) handle_rescue, Qnil,
1120
+ rb_eStandardError, rb_eNameError, 0);
1121
+ #else
1122
+ retval=rb_rescue2((VALUE(*)(ANYARGS)) handle_body, reinterpret_cast<VALUE>(&hArgs),
1123
+ (VALUE(*)(ANYARGS)) handle_rescue, Qnil,
1124
+ rb_eStandardError, rb_eNameError, 0);
1125
+ #endif
1126
+ }
1127
+ else{
1128
+ retval=handle_body(reinterpret_cast<VALUE>(&hArgs));
1129
+ }
1130
+
1131
+ /**
1132
+ * Process the return value. For boolean return values, convert "true"
1133
+ * to 1 and "false" to zero. For numeric types, convert it to a long value
1134
+ * but trap the result to either 0 or 1 since these are usually what
1135
+ * FOX is looking for. For any other type result (including nil) return 1.
1136
+ * Thanks to Ted Meng for this suggestion.
1137
+ */
1138
+ long lresult;
1139
+ switch(TYPE(retval)){
1140
+ case T_TRUE:
1141
+ lresult=1;
1142
+ break;
1143
+ case T_FALSE:
1144
+ lresult=0;
1145
+ break;
1146
+ case T_BIGNUM:
1147
+ lresult=1;
1148
+ break;
1149
+ case T_FIXNUM:
1150
+ case T_FLOAT:
1151
+ lresult=(NUM2LONG(retval) == 0) ? 0 : 1; // trap any numeric result to either 0 or 1
1152
+ break;
1153
+ default:
1154
+ lresult=1;
1155
+ }
1156
+ return lresult;
1157
+ }
1158
+
1159
+ //----------------------------------------------------------------------
1160
+
1161
+ static ID id_begin;
1162
+ static ID id_end;
1163
+ static ID id_exclude_endp;
1164
+
1165
+ void FXRbRange2LoHi(VALUE range,FXint& lo,FXint& hi){
1166
+ if(Qtrue!=rb_obj_is_instance_of(range,rb_cRange)){
1167
+ rb_raise(rb_eTypeError,"wrong argument type %s (expected %s)",rb_class2name(CLASS_OF(range)),rb_class2name(rb_cRange));
1168
+ }
1169
+ else{
1170
+ VALUE beg=rb_funcall(range,id_begin,0,NULL);
1171
+ VALUE end=rb_funcall(range,id_end,0,NULL);
1172
+ VALUE excl=rb_funcall(range,id_exclude_endp,0,NULL);
1173
+ lo=NUM2INT(beg);
1174
+ hi=NUM2INT(end);
1175
+ if(excl==Qtrue){
1176
+ hi--;
1177
+ }
1178
+ }
1179
+ }
1180
+
1181
+ void FXRbRange2LoHi(VALUE range,FXdouble& lo,FXdouble& hi){
1182
+ if(Qtrue!=rb_obj_is_instance_of(range,rb_cRange)){
1183
+ rb_raise(rb_eTypeError,"wrong argument type %s (expected %s)",rb_class2name(CLASS_OF(range)),rb_class2name(rb_cRange));
1184
+ }
1185
+ else{
1186
+ VALUE beg=rb_funcall(range,id_begin,0,NULL);
1187
+ VALUE end=rb_funcall(range,id_end,0,NULL);
1188
+ VALUE excl=rb_funcall(range,id_exclude_endp,0,NULL);
1189
+ lo=NUM2DBL(beg);
1190
+ hi=NUM2DBL(end);
1191
+ if(excl==Qtrue){
1192
+ hi--;
1193
+ }
1194
+ }
1195
+ }
1196
+
1197
+ //----------------------------------------------------------------------
1198
+
1199
+ void FXRbCallVoidMethod(FXObject* recv, ID func) {
1200
+ VALUE obj=FXRbGetRubyObj(recv,false);
1201
+ FXASSERT(!NIL_P(obj));
1202
+ rb_funcall(obj,func,0,NULL);
1203
+ }
1204
+
1205
+ void FXRbCallVoidMethod(FXDC* recv,ID func) {
1206
+ VALUE obj=FXRbGetRubyObj(recv,false);
1207
+ FXASSERT(!NIL_P(obj));
1208
+ rb_funcall(obj,func,0,NULL);
1209
+ }
1210
+
1211
+ //----------------------------------------------------------------------
1212
+
1213
+ FXbool FXRbCallBoolMethod(const FXObject* recv,ID func){
1214
+ VALUE obj=FXRbGetRubyObj(recv,false);
1215
+ FXASSERT(!NIL_P(obj));
1216
+ VALUE v=rb_funcall(obj,func,0,NULL);
1217
+ return (v==Qtrue)?TRUE:FALSE;
1218
+ }
1219
+
1220
+ //----------------------------------------------------------------------
1221
+
1222
+ // Call function with "FXint" return value
1223
+ FXint FXRbCallIntMethod(FXObject* recv,ID func){
1224
+ VALUE obj=FXRbGetRubyObj(recv,false);
1225
+ FXASSERT(!NIL_P(obj));
1226
+ VALUE result=rb_funcall(obj,func,0,NULL);
1227
+ return static_cast<FXint>(NUM2INT(result));
1228
+ }
1229
+
1230
+ //----------------------------------------------------------------------
1231
+
1232
+ // Call function with "FXGLObject*" return value
1233
+ FXGLObject* FXRbCallGLObjectMethod(FXGLObject* recv,ID func){
1234
+ VALUE obj=FXRbGetRubyObj(recv,false);
1235
+ FXASSERT(!NIL_P(obj));
1236
+ VALUE result=rb_funcall(obj,func,0,NULL);
1237
+ return NIL_P(result) ? 0 : reinterpret_cast<FXGLObject*>(DATA_PTR(result));
1238
+ }
1239
+
1240
+ FXGLObject* FXRbCallGLObjectMethod(FXGLViewer* recv,ID func,FXint x,FXint y){
1241
+ VALUE obj=FXRbGetRubyObj(recv,false);
1242
+ FXASSERT(!NIL_P(obj));
1243
+ VALUE result=rb_funcall(obj,func,2,INT2NUM(x),INT2NUM(y));
1244
+ return NIL_P(result) ? 0 : reinterpret_cast<FXGLObject*>(DATA_PTR(result));
1245
+ }
1246
+
1247
+ FXGLObject* FXRbCallGLObjectMethod(FXGLObject* recv,ID func,FXuint* path,FXint n){
1248
+ VALUE obj=FXRbGetRubyObj(recv,false);
1249
+ FXASSERT(!NIL_P(obj));
1250
+ VALUE result=rb_funcall(obj,func,1,FXRbMakeArray(path,n));
1251
+ return NIL_P(result) ? 0 : reinterpret_cast<FXGLObject*>(DATA_PTR(result));
1252
+ }
1253
+
1254
+ //----------------------------------------------------------------------
1255
+
1256
+ // Call function with "FXGLObject**" return value
1257
+ FXGLObject** FXRbCallGLObjectArrayMethod(FXGLViewer* recv,ID func,FXint x,FXint y,FXint w,FXint h){
1258
+ FXGLObject** objects=NULL;
1259
+ VALUE obj=FXRbGetRubyObj(recv,false);
1260
+ FXASSERT(!NIL_P(obj));
1261
+ VALUE result=rb_funcall(obj,func,4,INT2NUM(x),INT2NUM(y),INT2NUM(w),INT2NUM(h));
1262
+ if(!NIL_P(result)){
1263
+ Check_Type(result,T_ARRAY);
1264
+ if(FXMALLOC(&objects,FXGLObject*,RARRAY(result)->len+1)){
1265
+ for(long i=0; i<RARRAY(result)->len; i++){
1266
+ objects[i]=reinterpret_cast<FXGLObject*>(DATA_PTR(rb_ary_entry(result,i)));
1267
+ }
1268
+ objects[RARRAY(result)->len]=0;
1269
+ }
1270
+ }
1271
+ return objects; // caller must free this
1272
+ }
1273
+
1274
+ //----------------------------------------------------------------------
1275
+
1276
+ FXTableItem* FXRbCallTableItemMethod(FXTable* recv,ID func,const FXString& text,FXIcon* icon,void* ptr){
1277
+ VALUE itemData=(ptr==0)?Qnil:reinterpret_cast<VALUE>(ptr);
1278
+ VALUE obj=FXRbGetRubyObj(recv,false);
1279
+ FXASSERT(!NIL_P(obj));
1280
+ VALUE result=rb_funcall(obj,func,3,to_ruby(text),to_ruby(icon),itemData);
1281
+ return NIL_P(result)?0:reinterpret_cast<FXTableItem*>(DATA_PTR(result));
1282
+ }
1283
+
1284
+ //----------------------------------------------------------------------
1285
+
1286
+ FXTreeItem* FXRbCallTreeItemMethod(const FXTreeList* recv,ID func,FXint x,FXint y){
1287
+ VALUE obj=FXRbGetRubyObj(recv,false);
1288
+ FXASSERT(!NIL_P(obj));
1289
+ VALUE result=rb_funcall(obj,func,2,INT2NUM(x),INT2NUM(y));
1290
+ return NIL_P(result) ? 0 : reinterpret_cast<FXTreeItem*>(DATA_PTR(result));
1291
+ }
1292
+
1293
+ //----------------------------------------------------------------------
1294
+
1295
+ FXFileAssoc* FXRbCallFileAssocMethod(const FXFileDict* recv,ID func,const char* pathname){
1296
+ VALUE obj=FXRbGetRubyObj(recv,false);
1297
+ FXASSERT(!NIL_P(obj));
1298
+ VALUE result=rb_funcall(obj,func,1,rb_str_new2(pathname));
1299
+ return NIL_P(result) ? 0 : reinterpret_cast<FXFileAssoc*>(DATA_PTR(result));
1300
+ }
1301
+
1302
+ //----------------------------------------------------------------------
1303
+
1304
+ // Call function with "FXRange" return value
1305
+ FXRangef FXRbCallRangeMethod(FXObject* recv,ID func){
1306
+ VALUE obj=FXRbGetRubyObj(recv,false);
1307
+ FXASSERT(!NIL_P(obj));
1308
+ VALUE result=rb_funcall(obj,func,0,NULL);
1309
+ return *reinterpret_cast<FXRangef*>(DATA_PTR(result));
1310
+ }
1311
+
1312
+ //----------------------------------------------------------------------
1313
+
1314
+ // Special destructors to handle order dependencies
1315
+ FXRbMenuCommand::~FXRbMenuCommand(){
1316
+ FXAccelTable *table;
1317
+ FXWindow *owner;
1318
+ if(acckey){
1319
+ owner=getShell()->getOwner();
1320
+ if(owner){
1321
+ table=owner->getAccelTable();
1322
+ if(table && table!=reinterpret_cast<FXAccelTable*>(-1)){
1323
+ table->removeAccel(acckey);
1324
+ }
1325
+ }
1326
+ }
1327
+ acckey=(FXHotKey)NULL;
1328
+ FXRbUnregisterRubyObj(this);
1329
+ }
1330
+
1331
+ FXRbMenuCheck::~FXRbMenuCheck(){
1332
+ FXAccelTable *table;
1333
+ FXWindow *owner;
1334
+ if(acckey){
1335
+ owner=getShell()->getOwner();
1336
+ if(owner){
1337
+ table=owner->getAccelTable();
1338
+ if(table && table!=reinterpret_cast<FXAccelTable*>(-1)){
1339
+ table->removeAccel(acckey);
1340
+ }
1341
+ }
1342
+ }
1343
+ acckey=(FXHotKey)NULL;
1344
+ FXRbUnregisterRubyObj(this);
1345
+ }
1346
+
1347
+ FXRbMenuRadio::~FXRbMenuRadio(){
1348
+ FXAccelTable *table;
1349
+ FXWindow *owner;
1350
+ if(acckey){
1351
+ owner=getShell()->getOwner();
1352
+ if(owner){
1353
+ table=owner->getAccelTable();
1354
+ if(table && table!=reinterpret_cast<FXAccelTable*>(-1)){
1355
+ table->removeAccel(acckey);
1356
+ }
1357
+ }
1358
+ }
1359
+ acckey=(FXHotKey)NULL;
1360
+ FXRbUnregisterRubyObj(this);
1361
+ }
1362
+
1363
+ //----------------------------------------------------------------------
1364
+
1365
+ // Visit all of the items between fm and to (inclusive), plus their
1366
+ // child items, and add to the items list
1367
+ void FXRbTreeList::enumerateItem(FXTreeItem* item,FXObjectListOf<FXTreeItem>& items){
1368
+ // Add this item to the list
1369
+ items.append(item);
1370
+
1371
+ // Add this item's children
1372
+ FXRbTreeList::enumerateItems(item->getFirst(),item->getLast(),items);
1373
+ }
1374
+
1375
+
1376
+ // Visit all of the items between fm and to (inclusive), plus their
1377
+ // child items, and add to the items list
1378
+ void FXRbTreeList::enumerateItems(FXTreeItem* fm,FXTreeItem* to,FXObjectListOf<FXTreeItem>& items){
1379
+ register FXTreeItem *item;
1380
+ if(fm && to){
1381
+ do{
1382
+ item=fm;
1383
+ fm=fm->getNext();
1384
+ FXRbTreeList::enumerateItem(item,items);
1385
+ }
1386
+ while(item!=to);
1387
+ }
1388
+ }
1389
+
1390
+ //----------------------------------------------------------------------
1391
+
1392
+ /**
1393
+ * Visit all of the items between fm and to (inclusive), plus their
1394
+ * child items, and add to the items list.
1395
+ */
1396
+ void FXRbFoldingList::enumerateItem(FXFoldingItem* item,FXObjectListOf<FXFoldingItem>& items){
1397
+ // Add this item to the list
1398
+ items.append(item);
1399
+
1400
+ // Add this item's children
1401
+ FXRbFoldingList::enumerateItems(item->getFirst(),item->getLast(),items);
1402
+ }
1403
+
1404
+
1405
+ /**
1406
+ * Visit all of the items between fm and to (inclusive), plus their
1407
+ * child items, and add to the items list.
1408
+ */
1409
+ void FXRbFoldingList::enumerateItems(FXFoldingItem* fm,FXFoldingItem* to,FXObjectListOf<FXFoldingItem>& items){
1410
+ register FXFoldingItem *item;
1411
+ if(fm && to){
1412
+ do{
1413
+ item=fm;
1414
+ fm=fm->getNext();
1415
+ FXRbFoldingList::enumerateItem(item,items);
1416
+ }
1417
+ while(item!=to);
1418
+ }
1419
+ }
1420
+
1421
+
1422
+ //----------------------------------------------------------------------
1423
+
1424
+ static ID id_cmp;
1425
+
1426
+ // Sort function stand-in for FXComboBox
1427
+ FXint FXRbComboBox::sortFunc(const FXListItem* a,const FXListItem* b){
1428
+ VALUE itemA = FXRbGetRubyObj(const_cast<FXListItem*>(a), "FXListItem *");
1429
+ VALUE itemB = FXRbGetRubyObj(const_cast<FXListItem*>(b), "FXListItem *");
1430
+ VALUE result=rb_funcall(itemA,id_cmp,1,itemB);
1431
+ return static_cast<FXint>(NUM2INT(result));
1432
+ }
1433
+
1434
+
1435
+ // Sort function stand-in for FXFoldingList
1436
+ FXint FXRbFoldingList::sortFunc(const FXFoldingItem* a,const FXFoldingItem* b){
1437
+ VALUE itemA = FXRbGetRubyObj(const_cast<FXFoldingItem*>(a), "FXFoldingItem *");
1438
+ VALUE itemB = FXRbGetRubyObj(const_cast<FXFoldingItem*>(b), "FXFoldingItem *");
1439
+ VALUE result=rb_funcall(itemA,id_cmp,1,itemB);
1440
+ return static_cast<FXint>(NUM2INT(result));
1441
+ }
1442
+
1443
+
1444
+ // Sort function stand-in for FXIconList
1445
+ FXint FXRbIconList::sortFunc(const FXIconItem* a,const FXIconItem* b){
1446
+ VALUE itemA = FXRbGetRubyObj(const_cast<FXIconItem*>(a), "FXIconItem *");
1447
+ VALUE itemB = FXRbGetRubyObj(const_cast<FXIconItem*>(b), "FXIconItem *");
1448
+ VALUE result = rb_funcall(itemA,id_cmp,1,itemB);
1449
+ return static_cast<FXint>(NUM2INT(result));
1450
+ }
1451
+
1452
+
1453
+ // Sort function stand-in for FXList
1454
+ FXint FXRbList::sortFunc(const FXListItem* a,const FXListItem* b){
1455
+ VALUE itemA = FXRbGetRubyObj(const_cast<FXListItem*>(a), "FXListItem *");
1456
+ VALUE itemB = FXRbGetRubyObj(const_cast<FXListItem*>(b), "FXListItem *");
1457
+ VALUE result=rb_funcall(itemA,id_cmp,1,itemB);
1458
+ return static_cast<FXint>(NUM2INT(result));
1459
+ }
1460
+
1461
+
1462
+ // Sort function stand-in for FXListBox
1463
+ FXint FXRbListBox::sortFunc(const FXListItem* a,const FXListItem* b){
1464
+ VALUE itemA = FXRbGetRubyObj(const_cast<FXListItem*>(a), "FXListItem *");
1465
+ VALUE itemB = FXRbGetRubyObj(const_cast<FXListItem*>(b), "FXListItem *");
1466
+ VALUE result=rb_funcall(itemA,id_cmp,1,itemB);
1467
+ return static_cast<FXint>(NUM2INT(result));
1468
+ }
1469
+
1470
+
1471
+ // Sort function stand-in for FXTreeList
1472
+ FXint FXRbTreeList::sortFunc(const FXTreeItem* a,const FXTreeItem* b){
1473
+ VALUE itemA = FXRbGetRubyObj(const_cast<FXTreeItem*>(a), "FXTreeItem *");
1474
+ VALUE itemB = FXRbGetRubyObj(const_cast<FXTreeItem*>(b), "FXTreeItem *");
1475
+ VALUE result=rb_funcall(itemA,id_cmp,1,itemB);
1476
+ return static_cast<FXint>(NUM2INT(result));
1477
+ }
1478
+
1479
+
1480
+ // Feedback buffer sort routine stand-in for FXGLViewer
1481
+ FXbool FXRbGLViewer::sortProc(FXfloat*& buffer,FXint& used,FXint& size){
1482
+ return TRUE;
1483
+ }
1484
+
1485
+ //----------------------------------------------------------------------
1486
+
1487
+ // Copied from the Ruby 1.6.6 sources (signal.c)
1488
+ static struct signals {
1489
+ const char* signm;
1490
+ FXint signo;
1491
+ } siglist[]={
1492
+ #ifdef SIGHUP
1493
+ { "HUP", SIGHUP },
1494
+ #endif
1495
+ #ifdef SIGINT
1496
+ { "INT", SIGINT },
1497
+ #endif
1498
+ #ifdef SIGQUIT
1499
+ { "QUIT", SIGQUIT },
1500
+ #endif
1501
+ #ifdef SIGILL
1502
+ { "ILL", SIGILL },
1503
+ #endif
1504
+ #ifdef SIGTRAP
1505
+ { "TRAP", SIGTRAP },
1506
+ #endif
1507
+ #ifdef SIGIOT
1508
+ { "IOT", SIGIOT },
1509
+ #endif
1510
+ #ifdef SIGABRT
1511
+ { "ABRT", SIGABRT },
1512
+ #endif
1513
+ #ifdef SIGEMT
1514
+ { "EMT", SIGEMT },
1515
+ #endif
1516
+ #ifdef SIGFPE
1517
+ { "FPE", SIGFPE },
1518
+ #endif
1519
+ #ifdef SIGKILL
1520
+ { "KILL", SIGKILL },
1521
+ #endif
1522
+ #ifdef SIGBUS
1523
+ { "BUS", SIGBUS },
1524
+ #endif
1525
+ #ifdef SIGSEGV
1526
+ { "SEGV", SIGSEGV },
1527
+ #endif
1528
+ #ifdef SIGSYS
1529
+ { "SYS", SIGSYS },
1530
+ #endif
1531
+ #ifdef SIGPIPE
1532
+ { "PIPE", SIGPIPE },
1533
+ #endif
1534
+ #ifdef SIGALRM
1535
+ { "ALRM", SIGALRM },
1536
+ #endif
1537
+ #ifdef SIGTERM
1538
+ { "TERM", SIGTERM },
1539
+ #endif
1540
+ #ifdef SIGURG
1541
+ { "URG", SIGURG },
1542
+ #endif
1543
+ #ifdef SIGSTOP
1544
+ { "STOP", SIGSTOP },
1545
+ #endif
1546
+ #ifdef SIGTSTP
1547
+ { "TSTP", SIGTSTP },
1548
+ #endif
1549
+ #ifdef SIGCONT
1550
+ { "CONT", SIGCONT },
1551
+ #endif
1552
+ #ifdef SIGCHLD
1553
+ { "CHLD", SIGCHLD },
1554
+ #endif
1555
+ #ifdef SIGCLD
1556
+ { "CLD", SIGCLD },
1557
+ #else
1558
+ # ifdef SIGCHLD
1559
+ { "CLD", SIGCHLD, },
1560
+ # endif
1561
+ #endif
1562
+ #ifdef SIGTTIN
1563
+ { "TTIN", SIGTTIN },
1564
+ #endif
1565
+ #ifdef SIGTTOU
1566
+ { "TTOU", SIGTTOU },
1567
+ #endif
1568
+ #ifdef SIGIO
1569
+ { "IO", SIGIO },
1570
+ #endif
1571
+ #ifdef SIGXCPU
1572
+ { "XCPU", SIGXCPU },
1573
+ #endif
1574
+ #ifdef SIGXFSZ
1575
+ { "XFSZ", SIGXFSZ },
1576
+ #endif
1577
+ #ifdef SIGVTALRM
1578
+ { "VTALRM", SIGVTALRM },
1579
+ #endif
1580
+ #ifdef SIGPROF
1581
+ { "PROF", SIGPROF },
1582
+ #endif
1583
+ #ifdef SIGWINCH
1584
+ { "WINCH", SIGWINCH },
1585
+ #endif
1586
+ #ifdef SIGUSR1
1587
+ { "USR1", SIGUSR1 },
1588
+ #endif
1589
+ #ifdef SIGUSR2
1590
+ { "USR2", SIGUSR2 },
1591
+ #endif
1592
+ #ifdef SIGLOST
1593
+ { "LOST", SIGLOST },
1594
+ #endif
1595
+ #ifdef SIGMSG
1596
+ { "MSG", SIGMSG },
1597
+ #endif
1598
+ #ifdef SIGPWR
1599
+ { "PWR", SIGPWR },
1600
+ #endif
1601
+ #ifdef SIGPOLL
1602
+ { "POLL", SIGPOLL },
1603
+ #endif
1604
+ #ifdef SIGDANGER
1605
+ { "DANGER", SIGDANGER },
1606
+ #endif
1607
+ #ifdef SIGMIGRATE
1608
+ { "MIGRATE", SIGMIGRATE },
1609
+ #endif
1610
+ #ifdef SIGPRE
1611
+ { "PRE", SIGPRE },
1612
+ #endif
1613
+ #ifdef SIGGRANT
1614
+ { "GRANT", SIGGRANT },
1615
+ #endif
1616
+ #ifdef SIGRETRACT
1617
+ { "RETRACT", SIGRETRACT },
1618
+ #endif
1619
+ #ifdef SIGSOUND
1620
+ { "SOUND", SIGSOUND },
1621
+ #endif
1622
+ #ifdef SIGINFO
1623
+ { "INFO", SIGINFO },
1624
+ #endif
1625
+ { NULL, 0 },
1626
+ };
1627
+
1628
+ FXint FXRbSignalNameToNumber(const char* s){
1629
+ #ifdef HAVE_SIGNAL_H
1630
+ const char *nm=s;
1631
+ if(strncmp("SIG",nm,3)==0){
1632
+ nm+=3;
1633
+ }
1634
+ for(signals* sigs=siglist;sigs->signm;sigs++){
1635
+ if(strcmp(sigs->signm,nm)==0)
1636
+ return sigs->signo;
1637
+ }
1638
+ #endif /* HAVE_SIGNAL_H */
1639
+ return 0;
1640
+ }
1641
+
1642
+ //----------------------------------------------------------------------
1643
+
1644
+ /*
1645
+ * The Ruby header files define a TYPE(x) macro that conflicts with the
1646
+ * TYPE template parameter used in FXArray.h and FXElement.h.
1647
+ */
1648
+ #ifdef TYPE
1649
+ #undef TYPE
1650
+ #endif
1651
+
1652
+ #include <new>
1653
+
1654
+ #include "FXArray.h"
1655
+ #include "FXElement.h"
1656
+
1657
+ static st_table * appSensitiveObjs;
1658
+ static st_table * appSensitiveDCs;
1659
+
1660
+ void FXRbRegisterAppSensitiveObject(FXObject* obj){
1661
+ FXASSERT(obj!=0);
1662
+ FXTRACE((100,"%s:%d: FXRbRegisterAppSensitiveObject(obj=0x%08x(%s))\n",__FILE__,__LINE__,obj,obj->getClassName()));
1663
+ st_insert(appSensitiveObjs,reinterpret_cast<char*>(obj),reinterpret_cast<char*>(0));
1664
+ FXASSERT(st_lookup(appSensitiveObjs,reinterpret_cast<char*>(obj),reinterpret_cast<char**>(0))!=0);
1665
+ }
1666
+
1667
+ void FXRbRegisterAppSensitiveObject(FXDC* dc){
1668
+ FXASSERT(dc!=0);
1669
+ FXTRACE((100,"%s:%d: FXRbRegisterAppSensitiveObject(dc=0x%08x)\n",__FILE__,__LINE__,dc));
1670
+ st_insert(appSensitiveDCs,reinterpret_cast<char*>(dc),reinterpret_cast<char*>(0));
1671
+ FXASSERT(st_lookup(appSensitiveDCs,reinterpret_cast<char*>(dc),reinterpret_cast<char**>(0))!=0);
1672
+ }
1673
+
1674
+ void FXRbUnregisterAppSensitiveObject(FXObject* obj){
1675
+ FXASSERT(obj!=0);
1676
+ FXTRACE((100,"%s:%d: FXRbUnregisterAppSensitiveObject(obj=0x%08x(%s))\n",__FILE__,__LINE__,obj,obj->getClassName()));
1677
+ st_delete(appSensitiveObjs,reinterpret_cast<char**>(&obj),reinterpret_cast<char**>(0));
1678
+ FXASSERT(st_lookup(appSensitiveObjs,reinterpret_cast<char*>(obj),reinterpret_cast<char**>(0))==0);
1679
+ }
1680
+
1681
+ void FXRbUnregisterAppSensitiveObject(FXDC* dc){
1682
+ FXASSERT(dc!=0);
1683
+ FXTRACE((100,"%s:%d: FXRbUnregisterAppSensitiveObject(dc=0x%08x)\n",__FILE__,__LINE__,dc));
1684
+ st_delete(appSensitiveDCs,reinterpret_cast<char**>(&dc),reinterpret_cast<char**>(0));
1685
+ FXASSERT(st_lookup(appSensitiveDCs,reinterpret_cast<char*>(dc),reinterpret_cast<char**>(0))==0);
1686
+ }
1687
+
1688
+ static int st_cbfunc_obj(char *key,char *,char* arg){
1689
+ FXASSERT(key!=0);
1690
+ FXASSERT(arg!=0);
1691
+ FXObjectListOf<FXObject> *pObjectList=reinterpret_cast<FXObjectListOf<FXObject>*>(arg);
1692
+ FXObject *pObject=reinterpret_cast<FXObject*>(key);
1693
+ pObjectList->append(pObject);
1694
+ return 0;
1695
+ }
1696
+
1697
+ static int st_cbfunc_dc(char *key,char *,char* arg){
1698
+ FXASSERT(key!=0);
1699
+ FXASSERT(arg!=0);
1700
+ FXArray<FXDC*> *pDCArray=reinterpret_cast<FXArray<FXDC*>*>(arg);
1701
+ FXDC *pDC=reinterpret_cast<FXDC*>(key);
1702
+ pDCArray->append(pDC);
1703
+ return 0;
1704
+ }
1705
+
1706
+ void FXRbDestroyAppSensitiveObjects(){
1707
+ FXTRACE((100,"%s:%d: Begin destroying objects that hold references to the FXApp...\n",__FILE__,__LINE__));
1708
+
1709
+ FXObjectListOf<FXObject> objs;
1710
+ st_foreach(appSensitiveObjs,st_cbfunc_obj,reinterpret_cast<char*>(&objs));
1711
+ for(FXint i=0;i<objs.no();i++){
1712
+ if(objs[i]->isMemberOf(FXMETACLASS(FXRbCursor))){
1713
+ if(dynamic_cast<FXRbCursor*>(objs[i])->ownedByApp)
1714
+ continue;
1715
+ }
1716
+ else if(objs[i]->isMemberOf(FXMETACLASS(FXRbCURCursor))){
1717
+ if(dynamic_cast<FXRbCURCursor*>(objs[i])->ownedByApp)
1718
+ continue;
1719
+ }
1720
+ else if(objs[i]->isMemberOf(FXMETACLASS(FXRbGIFCursor))){
1721
+ if(dynamic_cast<FXRbGIFCursor*>(objs[i])->ownedByApp)
1722
+ continue;
1723
+ }
1724
+ else if(objs[i]->isMemberOf(FXMETACLASS(FXRbFont))){
1725
+ if(dynamic_cast<FXRbFont*>(objs[i])->ownedByApp)
1726
+ continue;
1727
+ }
1728
+ else if(objs[i]->isMemberOf(FXMETACLASS(FXRbGLVisual))){
1729
+ if(dynamic_cast<FXRbGLVisual*>(objs[i])->ownedByApp)
1730
+ continue;
1731
+ }
1732
+ else if(objs[i]->isMemberOf(FXMETACLASS(FXRbVisual))){
1733
+ if(dynamic_cast<FXRbVisual*>(objs[i])->ownedByApp)
1734
+ continue;
1735
+ }
1736
+ delete objs[i];
1737
+ }
1738
+
1739
+ FXArray<FXDC*> dcs;
1740
+ st_foreach(appSensitiveDCs,st_cbfunc_dc,reinterpret_cast<char*>(&dcs));
1741
+ for(FXint j=0;j<dcs.no();j++){
1742
+ delete dcs[j];
1743
+ }
1744
+
1745
+ FXTRACE((100,"%s:%d: Finished destroying objects that hold references to the FXApp.\n",__FILE__,__LINE__));
1746
+ }
1747
+
1748
+ //----------------------------------------------------------------------
1749
+
1750
+ extern "C" void Init_core(void);
1751
+ extern "C" void Init_dc(void);
1752
+ extern "C" void Init_dialogs(void);
1753
+ extern "C" void Init_frames(void);
1754
+ extern "C" void Init_fx3d(void);
1755
+ extern "C" void Init_image(void);
1756
+ extern "C" void Init_iconlist(void);
1757
+ extern "C" void Init_icons(void);
1758
+ extern "C" void Init_label(void);
1759
+ extern "C" void Init_layout(void);
1760
+ extern "C" void Init_list(void);
1761
+ extern "C" void Init_mdi(void);
1762
+ extern "C" void Init_menu(void);
1763
+ #ifdef WITH_FXSCINTILLA
1764
+ extern "C" void Init_scintilla(void);
1765
+ #endif
1766
+ extern "C" void Init_table(void);
1767
+ extern "C" void Init_text(void);
1768
+ extern "C" void Init_treelist(void);
1769
+ extern "C" void Init_ui(void);
1770
+
1771
+ #ifdef USE_RB_REQUIRE
1772
+ #define REQUIRE(fname) rb_require((fname))
1773
+ #else
1774
+ #define REQUIRE(fname) rb_funcall(rb_mKernel,rb_intern("require"),1,rb_str_new2((fname)))
1775
+ #endif
1776
+
1777
+ extern "C" void Init_fox12(void) {
1778
+ Init_core();
1779
+ Init_dc();
1780
+ Init_frames();
1781
+ Init_layout();
1782
+ Init_label();
1783
+ Init_ui();
1784
+ Init_iconlist();
1785
+ Init_list();
1786
+ Init_dialogs();
1787
+ Init_image();
1788
+ Init_icons();
1789
+ Init_menu();
1790
+ Init_mdi();
1791
+ Init_fx3d();
1792
+ #ifdef WITH_FXSCINTILLA
1793
+ Init_scintilla();
1794
+ #endif
1795
+ Init_table();
1796
+ Init_text();
1797
+ Init_treelist();
1798
+ REQUIRE("fox12/core");
1799
+ REQUIRE("fox12/dict");
1800
+ REQUIRE("fox12/settings");
1801
+ REQUIRE("fox12/iterators");
1802
+ REQUIRE("fox12/keys");
1803
+ REQUIRE("fox12/aliases");
1804
+ REQUIRE("fox12/responder2");
1805
+ REQUIRE("fox12/glgroup");
1806
+ REQUIRE("fox12/version");
1807
+
1808
+ id_assocs=rb_intern("@assocs");
1809
+ id_backtrace=rb_intern("backtrace");
1810
+ id_cmp=rb_intern("<=>");
1811
+ id_begin=rb_intern("begin");
1812
+ id_end=rb_intern("end");
1813
+ id_exclude_endp=rb_intern("exclude_end?");
1814
+
1815
+ FXRuby_Objects=st_init_numtable();
1816
+ appSensitiveObjs=st_init_numtable();
1817
+ appSensitiveDCs=st_init_numtable();
1818
+ }