fxruby 1.4.6 → 1.4.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (251) hide show
  1. data/doc/apes02.html +6 -6
  2. data/doc/apes03.html +11 -11
  3. data/doc/book.html +1 -1
  4. data/doc/build.html +63 -63
  5. data/doc/ch03s02.html +7 -7
  6. data/doc/ch03s03.html +18 -18
  7. data/doc/ch03s04.html +11 -11
  8. data/doc/ch03s05.html +14 -14
  9. data/doc/ch04s02.html +14 -14
  10. data/doc/ch04s03.html +15 -15
  11. data/doc/ch04s04.html +28 -28
  12. data/doc/ch05s02.html +49 -49
  13. data/doc/ch05s03.html +8 -8
  14. data/doc/changes.html +176 -176
  15. data/doc/clipboardtut.html +11 -11
  16. data/doc/cvs.html +10 -10
  17. data/doc/differences.html +4 -4
  18. data/doc/dragdroptut.html +50 -50
  19. data/doc/events.html +11 -11
  20. data/doc/examples.html +47 -47
  21. data/doc/gems.html +37 -37
  22. data/doc/goals.html +4 -4
  23. data/doc/images/iconlist-bigicons.png +0 -0
  24. data/doc/images/iconlist-details.png +0 -0
  25. data/doc/implementation.html +4 -4
  26. data/doc/infosources.html +6 -6
  27. data/doc/library.html +19 -19
  28. data/doc/opengl.html +31 -31
  29. data/doc/pt01.html +1 -1
  30. data/doc/pt02.html +1 -1
  31. data/doc/scintilla.html +15 -15
  32. data/doc/todo.html +5 -5
  33. data/doc/tutorial1.html +34 -34
  34. data/examples/dilbert.rb +1 -1
  35. data/ext/fox14/FXRbApp.cpp +1 -1
  36. data/ext/fox14/FXRbDataTarget.cpp +1 -1
  37. data/ext/fox14/FXRbGLViewer.cpp +1 -1
  38. data/ext/fox14/FXRuby.cpp +1 -1
  39. data/ext/fox14/core_wrap.cpp +0 -12
  40. data/ext/fox14/dialogs_wrap.cpp +43 -19
  41. data/ext/fox14/frames_wrap.cpp +1130 -308
  42. data/ext/fox14/fx3d_wrap.cpp +38 -13
  43. data/ext/fox14/icons_wrap.cpp +24 -6
  44. data/ext/fox14/image_wrap.cpp +24 -6
  45. data/ext/fox14/include/FXMemoryBuffer.h +1 -1
  46. data/ext/fox14/include/FXRb4Splitter.h +1 -1
  47. data/ext/fox14/include/FXRb7Segment.h +1 -1
  48. data/ext/fox14/include/FXRbAccelTable.h +1 -1
  49. data/ext/fox14/include/FXRbApp.h +1 -1
  50. data/ext/fox14/include/FXRbArrowButton.h +1 -1
  51. data/ext/fox14/include/FXRbBMPIcon.h +1 -1
  52. data/ext/fox14/include/FXRbBMPImage.h +1 -1
  53. data/ext/fox14/include/FXRbBitmap.h +1 -1
  54. data/ext/fox14/include/FXRbBitmapFrame.h +1 -1
  55. data/ext/fox14/include/FXRbBitmapView.h +1 -1
  56. data/ext/fox14/include/FXRbButton.h +1 -1
  57. data/ext/fox14/include/FXRbCURCursor.h +1 -1
  58. data/ext/fox14/include/FXRbCanvas.h +1 -1
  59. data/ext/fox14/include/FXRbCheckButton.h +1 -1
  60. data/ext/fox14/include/FXRbChoiceBox.h +1 -1
  61. data/ext/fox14/include/FXRbColorBar.h +1 -1
  62. data/ext/fox14/include/FXRbColorDialog.h +1 -1
  63. data/ext/fox14/include/FXRbColorSelector.h +1 -1
  64. data/ext/fox14/include/FXRbColorWell.h +1 -1
  65. data/ext/fox14/include/FXRbColorWheel.h +1 -1
  66. data/ext/fox14/include/FXRbComboBox.h +1 -1
  67. data/ext/fox14/include/FXRbCommon.h +1 -1
  68. data/ext/fox14/include/FXRbComposite.h +1 -1
  69. data/ext/fox14/include/FXRbCursor.h +1 -1
  70. data/ext/fox14/include/FXRbDC.h +1 -1
  71. data/ext/fox14/include/FXRbDCPrint.h +1 -1
  72. data/ext/fox14/include/FXRbDCWindow.h +1 -1
  73. data/ext/fox14/include/FXRbDataTarget.h +1 -1
  74. data/ext/fox14/include/FXRbDebugTarget.h +1 -1
  75. data/ext/fox14/include/FXRbDelegator.h +1 -1
  76. data/ext/fox14/include/FXRbDial.h +1 -1
  77. data/ext/fox14/include/FXRbDialogBox.h +1 -1
  78. data/ext/fox14/include/FXRbDict.h +1 -1
  79. data/ext/fox14/include/FXRbDirBox.h +1 -1
  80. data/ext/fox14/include/FXRbDirDialog.h +1 -1
  81. data/ext/fox14/include/FXRbDirList.h +1 -1
  82. data/ext/fox14/include/FXRbDirSelector.h +1 -1
  83. data/ext/fox14/include/FXRbDockBar.h +1 -1
  84. data/ext/fox14/include/FXRbDockHandler.h +1 -1
  85. data/ext/fox14/include/FXRbDockSite.h +1 -1
  86. data/ext/fox14/include/FXRbDockTitle.h +1 -1
  87. data/ext/fox14/include/FXRbDocument.h +1 -1
  88. data/ext/fox14/include/FXRbDragCorner.h +1 -1
  89. data/ext/fox14/include/FXRbDrawable.h +1 -1
  90. data/ext/fox14/include/FXRbDriveBox.h +1 -1
  91. data/ext/fox14/include/FXRbFileDialog.h +1 -1
  92. data/ext/fox14/include/FXRbFileDict.h +1 -1
  93. data/ext/fox14/include/FXRbFileList.h +1 -1
  94. data/ext/fox14/include/FXRbFileSelector.h +1 -1
  95. data/ext/fox14/include/FXRbFoldingList.h +1 -1
  96. data/ext/fox14/include/FXRbFont.h +1 -1
  97. data/ext/fox14/include/FXRbFontDialog.h +1 -1
  98. data/ext/fox14/include/FXRbFontSelector.h +1 -1
  99. data/ext/fox14/include/FXRbFrame.h +1 -1
  100. data/ext/fox14/include/FXRbGIFCursor.h +1 -1
  101. data/ext/fox14/include/FXRbGIFIcon.h +1 -1
  102. data/ext/fox14/include/FXRbGIFImage.h +1 -1
  103. data/ext/fox14/include/FXRbGLCanvas.h +1 -1
  104. data/ext/fox14/include/FXRbGLContext.h +1 -1
  105. data/ext/fox14/include/FXRbGLObject.h +1 -1
  106. data/ext/fox14/include/FXRbGLShape.h +1 -1
  107. data/ext/fox14/include/FXRbGLViewer.h +1 -1
  108. data/ext/fox14/include/FXRbGLVisual.h +1 -1
  109. data/ext/fox14/include/FXRbGradientBar.h +1 -1
  110. data/ext/fox14/include/FXRbGroupBox.h +1 -1
  111. data/ext/fox14/include/FXRbHeader.h +1 -1
  112. data/ext/fox14/include/FXRbHorizontalFrame.h +1 -1
  113. data/ext/fox14/include/FXRbICOIcon.h +1 -1
  114. data/ext/fox14/include/FXRbICOImage.h +1 -1
  115. data/ext/fox14/include/FXRbIcon.h +1 -1
  116. data/ext/fox14/include/FXRbIconList.h +1 -1
  117. data/ext/fox14/include/FXRbIconSource.h +1 -1
  118. data/ext/fox14/include/FXRbId.h +1 -1
  119. data/ext/fox14/include/FXRbImage.h +1 -1
  120. data/ext/fox14/include/FXRbImageFrame.h +1 -1
  121. data/ext/fox14/include/FXRbImageView.h +1 -1
  122. data/ext/fox14/include/FXRbInputDialog.h +1 -1
  123. data/ext/fox14/include/FXRbJPGIcon.h +1 -1
  124. data/ext/fox14/include/FXRbJPGImage.h +1 -1
  125. data/ext/fox14/include/FXRbLabel.h +1 -1
  126. data/ext/fox14/include/FXRbList.h +1 -1
  127. data/ext/fox14/include/FXRbListBox.h +1 -1
  128. data/ext/fox14/include/FXRbMDIButton.h +1 -1
  129. data/ext/fox14/include/FXRbMDIChild.h +1 -1
  130. data/ext/fox14/include/FXRbMDIClient.h +1 -1
  131. data/ext/fox14/include/FXRbMainWindow.h +1 -1
  132. data/ext/fox14/include/FXRbMatrix.h +1 -1
  133. data/ext/fox14/include/FXRbMenuBar.h +1 -1
  134. data/ext/fox14/include/FXRbMenuButton.h +1 -1
  135. data/ext/fox14/include/FXRbMenuCaption.h +1 -1
  136. data/ext/fox14/include/FXRbMenuCascade.h +1 -1
  137. data/ext/fox14/include/FXRbMenuCheck.h +1 -1
  138. data/ext/fox14/include/FXRbMenuCommand.h +1 -1
  139. data/ext/fox14/include/FXRbMenuPane.h +1 -1
  140. data/ext/fox14/include/FXRbMenuRadio.h +1 -1
  141. data/ext/fox14/include/FXRbMenuSeparator.h +1 -1
  142. data/ext/fox14/include/FXRbMenuTitle.h +1 -1
  143. data/ext/fox14/include/FXRbMessageBox.h +1 -1
  144. data/ext/fox14/include/FXRbObject.h +1 -1
  145. data/ext/fox14/include/FXRbOptionMenu.h +1 -1
  146. data/ext/fox14/include/FXRbPCXIcon.h +1 -1
  147. data/ext/fox14/include/FXRbPCXImage.h +1 -1
  148. data/ext/fox14/include/FXRbPNGIcon.h +1 -1
  149. data/ext/fox14/include/FXRbPNGImage.h +1 -1
  150. data/ext/fox14/include/FXRbPPMIcon.h +1 -1
  151. data/ext/fox14/include/FXRbPPMImage.h +1 -1
  152. data/ext/fox14/include/FXRbPacker.h +1 -1
  153. data/ext/fox14/include/FXRbPicker.h +1 -1
  154. data/ext/fox14/include/FXRbPopup.h +1 -1
  155. data/ext/fox14/include/FXRbPrintDialog.h +1 -1
  156. data/ext/fox14/include/FXRbProgressBar.h +1 -1
  157. data/ext/fox14/include/FXRbProgressDialog.h +1 -1
  158. data/ext/fox14/include/FXRbRGBIcon.h +1 -1
  159. data/ext/fox14/include/FXRbRGBImage.h +1 -1
  160. data/ext/fox14/include/FXRbRadioButton.h +1 -1
  161. data/ext/fox14/include/FXRbRealSlider.h +1 -1
  162. data/ext/fox14/include/FXRbRealSpinner.h +1 -1
  163. data/ext/fox14/include/FXRbRecentFiles.h +1 -1
  164. data/ext/fox14/include/FXRbRegistry.h +1 -1
  165. data/ext/fox14/include/FXRbReplaceDialog.h +1 -1
  166. data/ext/fox14/include/FXRbRootWindow.h +1 -1
  167. data/ext/fox14/include/FXRbRuler.h +1 -1
  168. data/ext/fox14/include/FXRbScintilla.h +1 -1
  169. data/ext/fox14/include/FXRbScrollArea.h +1 -1
  170. data/ext/fox14/include/FXRbScrollBar.h +1 -1
  171. data/ext/fox14/include/FXRbScrollPane.h +1 -1
  172. data/ext/fox14/include/FXRbScrollWindow.h +1 -1
  173. data/ext/fox14/include/FXRbSearchDialog.h +1 -1
  174. data/ext/fox14/include/FXRbSeparator.h +1 -1
  175. data/ext/fox14/include/FXRbSettings.h +1 -1
  176. data/ext/fox14/include/FXRbShell.h +1 -1
  177. data/ext/fox14/include/FXRbShutter.h +1 -1
  178. data/ext/fox14/include/FXRbSlider.h +1 -1
  179. data/ext/fox14/include/FXRbSpinner.h +1 -1
  180. data/ext/fox14/include/FXRbSplashWindow.h +1 -1
  181. data/ext/fox14/include/FXRbSplitter.h +1 -1
  182. data/ext/fox14/include/FXRbSpring.h +1 -1
  183. data/ext/fox14/include/FXRbStatusBar.h +1 -1
  184. data/ext/fox14/include/FXRbStatusLine.h +1 -1
  185. data/ext/fox14/include/FXRbStream.h +1 -1
  186. data/ext/fox14/include/FXRbStringDict.h +1 -1
  187. data/ext/fox14/include/FXRbSwitcher.h +1 -1
  188. data/ext/fox14/include/FXRbTGAIcon.h +1 -1
  189. data/ext/fox14/include/FXRbTGAImage.h +1 -1
  190. data/ext/fox14/include/FXRbTIFIcon.h +1 -1
  191. data/ext/fox14/include/FXRbTIFImage.h +1 -1
  192. data/ext/fox14/include/FXRbTabBar.h +1 -1
  193. data/ext/fox14/include/FXRbTabBook.h +1 -1
  194. data/ext/fox14/include/FXRbTabItem.h +1 -1
  195. data/ext/fox14/include/FXRbTable.h +1 -1
  196. data/ext/fox14/include/FXRbText.h +1 -1
  197. data/ext/fox14/include/FXRbTextField.h +1 -1
  198. data/ext/fox14/include/FXRbToggleButton.h +1 -1
  199. data/ext/fox14/include/FXRbToolBar.h +1 -1
  200. data/ext/fox14/include/FXRbToolBarGrip.h +1 -1
  201. data/ext/fox14/include/FXRbToolBarShell.h +1 -1
  202. data/ext/fox14/include/FXRbToolBarTab.h +1 -1
  203. data/ext/fox14/include/FXRbToolTip.h +1 -1
  204. data/ext/fox14/include/FXRbTopWindow.h +1 -1
  205. data/ext/fox14/include/FXRbTreeList.h +1 -1
  206. data/ext/fox14/include/FXRbTreeListBox.h +1 -1
  207. data/ext/fox14/include/FXRbTriStateButton.h +1 -1
  208. data/ext/fox14/include/FXRbVerticalFrame.h +1 -1
  209. data/ext/fox14/include/FXRbVisual.h +1 -1
  210. data/ext/fox14/include/FXRbWindow.h +1 -1
  211. data/ext/fox14/include/FXRbWizard.h +1 -1
  212. data/ext/fox14/include/FXRbXBMIcon.h +1 -1
  213. data/ext/fox14/include/FXRbXBMImage.h +1 -1
  214. data/ext/fox14/include/FXRbXPMIcon.h +1 -1
  215. data/ext/fox14/include/FXRbXPMImage.h +1 -1
  216. data/ext/fox14/include/FXRuby.h +1 -1
  217. data/ext/fox14/label_wrap.cpp +23 -8
  218. data/ext/fox14/markfuncs.cpp +8 -1
  219. data/ext/fox14/mdi_wrap.cpp +47 -17
  220. data/ext/fox14/menu_wrap.cpp +34 -10
  221. data/ext/fox14/scintilla_wrap.cpp +31 -7
  222. data/ext/fox14/table_wrap.cpp +31 -7
  223. data/ext/fox14/text_wrap.cpp +31 -7
  224. data/ext/fox14/treelist_wrap.cpp +31 -7
  225. data/ext/fox14/ui_wrap.cpp +497 -154
  226. data/ext/fox14/unregisterOwnedObjects.cpp +1 -1
  227. data/lib/fox14/aliases.rb +3 -3
  228. data/lib/fox14/colors.rb +282 -282
  229. data/lib/fox14/core.rb +7 -0
  230. data/lib/fox14/splashscreen.rb +83 -83
  231. data/lib/fox14/version.rb +1 -1
  232. data/rdoc-sources/FX4Splitter.rb +138 -138
  233. data/rdoc-sources/FXFoldingList.rb +2 -2
  234. data/rdoc-sources/FXQuatd.rb +171 -1
  235. data/rdoc-sources/FXQuatf.rb +175 -1
  236. data/rdoc-sources/FXWindow.rb +0 -3
  237. data/tests/TC_FXComboBox.rb +10 -1
  238. data/tests/TC_FXDirList.rb +1 -1
  239. data/tests/TC_FXGLViewer.rb +2 -0
  240. data/tests/TC_FXHeader.rb +1 -1
  241. data/tests/TC_FXIconList.rb +1 -1
  242. data/tests/TC_FXId.rb +1 -1
  243. data/tests/TC_FXListBox.rb +1 -1
  244. data/tests/TC_FXMenuCommand.rb +0 -14
  245. data/tests/TC_FXTable.rb +0 -32
  246. data/tests/TC_FXTableItem.rb +1 -1
  247. data/tests/TC_FXTreeList.rb +1 -1
  248. data/tests/TC_FXTreeListBox.rb +1 -1
  249. data/web/top.html +15 -15
  250. metadata +2 -3
  251. data/ChangeLog +0 -11094
@@ -1,18 +1,18 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Chapter&nbsp;4.&nbsp;Working With the Clipboard</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="pt01.html" title="Part&nbsp;I.&nbsp;The Basics"><link rel="previous" href="ch03s05.html" title="Adding an icon"><link rel="next" href="ch04s02.html" title="Acquiring the Clipboard"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&nbsp;4.&nbsp;Working With the Clipboard</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s05.html">Prev</a>&nbsp;</td><th width="60%" align="center">Part&nbsp;I.&nbsp;The Basics</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch04s02.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="clipboardtut"></a>Chapter&nbsp;4.&nbsp;Working With the Clipboard</h2></div></div><div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="clipboardtut.html#d0e986">Basic Application</a></dt><dt><a href="ch04s02.html">Acquiring the Clipboard</a></dt><dt><a href="ch04s03.html">Sending Data to the Clipboard</a></dt><dt><a href="ch04s04.html">Pasting Data from the Clipboard</a></dt></dl></div><p>Two of the standard FOX widgets, <tt class="classname">FXText</tt> and
4
- <tt class="classname">FXTextField</tt>, provide clipboard support out of the
3
+ <title>Chapter&nbsp;4.&nbsp;Working With the Clipboard</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.68.1"><link rel="start" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="pt01.html" title="Part&nbsp;I.&nbsp;The Basics"><link rel="prev" href="ch03s05.html" title="Adding an icon"><link rel="next" href="ch04s02.html" title="Acquiring the Clipboard"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&nbsp;4.&nbsp;Working With the Clipboard</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s05.html">Prev</a>&nbsp;</td><th width="60%" align="center">Part&nbsp;I.&nbsp;The Basics</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch04s02.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="clipboardtut"></a>Chapter&nbsp;4.&nbsp;Working With the Clipboard</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="clipboardtut.html#d0e986">Basic Application</a></span></dt><dt><span class="section"><a href="ch04s02.html">Acquiring the Clipboard</a></span></dt><dt><span class="section"><a href="ch04s03.html">Sending Data to the Clipboard</a></span></dt><dt><span class="section"><a href="ch04s04.html">Pasting Data from the Clipboard</a></span></dt></dl></div><p>Two of the standard FOX widgets, <code class="classname">FXText</code> and
4
+ <code class="classname">FXTextField</code>, provide clipboard support out of the
5
5
  box. For example, you can select some text in an
6
- <tt class="classname">FXTextField</tt> and then press Ctrl+C to copy that text
6
+ <code class="classname">FXTextField</code> and then press Ctrl+C to copy that text
7
7
  to the system clipboard. You can also press Ctrl+X to "cut" the selected
8
8
  text to the clipboard, or Ctrl+V to paste text from the clipboard into an
9
- <tt class="classname">FXText</tt> or <tt class="classname">FXTextField</tt> widget.
9
+ <code class="classname">FXText</code> or <code class="classname">FXTextField</code> widget.
10
10
  The purpose of this tutorial is to demonstrate how to interact with the
11
11
  clipboard programmatically, so that you can integrate additional clipboard
12
- support into your FXRuby applications.</p><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e986"></a>Basic Application</h2></div></div><div></div></div><p>In order to illustrate how to integrate cut and paste operations
12
+ support into your FXRuby applications.</p><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e986"></a>Basic Application</h2></div></div></div><p>In order to illustrate how to integrate cut and paste operations
13
13
  into your application, we'll start from a simple FXRuby application that
14
14
  doesn't yet provide any clipboard support. This application simply
15
- presents a list of customers (from some external source).</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">require 'rubygems'
15
+ presents a list of customers (from some external source).</p><pre class="programlisting">require 'rubygems'
16
16
  require_gem 'fxruby'
17
17
  require 'customer'
18
18
 
@@ -47,12 +47,12 @@ if __FILE__ == $0
47
47
  theApp.run
48
48
  end
49
49
  end
50
- </pre></td></tr></table><p>We're assuming that the "customer" module defines a
51
- <tt class="classname">Customer</tt> class and a global array
52
- <tt class="varname">$customers</tt> that contains the list of customers. For a
50
+ </pre><p>We're assuming that the "customer" module defines a
51
+ <code class="classname">Customer</code> class and a global array
52
+ <code class="varname">$customers</code> that contains the list of customers. For a
53
53
  real world application, you might access this information from a database
54
54
  or some other source, but for this example we'll just use a hard-coded
55
- array:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"># customer.rb
55
+ array:</p><pre class="programlisting"># customer.rb
56
56
 
57
57
  Customer = Struct.new("Customer", :name, :address, :zip)
58
58
 
@@ -61,7 +61,7 @@ $customers &lt;&lt; Customer.new("Reed Richards", "123 Maple, Central City, NY",
61
61
  $customers &lt;&lt; Customer.new("Sue Storm", "123 Maple, Anytown, NC", 12345)
62
62
  $customers &lt;&lt; Customer.new("Benjamin J. Grimm", "123 Maple, Anytown, NC", 12345)
63
63
  $customers &lt;&lt; Customer.new("Johnny Storm", "123 Maple, Anytown, NC", 12345)
64
- </pre></td></tr></table><p>The goals for the next few sections are to extend this application
64
+ </pre><p>The goals for the next few sections are to extend this application
65
65
  so that users can select a customer from the list and copy that customer's
66
66
  information to the clipboard, and subsequently paste that information into
67
67
  another copy of the program (or some other clipboard-aware
data/doc/cvs.html CHANGED
@@ -1,6 +1,6 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Appendix&nbsp;F.&nbsp;Getting the Sources from CVS</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="pt02.html" title="Part&nbsp;II.&nbsp;Appendices"><link rel="previous" href="apes03.html" title="Virtual Functions"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Appendix&nbsp;F.&nbsp;Getting the Sources from CVS</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="apes03.html">Prev</a>&nbsp;</td><th width="60%" align="center">Part&nbsp;II.&nbsp;Appendices</th><td width="20%" align="right">&nbsp;</td></tr></table><hr></div><div class="appendix" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="cvs"></a>Appendix&nbsp;F.&nbsp;Getting the Sources from CVS</h2></div></div><div></div></div><p>All of the source code for FXRuby is available for anonymous,
3
+ <title>Appendix&nbsp;F.&nbsp;Getting the Sources from CVS</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.68.1"><link rel="start" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="pt02.html" title="Part&nbsp;II.&nbsp;Appendices"><link rel="prev" href="apes03.html" title="Virtual Functions"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Appendix&nbsp;F.&nbsp;Getting the Sources from CVS</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="apes03.html">Prev</a>&nbsp;</td><th width="60%" align="center">Part&nbsp;II.&nbsp;Appendices</th><td width="20%" align="right">&nbsp;</td></tr></table><hr></div><div class="appendix" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="cvs"></a>Appendix&nbsp;F.&nbsp;Getting the Sources from CVS</h2></div></div></div><p>All of the source code for FXRuby is available for anonymous,
4
4
  read-only CVS access. This chapter describes how to check out the sources
5
5
  for either the stable or development release of FXRuby and then build FXRuby
6
6
  from those sources. The information in this chapter builds on the basic CVS
@@ -19,17 +19,17 @@
19
19
  modified SWIG interface files. I always use the latest development version
20
20
  of <a href="http://www.swig.org" target="_top">SWIG</a>, but any release after,
21
21
  say, SWIG 1.3.15 should work fine. The older SWIG 1.1 releases will
22
- definitely <span class="emphasis"><em>not</em></span> work.</p><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4695"></a>Checking out the stable version</h2></div></div><div></div></div><p>The stable version of FXRuby is the 1.0.x branch and is compatible
22
+ definitely <span class="emphasis"><em>not</em></span> work.</p><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4695"></a>Checking out the stable version</h2></div></div></div><p>The stable version of FXRuby is the 1.0.x branch and is compatible
23
23
  with any of the FOX 1.0.x releases. It is <span class="emphasis"><em>not</em></span>
24
24
  compatible with any other release branches of FOX (e.g. the FOX 1.2.x or
25
- 1.3.x series of releases).</p><p>To check out the stable version of FXRuby, do the following:</p><div class="orderedlist"><ol type="1"><li><p>Log in to the CVS server by typing:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">cvs -d:pserver:anonymous@rubyforge.org:/var/cvs/fxruby login</pre></td></tr></table><p>When prompted for a password for <span class="emphasis"><em>anonymous</em></span>,
26
- simply press the <b class="keycap">Enter</b> key.</p></li><li><p>Check out the stable branch of FXRuby by typing:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">cvs -z3 -d:pserver:anonymous@rubyforge.org:/var/cvs/fxruby co -rrelease10 FXRuby</pre></td></tr></table></li></ol></div><p>At this point, you should be ready to change to the top-level
25
+ 1.3.x series of releases).</p><p>To check out the stable version of FXRuby, do the following:</p><div class="orderedlist"><ol type="1"><li><p>Log in to the CVS server by typing:</p><pre class="screen">cvs -d:pserver:anonymous@rubyforge.org:/var/cvs/fxruby login</pre><p>When prompted for a password for <span class="emphasis"><em>anonymous</em></span>,
26
+ simply press the <span><strong class="keycap">Enter</strong></span> key.</p></li><li><p>Check out the stable branch of FXRuby by typing:</p><pre class="screen">cvs -z3 -d:pserver:anonymous@rubyforge.org:/var/cvs/fxruby co -rrelease10 FXRuby</pre></li></ol></div><p>At this point, you should be ready to change to the top-level
27
27
  directory and go through the normal build and installation process, as
28
- described in an earlier chapter.</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4728"></a>Regenerating wrapper code with SWIG</h2></div></div><div></div></div><p>If you make changes to any of the SWIG interface files (the files
29
- ending with a <tt class="filename">.i</tt> extension, in the <tt class="filename">swig-interfaces</tt> subdirectory) you will need
30
- to re-run SWIG to regenerate parts of the FXRuby source code:</p><div class="orderedlist"><ol type="1"><li><p>Change directories to the <tt class="filename">swig-interfaces</tt> subdirectory of the
28
+ described in an earlier chapter.</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4728"></a>Regenerating wrapper code with SWIG</h2></div></div></div><p>If you make changes to any of the SWIG interface files (the files
29
+ ending with a <code class="filename">.i</code> extension, in the <code class="filename">swig-interfaces</code> subdirectory) you will need
30
+ to re-run SWIG to regenerate parts of the FXRuby source code:</p><div class="orderedlist"><ol type="1"><li><p>Change directories to the <code class="filename">swig-interfaces</code> subdirectory of the
31
31
  FXRuby source tree.</p></li><li><p>Type the following command to create a "bootstrap"
32
- <tt class="filename">dependencies</tt> file:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">touch dependencies</pre></td></tr></table><p>You should only need to do this for the initial checkout of the
33
- sources; after that, the <tt class="filename">dependencies</tt> file will
32
+ <code class="filename">dependencies</code> file:</p><pre class="screen">touch dependencies</pre><p>You should only need to do this for the initial checkout of the
33
+ sources; after that, the <code class="filename">dependencies</code> file will
34
34
  be updated as described in the next step.</p></li><li><p>Build the "depend" target to generate the real
35
- <tt class="filename">dependencies</tt> file by typing:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">make depend</pre></td></tr></table></li><li><p>Finally, regenerate the sources by typing:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">make</pre></td></tr></table></li></ol></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="apes03.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="pt02.html">Up</a></td><td width="40%" align="right">&nbsp;</td></tr><tr><td width="40%" align="left" valign="top">Virtual Functions&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;</td></tr></table></div></body></html>
35
+ <code class="filename">dependencies</code> file by typing:</p><pre class="screen">make depend</pre></li><li><p>Finally, regenerate the sources by typing:</p><pre class="screen">make</pre></li></ol></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="apes03.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="pt02.html">Up</a></td><td width="40%" align="right">&nbsp;</td></tr><tr><td width="40%" align="left" valign="top">Virtual Functions&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;</td></tr></table></div></body></html>
data/doc/differences.html CHANGED
@@ -1,11 +1,11 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Appendix&nbsp;C.&nbsp;Differences between FOX and FXRuby</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="pt02.html" title="Part&nbsp;II.&nbsp;Appendices"><link rel="previous" href="scintilla.html" title="Appendix&nbsp;B.&nbsp;Using Scintilla with FXRuby"><link rel="next" href="library.html" title="Appendix&nbsp;D.&nbsp;The FXRuby Standard Library"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Appendix&nbsp;C.&nbsp;Differences between FOX and FXRuby</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="scintilla.html">Prev</a>&nbsp;</td><th width="60%" align="center">Part&nbsp;II.&nbsp;Appendices</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="library.html">Next</a></td></tr></table><hr></div><div class="appendix" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="differences"></a>Appendix&nbsp;C.&nbsp;Differences between FOX and FXRuby</h2></div></div><div></div></div><p>The FXRuby API follows the FOX API very closely and for the most part, you should be able to use the standard FOX class documentation as a reference. In some cases, however, fundamental differences between Ruby and C++ necessitated slight changes in the API. For some other cases, FOX classes were enhanced to take advantage of Ruby language features (such as iterators). The purpose of this chapter is to identify some of the differences between the C++ and Ruby interfaces to FOX.</p><p>One difference that should be easy to cope with is the substitution of Ruby Strings for FXStrings. Any function that would normally expect an <span class="type">FXString</span> input argument insteads takes a Ruby String. Similarly, functions that would return an <span class="type">FXString</span> will instead return a Ruby string. For functions that would normally accept a <tt class="constant">NULL</tt> or empty string argument, just pass <tt class="constant">nil</tt> or an empty string ("").</p><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e3776"></a>Functions that expect arrays of objects</h2></div></div><div></div></div><p>One common pattern in FOX member function argument lists is to expect a pointer to an array of values, followed by an integer indicating the number of values in the array. This of course isn't necessary in Ruby, where <tt class="classname">Array</tt> objects "know" their lengths. As a result, functions such as <tt class="methodname">FXWindow::acquireClipboard()</tt>, whose C++ declaration looks like this:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">FXbool acquireClipboard(const FXDragType *types, FXuint numTypes);</pre></td></tr></table><p>are called from Ruby code by passing in a single <tt class="classname">Array</tt> argument, e.g.</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">myWindow.acquireClipboard(typesArray)</pre></td></tr></table></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e3796"></a>Functions that return values by reference</h2></div></div><div></div></div><p>Many FOX methods take advantage of the C++ language feature of returning values by reference. For example, the <tt class="methodname">getCursorPos()</tt> member function for class <tt class="classname">FXWindow</tt> has the declaration:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">FXint getCursorPos(FXint&amp; x, FXint&amp; y, FXint&amp; buttons) const;</pre></td></tr></table><p>which indicates that the function takes references to three integers (x, y and buttons). To call this function from a C++ program, you'd write code like this:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">FXint x, y;
3
+ <title>Appendix&nbsp;C.&nbsp;Differences between FOX and FXRuby</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.68.1"><link rel="start" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="pt02.html" title="Part&nbsp;II.&nbsp;Appendices"><link rel="prev" href="scintilla.html" title="Appendix&nbsp;B.&nbsp;Using Scintilla with FXRuby"><link rel="next" href="library.html" title="Appendix&nbsp;D.&nbsp;The FXRuby Standard Library"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Appendix&nbsp;C.&nbsp;Differences between FOX and FXRuby</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="scintilla.html">Prev</a>&nbsp;</td><th width="60%" align="center">Part&nbsp;II.&nbsp;Appendices</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="library.html">Next</a></td></tr></table><hr></div><div class="appendix" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="differences"></a>Appendix&nbsp;C.&nbsp;Differences between FOX and FXRuby</h2></div></div></div><p>The FXRuby API follows the FOX API very closely and for the most part, you should be able to use the standard FOX class documentation as a reference. In some cases, however, fundamental differences between Ruby and C++ necessitated slight changes in the API. For some other cases, FOX classes were enhanced to take advantage of Ruby language features (such as iterators). The purpose of this chapter is to identify some of the differences between the C++ and Ruby interfaces to FOX.</p><p>One difference that should be easy to cope with is the substitution of Ruby Strings for FXStrings. Any function that would normally expect an <span class="type">FXString</span> input argument insteads takes a Ruby String. Similarly, functions that would return an <span class="type">FXString</span> will instead return a Ruby string. For functions that would normally accept a <code class="constant">NULL</code> or empty string argument, just pass <code class="constant">nil</code> or an empty string ("").</p><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e3776"></a>Functions that expect arrays of objects</h2></div></div></div><p>One common pattern in FOX member function argument lists is to expect a pointer to an array of values, followed by an integer indicating the number of values in the array. This of course isn't necessary in Ruby, where <code class="classname">Array</code> objects "know" their lengths. As a result, functions such as <code class="methodname">FXWindow::acquireClipboard()</code>, whose C++ declaration looks like this:</p><pre class="programlisting">FXbool acquireClipboard(const FXDragType *types, FXuint numTypes);</pre><p>are called from Ruby code by passing in a single <code class="classname">Array</code> argument, e.g.</p><pre class="programlisting">myWindow.acquireClipboard(typesArray)</pre></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e3796"></a>Functions that return values by reference</h2></div></div></div><p>Many FOX methods take advantage of the C++ language feature of returning values by reference. For example, the <code class="methodname">getCursorPos()</code> member function for class <code class="classname">FXWindow</code> has the declaration:</p><pre class="programlisting">FXint getCursorPos(FXint&amp; x, FXint&amp; y, FXint&amp; buttons) const;</pre><p>which indicates that the function takes references to three integers (x, y and buttons). To call this function from a C++ program, you'd write code like this:</p><pre class="programlisting">FXint x, y;
4
4
  FXuint buttons;
5
5
 
6
6
  if (window-&gt;getCursorPosition(x, y, buttons))
7
- fprintf(stderr, "Current position is (%d, %d)\n", x, y);</pre></td></tr></table><p>Since this idiom doesn't translate well to Ruby, some functions' interfaces have been slightly modified. For example, the FXRuby implementation of <tt class="methodname">getCursorPos()</tt> returns the three values as an <tt class="classname">Array</tt>, e.g.:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">x, y, buttons = aWindow.getCursorPos()</pre></td></tr></table><p>The following table shows how these kinds of functions are implemented in FXRuby:</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><thead><tr><th align="center">Instance Method</th><th align="center">Return Value</th></tr></thead><tbody><tr><td><tt class="methodname">FXDial#range</tt></td><td>Returns a <tt class="classname">Range</tt> instance.</td></tr><tr><td><tt class="methodname">FXDial#range=(aRange)</tt></td><td>Accepts a <tt class="classname">Range</tt> instance as its input.</td></tr><tr><td><tt class="methodname">FXFontDialog#fontSelection</tt></td><td>Returns the <tt class="classname">FXFontDesc</tt> instance</td></tr><tr><td><tt class="methodname">FXFontSelector#fontSelection</tt></td><td>Returns the <tt class="classname">FXFontDesc</tt> instance</td></tr><tr><td><tt class="methodname">FXGLObject#bounds(range)</tt></td><td>Takes an <tt class="classname">FXRange</tt> instance as its input and returns a (possibly modified) <tt class="classname">FXRange</tt> instance.</td></tr><tr><td><tt class="methodname">FXGLViewer#eyeToScreen(eye)</tt></td><td>Takes an array of eye coordinates (floats) as its input and returns the screen point coordinate as an array of integers [sx, sy]</td></tr><tr><td><tt class="methodname">FXGLViewer#getBoreVector(sx, sy)</tt></td><td>Returns the endpoint and direction vector as an array of arrays [point, dir]</td></tr><tr><td><tt class="methodname">FXGLViewer#light</tt></td><td>Returns a <tt class="classname">FXLight</tt> instance</td></tr><tr><td><tt class="methodname">FXGLViewer#viewport</tt></td><td>Returns an <tt class="classname">FXViewport</tt> instance.</td></tr><tr><td><tt class="methodname">FXPrinterDialog#printer</tt></td><td>Returns the <tt class="classname">FXPrinter</tt> instance</td></tr><tr><td><tt class="methodname">FXScrollArea#position</tt></td><td>Returns the position as an array of integers [x, y]</td></tr><tr><td><tt class="methodname">FXSlider#range</tt></td><td>Returns a <tt class="classname">Range</tt> instance.</td></tr><tr><td><tt class="methodname">FXSlider#range=(aRange)</tt></td><td>Accepts a <tt class="classname">Range</tt> instance as its input.</td></tr><tr><td><tt class="methodname">FXSpinner#range</tt></td><td>Returns a <tt class="classname">Range</tt> instance.</td></tr><tr><td><tt class="methodname">FXSpinner#range=(aRange)</tt></td><td>Accepts a <tt class="classname">Range</tt> instance as its input.</td></tr><tr><td><tt class="methodname">FXText#appendText(text, notify=false)</tt></td><td>Append text to the end of the buffer.</td></tr><tr><td><tt class="methodname">FXText#appendStyledText(text, style=0, notify=false)</tt></td><td>Append styled text to the end of the buffer.</td></tr><tr><td><tt class="methodname">FXText#extractText(pos, n)</tt></td><td>Extracts <span class="emphasis"><em>n</em></span> characters from the buffer beginning at position <span class="emphasis"><em>pos</em></span> and returns the result as a String.</td></tr><tr><td><tt class="methodname">FXText#extractStyle(pos, n)</tt></td><td>Extracts <span class="emphasis"><em>n</em></span> style characters from the buffer beginning at position <span class="emphasis"><em>pos</em></span> and returns the result as a String.</td></tr><tr><td><tt class="methodname">FXText#insertText(pos, text, notify=false)</tt></td><td>Insert <span class="emphasis"><em>text</em></span> at position <span class="emphasis"><em>pos</em></span> in the buffer.</td></tr><tr><td><tt class="methodname">FXText#insertStyledText(pos, text, style=0, notify=false)</tt></td><td>Insert <span class="emphasis"><em>text</em></span> at position <span class="emphasis"><em>pos</em></span> in the buffer.</td></tr><tr><td><tt class="methodname">FXText#replaceText(pos, m, text, notify=false)</tt></td><td>Replace <span class="emphasis"><em>m</em></span> characters at <span class="emphasis"><em>pos</em></span> by <span class="emphasis"><em>text</em></span>.</td></tr><tr><td><tt class="methodname">FXText#replaceStyledText(pos, m, text, style=0, notify=false)</tt></td><td>Replace <span class="emphasis"><em>m</em></span> characters at <span class="emphasis"><em>pos</em></span> by <span class="emphasis"><em>text</em></span>.</td></tr><tr><td><tt class="methodname">FXText#setDelimiters(delimiters)</tt></td><td>Change delimiters of words (<span class="emphasis"><em>delimiters</em></span> is a string).</td></tr><tr><td><tt class="methodname">FXText#getDelimiters()</tt></td><td>Return word delimiters as a string.</td></tr><tr><td><tt class="methodname">FXWindow#cursorPosition</tt></td><td>Returns an array of integers [x, y, buttons]</td></tr><tr><td><tt class="methodname">FXWindow#translateCoordinatesFrom(window, x, y)</tt></td><td>Returns the translated coordinates as an array [x, y]</td></tr><tr><td><tt class="methodname">FXWindow#translateCoordinatesTo(window, x, y)</tt></td><td>Returns the translated coordinates as an array [x, y]</td></tr></tbody></table></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4086"></a>Iterators</h2></div></div><div></div></div><p>Several classes have been extended with an <tt class="methodname">each</tt> method to provide Ruby-style iterators. These classes include <tt class="classname">FXComboBox</tt>, <tt class="classname">FXGLGroup</tt>, <tt class="classname">FXHeader</tt>, <tt class="classname">FXIconList</tt>, <tt class="classname">FXList</tt>, <tt class="classname">FXListBox</tt>, <tt class="classname">FXTreeItem</tt>, <tt class="classname">FXTreeList</tt> and <tt class="classname">FXTreeListBox</tt>. These classes also mix-in Ruby's <tt class="classname">Enumerable</tt> module so that you can take full advantage of the iterators.</p><p>The block parameters passed to your code block vary depending on the class. For example, iterating over an <tt class="classname">FXList</tt> instance yields <tt class="classname">FXListItem</tt> parameters:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aList.each { |aListItem|
7
+ fprintf(stderr, "Current position is (%d, %d)\n", x, y);</pre><p>Since this idiom doesn't translate well to Ruby, some functions' interfaces have been slightly modified. For example, the FXRuby implementation of <code class="methodname">getCursorPos()</code> returns the three values as an <code class="classname">Array</code>, e.g.:</p><pre class="programlisting">x, y, buttons = aWindow.getCursorPos()</pre><p>The following table shows how these kinds of functions are implemented in FXRuby:</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><thead><tr><th align="center">Instance Method</th><th align="center">Return Value</th></tr></thead><tbody><tr><td><code class="methodname">FXDial#range</code></td><td>Returns a <code class="classname">Range</code> instance.</td></tr><tr><td><code class="methodname">FXDial#range=(aRange)</code></td><td>Accepts a <code class="classname">Range</code> instance as its input.</td></tr><tr><td><code class="methodname">FXFontDialog#fontSelection</code></td><td>Returns the <code class="classname">FXFontDesc</code> instance</td></tr><tr><td><code class="methodname">FXFontSelector#fontSelection</code></td><td>Returns the <code class="classname">FXFontDesc</code> instance</td></tr><tr><td><code class="methodname">FXGLObject#bounds(range)</code></td><td>Takes an <code class="classname">FXRange</code> instance as its input and returns a (possibly modified) <code class="classname">FXRange</code> instance.</td></tr><tr><td><code class="methodname">FXGLViewer#eyeToScreen(eye)</code></td><td>Takes an array of eye coordinates (floats) as its input and returns the screen point coordinate as an array of integers [sx, sy]</td></tr><tr><td><code class="methodname">FXGLViewer#getBoreVector(sx, sy)</code></td><td>Returns the endpoint and direction vector as an array of arrays [point, dir]</td></tr><tr><td><code class="methodname">FXGLViewer#light</code></td><td>Returns a <code class="classname">FXLight</code> instance</td></tr><tr><td><code class="methodname">FXGLViewer#viewport</code></td><td>Returns an <code class="classname">FXViewport</code> instance.</td></tr><tr><td><code class="methodname">FXPrinterDialog#printer</code></td><td>Returns the <code class="classname">FXPrinter</code> instance</td></tr><tr><td><code class="methodname">FXScrollArea#position</code></td><td>Returns the position as an array of integers [x, y]</td></tr><tr><td><code class="methodname">FXSlider#range</code></td><td>Returns a <code class="classname">Range</code> instance.</td></tr><tr><td><code class="methodname">FXSlider#range=(aRange)</code></td><td>Accepts a <code class="classname">Range</code> instance as its input.</td></tr><tr><td><code class="methodname">FXSpinner#range</code></td><td>Returns a <code class="classname">Range</code> instance.</td></tr><tr><td><code class="methodname">FXSpinner#range=(aRange)</code></td><td>Accepts a <code class="classname">Range</code> instance as its input.</td></tr><tr><td><code class="methodname">FXText#appendText(text, notify=false)</code></td><td>Append text to the end of the buffer.</td></tr><tr><td><code class="methodname">FXText#appendStyledText(text, style=0, notify=false)</code></td><td>Append styled text to the end of the buffer.</td></tr><tr><td><code class="methodname">FXText#extractText(pos, n)</code></td><td>Extracts <span class="emphasis"><em>n</em></span> characters from the buffer beginning at position <span class="emphasis"><em>pos</em></span> and returns the result as a String.</td></tr><tr><td><code class="methodname">FXText#extractStyle(pos, n)</code></td><td>Extracts <span class="emphasis"><em>n</em></span> style characters from the buffer beginning at position <span class="emphasis"><em>pos</em></span> and returns the result as a String.</td></tr><tr><td><code class="methodname">FXText#insertText(pos, text, notify=false)</code></td><td>Insert <span class="emphasis"><em>text</em></span> at position <span class="emphasis"><em>pos</em></span> in the buffer.</td></tr><tr><td><code class="methodname">FXText#insertStyledText(pos, text, style=0, notify=false)</code></td><td>Insert <span class="emphasis"><em>text</em></span> at position <span class="emphasis"><em>pos</em></span> in the buffer.</td></tr><tr><td><code class="methodname">FXText#replaceText(pos, m, text, notify=false)</code></td><td>Replace <span class="emphasis"><em>m</em></span> characters at <span class="emphasis"><em>pos</em></span> by <span class="emphasis"><em>text</em></span>.</td></tr><tr><td><code class="methodname">FXText#replaceStyledText(pos, m, text, style=0, notify=false)</code></td><td>Replace <span class="emphasis"><em>m</em></span> characters at <span class="emphasis"><em>pos</em></span> by <span class="emphasis"><em>text</em></span>.</td></tr><tr><td><code class="methodname">FXText#setDelimiters(delimiters)</code></td><td>Change delimiters of words (<span class="emphasis"><em>delimiters</em></span> is a string).</td></tr><tr><td><code class="methodname">FXText#getDelimiters()</code></td><td>Return word delimiters as a string.</td></tr><tr><td><code class="methodname">FXWindow#cursorPosition</code></td><td>Returns an array of integers [x, y, buttons]</td></tr><tr><td><code class="methodname">FXWindow#translateCoordinatesFrom(window, x, y)</code></td><td>Returns the translated coordinates as an array [x, y]</td></tr><tr><td><code class="methodname">FXWindow#translateCoordinatesTo(window, x, y)</code></td><td>Returns the translated coordinates as an array [x, y]</td></tr></tbody></table></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4086"></a>Iterators</h2></div></div></div><p>Several classes have been extended with an <code class="methodname">each</code> method to provide Ruby-style iterators. These classes include <code class="classname">FXComboBox</code>, <code class="classname">FXGLGroup</code>, <code class="classname">FXHeader</code>, <code class="classname">FXIconList</code>, <code class="classname">FXList</code>, <code class="classname">FXListBox</code>, <code class="classname">FXTreeItem</code>, <code class="classname">FXTreeList</code> and <code class="classname">FXTreeListBox</code>. These classes also mix-in Ruby's <code class="classname">Enumerable</code> module so that you can take full advantage of the iterators.</p><p>The block parameters passed to your code block vary depending on the class. For example, iterating over an <code class="classname">FXList</code> instance yields <code class="classname">FXListItem</code> parameters:</p><pre class="programlisting">aList.each { |aListItem|
8
8
  puts "text for this item = #{aListItem.getText()}"
9
- }</pre></td></tr></table><p>whereas iterating over an <tt class="classname">FXComboBox</tt> instance yields two parameters, the item text (a string) and the item data:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aComboBox.each { |itemText, itemData|
9
+ }</pre><p>whereas iterating over an <code class="classname">FXComboBox</code> instance yields two parameters, the item text (a string) and the item data:</p><pre class="programlisting">aComboBox.each { |itemText, itemData|
10
10
  puts "text for this item = #{itemText}"
11
- }</pre></td></tr></table><p>The following table shows the block parameters for each of these classes' iterators:</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><thead><tr><th align="center">Class</th><th align="center">Block Parameters</th></tr></thead><tbody><tr><td><tt class="classname">FXComboBox</tt></td><td>the item text (a string) and user data</td></tr><tr><td><tt class="classname">FXGLGroup</tt></td><td>an <tt class="classname">FXGLObject</tt> instance</td></tr><tr><td><tt class="classname">FXHeader</tt></td><td>an <tt class="classname">FXHeaderItem</tt> instance</td></tr><tr><td><tt class="classname">FXIconList</tt></td><td>an <tt class="classname">FXIconItem</tt> instance</td></tr><tr><td><tt class="classname">FXList</tt></td><td>an <tt class="classname">FXListItem</tt> instance</td></tr><tr><td><tt class="classname">FXListBox</tt></td><td>the item text (a string), icon (an <tt class="classname">FXIcon</tt> instance) and user data</td></tr><tr><td><tt class="classname">FXTreeItem</tt></td><td>an <tt class="classname">FXTreeItem</tt> instance</td></tr><tr><td><tt class="classname">FXTreeList</tt></td><td>an <tt class="classname">FXTreeItem</tt> instance</td></tr><tr><td><tt class="classname">FXTreeListBox</tt></td><td>an <tt class="classname">FXTreeItem</tt> instance</td></tr></tbody></table></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4230"></a>Attribute Accessors</h2></div></div><div></div></div><p>FOX strictly handles access to all object attributes through member functions, e.g. <tt class="methodname">setBackgroundColor</tt> and <tt class="methodname">getBackgroundColor</tt> or <tt class="methodname">setText</tt> and <tt class="methodname">getText</tt>. FXRuby exposes all of these functions but also provides aliases that look more like regular Ruby attribute accessors. The names for these accessors are based on the FOX method names; for example, <tt class="methodname">setBackgroundColor</tt> and <tt class="methodname">getBackgroundColor</tt> are aliased to <tt class="methodname">backgroundColor=</tt> and <tt class="methodname">backgroundColor</tt>, respectively.</p><p>In many cases these aliases allow you to write more compact and legible code. For example, consider this code snippet:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aLabel.setText(aLabel.getText() + " (modified)")</pre></td></tr></table><p>Now consider a different code snippet, using the aliased accessor method names:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aLabel.text += " (modified)"</pre></td></tr></table><p>While these two are functionally equivalent, the latter is a bit easier to read and understand at first glance.</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4269"></a>Message Passing</h2></div></div><div></div></div><p>FOX message maps are implemented as static C++ class members. With FXRuby, you just associate messages with message handlers in the class <tt class="methodname">initialize</tt> method using the <tt class="methodname">FXMAPFUNC()</tt>, <tt class="methodname">FXMAPTYPE()</tt>, <tt class="methodname">FXMAPTYPES()</tt> or <tt class="methodname">FXMAPFUNCS()</tt> methods. See almost any of the example programs for examples of how this is done.</p><p>As in C++ FOX, the last argument passed to your message handler functions contains message-specific data. For instance, all <tt class="constant">SEL_PAINT</tt> messages pass an <tt class="classname">FXEvent</tt> object through this argument to give you some information about the size of the exposed rectangle. On the other hand, a <tt class="constant">SEL_COMMAND</tt> message from an <tt class="classname">FXHeader</tt> object passes the index of the selected header item through this argument. Instead of guessing what's in this last argument, your best bet is to instead invoke a member function on the sending object to find out what you need, instead of relying on the data passed through this pointer. For example, if you get a <tt class="constant">SEL_COMMAND</tt> message from an <tt class="classname">FXColorWell</tt> object, the data passed through that last argument is supposed to be the new RGB color value. Instead of trying to interpret the argument's contents, just turn around and call the color well's <tt class="methodname">getRGBA()</tt> member function to retrieve its color. Similarly, if you get a <tt class="constant">SEL_COMMAND</tt> message from a tree list, call its <tt class="methodname">getCurrentItem()</tt> method to find out which item was selected.</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4318"></a>Catching Operating System Signals</h2></div></div><div></div></div><p>The <tt class="methodname">FXApp#addSignal</tt> and <tt class="methodname">FXApp#removeSignal</tt> methods have been enhanced to accept either a string or integer as their first argument. If it's a string (e.g. "SIGINT" or just "INT") the code will determine the corresponding signal number for you (similar to the standard Ruby library's <tt class="methodname">Process.kill</tt> module method). For examples of how to use this, see the <tt class="filename">datatarget.rb</tt> or <tt class="filename">imageviewer.rb</tt> example programs.</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4338"></a>Support for Multithreaded Applications</h2></div></div><div></div></div><p>There is some support for multithreaded FXRuby applications, but it's not wonderful. The current implementation does what is also done in Ruby/GTK; it turns over some idle processing time to the Ruby thread scheduler to let other threads do their thing. As I learn more about Ruby's threading implementation I may try something different, but this seems to work OK for now. For a simple example, see the <tt class="filename">groupbox.rb</tt> example program, in which the clock label that appears in the lower right-hand corner is continuously updated (by a separate thread).</p><p>If you suspect that FXRuby's threads support is interfering with your application's performance, you may want to try tweaking the amount of time that the main application thread "sleeps" during idle processing; do this by setting the <tt class="classname">FXApp</tt> object's <i class="structfield"><tt>sleepTime</tt></i> attribute. The default value for <i class="structfield"><tt>FXApp#sleepTime</tt></i> is 100 milliseconds. You can also disable the threads support completely by calling <tt class="methodname">FXApp#threadsEnabled=false</tt> (and subsequently re-enable it with <tt class="methodname">FXApp#threadsEnabled=true</tt>).</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4363"></a>Debugging Tricks</h2></div></div><div></div></div><p>As a debugging tool, you can optionally catch exceptions raised in message handlers. To turn on this feature, call the <tt class="methodname">setIgnoreExceptions(true)</tt> module method. When this is enabled, any exceptions raised in message handler functions will cause a standard stack trace to be dumped to the standard output, but then your application will, for better or worse, proceed normally. Thanks to Ted Meng for this suggestion.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="scintilla.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="pt02.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="library.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Appendix&nbsp;B.&nbsp;Using Scintilla with FXRuby&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Appendix&nbsp;D.&nbsp;The FXRuby Standard Library</td></tr></table></div></body></html>
11
+ }</pre><p>The following table shows the block parameters for each of these classes' iterators:</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><thead><tr><th align="center">Class</th><th align="center">Block Parameters</th></tr></thead><tbody><tr><td><code class="classname">FXComboBox</code></td><td>the item text (a string) and user data</td></tr><tr><td><code class="classname">FXGLGroup</code></td><td>an <code class="classname">FXGLObject</code> instance</td></tr><tr><td><code class="classname">FXHeader</code></td><td>an <code class="classname">FXHeaderItem</code> instance</td></tr><tr><td><code class="classname">FXIconList</code></td><td>an <code class="classname">FXIconItem</code> instance</td></tr><tr><td><code class="classname">FXList</code></td><td>an <code class="classname">FXListItem</code> instance</td></tr><tr><td><code class="classname">FXListBox</code></td><td>the item text (a string), icon (an <code class="classname">FXIcon</code> instance) and user data</td></tr><tr><td><code class="classname">FXTreeItem</code></td><td>an <code class="classname">FXTreeItem</code> instance</td></tr><tr><td><code class="classname">FXTreeList</code></td><td>an <code class="classname">FXTreeItem</code> instance</td></tr><tr><td><code class="classname">FXTreeListBox</code></td><td>an <code class="classname">FXTreeItem</code> instance</td></tr></tbody></table></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4230"></a>Attribute Accessors</h2></div></div></div><p>FOX strictly handles access to all object attributes through member functions, e.g. <code class="methodname">setBackgroundColor</code> and <code class="methodname">getBackgroundColor</code> or <code class="methodname">setText</code> and <code class="methodname">getText</code>. FXRuby exposes all of these functions but also provides aliases that look more like regular Ruby attribute accessors. The names for these accessors are based on the FOX method names; for example, <code class="methodname">setBackgroundColor</code> and <code class="methodname">getBackgroundColor</code> are aliased to <code class="methodname">backgroundColor=</code> and <code class="methodname">backgroundColor</code>, respectively.</p><p>In many cases these aliases allow you to write more compact and legible code. For example, consider this code snippet:</p><pre class="programlisting">aLabel.setText(aLabel.getText() + " (modified)")</pre><p>Now consider a different code snippet, using the aliased accessor method names:</p><pre class="programlisting">aLabel.text += " (modified)"</pre><p>While these two are functionally equivalent, the latter is a bit easier to read and understand at first glance.</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4269"></a>Message Passing</h2></div></div></div><p>FOX message maps are implemented as static C++ class members. With FXRuby, you just associate messages with message handlers in the class <code class="methodname">initialize</code> method using the <code class="methodname">FXMAPFUNC()</code>, <code class="methodname">FXMAPTYPE()</code>, <code class="methodname">FXMAPTYPES()</code> or <code class="methodname">FXMAPFUNCS()</code> methods. See almost any of the example programs for examples of how this is done.</p><p>As in C++ FOX, the last argument passed to your message handler functions contains message-specific data. For instance, all <code class="constant">SEL_PAINT</code> messages pass an <code class="classname">FXEvent</code> object through this argument to give you some information about the size of the exposed rectangle. On the other hand, a <code class="constant">SEL_COMMAND</code> message from an <code class="classname">FXHeader</code> object passes the index of the selected header item through this argument. Instead of guessing what's in this last argument, your best bet is to instead invoke a member function on the sending object to find out what you need, instead of relying on the data passed through this pointer. For example, if you get a <code class="constant">SEL_COMMAND</code> message from an <code class="classname">FXColorWell</code> object, the data passed through that last argument is supposed to be the new RGB color value. Instead of trying to interpret the argument's contents, just turn around and call the color well's <code class="methodname">getRGBA()</code> member function to retrieve its color. Similarly, if you get a <code class="constant">SEL_COMMAND</code> message from a tree list, call its <code class="methodname">getCurrentItem()</code> method to find out which item was selected.</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4318"></a>Catching Operating System Signals</h2></div></div></div><p>The <code class="methodname">FXApp#addSignal</code> and <code class="methodname">FXApp#removeSignal</code> methods have been enhanced to accept either a string or integer as their first argument. If it's a string (e.g. "SIGINT" or just "INT") the code will determine the corresponding signal number for you (similar to the standard Ruby library's <code class="methodname">Process.kill</code> module method). For examples of how to use this, see the <code class="filename">datatarget.rb</code> or <code class="filename">imageviewer.rb</code> example programs.</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4338"></a>Support for Multithreaded Applications</h2></div></div></div><p>There is some support for multithreaded FXRuby applications, but it's not wonderful. The current implementation does what is also done in Ruby/GTK; it turns over some idle processing time to the Ruby thread scheduler to let other threads do their thing. As I learn more about Ruby's threading implementation I may try something different, but this seems to work OK for now. For a simple example, see the <code class="filename">groupbox.rb</code> example program, in which the clock label that appears in the lower right-hand corner is continuously updated (by a separate thread).</p><p>If you suspect that FXRuby's threads support is interfering with your application's performance, you may want to try tweaking the amount of time that the main application thread "sleeps" during idle processing; do this by setting the <code class="classname">FXApp</code> object's <em class="structfield"><code>sleepTime</code></em> attribute. The default value for <em class="structfield"><code>FXApp#sleepTime</code></em> is 100 milliseconds. You can also disable the threads support completely by calling <code class="methodname">FXApp#threadsEnabled=false</code> (and subsequently re-enable it with <code class="methodname">FXApp#threadsEnabled=true</code>).</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4363"></a>Debugging Tricks</h2></div></div></div><p>As a debugging tool, you can optionally catch exceptions raised in message handlers. To turn on this feature, call the <code class="methodname">setIgnoreExceptions(true)</code> module method. When this is enabled, any exceptions raised in message handler functions will cause a standard stack trace to be dumped to the standard output, but then your application will, for better or worse, proceed normally. Thanks to Ted Meng for this suggestion.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="scintilla.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="pt02.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="library.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Appendix&nbsp;B.&nbsp;Using Scintilla with FXRuby&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Appendix&nbsp;D.&nbsp;The FXRuby Standard Library</td></tr></table></div></body></html>
data/doc/dragdroptut.html CHANGED
@@ -1,11 +1,11 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Chapter&nbsp;5.&nbsp;Drag and Drop</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="pt01.html" title="Part&nbsp;I.&nbsp;The Basics"><link rel="previous" href="ch04s04.html" title="Pasting Data from the Clipboard"><link rel="next" href="ch05s02.html" title="Drag Sources"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&nbsp;5.&nbsp;Drag and Drop</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s04.html">Prev</a>&nbsp;</td><th width="60%" align="center">Part&nbsp;I.&nbsp;The Basics</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch05s02.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="dragdroptut"></a>Chapter&nbsp;5.&nbsp;Drag and Drop</h2></div></div><div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="dragdroptut.html#d0e1201">Drop Sites</a></dt><dt><a href="ch05s02.html">Drag Sources</a></dt><dt><a href="ch05s03.html">Putting It All Together</a></dt></dl></div><p>One of the more powerful features available to FOX applications is
3
+ <title>Chapter&nbsp;5.&nbsp;Drag and Drop</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.68.1"><link rel="start" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="pt01.html" title="Part&nbsp;I.&nbsp;The Basics"><link rel="prev" href="ch04s04.html" title="Pasting Data from the Clipboard"><link rel="next" href="ch05s02.html" title="Drag Sources"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&nbsp;5.&nbsp;Drag and Drop</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s04.html">Prev</a>&nbsp;</td><th width="60%" align="center">Part&nbsp;I.&nbsp;The Basics</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch05s02.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="dragdroptut"></a>Chapter&nbsp;5.&nbsp;Drag and Drop</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="dragdroptut.html#d0e1201">Drop Sites</a></span></dt><dt><span class="section"><a href="ch05s02.html">Drag Sources</a></span></dt><dt><span class="section"><a href="ch05s03.html">Putting It All Together</a></span></dt></dl></div><p>One of the more powerful features available to FOX applications is
4
4
  drag-and-drop. It's also one of the more complicated to understand. For more
5
5
  background, see the standard FOX documentation on <a href="http://www.fox-toolkit.com/draganddrop.html" target="_top">Drag and
6
- Drop</a>.</p><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1201"></a>Drop Sites</h2></div></div><div></div></div><p>We're going to start by presenting a skeleton application consisting
7
- of a main window widget (a <tt class="classname">DropSite</tt> instance) that
8
- parents an <tt class="classname">FXCanvas</tt> widget:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">require 'rubygems'
6
+ Drop</a>.</p><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1201"></a>Drop Sites</h2></div></div></div><p>We're going to start by presenting a skeleton application consisting
7
+ of a main window widget (a <code class="classname">DropSite</code> instance) that
8
+ parents an <code class="classname">FXCanvas</code> widget:</p><pre class="programlisting">require 'rubygems'
9
9
  require_gem 'fxruby'
10
10
 
11
11
  include Fox
@@ -35,13 +35,13 @@ if __FILE__ == $0
35
35
  theApp.run
36
36
  end
37
37
  end
38
- </pre></td></tr></table><p>Since the main program (i.e. the part at the end) won't change for
38
+ </pre><p>Since the main program (i.e. the part at the end) won't change for
39
39
  the rest of the tutorial, I won't show that code anymore. Since an
40
- <tt class="classname">FXCanvas</tt> widget relies on some other object (its
40
+ <code class="classname">FXCanvas</code> widget relies on some other object (its
41
41
  message target) to draw its contents, we need to handle
42
- <tt class="constant">SEL_PAINT</tt> messages generated by the canvas. We'll do
42
+ <code class="constant">SEL_PAINT</code> messages generated by the canvas. We'll do
43
43
  that by adding a handler that clears the canvas to its current background
44
- color:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">require 'rubygems'
44
+ color:</p><pre class="programlisting">require 'rubygems'
45
45
  require_gem 'fxruby'
46
46
 
47
47
  include Fox
@@ -54,13 +54,13 @@ class DropSite &lt; FXMainWindow
54
54
  # Fill main window with canvas
55
55
  @canvas = FXCanvas.new(self, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y)
56
56
 
57
- <span class="bold"><b> # Handle expose events on the canvas
57
+ <span class="bold"><strong> # Handle expose events on the canvas
58
58
  @canvas.connect(SEL_PAINT) { |sender, sel, event|
59
59
  FXDCWindow.new(@canvas, event) { |dc|
60
60
  dc.foreground = @canvas.backColor
61
61
  dc.fillRectangle(event.rect.x, event.rect.y, event.rect.w, event.rect.h)
62
62
  }
63
- }</b></span>
63
+ }</strong></span>
64
64
  end
65
65
 
66
66
  def create
@@ -71,14 +71,14 @@ class DropSite &lt; FXMainWindow
71
71
  show(PLACEMENT_SCREEN)
72
72
  end
73
73
  end
74
- </pre></td></tr></table><p>Run this basic version of the program to be sure that it's working
74
+ </pre><p>Run this basic version of the program to be sure that it's working
75
75
  properly so far. You should simply see an empty window with a white
76
76
  background.</p><p>Now, on to the fun stuff. Our goal is to be able to drag color data
77
- from some other window, such as an <tt class="classname">FXColorWell</tt>
77
+ from some other window, such as an <code class="classname">FXColorWell</code>
78
78
  widget, and drop it onto the canvas in order to change the canvas'
79
79
  background color. In order for a FOX widget to be able to accept drops at
80
- all, we need to first call its <tt class="methodname">dropEnable()</tt>
81
- method:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">def initialize(anApp)
80
+ all, we need to first call its <code class="methodname">dropEnable()</code>
81
+ method:</p><pre class="programlisting">def initialize(anApp)
82
82
  # Initialize base class
83
83
  super(anApp, "Drop Site", nil, nil, DECOR_ALL, 0, 0, 400, 300)
84
84
 
@@ -93,10 +93,10 @@ end
93
93
  }
94
94
  }
95
95
 
96
- <span class="bold"><b> # Enable canvas for drag-and-drop messages
96
+ <span class="bold"><strong> # Enable canvas for drag-and-drop messages
97
97
  @canvas.dropEnable
98
- </b></span>end
99
- </pre></td></tr></table><p>At this point, let's try a little test to see if the program does
98
+ </strong></span>end
99
+ </pre><p>At this point, let's try a little test to see if the program does
100
100
  anything interesting yet. Start by running some other FOX or FXRuby
101
101
  program to use as a drag source for the color data. You should be able to
102
102
  use any program that displays an FXColorWell widget, and this includes the
@@ -106,15 +106,15 @@ end
106
106
  and try to drag a color from one of these color wells onto this window. At
107
107
  this point, the mouse pointer should turn into a stop sign, indicating
108
108
  that the canvas isn't accepting drops of color data yet.</p><p>To correct this problem, we need to use the canvas'
109
- <tt class="methodname">acceptDrop()</tt> method to indicate whether or not
109
+ <code class="methodname">acceptDrop()</code> method to indicate whether or not
110
110
  we'll accept certain kinds of drops. You can call
111
- <tt class="methodname">acceptDrop()</tt> any time after receiving the initial
112
- <tt class="constant">SEL_DND_ENTER</tt> message, but it's usually done in
113
- response to a <tt class="constant">SEL_DND_MOTION</tt> message. Let's add a
114
- handler for <tt class="constant">SEL_DND_MOTION</tt> messages from the canvas
111
+ <code class="methodname">acceptDrop()</code> any time after receiving the initial
112
+ <code class="constant">SEL_DND_ENTER</code> message, but it's usually done in
113
+ response to a <code class="constant">SEL_DND_MOTION</code> message. Let's add a
114
+ handler for <code class="constant">SEL_DND_MOTION</code> messages from the canvas
115
115
  in DropSite's initialize() method. For now, we'll unconditionally accept
116
116
  drops from any drag source, regardless of what kind of data they're
117
- offering:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">def initialize(anApp)
117
+ offering:</p><pre class="programlisting">def initialize(anApp)
118
118
  # Initialize base class
119
119
  super(anApp, "Drop Site", nil, nil, DECOR_ALL, 0, 0, 400, 300)
120
120
 
@@ -132,13 +132,13 @@ end
132
132
  # Enable canvas for drag-and-drop messages
133
133
  @canvas.dropEnable
134
134
 
135
- <span class="bold"><b> # Handle SEL_DND_MOTION messages from the canvas
135
+ <span class="bold"><strong> # Handle SEL_DND_MOTION messages from the canvas
136
136
  @canvas.connect(SEL_DND_MOTION) {
137
137
  # Accept drops unconditionally (for now)
138
138
  @canvas.acceptDrop
139
139
  }
140
- </b></span>end
141
- </pre></td></tr></table><p>Now try the previous test again. This time, when you try to drag
140
+ </strong></span>end
141
+ </pre><p>Now try the previous test again. This time, when you try to drag
142
142
  from a color well to the drop-enabled canvas, you should see the mouse
143
143
  pointer turn into a small filled square. This is a visual cue to the user
144
144
  indicating that the canvas will accept a drop of the drag-and-drop
@@ -152,35 +152,35 @@ end
152
152
  types for any kind of application-specific data that you need; but for
153
153
  now, we're going to use FOX's built-in drag type for color data.</p><p>Drag types (even the standard ones) must be registered before they
154
154
  can be used, and so we'll start by adding a few lines to
155
- <tt class="classname">DropSite</tt>'s <tt class="methodname">create()</tt> method
156
- to register the drag type for color data:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">def create
155
+ <code class="classname">DropSite</code>'s <code class="methodname">create()</code> method
156
+ to register the drag type for color data:</p><pre class="programlisting">def create
157
157
  # Create the main window and canvas
158
158
  super
159
159
 
160
- <span class="bold"><b> # Register the drag type for colors
160
+ <span class="bold"><strong> # Register the drag type for colors
161
161
  FXWindow.colorType = getApp().registerDragType(FXWindow.colorTypeName)
162
162
 
163
- </b></span> # Show the main window
163
+ </strong></span> # Show the main window
164
164
  show(PLACEMENT_SCREEN)
165
165
  end
166
- </pre></td></tr></table><p>Note that the first time that
167
- <tt class="methodname">registerDragType()</tt> is called for a particular
168
- drag type name (such as <tt class="methodname">FXWindow.colorTypeName</tt>)
166
+ </pre><p>Note that the first time that
167
+ <code class="methodname">registerDragType()</code> is called for a particular
168
+ drag type name (such as <code class="methodname">FXWindow.colorTypeName</code>)
169
169
  it will generate a unique identifier for that drag type. Subsequent calls
170
- to <tt class="methodname">registerDragType()</tt> for the same drag type name
170
+ to <code class="methodname">registerDragType()</code> for the same drag type name
171
171
  will just return the previously-generated drag type. Now, we want to
172
- modify our <tt class="constant">SEL_DND_MOTION</tt> handler so that it's a
173
- little more picky about which kinds of drops it will accept:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"># Handle SEL_DND_MOTION messages from the canvas
172
+ modify our <code class="constant">SEL_DND_MOTION</code> handler so that it's a
173
+ little more picky about which kinds of drops it will accept:</p><pre class="programlisting"># Handle SEL_DND_MOTION messages from the canvas
174
174
  @canvas.connect(SEL_DND_MOTION) {
175
- <span class="bold"><b> if @canvas.offeredDNDType?(FROM_DRAGNDROP, FXWindow.colorType)
175
+ <span class="bold"><strong> if @canvas.offeredDNDType?(FROM_DRAGNDROP, FXWindow.colorType)
176
176
  @canvas.acceptDrop
177
177
  end
178
- </b></span>}
179
- </pre></td></tr></table><p>Here, we call the canvas' <tt class="methodname">offeredDNDType?</tt>
178
+ </strong></span>}
179
+ </pre><p>Here, we call the canvas' <code class="methodname">offeredDNDType?</code>
180
180
  method to ask if the drag source can provide its data in the requested
181
- format. Only if <tt class="methodname">offeredDNDType?</tt> returns true will
182
- we call <tt class="methodname">acceptDrop()</tt> as before.</p><p>The last step is to actually handle the drop, and for that we add a
183
- handler for the <tt class="constant">SEL_DND_DROP</tt> message:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><span class="bold"><b># Handle SEL_DND_DROP message from the canvas
181
+ format. Only if <code class="methodname">offeredDNDType?</code> returns true will
182
+ we call <code class="methodname">acceptDrop()</code> as before.</p><p>The last step is to actually handle the drop, and for that we add a
183
+ handler for the <code class="constant">SEL_DND_DROP</code> message:</p><pre class="programlisting"><span class="bold"><strong># Handle SEL_DND_DROP message from the canvas
184
184
  @canvas.connect(SEL_DND_DROP) {
185
185
  # Try to obtain the data as color values first
186
186
  data = @canvas.getDNDData(FROM_DRAGNDROP, FXWindow.colorType)
@@ -188,21 +188,21 @@ end
188
188
  # Update canvas background color
189
189
  @canvas.backColor = Fox.fxdecodeColorData(data)
190
190
  end
191
- }</b></span></pre></td></tr></table><p>Assuming that the drag source is able to provide its data in the
192
- requested format, the <tt class="methodname">getDNDData()</tt> method will
191
+ }</strong></span></pre><p>Assuming that the drag source is able to provide its data in the
192
+ requested format, the <code class="methodname">getDNDData()</code> method will
193
193
  return a String (which for our purposes is just a byte buffer). If you've
194
194
  defined your own application-specific drag types, this data can of course
195
195
  be anything, and we'll see examples of this in a later tutorial. But the
196
196
  data for standard drag types like
197
- <tt class="methodname">FXWindow.colorType</tt> can be decoded using the
197
+ <code class="methodname">FXWindow.colorType</code> can be decoded using the
198
198
  appropriate built-in library functions. In this case, we use the
199
- <tt class="methodname">fxdecodeColorData()</tt> method to convert the bytes
199
+ <code class="methodname">fxdecodeColorData()</code> method to convert the bytes
200
200
  into a color value that we can use.</p><p>Now comes the moment of truth. Try running your test program again
201
201
  (one that displays a color well). Now, when you drag a color from a color
202
- well and drop it onto the <tt class="classname">DropSite</tt> window, the
202
+ well and drop it onto the <code class="classname">DropSite</code> window, the
203
203
  canvas should change its background color accordingly.</p><p>The complete program is listed below, and is included in the
204
- <tt class="filename">examples</tt> directory under the file
205
- name <tt class="filename">dropsite.rb</tt>.</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">require 'rubygems'
204
+ <code class="filename">examples</code> directory under the file
205
+ name <code class="filename">dropsite.rb</code>.</p><pre class="programlisting">require 'rubygems'
206
206
  require_gem 'fxruby'
207
207
 
208
208
  include Fox
@@ -263,4 +263,4 @@ if __FILE__ == $0
263
263
  theApp.run
264
264
  end
265
265
  end
266
- </pre></td></tr></table></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch04s04.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="pt01.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="ch05s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Pasting Data from the Clipboard&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Drag Sources</td></tr></table></div></body></html>
266
+ </pre></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch04s04.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="pt01.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="ch05s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Pasting Data from the Clipboard&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Drag Sources</td></tr></table></div></body></html>
data/doc/events.html CHANGED
@@ -1,36 +1,36 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Chapter&nbsp;7.&nbsp;FXRuby's Message-Target System</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="pt01.html" title="Part&nbsp;I.&nbsp;The Basics"><link rel="previous" href="examples.html" title="Chapter&nbsp;6.&nbsp;Examples"><link rel="next" href="todo.html" title="Chapter&nbsp;8.&nbsp;To-do list"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&nbsp;7.&nbsp;FXRuby's Message-Target System</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="examples.html">Prev</a>&nbsp;</td><th width="60%" align="center">Part&nbsp;I.&nbsp;The Basics</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="todo.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="events"></a>Chapter&nbsp;7.&nbsp;FXRuby's Message-Target System</h2></div></div><div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2027"></a>Background</h2></div></div><div></div></div><p>One of the biggest flaws with earlier releases of FXRuby was its strict reproduction of FOX's process for mapping GUI events (messages) to instance methods (handlers). That process involved four distinct steps:</p><div class="orderedlist"><ol type="1" compact><li><p>Initializing a <span class="emphasis"><em>message identifier</em></span>, an integer that helps to disambiguate the sender of the message and/or its purpose.</p></li><li><p>Mapping a specific message type and identifier to an instance method for the message target object.</p></li><li><p>Implementing the actual handler method in the message target.</p></li><li><p>Registering the message target and message identifier with the widget that's going to send the messages.</p></li></ol></div><p>So, for example, let's say you wanted to create a button widget that, when pressed, prints the string "Ouch!" to the terminal. In the old scheme of things, you'd need to identify some object to act as the target for any messages generated by this button. To keep things simple, let's say that the application's main window (<span class="emphasis"><em>mainWindow</em></span>) is designated as the target for the button. We'll need to generate a unique identifier associated with the button:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">class MyMainWindow &lt; FXMainWindow
3
+ <title>Chapter&nbsp;7.&nbsp;FXRuby's Message-Target System</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.68.1"><link rel="start" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="pt01.html" title="Part&nbsp;I.&nbsp;The Basics"><link rel="prev" href="examples.html" title="Chapter&nbsp;6.&nbsp;Examples"><link rel="next" href="todo.html" title="Chapter&nbsp;8.&nbsp;To-do list"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&nbsp;7.&nbsp;FXRuby's Message-Target System</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="examples.html">Prev</a>&nbsp;</td><th width="60%" align="center">Part&nbsp;I.&nbsp;The Basics</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="todo.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="events"></a>Chapter&nbsp;7.&nbsp;FXRuby's Message-Target System</h2></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2027"></a>Background</h2></div></div></div><p>One of the biggest flaws with earlier releases of FXRuby was its strict reproduction of FOX's process for mapping GUI events (messages) to instance methods (handlers). That process involved four distinct steps:</p><div class="orderedlist"><ol type="1" compact><li><p>Initializing a <span class="emphasis"><em>message identifier</em></span>, an integer that helps to disambiguate the sender of the message and/or its purpose.</p></li><li><p>Mapping a specific message type and identifier to an instance method for the message target object.</p></li><li><p>Implementing the actual handler method in the message target.</p></li><li><p>Registering the message target and message identifier with the widget that's going to send the messages.</p></li></ol></div><p>So, for example, let's say you wanted to create a button widget that, when pressed, prints the string "Ouch!" to the terminal. In the old scheme of things, you'd need to identify some object to act as the target for any messages generated by this button. To keep things simple, let's say that the application's main window (<span class="emphasis"><em>mainWindow</em></span>) is designated as the target for the button. We'll need to generate a unique identifier associated with the button:</p><pre class="programlisting">class MyMainWindow &lt; FXMainWindow
4
4
 
5
5
  include Responder
6
6
 
7
7
  ID_BUTTON = FXMainWindow::ID_LAST
8
8
 
9
9
  ... other stuff ...
10
- end</pre></td></tr></table><p>Next, you'd want to specify the mapping for a specific message type to the target's instance method that handles that message:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">FXMAPFUNC(SEL_COMMAND, MyMainWindow::ID_BUTTON, 'onCmdButton')</pre></td></tr></table><p>Finally, you'd need to implement the instance method (<tt class="methodname">onCmdButton</tt>) named in the call to <tt class="methodname">FXMAPFUNC</tt>:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">def onCmdButton(sender, sel, ptr)
10
+ end</pre><p>Next, you'd want to specify the mapping for a specific message type to the target's instance method that handles that message:</p><pre class="programlisting">FXMAPFUNC(SEL_COMMAND, MyMainWindow::ID_BUTTON, 'onCmdButton')</pre><p>Finally, you'd need to implement the instance method (<code class="methodname">onCmdButton</code>) named in the call to <code class="methodname">FXMAPFUNC</code>:</p><pre class="programlisting">def onCmdButton(sender, sel, ptr)
11
11
  puts "Ouch!"
12
- end</pre></td></tr></table><p>The last step is to tell the button who it's message target is, and which message identifier to use when sending messages to that target:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aButton = FXButton.new(parent, "Push Me", nil, mainWindow, ID_BUTTON)</pre></td></tr></table><p>This was an extremely tedious process, especially for programmers who are used to Ruby/Tk's or Ruby/GTK's approach for connecting signals (events) to blocks that handle the signal. After some discussions at RubyConf 2001 and subsequent discussions on the Ruby newsgroup, a new model was proposed and hashed out on the RubyGarden Wiki. This new model was introduced with the FXRuby-0.99.179 release.</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2075"></a>Event Model</h2></div></div><div></div></div><p>FXRuby implements a new, simplified approach to this built on top of the old model. It more or less mimics the syntax used in Ruby/GTK; you can attach a message handler block to a widget using a new <tt class="methodname">connect</tt> instance method, e.g.</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aButton = FXButton.new(parent, "Push Me")
12
+ end</pre><p>The last step is to tell the button who it's message target is, and which message identifier to use when sending messages to that target:</p><pre class="programlisting">aButton = FXButton.new(parent, "Push Me", nil, mainWindow, ID_BUTTON)</pre><p>This was an extremely tedious process, especially for programmers who are used to Ruby/Tk's or Ruby/GTK's approach for connecting signals (events) to blocks that handle the signal. After some discussions at RubyConf 2001 and subsequent discussions on the Ruby newsgroup, a new model was proposed and hashed out on the RubyGarden Wiki. This new model was introduced with the FXRuby-0.99.179 release.</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2075"></a>Event Model</h2></div></div></div><p>FXRuby implements a new, simplified approach to this built on top of the old model. It more or less mimics the syntax used in Ruby/GTK; you can attach a message handler block to a widget using a new <code class="methodname">connect</code> instance method, e.g.</p><pre class="programlisting">aButton = FXButton.new(parent, "Push Me")
13
13
  aButton.connect(SEL_COMMAND) { |sender, sel, ptr|
14
14
  puts "Ouch!"
15
- }</pre></td></tr></table><p>Alternate forms of the <tt class="methodname">FXObject#connect</tt> method can take either a <tt class="classname">Method</tt> or <tt class="classname">Proc</tt> instance as a second argument (i.e. instead of attaching a block), e.g.</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">def push(sender, sel, ptr)
15
+ }</pre><p>Alternate forms of the <code class="methodname">FXObject#connect</code> method can take either a <code class="classname">Method</code> or <code class="classname">Proc</code> instance as a second argument (i.e. instead of attaching a block), e.g.</p><pre class="programlisting">def push(sender, sel, ptr)
16
16
  puts "Ouch!"
17
17
  end
18
18
 
19
19
  aButton = FXButton.new(parent, "Push Me")
20
- aButton.connect(SEL_COMMAND, method(:push))</pre></td></tr></table><p>It works by creating a special target object (behind the scenes) that stands-in as the message target for your widget and passes off incoming messages to the appropriate block. The single argument to <tt class="methodname">connect</tt> is the FOX message type you're handling (e.g. <tt class="constant">SEL_COMMAND</tt>, <tt class="constant">SEL_CHANGED</tt>, etc.) The three arguments to the block are the same as those for regular FOX message handler methods, namely, the sender object, the message type and identifier and the message data. And of course, for simple handlers like this one, you can just leave the arguments off altogether:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aButton = FXButton.new(parent, "Push Me")
21
- aButton.connect(SEL_COMMAND) { puts "Ouch!" }</pre></td></tr></table></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2111"></a>Timers</h2></div></div><div></div></div><p>Timers are scheduled by calling <tt class="methodname">FXApp#addTimeout</tt>. There are three different forms of <tt class="methodname">addTimeout</tt>, but the first argument to each is the timeout interval in milliseconds. The most primitive version of this method takes two additional arguments to specify the target object and message identifier for the object that will handle the timeout event:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aTimer = getApp().addTimeout(1000, timeoutHandlerObj, ID_TIMER)</pre></td></tr></table><p>The second form takes either a <tt class="classname">Method</tt> or <tt class="classname">Proc</tt> instance as its second argument, e.g.</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aTimer = getApp().addTimeout(1000, method(:timeoutHandlerMethod))</pre></td></tr></table><p>The last form uses a code block as the handler for the timeout event:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aTimer = getApp().addTimeout(1000) { |sender, sel, ptr|
20
+ aButton.connect(SEL_COMMAND, method(:push))</pre><p>It works by creating a special target object (behind the scenes) that stands-in as the message target for your widget and passes off incoming messages to the appropriate block. The single argument to <code class="methodname">connect</code> is the FOX message type you're handling (e.g. <code class="constant">SEL_COMMAND</code>, <code class="constant">SEL_CHANGED</code>, etc.) The three arguments to the block are the same as those for regular FOX message handler methods, namely, the sender object, the message type and identifier and the message data. And of course, for simple handlers like this one, you can just leave the arguments off altogether:</p><pre class="programlisting">aButton = FXButton.new(parent, "Push Me")
21
+ aButton.connect(SEL_COMMAND) { puts "Ouch!" }</pre></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2111"></a>Timers</h2></div></div></div><p>Timers are scheduled by calling <code class="methodname">FXApp#addTimeout</code>. There are three different forms of <code class="methodname">addTimeout</code>, but the first argument to each is the timeout interval in milliseconds. The most primitive version of this method takes two additional arguments to specify the target object and message identifier for the object that will handle the timeout event:</p><pre class="programlisting">aTimer = getApp().addTimeout(1000, timeoutHandlerObj, ID_TIMER)</pre><p>The second form takes either a <code class="classname">Method</code> or <code class="classname">Proc</code> instance as its second argument, e.g.</p><pre class="programlisting">aTimer = getApp().addTimeout(1000, method(:timeoutHandlerMethod))</pre><p>The last form uses a code block as the handler for the timeout event:</p><pre class="programlisting">aTimer = getApp().addTimeout(1000) { |sender, sel, ptr|
22
22
  # handle this timeout event
23
- }</pre></td></tr></table></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2138"></a>Chores</h2></div></div><div></div></div><p>Chores are scheduled by calling <tt class="methodname">FXApp#addChore</tt>. There are three different forms of <tt class="methodname">addChore</tt>; the most primitive version requires two arguments to specify the target object and message identifier for the object that will handle the chore event:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aChore = getApp().addChore(choreHandlerObj, ID_CHORE)</pre></td></tr></table><p>The second form takes either a <tt class="classname">Method</tt> or <tt class="classname">Proc</tt> instance as its single argument, e.g.</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aChore = getApp().addChore(method(:choreHandlerMethod))</pre></td></tr></table><p>The last form uses a code block as the handler for the chore:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aChore = getApp().addChore { |sender, sel, ptr|
23
+ }</pre></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2138"></a>Chores</h2></div></div></div><p>Chores are scheduled by calling <code class="methodname">FXApp#addChore</code>. There are three different forms of <code class="methodname">addChore</code>; the most primitive version requires two arguments to specify the target object and message identifier for the object that will handle the chore event:</p><pre class="programlisting">aChore = getApp().addChore(choreHandlerObj, ID_CHORE)</pre><p>The second form takes either a <code class="classname">Method</code> or <code class="classname">Proc</code> instance as its single argument, e.g.</p><pre class="programlisting">aChore = getApp().addChore(method(:choreHandlerMethod))</pre><p>The last form uses a code block as the handler for the chore:</p><pre class="programlisting">aChore = getApp().addChore { |sender, sel, ptr|
24
24
  # handle this chore
25
- }</pre></td></tr></table></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2165"></a>Signals</h2></div></div><div></div></div><p>Operating system signal handlers are designated by calling <tt class="methodname">FXApp#addSignal</tt>. There are three different forms of <tt class="methodname">addSignal</tt>, but the first argument to each is the signal name (e.g. "SIGINT") or number. Each version also has two optional arguments (which should come at the end of the list) to specify <i class="parameter"><tt>immediate</tt></i> and <i class="parameter"><tt>flags</tt></i>. The most primitive version of this method takes two additional arguments to specify the target object and message identifier for the object that will handle this operating system signal:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aSignal = getApp().addSignal("SIGINT", signalHandlerObj, ID_SIGINT)</pre></td></tr></table><p>The second form takes either a <tt class="classname">Method</tt> or <tt class="classname">Proc</tt> instance as its second argument, e.g.</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aSignal = getApp().addSignal("SIGINT", method(:signalHandlerMethod))</pre></td></tr></table><p>The last form uses a code block as the handler for the signal:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aSignal = getApp().addSignal("SIGINT") { |sender, sel, ptr|
25
+ }</pre></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2165"></a>Signals</h2></div></div></div><p>Operating system signal handlers are designated by calling <code class="methodname">FXApp#addSignal</code>. There are three different forms of <code class="methodname">addSignal</code>, but the first argument to each is the signal name (e.g. "SIGINT") or number. Each version also has two optional arguments (which should come at the end of the list) to specify <em class="parameter"><code>immediate</code></em> and <em class="parameter"><code>flags</code></em>. The most primitive version of this method takes two additional arguments to specify the target object and message identifier for the object that will handle this operating system signal:</p><pre class="programlisting">aSignal = getApp().addSignal("SIGINT", signalHandlerObj, ID_SIGINT)</pre><p>The second form takes either a <code class="classname">Method</code> or <code class="classname">Proc</code> instance as its second argument, e.g.</p><pre class="programlisting">aSignal = getApp().addSignal("SIGINT", method(:signalHandlerMethod))</pre><p>The last form uses a code block as the handler for the signal:</p><pre class="programlisting">aSignal = getApp().addSignal("SIGINT") { |sender, sel, ptr|
26
26
  # handle this signal
27
- }</pre></td></tr></table></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2198"></a>Input Events</h2></div></div><div></div></div><p>Input event handlers are designated by calling <tt class="methodname">FXApp#addInput</tt>. There are three different forms of <tt class="methodname">addInput</tt>, but the first two arguments to each are the file object (including sockets) and the mode flag (some combination of <tt class="constant">INPUT_READ</tt>, <tt class="constant">INPUT_WRITE</tt> and <tt class="constant">INPUT_EXCEPT</tt>). The most primitive version of this method takes two additional arguments to specify the target object and message identifier for the object that will handle this input event:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">getApp().addInput(aFile, INPUT_READ, inputHandlerObj, ID_INPUT)</pre></td></tr></table><p>The second form takes either a <tt class="classname">Method</tt> or <tt class="classname">Proc</tt> instance as its third argument, e.g.</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">getApp().addInput(aSocket, INPUT_READ|INPUT_EXCEPT, method(:inputHandlerMethod))</pre></td></tr></table><p>The last form uses a code block as the handler for the input event:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">getApp().addInput(aFile, INPUT_WRITE|INPUT_EXCEPT) { |sender, sel, ptr|
27
+ }</pre></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2198"></a>Input Events</h2></div></div></div><p>Input event handlers are designated by calling <code class="methodname">FXApp#addInput</code>. There are three different forms of <code class="methodname">addInput</code>, but the first two arguments to each are the file object (including sockets) and the mode flag (some combination of <code class="constant">INPUT_READ</code>, <code class="constant">INPUT_WRITE</code> and <code class="constant">INPUT_EXCEPT</code>). The most primitive version of this method takes two additional arguments to specify the target object and message identifier for the object that will handle this input event:</p><pre class="programlisting">getApp().addInput(aFile, INPUT_READ, inputHandlerObj, ID_INPUT)</pre><p>The second form takes either a <code class="classname">Method</code> or <code class="classname">Proc</code> instance as its third argument, e.g.</p><pre class="programlisting">getApp().addInput(aSocket, INPUT_READ|INPUT_EXCEPT, method(:inputHandlerMethod))</pre><p>The last form uses a code block as the handler for the input event:</p><pre class="programlisting">getApp().addInput(aFile, INPUT_WRITE|INPUT_EXCEPT) { |sender, sel, ptr|
28
28
  # handle this input
29
- }</pre></td></tr></table><p>This API is a little different from the other cases. For example, timeout events always send the same message type (<tt class="constant">SEL_TIMEOUT</tt>) to their message target, so you just have a single handler method (or block) to handle the timeout. In contrast, input sources (e.g. pipes or sockets) can generate three different FOX messages, <tt class="constant">SEL_IO_READ</tt>, <tt class="constant">SEL_IO_WRITE</tt> and <tt class="constant">SEL_IO_EXCEPTION</tt>, depending on what happens, so your handler method (block) needs to check the message type, e.g.</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">getApp().addInput(socket, INPUT_READ|INPUT_WRITE) { |sender, sel, ptr|
29
+ }</pre><p>This API is a little different from the other cases. For example, timeout events always send the same message type (<code class="constant">SEL_TIMEOUT</code>) to their message target, so you just have a single handler method (or block) to handle the timeout. In contrast, input sources (e.g. pipes or sockets) can generate three different FOX messages, <code class="constant">SEL_IO_READ</code>, <code class="constant">SEL_IO_WRITE</code> and <code class="constant">SEL_IO_EXCEPTION</code>, depending on what happens, so your handler method (block) needs to check the message type, e.g.</p><pre class="programlisting">getApp().addInput(socket, INPUT_READ|INPUT_WRITE) { |sender, sel, ptr|
30
30
  case SELTYPE(sel)
31
31
  when SEL_IO_READ
32
32
  # handle read event
33
33
  when SEL_IO_WRITE
34
34
  # handle write event
35
35
  end
36
- }</pre></td></tr></table></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="examples.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="pt01.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="todo.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter&nbsp;6.&nbsp;Examples&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Chapter&nbsp;8.&nbsp;To-do list</td></tr></table></div></body></html>
36
+ }</pre></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="examples.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="pt01.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="todo.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter&nbsp;6.&nbsp;Examples&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Chapter&nbsp;8.&nbsp;To-do list</td></tr></table></div></body></html>
data/doc/examples.html CHANGED
@@ -1,24 +1,24 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Chapter&nbsp;6.&nbsp;Examples</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="pt01.html" title="Part&nbsp;I.&nbsp;The Basics"><link rel="previous" href="ch05s03.html" title="Putting It All Together"><link rel="next" href="events.html" title="Chapter&nbsp;7.&nbsp;FXRuby's Message-Target System"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&nbsp;6.&nbsp;Examples</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch05s03.html">Prev</a>&nbsp;</td><th width="60%" align="center">Part&nbsp;I.&nbsp;The Basics</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="events.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="examples"></a>Chapter&nbsp;6.&nbsp;Examples</h2></div></div><div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1600"></a>hello</h2></div></div><div></div></div><p>The <a href="../examples/hello.rb" target="_top"><tt class="filename">hello.rb</tt></a>
3
+ <title>Chapter&nbsp;6.&nbsp;Examples</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.68.1"><link rel="start" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="pt01.html" title="Part&nbsp;I.&nbsp;The Basics"><link rel="prev" href="ch05s03.html" title="Putting It All Together"><link rel="next" href="events.html" title="Chapter&nbsp;7.&nbsp;FXRuby's Message-Target System"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&nbsp;6.&nbsp;Examples</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch05s03.html">Prev</a>&nbsp;</td><th width="60%" align="center">Part&nbsp;I.&nbsp;The Basics</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="events.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="examples"></a>Chapter&nbsp;6.&nbsp;Examples</h2></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1600"></a>hello</h2></div></div></div><p>The <a href="../examples/hello.rb" target="_top"><code class="filename">hello.rb</code></a>
4
4
  example program is about as short as it gets for a working FXRuby program.
5
5
  Use this as a starting point for understanding the basic elements of an
6
6
  FXRuby program, especially if you're new to GUI programming in
7
- general.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/hello.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1613"></a>hello2</h2></div></div><div></div></div><p>The <a href="../examples/hello2.rb" target="_top"><tt class="filename">hello2.rb</tt></a>
7
+ general.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/hello.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1613"></a>hello2</h2></div></div></div><p>The <a href="../examples/hello2.rb" target="_top"><code class="filename">hello2.rb</code></a>
8
8
  example kicks it up a notch by adding an icon and tooltip to the button
9
- from the <tt class="filename">hello.rb</tt> example.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/hello2.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1629"></a>scribble</h2></div></div><div></div></div><p>The <a href="../examples/scribble.rb" target="_top"><tt class="filename">scribble.rb</tt></a>
9
+ from the <code class="filename">hello.rb</code> example.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/hello2.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1629"></a>scribble</h2></div></div></div><p>The <a href="../examples/scribble.rb" target="_top"><code class="filename">scribble.rb</code></a>
10
10
  example is a good demonstration of how to obtain a device context for a
11
- window (in this case, an <tt class="classname">FXCanvas</tt>) and draw into
11
+ window (in this case, an <code class="classname">FXCanvas</code>) and draw into
12
12
  that window. It also provides a basic demonstration of how FOX's GUI
13
13
  updating mechanism can be used to automatically update the state of
14
14
  widgets based on the application's state. Observe the "Clear"
15
15
  button becoming enabled and disabled (greyed-out) depending on whether the
16
16
  canvas is currently "dirty" or "clean", and then see how
17
- this updating is actually handled in the code.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/scribble.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1645"></a>button</h2></div></div><div></div></div><p>The <a href="../examples/button.rb" target="_top"><tt class="filename">button.rb</tt></a>
17
+ this updating is actually handled in the code.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/scribble.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1645"></a>button</h2></div></div></div><p>The <a href="../examples/button.rb" target="_top"><code class="filename">button.rb</code></a>
18
18
  example program shows off the various options (or button styles) for
19
- <tt class="classname">FXButton</tt> widgets.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/button.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1661"></a>datatarget</h2></div></div><div></div></div><p>The <a href="../examples/datatarget.rb" target="_top"><tt class="filename">datatarget.rb</tt></a>
19
+ <code class="classname">FXButton</code> widgets.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/button.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1661"></a>datatarget</h2></div></div></div><p>The <a href="../examples/datatarget.rb" target="_top"><code class="filename">datatarget.rb</code></a>
20
20
  example program demonstrates most or all of the widgets that can work with
21
- FOX data targets (that is, instances of class <tt class="classname">FXDataTarget</tt>).
21
+ FOX data targets (that is, instances of class <code class="classname">FXDataTarget</code>).
22
22
  Data targets are special objects that have a a string, float or integer
23
23
  value associated with them, and can interact with widgets to keep the data
24
24
  target's value in sync with the widget's setting. For example, you
@@ -28,77 +28,77 @@
28
28
  target's value is changed, the text field will update its setting.
29
29
  Since a single data targets can be attached to multiple widgets, this can
30
30
  be a useful way to keep multiple controls for the same logical value in
31
- sync with each other.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/datatarget.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1677"></a>dialog</h2></div></div><div></div></div><p>The <a href="../examples/dialog.rb" target="_top"><tt class="filename">dialog.rb</tt></a>
31
+ sync with each other.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/datatarget.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1677"></a>dialog</h2></div></div></div><p>The <a href="../examples/dialog.rb" target="_top"><code class="filename">dialog.rb</code></a>
32
32
  example is a simple program demonstrating how to construct and display
33
- modal and non-modal dialog boxes.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/dialog.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1690"></a>dirlist</h2></div></div><div></div></div><p>The <a href="../examples/dirlist.rb" target="_top"><tt class="filename">dirlist.rb</tt></a>
34
- example program demonstrates the <tt class="classname">FXDirList</tt> widget.
33
+ modal and non-modal dialog boxes.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/dialog.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1690"></a>dirlist</h2></div></div></div><p>The <a href="../examples/dirlist.rb" target="_top"><code class="filename">dirlist.rb</code></a>
34
+ example program demonstrates the <code class="classname">FXDirList</code> widget.
35
35
  The directory list is a special kind of tree list, where each tree item
36
- represents a directory (or folder) in the file system.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/dirlist.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1706"></a>iconlist</h2></div></div><div></div></div><p>The <a href="../examples/iconlist.rb" target="_top"><tt class="filename">iconlist.rb</tt></a>
37
- example program demonstrates the <tt class="classname">FXIconList</tt> widget.
36
+ represents a directory (or folder) in the file system.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/dirlist.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1706"></a>iconlist</h2></div></div></div><p>The <a href="../examples/iconlist.rb" target="_top"><code class="filename">iconlist.rb</code></a>
37
+ example program demonstrates the <code class="classname">FXIconList</code> widget.
38
38
  An icon list is a special kind of list widget that can display its
39
39
  contents in one of three basic modes (details mode, small icons mode or
40
40
  large icons mode). The first screenshot below shows an icon list in
41
41
  details mode, while the second shows the same icon list in "big
42
- icons" mode.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/iconlist-details.png" align="middle"></div></div><div class="screenshot"><div class="mediaobject" align="center"><img src="images/iconlist-bigicons.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1726"></a>mditest</h2></div></div><div></div></div><p>The <a href="../examples/mditest.rb" target="_top"><tt class="filename">mditest.rb</tt></a>
42
+ icons" mode.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/iconlist-details.png" align="middle"></div></div><div class="screenshot"><div class="mediaobject" align="center"><img src="images/iconlist-bigicons.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1726"></a>mditest</h2></div></div></div><p>The <a href="../examples/mditest.rb" target="_top"><code class="filename">mditest.rb</code></a>
43
43
  example program demonstrates FOX's Multiple Document Interface (MDI)
44
- capabilities, specifically the <tt class="classname">FXMDIClient</tt> and
45
- <tt class="classname">FXMDIChild</tt> classes.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/mditest.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1745"></a>groupbox</h2></div></div><div></div></div><p>The <a href="../examples/groupbox.rb" target="_top"><tt class="filename">groupbox.rb</tt></a>
44
+ capabilities, specifically the <code class="classname">FXMDIClient</code> and
45
+ <code class="classname">FXMDIChild</code> classes.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/mditest.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1745"></a>groupbox</h2></div></div></div><p>The <a href="../examples/groupbox.rb" target="_top"><code class="filename">groupbox.rb</code></a>
46
46
  example program is a kind of "periodic table of widgets"
47
47
  demonstration, FOX-style. It shows off a lot of the FOX widgets as well as
48
- providing a good exercise of FOX's layout managers.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/groupbox.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1758"></a>header</h2></div></div><div></div></div><p>The <a href="../examples/header.rb" target="_top"><tt class="filename">header.rb</tt></a>
49
- example program mainly demonstrates the <tt class="classname">FXHeader</tt>
50
- widget and the <tt class="classname">FXSplitter</tt> layout manager.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/header.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1777"></a>image</h2></div></div><div></div></div><p>The <a href="../examples/image.rb" target="_top"><tt class="filename">image.rb</tt></a>
51
- example demonstrates how to draw directly into an <tt class="classname">FXImage</tt>
52
- object and then "draw" that image into a canvas.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/image.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1793"></a>splitter</h2></div></div><div></div></div><p>The <a href="../examples/splitter.rb" target="_top"><tt class="filename">splitter.rb</tt></a>
53
- example demonstrates the <tt class="classname">FXSplitter</tt> layout manager.
54
- It also provides an example of the <tt class="classname">FXTreeList</tt>
55
- widget (on the left side of the split) and the <tt class="classname">FXMatrix</tt>
56
- layout manager (in the middle pane).</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/splitter.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1815"></a>foursplit</h2></div></div><div></div></div><p>The <a href="../examples/foursplit.rb" target="_top"><tt class="filename">foursplit.rb</tt></a>
57
- example program demonstrates the <tt class="classname">FX4Splitter</tt> layout
48
+ providing a good exercise of FOX's layout managers.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/groupbox.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1758"></a>header</h2></div></div></div><p>The <a href="../examples/header.rb" target="_top"><code class="filename">header.rb</code></a>
49
+ example program mainly demonstrates the <code class="classname">FXHeader</code>
50
+ widget and the <code class="classname">FXSplitter</code> layout manager.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/header.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1777"></a>image</h2></div></div></div><p>The <a href="../examples/image.rb" target="_top"><code class="filename">image.rb</code></a>
51
+ example demonstrates how to draw directly into an <code class="classname">FXImage</code>
52
+ object and then "draw" that image into a canvas.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/image.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1793"></a>splitter</h2></div></div></div><p>The <a href="../examples/splitter.rb" target="_top"><code class="filename">splitter.rb</code></a>
53
+ example demonstrates the <code class="classname">FXSplitter</code> layout manager.
54
+ It also provides an example of the <code class="classname">FXTreeList</code>
55
+ widget (on the left side of the split) and the <code class="classname">FXMatrix</code>
56
+ layout manager (in the middle pane).</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/splitter.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1815"></a>foursplit</h2></div></div></div><p>The <a href="../examples/foursplit.rb" target="_top"><code class="filename">foursplit.rb</code></a>
57
+ example program demonstrates the <code class="classname">FX4Splitter</code> layout
58
58
  manager. This four-way split is especially useful for CAD-type programs
59
59
  where it's necessary to show multiple views of the model
60
- simultaneously.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/foursplit.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1831"></a>shutter</h2></div></div><div></div></div><p>The <a href="../examples/shutter.rb" target="_top"><tt class="filename">shutter.rb</tt></a>
61
- example provides a simple demonstration of the <tt class="classname">FXShutter</tt>
60
+ simultaneously.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/foursplit.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1831"></a>shutter</h2></div></div></div><p>The <a href="../examples/shutter.rb" target="_top"><code class="filename">shutter.rb</code></a>
61
+ example provides a simple demonstration of the <code class="classname">FXShutter</code>
62
62
  widget, with the skeleton of a PIM-type application. The very nice icons
63
- used for this program are courtesy of <a href="http://www.forrestwalter.com/icons" target="_top">Gort's Icons</a>.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/shutter.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1850"></a>tabbook</h2></div></div><div></div></div><p>The <a href="../examples/tabbook.rb" target="_top"><tt class="filename">tabbook.rb</tt></a>
64
- example exists mainly to demonstrate the <tt class="classname">FXTabBook</tt>
65
- widget, but shows off a few other features in the process.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/tabbook.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1866"></a>table</h2></div></div><div></div></div><p>The <a href="../examples/table.rb" target="_top"><tt class="filename">table.rb</tt></a>
66
- example features the <tt class="classname">FXTable</tt> widget, sometimes
63
+ used for this program are courtesy of <a href="http://www.forrestwalter.com/icons" target="_top">Gort's Icons</a>.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/shutter.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1850"></a>tabbook</h2></div></div></div><p>The <a href="../examples/tabbook.rb" target="_top"><code class="filename">tabbook.rb</code></a>
64
+ example exists mainly to demonstrate the <code class="classname">FXTabBook</code>
65
+ widget, but shows off a few other features in the process.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/tabbook.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1866"></a>table</h2></div></div></div><p>The <a href="../examples/table.rb" target="_top"><code class="filename">table.rb</code></a>
66
+ example features the <code class="classname">FXTable</code> widget, sometimes
67
67
  known as a "grid" or "spreadsheet" widget in other
68
- toolkits.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/table.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1882"></a>gltest</h2></div></div><div></div></div><p>The <a href="../examples/gltest.rb" target="_top"><tt class="filename">gltest.rb</tt></a>
68
+ toolkits.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/table.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1882"></a>gltest</h2></div></div></div><p>The <a href="../examples/gltest.rb" target="_top"><code class="filename">gltest.rb</code></a>
69
69
  example program demonstrates how to create a basic OpenGL canvas (i.e. an
70
- instance of the <tt class="classname">FXGLCanvas</tt> widget) and draw into
70
+ instance of the <code class="classname">FXGLCanvas</code> widget) and draw into
71
71
  it. It also demonstrates how to use timers and chores. This example
72
72
  requires the Ruby/OpenGL extension, available from the Ruby Application
73
- Archive.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/gltest.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1898"></a>glviewer</h2></div></div><div></div></div><p>The <a href="../examples/glviewer.rb" target="_top"><tt class="filename">glviewer.rb</tt></a>
74
- example program demonstrates how to use the <tt class="classname">FXGLViewer</tt>
73
+ Archive.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/gltest.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1898"></a>glviewer</h2></div></div></div><p>The <a href="../examples/glviewer.rb" target="_top"><code class="filename">glviewer.rb</code></a>
74
+ example program demonstrates how to use the <code class="classname">FXGLViewer</code>
75
75
  widget and draw various kinds of GL objects into it. It can also be used
76
76
  as model for a fairly complicated FXRuby application, since it includes a
77
- lot of typical features (like a menu bar, toolbar, status line, etc.).</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/glviewer.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1914"></a>imageviewer</h2></div></div><div></div></div><p>Like the <a href="../examples/glviewer.rb" target="_top"><tt class="filename">glviewer.rb</tt></a>
78
- example, the <a href="../examples/imageviewer.rb" target="_top"><tt class="filename">imageviewer.rb</tt></a>
77
+ lot of typical features (like a menu bar, toolbar, status line, etc.).</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/glviewer.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1914"></a>imageviewer</h2></div></div></div><p>Like the <a href="../examples/glviewer.rb" target="_top"><code class="filename">glviewer.rb</code></a>
78
+ example, the <a href="../examples/imageviewer.rb" target="_top"><code class="filename">imageviewer.rb</code></a>
79
79
  can be used as a model for a typical full-featured GUI application, with a
80
80
  menu bar, toolbar, and so forth. It also features the
81
- <tt class="classname">FXImageView</tt> widget.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/imageviewer.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1934"></a>dilbert</h2></div></div><div></div></div><p>The <a href="../examples/dilbert.rb" target="_top"><tt class="filename">dilbert.rb</tt></a>
81
+ <code class="classname">FXImageView</code> widget.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/imageviewer.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1934"></a>dilbert</h2></div></div></div><p>The <a href="../examples/dilbert.rb" target="_top"><code class="filename">dilbert.rb</code></a>
82
82
  example fetches the "Daily Dilbert" cartoon and displays it in a
83
83
  window. This was just a fun little exercise for me, but it does provide a
84
- more bare-bones example of the <tt class="classname">FXImageView</tt> widget
85
- than that provided by the (more complicated) <tt class="filename">imageviewer.rb</tt>
84
+ more bare-bones example of the <code class="classname">FXImageView</code> widget
85
+ than that provided by the (more complicated) <code class="filename">imageviewer.rb</code>
86
86
  example.</p><p>This example program requires the html-parser extension, available
87
- from the Ruby Application Archive.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/dilbert.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1955"></a>raabrowser</h2></div></div><div></div></div><p>The <a href="../examples/raabrowser.rb" target="_top"><tt class="filename">raabrowser.rb</tt></a>
87
+ from the Ruby Application Archive.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/dilbert.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1955"></a>raabrowser</h2></div></div></div><p>The <a href="../examples/raabrowser.rb" target="_top"><code class="filename">raabrowser.rb</code></a>
88
88
  example program shows a treelist view of the current Ruby Application
89
89
  Archive (RAA) contents, and product-specific information for the currently
90
90
  selected product in the panel on the right. This is a good demonstration
91
- of the following features:</p><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc"><p>the <tt class="classname">FXSplitter</tt> layout manager, used to
91
+ of the following features:</p><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc"><p>the <code class="classname">FXSplitter</code> layout manager, used to
92
92
  split the left side (containing the tree list) from the right side
93
93
  (containing the information panel). If the panel on the left is too
94
94
  narrow to see all of its contents (especially when you've expanded
95
- the tree) try resizing the split.</p></li><li style="list-style-type: disc"><p>the <tt class="classname">FXTreeList</tt> widget, used to display
96
- the RAA contents.</p></li><li style="list-style-type: disc"><p>data targets (i.e. instances of class <tt class="classname">FXDataTarget</tt>),
95
+ the tree) try resizing the split.</p></li><li style="list-style-type: disc"><p>the <code class="classname">FXTreeList</code> widget, used to display
96
+ the RAA contents.</p></li><li style="list-style-type: disc"><p>data targets (i.e. instances of class <code class="classname">FXDataTarget</code>),
97
97
  which are used for the contents of the fields in the information
98
- panel.</p></li></ul></div><p>This example program requires the <a href="http://www.jin.gr.jp/~nahi/Ruby/SOAP4R" target="_top">SOAP4R</a> extension.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/raabrowser.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1992"></a>babelfish</h2></div></div><div></div></div><p>The <a href="../examples/babelfish.rb" target="_top"><tt class="filename">babelfish.rb</tt></a>
99
- example program, like the <tt class="filename">raabrowser.rb</tt> example,
98
+ panel.</p></li></ul></div><p>This example program requires the <a href="http://www.jin.gr.jp/~nahi/Ruby/SOAP4R" target="_top">SOAP4R</a> extension.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/raabrowser.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1992"></a>babelfish</h2></div></div></div><p>The <a href="../examples/babelfish.rb" target="_top"><code class="filename">babelfish.rb</code></a>
99
+ example program, like the <code class="filename">raabrowser.rb</code> example,
100
100
  depends on the <a href="http://www.jin.gr.jp/~nahi/Ruby/SOAP4R" target="_top">SOAP4R</a>
101
- extension. Other than that it doesn't bring anything new to the table.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/babelfish.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2011"></a>browser</h2></div></div><div></div></div><p>The <a href="../examples/browser.rb" target="_top"><tt class="filename">browser.rb</tt></a>
101
+ extension. Other than that it doesn't bring anything new to the table.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/babelfish.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2011"></a>browser</h2></div></div></div><p>The <a href="../examples/browser.rb" target="_top"><code class="filename">browser.rb</code></a>
102
102
  example program is mainly a "me too" for the class browser
103
103
  distributed with Ruby/GTK. It's hard for me to get excited about it,
104
104
  but here it is.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/browser.png" align="middle"></div></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch05s03.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="pt01.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="events.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Putting It All Together&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Chapter&nbsp;7.&nbsp;FXRuby's Message-Target System</td></tr></table></div></body></html>