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
data/doc/apes02.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>Object Life Cycles and Garbage Collection</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="implementation.html" title="Appendix&nbsp;E.&nbsp;Implementation"><link rel="previous" href="implementation.html" title="Appendix&nbsp;E.&nbsp;Implementation"><link rel="next" 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">Object Life Cycles and Garbage Collection</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="implementation.html">Prev</a>&nbsp;</td><th width="60%" align="center">Appendix&nbsp;E.&nbsp;Implementation</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="apes03.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4533"></a>Object Life Cycles and Garbage Collection</h2></div></div><div></div></div><p>One of the more difficult issues to deal with was understanding
3
+ <title>Object Life Cycles and Garbage Collection</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="implementation.html" title="Appendix&nbsp;E.&nbsp;Implementation"><link rel="prev" href="implementation.html" title="Appendix&nbsp;E.&nbsp;Implementation"><link rel="next" 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">Object Life Cycles and Garbage Collection</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="implementation.html">Prev</a>&nbsp;</td><th width="60%" align="center">Appendix&nbsp;E.&nbsp;Implementation</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="apes03.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4533"></a>Object Life Cycles and Garbage Collection</h2></div></div></div><p>One of the more difficult issues to deal with was understanding
4
4
  the "life cycle" of FOX objects (that is, the actual C++ objects) and
5
5
  their relationship to the associated Ruby instances. Understanding this
6
6
  relationship is critical when dealing with Ruby's garbage collector,
@@ -8,14 +8,14 @@
8
8
  program into two groups, those objects that Ruby "owns" and those that
9
9
  it doesn't. The first group (the "owned" objects) includes those that you
10
10
  create explicitly from Ruby code. This is usually done by calling a class'
11
- <tt class="methodname">new</tt> method, e.g.</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">myIcon = FXPNGIcon.new(myApp, File.open("icon.png", "rb").read)
12
- myButton = FXButton.new(parentWin, "Hello, World!", myIcon)</pre></td></tr></table><p>It's important to keep in mind that when you create an object like
11
+ <code class="methodname">new</code> method, e.g.</p><pre class="programlisting">myIcon = FXPNGIcon.new(myApp, File.open("icon.png", "rb").read)
12
+ myButton = FXButton.new(parentWin, "Hello, World!", myIcon)</pre><p>It's important to keep in mind that when you create an object like
13
13
  this you're not only creating the Ruby instance part (i.e. whatever
14
14
  overhead is usually associated with a Ruby instance) but a C++ FOX object
15
15
  as well. Because we created these objects, we would reasonably expect them
16
16
  to be destroyed when they are garbage-collected so that our programs
17
17
  don't leak memory.</p><p>The other group of objects (those not owned by Ruby) are those
18
18
  returned from most class instance methods; they are references to already-
19
- existing objects. For example, <tt class="methodname">FXStatusBar#statusline
20
- </tt> returns a reference to the status bar's enclosed status line
21
- instance.</p><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e4552"></a>GL Objects</h3></div></div><div></div></div><p>A C++ <tt class="classname">FXGLGroup</tt> object owns all of the <tt class="classname">FXGLObject</tt> objects it "contains". In other words, when that <tt class="classname">FXGLGroup</tt> object is destroyed, it will also destroy all of the <tt class="classname">FXGLObject</tt> objects for which it holds pointers.</p><p>In order to keep track of <span class="emphasis"><em>which</em></span> GL objects have been added to an <tt class="classname">FXGLGroup</tt>, all of the FXRuby C++ classes derived from <tt class="classname">FXGLObject</tt> have a boolean member variable <i class="structfield"><tt>owned</tt></i> that indicates whether this object is "owned" or not. Until an <tt class="classname">FXGLObject</tt> object is added to a group, this member variable should stay false.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="implementation.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="implementation.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="apes03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Appendix&nbsp;E.&nbsp;Implementation&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Virtual Functions</td></tr></table></div></body></html>
19
+ existing objects. For example, <code class="methodname">FXStatusBar#statusline
20
+ </code> returns a reference to the status bar's enclosed status line
21
+ instance.</p><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e4552"></a>GL Objects</h3></div></div></div><p>A C++ <code class="classname">FXGLGroup</code> object owns all of the <code class="classname">FXGLObject</code> objects it "contains". In other words, when that <code class="classname">FXGLGroup</code> object is destroyed, it will also destroy all of the <code class="classname">FXGLObject</code> objects for which it holds pointers.</p><p>In order to keep track of <span class="emphasis"><em>which</em></span> GL objects have been added to an <code class="classname">FXGLGroup</code>, all of the FXRuby C++ classes derived from <code class="classname">FXGLObject</code> have a boolean member variable <em class="structfield"><code>owned</code></em> that indicates whether this object is "owned" or not. Until an <code class="classname">FXGLObject</code> object is added to a group, this member variable should stay false.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="implementation.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="implementation.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="apes03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Appendix&nbsp;E.&nbsp;Implementation&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Virtual Functions</td></tr></table></div></body></html>
data/doc/apes03.html CHANGED
@@ -1,39 +1,39 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Virtual Functions</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="implementation.html" title="Appendix&nbsp;E.&nbsp;Implementation"><link rel="previous" href="apes02.html" title="Object Life Cycles and Garbage Collection"><link rel="next" href="cvs.html" title="Appendix&nbsp;F.&nbsp;Getting the Sources from CVS"></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">Virtual Functions</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="apes02.html">Prev</a>&nbsp;</td><th width="60%" align="center">Appendix&nbsp;E.&nbsp;Implementation</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="cvs.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4586"></a>Virtual Functions</h2></div></div><div></div></div><p>
3
+ <title>Virtual Functions</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="implementation.html" title="Appendix&nbsp;E.&nbsp;Implementation"><link rel="prev" href="apes02.html" title="Object Life Cycles and Garbage Collection"><link rel="next" href="cvs.html" title="Appendix&nbsp;F.&nbsp;Getting the Sources from CVS"></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">Virtual Functions</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="apes02.html">Prev</a>&nbsp;</td><th width="60%" align="center">Appendix&nbsp;E.&nbsp;Implementation</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="cvs.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4586"></a>Virtual Functions</h2></div></div></div><p>
4
4
  One of the design requirements for FXRuby was to ensure that any
5
5
  virtual function call made on a FOX object (from the C++ library
6
6
  layer) is routed to the proper Ruby instance method, even if that
7
7
  method has been overridden in a derived class.
8
8
  </p><p>
9
9
  For example, many of the FXRuby example programs are structured with a
10
- main window class that subclasses <tt class="classname">FXMainWindow</tt>
11
- and then overrides its <tt class="methodname">create</tt> instance method:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">class MyMainWindow &lt; Fox::FXMainWindow
10
+ main window class that subclasses <code class="classname">FXMainWindow</code>
11
+ and then overrides its <code class="methodname">create</code> instance method:</p><pre class="programlisting">class MyMainWindow &lt; Fox::FXMainWindow
12
12
  # overrides the base class version, FXMainWindow#create
13
13
  def create
14
14
  end
15
- end</pre></td></tr></table><p>This <tt class="methodname">create</tt> method isn't called directly from Ruby code, however; it's called as a side effect of calling <tt class="methodname">FXApp#create</tt>. Inside the C++ FOX library, the <tt class="methodname">FXApp::create()</tt> member function recursively calls <tt class="methodname">create()</tt> on all of the application's windows and eventually calls the virtual <tt class="methodname">FXMainWindow::create()</tt> member function as well:
15
+ end</pre><p>This <code class="methodname">create</code> method isn't called directly from Ruby code, however; it's called as a side effect of calling <code class="methodname">FXApp#create</code>. Inside the C++ FOX library, the <code class="methodname">FXApp::create()</code> member function recursively calls <code class="methodname">create()</code> on all of the application's windows and eventually calls the virtual <code class="methodname">FXMainWindow::create()</code> member function as well:
16
16
  </p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/call-chain-example.png" align="middle"></div></div><p>
17
- To ensure that our main window's overridden <tt class="methodname">create
18
- </tt> method is invoked instead of the base class implementation,
17
+ To ensure that our main window's overridden <code class="methodname">create
18
+ </code> method is invoked instead of the base class implementation,
19
19
  we need some special machinery in place.
20
20
  </p><p>
21
21
  For every C++ class that declares virtual member functions, we derive
22
22
  a new C++ class that overrides all of those virtual functions with special
23
23
  stubs that know how to make method calls on Ruby instances. The naming
24
24
  convention for these classes is that the "FX" prefix is replaced with
25
- "FXRb"; for example, our <tt class="classname">FXRbButton</tt> C++ class is
26
- derived from FOX's <tt class="classname">FXButton</tt>:
25
+ "FXRb"; for example, our <code class="classname">FXRbButton</code> C++ class is
26
+ derived from FOX's <code class="classname">FXButton</code>:
27
27
  </p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/inheritance.png" align="middle"></div></div><p>
28
28
  Although the implementation of these "stubs" varies from function to function, the
29
29
  basic requirements are always the same:
30
30
  </p><div class="orderedlist"><ol type="1"><li><p>Look up the Ruby object associated with this C++ object.</p></li><li><p>Convert each of the function's arguments to their Ruby
31
31
  representation. For example, arguments of type <span class="type">FXint</span> are
32
- converted to Ruby <tt class="classname">Fixnum</tt>s.</p></li><li><p>Call the Ruby object's method, using the <tt class="function">
33
- rb_funcall()</tt> function from Ruby's C API, and capture its
32
+ converted to Ruby <code class="classname">Fixnum</code>s.</p></li><li><p>Call the Ruby object's method, using the <code class="function">
33
+ rb_funcall()</code> function from Ruby's C API, and capture its
34
34
  result (which is itself a Ruby object).</p></li><li><p>Convert the method call's result back to the virtual
35
35
  function's C++ return type, and then return that result from the C++
36
36
  function. For example, if the C++ function has a <span class="type"> FXbool</span>
37
37
  return type, we would expect the corresponding Ruby method to return
38
- either <tt class="constant">Qtrue</tt> or <tt class="constant">Qfalse</tt>.</p></li></ol></div><p>
38
+ either <code class="constant">Qtrue</code> or <code class="constant">Qfalse</code>.</p></li></ol></div><p>
39
39
  </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="apes02.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="implementation.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="cvs.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Object Life Cycles and Garbage Collection&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;F.&nbsp;Getting the Sources from CVS</td></tr></table></div></body></html>
data/doc/book.html CHANGED
@@ -1,3 +1,3 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Developing Graphical User Interfaces with 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="next" href="pt01.html" title="Part&nbsp;I.&nbsp;The Basics"></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">Developing Graphical User Interfaces with FXRuby</th></tr><tr><td width="20%" align="left">&nbsp;</td><th width="60%" align="center">&nbsp;</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="pt01.html">Next</a></td></tr></table><hr></div><div class="book" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="book"></a>Developing Graphical User Interfaces with FXRuby</h1></div><div><h2 class="subtitle">Covers FXRuby Version 1.4</h2></div><div><div class="author"><h3 class="author"><span class="firstname">Lyle</span> <span class="surname">Johnson</span></h3></div></div><div><p class="copyright">Copyright &copy; 2001-2005 J. Lyle Johnson</p></div></div><div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt>I. <a href="pt01.html">The Basics</a></dt><dd><dl><dt><a href="goals.html">History and Goals</a></dt><dt>1. <a href="build.html">Building from Source Code</a></dt><dt>2. <a href="gems.html">Installing from Gems</a></dt><dt>3. <a href="tutorial1.html">Hello, World!</a></dt><dd><dl><dt><a href="tutorial1.html#d0e597">First Things First</a></dt><dt><a href="ch03s02.html">Better living through buttons</a></dt><dt><a href="ch03s03.html">Messages</a></dt><dt><a href="ch03s04.html">Adding a tool tip</a></dt><dt><a href="ch03s05.html">Adding an icon</a></dt></dl></dd><dt>4. <a href="clipboardtut.html">Working With the Clipboard</a></dt><dd><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></dd><dt>5. <a href="dragdroptut.html">Drag and Drop</a></dt><dd><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></dd><dt>6. <a href="examples.html">Examples</a></dt><dt>7. <a href="events.html">FXRuby's Message-Target System</a></dt><dt>8. <a href="todo.html">To-do list</a></dt><dt>9. <a href="infosources.html">Other Sources of Information</a></dt><dt>10. <a href="changes.html">Change History</a></dt></dl></dd><dt>II. <a href="pt02.html">Appendices</a></dt><dd><dl><dt>A. <a href="opengl.html">Using OpenGL with FXRuby</a></dt><dt>B. <a href="scintilla.html">Using Scintilla with FXRuby</a></dt><dt>C. <a href="differences.html">Differences between FOX and FXRuby</a></dt><dt>D. <a href="library.html">The FXRuby Standard Library</a></dt><dt>E. <a href="implementation.html">Implementation</a></dt><dd><dl><dt><a href="implementation.html#d0e4514">Code Generation</a></dt><dt><a href="apes02.html">Object Life Cycles and Garbage Collection</a></dt><dd><dl><dt><a href="apes02.html#d0e4552">GL Objects</a></dt></dl></dd><dt><a href="apes03.html">Virtual Functions</a></dt></dl></dd><dt>F. <a href="cvs.html">Getting the Sources from CVS</a></dt></dl></dd></dl></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left">&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" align="right">&nbsp;<a accesskey="n" href="pt01.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" align="right" valign="top">&nbsp;Part&nbsp;I.&nbsp;The Basics</td></tr></table></div></body></html>
3
+ <title>Developing Graphical User Interfaces with 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="next" href="pt01.html" title="Part&nbsp;I.&nbsp;The Basics"></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">Developing Graphical User Interfaces with FXRuby</th></tr><tr><td width="20%" align="left">&nbsp;</td><th width="60%" align="center">&nbsp;</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="pt01.html">Next</a></td></tr></table><hr></div><div class="book" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="book"></a>Developing Graphical User Interfaces with FXRuby</h1></div><div><h2 class="subtitle">Covers FXRuby Version 1.4</h2></div><div><div class="author"><h3 class="author"><span class="firstname">Lyle</span> <span class="surname">Johnson</span></h3></div></div><div><p class="copyright">Copyright &copy; 2001-2005 J. Lyle Johnson</p></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="part"><a href="pt01.html">I. The Basics</a></span></dt><dd><dl><dt><span class="preface"><a href="goals.html">History and Goals</a></span></dt><dt><span class="chapter"><a href="build.html">1. Building from Source Code</a></span></dt><dt><span class="chapter"><a href="gems.html">2. Installing from Gems</a></span></dt><dt><span class="chapter"><a href="tutorial1.html">3. Hello, World!</a></span></dt><dd><dl><dt><span class="section"><a href="tutorial1.html#d0e597">First Things First</a></span></dt><dt><span class="section"><a href="ch03s02.html">Better living through buttons</a></span></dt><dt><span class="section"><a href="ch03s03.html">Messages</a></span></dt><dt><span class="section"><a href="ch03s04.html">Adding a tool tip</a></span></dt><dt><span class="section"><a href="ch03s05.html">Adding an icon</a></span></dt></dl></dd><dt><span class="chapter"><a href="clipboardtut.html">4. Working With the Clipboard</a></span></dt><dd><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></dd><dt><span class="chapter"><a href="dragdroptut.html">5. Drag and Drop</a></span></dt><dd><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></dd><dt><span class="chapter"><a href="examples.html">6. Examples</a></span></dt><dt><span class="chapter"><a href="events.html">7. FXRuby's Message-Target System</a></span></dt><dt><span class="chapter"><a href="todo.html">8. To-do list</a></span></dt><dt><span class="chapter"><a href="infosources.html">9. Other Sources of Information</a></span></dt><dt><span class="chapter"><a href="changes.html">10. Change History</a></span></dt></dl></dd><dt><span class="part"><a href="pt02.html">II. Appendices</a></span></dt><dd><dl><dt><span class="appendix"><a href="opengl.html">A. Using OpenGL with FXRuby</a></span></dt><dt><span class="appendix"><a href="scintilla.html">B. Using Scintilla with FXRuby</a></span></dt><dt><span class="appendix"><a href="differences.html">C. Differences between FOX and FXRuby</a></span></dt><dt><span class="appendix"><a href="library.html">D. The FXRuby Standard Library</a></span></dt><dt><span class="appendix"><a href="implementation.html">E. Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="implementation.html#d0e4514">Code Generation</a></span></dt><dt><span class="section"><a href="apes02.html">Object Life Cycles and Garbage Collection</a></span></dt><dd><dl><dt><span class="section"><a href="apes02.html#d0e4552">GL Objects</a></span></dt></dl></dd><dt><span class="section"><a href="apes03.html">Virtual Functions</a></span></dt></dl></dd><dt><span class="appendix"><a href="cvs.html">F. Getting the Sources from CVS</a></span></dt></dl></dd></dl></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left">&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" align="right">&nbsp;<a accesskey="n" href="pt01.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" align="right" valign="top">&nbsp;Part&nbsp;I.&nbsp;The Basics</td></tr></table></div></body></html>
data/doc/build.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>Chapter&nbsp;1.&nbsp;Building from Source Code</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="goals.html" title="History and Goals"><link rel="next" href="gems.html" title="Chapter&nbsp;2.&nbsp;Installing from Gems"></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;1.&nbsp;Building from Source Code</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="goals.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="gems.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="build"></a>Chapter&nbsp;1.&nbsp;Building from Source Code</h2></div></div><div></div></div><p>A few words of advice, before getting started:</p><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc"><p>If you're planning to use FXRuby on Windows, with the standard
3
+ <title>Chapter&nbsp;1.&nbsp;Building from Source Code</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="goals.html" title="History and Goals"><link rel="next" href="gems.html" title="Chapter&nbsp;2.&nbsp;Installing from Gems"></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;1.&nbsp;Building from Source Code</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="goals.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="gems.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="build"></a>Chapter&nbsp;1.&nbsp;Building from Source Code</h2></div></div></div><p>A few words of advice, before getting started:</p><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc"><p>If you're planning to use FXRuby on Windows, with the standard
4
4
  <a href="http://rubyinstaller.rubyforge.org" target="_top">Ruby Installer for
5
5
  Windows</a>, you may wish to just download the pre-compiled binaries
6
6
  from the <a href="http://rubyforge.org/projects/fxruby" target="_top">RubyForge
@@ -8,128 +8,128 @@
8
8
  consult <a href="http://www.fox-toolkit.net/cgi-bin/wiki.pl?Mac_OS_X" target="_top">this
9
9
  page</a> from the <a href="http://www.fox-toolkit.net" target="_top">FOX
10
10
  Community Wiki</a>, in addition to the standard build instructions
11
- listed below.</p></li></ul></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e92"></a>Building From Source on Unix/Linux</h2></div></div><div></div></div><p>These instructions assume that you've already downloaded, compiled
11
+ listed below.</p></li></ul></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e92"></a>Building From Source on Unix/Linux</h2></div></div></div><p>These instructions assume that you've already downloaded, compiled
12
12
  and installed FOX. Next, you'll need to download the FXRuby source code
13
- tarball and unpack it by typing:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">$ <b class="command">tar xzf FXRuby-1.4.3.tar.gz</b></pre></td></tr></table><p>This will create a new directory called <tt class="filename">FXRuby-1.4.3</tt>. Change to the top-level
14
- directory and configure the build by typing:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">$ <b class="command">ruby install.rb config</b></pre></td></tr></table><p>By default, the <tt class="filename">install.rb</tt> script will look for
15
- the FOX include files and library in the standard <tt class="filename">/usr/local/include/fox</tt> and <tt class="filename">/usr/local/lib</tt> directories, respectively. You
13
+ tarball and unpack it by typing:</p><pre class="screen">$ <span><strong class="command">tar xzf FXRuby-1.4.3.tar.gz</strong></span></pre><p>This will create a new directory called <code class="filename">FXRuby-1.4.3</code>. Change to the top-level
14
+ directory and configure the build by typing:</p><pre class="screen">$ <span><strong class="command">ruby install.rb config</strong></span></pre><p>By default, the <code class="filename">install.rb</code> script will look for
15
+ the FOX include files and library in the standard <code class="filename">/usr/local/include/fox</code> and <code class="filename">/usr/local/lib</code> directories, respectively. You
16
16
  can override these locations by passing a few additional arguments to
17
- <tt class="filename">install.rb</tt> during this step, e.g.</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">$ <b class="command">ruby install.rb config -- \
17
+ <code class="filename">install.rb</code> during this step, e.g.</p><pre class="screen">$ <span><strong class="command">ruby install.rb config -- \
18
18
  --with-fox-include=/home/lyle/fox-1.4.17/include \
19
- --with-fox-lib=/home/lyle/fox-1.4.17/src/.libs</b></pre></td></tr></table><p>Once the build has been configured, you can start the build by
20
- typing:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">$ <b class="command">ruby install.rb setup</b></pre></td></tr></table><p>It will take quite awhile to build FXRuby, even on a fast machine,
19
+ --with-fox-lib=/home/lyle/fox-1.4.17/src/.libs</strong></span></pre><p>Once the build has been configured, you can start the build by
20
+ typing:</p><pre class="screen">$ <span><strong class="command">ruby install.rb setup</strong></span></pre><p>It will take quite awhile to build FXRuby, even on a fast machine,
21
21
  so this might be a good time to take a coffee break. If you run into
22
22
  problems during the compilation, please check the <a href="build.html#tragedies" title="Things That Can Go Wrong">list of things that can go wrong</a> for
23
- workarounds for those problems.</p><p>Once it's finished compiling, install FXRuby by typing:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">$ <b class="command">ruby install.rb install</b></pre></td></tr></table><p>As a quick sanity check, to make sure that all is well, you should
24
- probably fire up <tt class="filename">irb</tt> and try to import FXRuby:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">$ <b class="command">irb</b>
25
- irb(main):001:0&gt; <b class="userinput"><tt>require 'fox14'</tt></b>
23
+ workarounds for those problems.</p><p>Once it's finished compiling, install FXRuby by typing:</p><pre class="screen">$ <span><strong class="command">ruby install.rb install</strong></span></pre><p>As a quick sanity check, to make sure that all is well, you should
24
+ probably fire up <code class="filename">irb</code> and try to import FXRuby:</p><pre class="screen">$ <span><strong class="command">irb</strong></span>
25
+ irb(main):001:0&gt; <strong class="userinput"><code>require 'fox14'</code></strong>
26
26
  true
27
- irb(main):002:0&gt;</pre></td></tr></table><p>If the import failed (usually with a message along the lines of
27
+ irb(main):002:0&gt;</pre><p>If the import failed (usually with a message along the lines of
28
28
  "Cannot load library"), check the <a href="build.html#tragedies" title="Things That Can Go Wrong">list of things
29
29
  that can go wrong</a> for known problems. If that still doesn't solve
30
30
  your problem, drop me an e-mail or ask around on the Ruby newsgroup or
31
31
  mailing list; it's quite likely that someone else has run into this
32
32
  problem too. Once you do have a working FXRuby installation, you're ready
33
- to check out the example programs.</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e163"></a>Building From Source on Windows (Using Visual C++)</h2></div></div><div></div></div><p>This section describes how to compile FXRuby using Microsoft Visual
33
+ to check out the example programs.</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e163"></a>Building From Source on Windows (Using Visual C++)</h2></div></div></div><p>This section describes how to compile FXRuby using Microsoft Visual
34
34
  C++, for use with a Ruby that was also compiled using Visual C++.</p><p>This discussion assumes that you've built Ruby using the
35
35
  instructions and build files distributed with the standard Ruby source
36
36
  code. To review, you should have started by unpacking the source code
37
- tarball, changing into the top-level source code directory (e.g. <tt class="filename">C:\ruby-1.8.2</tt>) and then typing:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">C:\ruby-1.8.2&gt;<b class="command">win32\configure</b>
37
+ tarball, changing into the top-level source code directory (e.g. <code class="filename">C:\ruby-1.8.2</code>) and then typing:</p><pre class="screen">C:\ruby-1.8.2&gt;<span><strong class="command">win32\configure</strong></span>
38
38
  type 'nmake' to make ruby for mswin32.
39
- C:\ruby-1.8.2&gt;<b class="command">nmake</b></pre></td></tr></table><p>After the compilation finished, you installed Ruby somewhere by
40
- typing, e.g.,</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">C:\ruby-1.8.2&gt;<b class="command">nmake DESTDIR=C:\ruby install</b></pre></td></tr></table><p>Similarly, I'm assuming that you built the FOX library using the
39
+ C:\ruby-1.8.2&gt;<span><strong class="command">nmake</strong></span></pre><p>After the compilation finished, you installed Ruby somewhere by
40
+ typing, e.g.,</p><pre class="screen">C:\ruby-1.8.2&gt;<span><strong class="command">nmake DESTDIR=C:\ruby install</strong></span></pre><p>Similarly, I'm assuming that you built the FOX library using the
41
41
  Developer Studio project files distributed with the standard FOX source
42
42
  code distribution. Although it's possible to build FXRuby against either
43
43
  the static library build of FOX or the DLL build, these instructions
44
- currently cover only the static library build.</p><p>Now you can configure the FXRuby build by typing:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">C:\FXRuby-1.4.3&gt;<b class="command">ruby install.rb config --make-prog=nmake -- \
44
+ currently cover only the static library build.</p><p>Now you can configure the FXRuby build by typing:</p><pre class="screen">C:\FXRuby-1.4.3&gt;<span><strong class="command">ruby install.rb config --make-prog=nmake -- \
45
45
  --with-fox-include=C:\fox-1.4.17\include \
46
- --with-fox-lib=C:\fox-1.4.17\lib</b></pre></td></tr></table><p>Once the build has been configured, you can start the build by
47
- typing:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">C:\FXRuby-1.4.3&gt;<b class="command">ruby install.rb setup</b></pre></td></tr></table><p>It will take quite awhile to build FXRuby, even on a fast machine,
46
+ --with-fox-lib=C:\fox-1.4.17\lib</strong></span></pre><p>Once the build has been configured, you can start the build by
47
+ typing:</p><pre class="screen">C:\FXRuby-1.4.3&gt;<span><strong class="command">ruby install.rb setup</strong></span></pre><p>It will take quite awhile to build FXRuby, even on a fast machine,
48
48
  so this might be a good time to take a coffee break. Because Visual C++ is
49
49
  such a strict compiler (usually a good thing), you will probably run into
50
50
  a few problems with non-ANSI declarations in the Ruby header files. If you
51
51
  do run into problems during the compilation, just check the next section
52
52
  for a list of things that could go wrong, and workarounds for those
53
53
  problems. None of them are showstoppers and none require you to restart
54
- the compile from scratch (just type <b class="command">ruby install.rb
55
- setup</b> to pick up where you left off).</p><p>Once it's finished compiling, install FXRuby by typing:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">C:\FXRuby-1.4.3&gt;<b class="command">ruby install.rb install</b></pre></td></tr></table><p>As a quick sanity check, to make sure that all is well, you should
56
- probably fire up <tt class="filename">irb</tt> and try to import FXRuby:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">C:\FXRuby-1.4.0&gt;<b class="command">irb</b>
57
- irb(main):001:0&gt; <b class="userinput"><tt>require 'fox14'</tt></b>
54
+ the compile from scratch (just type <span><strong class="command">ruby install.rb
55
+ setup</strong></span> to pick up where you left off).</p><p>Once it's finished compiling, install FXRuby by typing:</p><pre class="screen">C:\FXRuby-1.4.3&gt;<span><strong class="command">ruby install.rb install</strong></span></pre><p>As a quick sanity check, to make sure that all is well, you should
56
+ probably fire up <code class="filename">irb</code> and try to import FXRuby:</p><pre class="screen">C:\FXRuby-1.4.0&gt;<span><strong class="command">irb</strong></span>
57
+ irb(main):001:0&gt; <strong class="userinput"><code>require 'fox14'</code></strong>
58
58
  true
59
- irb(main):002:0&gt;</pre></td></tr></table><p>If the import failed (usually with a message along the lines of
59
+ irb(main):002:0&gt;</pre><p>If the import failed (usually with a message along the lines of
60
60
  "Cannot load library"), check the list of things that can go wrong for
61
61
  known problems. If that still doesn't solve your problem, drop me an
62
62
  e-mail or ask around on the Ruby newsgroup or mailing list; it's quite
63
63
  likely that someone else has run into this problem too. Once you do have a
64
64
  working FXRuby installation, you're ready to check out the example
65
- programs.</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="tragedies"></a>Things That Can Go Wrong</h2></div></div><div></div></div><p><span class="emphasis"><em>"Too many arguments to function..."</em></span></p><p>The include files for Ruby versions 1.6.7 and earlier still have
65
+ programs.</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="tragedies"></a>Things That Can Go Wrong</h2></div></div></div><p><span class="emphasis"><em>"Too many arguments to function..."</em></span></p><p>The include files for Ruby versions 1.6.7 and earlier still have
66
66
  several function prototypes in the older "K &amp; R" C style, where the
67
67
  function's argument list is not included; for example, the function
68
- <tt class="function">rb_thread_wait_for()</tt> takes a single argument of type
68
+ <code class="function">rb_thread_wait_for()</code> takes a single argument of type
69
69
  <span class="type">struct timeval</span>, but its prototype in
70
- <tt class="filename">intern.h</tt> is:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">void rb_thread_wait_for();</pre></td></tr></table><p>Because FXRuby is written in C++, and C++ requires strict ANSI
70
+ <code class="filename">intern.h</code> is:</p><pre class="programlisting">void rb_thread_wait_for();</pre><p>Because FXRuby is written in C++, and C++ requires strict ANSI
71
71
  C-style function prototypes, code that attempts to call one of these
72
72
  functions will fail to compile under some compilers. For example, the
73
- error message from gcc will look something like this:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">FXRbApp.cpp: In method `long int FXRbApp::onChoreThreads (FXObject *, unsigned int, void *)':
73
+ error message from gcc will look something like this:</p><pre class="screen">FXRbApp.cpp: In method `long int FXRbApp::onChoreThreads (FXObject *, unsigned int, void *)':
74
74
  /usr/local/lib/ruby/1.8/i686-linux/intern.h:172: too many arguments to function `void rb_thread_wait_for ()'
75
75
  FXRbApp.cpp:100: at this point in file
76
- make: *** [FXRbApp.o] Error 1</pre></td></tr></table><p>while the error message from Microsoft's Visual C++ compiler looks
77
- something like this:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">FXRbApp.cpp(109): error C2660: 'rb_thread_wait_for' : function does not take 1 parameters
76
+ make: *** [FXRbApp.o] Error 1</pre><p>while the error message from Microsoft's Visual C++ compiler looks
77
+ something like this:</p><pre class="screen">FXRbApp.cpp(109): error C2660: 'rb_thread_wait_for' : function does not take 1 parameters
78
78
  NMAKE : fatal error U1077: 'cl' : return code '0x2'
79
- Stop.</pre></td></tr></table><p>This problem with the Ruby header files has been corrected for Ruby
79
+ Stop.</pre><p>This problem with the Ruby header files has been corrected for Ruby
80
80
  versions 1.6.8 (and later), but if you're building for an older version of
81
81
  Ruby you can do one of two things to work around the problem:</p><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc"><p>If you're using gcc version 2.95 or earlier, try modifying the
82
- compiler flags (<tt class="constant">CFLAGS</tt>) in the FXRuby
83
- <tt class="filename">Makefile</tt> to include the
84
- <tt class="option">-fno-strict-prototype</tt> option; this should instruct
82
+ compiler flags (<code class="constant">CFLAGS</code>) in the FXRuby
83
+ <code class="filename">Makefile</code> to include the
84
+ <code class="option">-fno-strict-prototype</code> option; this should instruct
85
85
  the compiler to allow these kinds of discrepancies. Unfortunately,
86
86
  this flag is not supported in more recent versions of gcc.</p></li><li style="list-style-type: disc"><p>A more direct approach is to just fix the offending declarations
87
87
  in the Ruby include file(s), i.e. change the declaration for
88
- <tt class="function">rb_thread_wait_for()</tt> in
89
- <tt class="filename">intern.h</tt> to read:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">void rb_thread_wait_for(struct timeval);</pre></td></tr></table><p>and change the declaration for <tt class="function">rb_gc_mark()</tt>
90
- in <tt class="filename">intern.h</tt> to read:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">void rb_gc_mark(VALUE);</pre></td></tr></table></li></ul></div><p><span class="emphasis"><em>"Virtual Memory Exhausted"</em></span></p><p>For FXRuby releases earlier than version 0.99.173 it was common for
88
+ <code class="function">rb_thread_wait_for()</code> in
89
+ <code class="filename">intern.h</code> to read:</p><pre class="programlisting">void rb_thread_wait_for(struct timeval);</pre><p>and change the declaration for <code class="function">rb_gc_mark()</code>
90
+ in <code class="filename">intern.h</code> to read:</p><pre class="programlisting">void rb_gc_mark(VALUE);</pre></li></ul></div><p><span class="emphasis"><em>"Virtual Memory Exhausted"</em></span></p><p>For FXRuby releases earlier than version 0.99.173 it was common for
91
91
  the compiler to run out of memory trying to compile
92
- <tt class="filename">core_wrap.cpp</tt>, with an error message like:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">core_wrap.cpp: In function 'void Init_core()':
93
- core_wrap.cpp:108596: virtual memory exhausted</pre></td></tr></table><p>This failure was due to the use of optimizations by the compiler;
92
+ <code class="filename">core_wrap.cpp</code>, with an error message like:</p><pre class="screen">core_wrap.cpp: In function 'void Init_core()':
93
+ core_wrap.cpp:108596: virtual memory exhausted</pre><p>This failure was due to the use of optimizations by the compiler;
94
94
  the FXRuby source code makes heavy use of C++ templates and some versions
95
95
  of gcc require a lot of memory to process these. Starting with FXRuby
96
- version 0.99.173, the <tt class="filename">extconf.rb</tt> script
96
+ version 0.99.173, the <code class="filename">extconf.rb</code> script
97
97
  <span class="emphasis"><em>should</em></span> disable compiler optimizations when it
98
- generates the FXRuby <tt class="filename">Makefile</tt>. If you suspect that
98
+ generates the FXRuby <code class="filename">Makefile</code>. If you suspect that
99
99
  it's not disabling optimizations (or can see this by watching the compile
100
100
  command lines), try modifying the compiler flags
101
- (<tt class="constant">CFLAGS</tt>) in the <tt class="filename">Makefile</tt> by hand
101
+ (<code class="constant">CFLAGS</code>) in the <code class="filename">Makefile</code> by hand
102
102
  to do so.</p><p><span class="emphasis"><em>"Cannot load library"</em></span></p><p>On Linux and other Unix systems that support shared libraries, FOX
103
103
  is typically installed as a shared library named
104
- <tt class="filename">libFOX-1.4.so</tt>. After all of the source files for
104
+ <code class="filename">libFOX-1.4.so</code>. After all of the source files for
105
105
  FXRuby are compiled, the last step is to link all of the FXRuby object
106
106
  files together with the FOX library (and possibly other system libraries)
107
- to produce a new shared library, named <tt class="filename">fox14.so</tt>, that
107
+ to produce a new shared library, named <code class="filename">fox14.so</code>, that
108
108
  Ruby can import as an extension module.</p><p>There are a few things that can go wrong when you try to import this
109
109
  extension into Ruby. A common problem is that the operating system cannot
110
- locate the FOX shared library (<tt class="filename">libFOX-1.4.so</tt>) when it
110
+ locate the FOX shared library (<code class="filename">libFOX-1.4.so</code>) when it
111
111
  tries to dynamically load the FXRuby extension module; when this happens,
112
- the error message will look something like:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">$ <b class="command">irb</b>
113
- irb(main):001:0&gt; <b class="userinput"><tt>require 'fox14'</tt></b>
112
+ the error message will look something like:</p><pre class="screen">$ <span><strong class="command">irb</strong></span>
113
+ irb(main):001:0&gt; <strong class="userinput"><code>require 'fox14'</code></strong>
114
114
  LoadError: libFOX-0.99.so.173: cannot open shared object file: No such file or directory - /usr/local/lib/ruby/1.6/i586-linux/fox.so
115
115
  from (irb):1:in 'require'
116
116
  from (irb):1
117
- </pre></td></tr></table><p>One workaround for this problem is to modify the
118
- <tt class="constant">LD_LIBRARY_PATH</tt> environment variable to include the
119
- directory where <tt class="filename">libFOX.so</tt> is installed. For example,
120
- if <tt class="filename">libFOX-1.4.so</tt> is installed in <tt class="filename">/usr/local/lib</tt>, try setting:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">$ <b class="command">export LD_LIBRARY_PATH=/usr/local/lib</b>
121
- $ <b class="command">irb</b>
122
- irb(main):001:0&gt; <b class="userinput"><tt>require 'fox14'</tt></b>
123
- </pre></td></tr></table><p>If this works, you can of course permanently add the
124
- <tt class="constant">LD_LIBRARY_PATH</tt> setting to your login file(s) so that
117
+ </pre><p>One workaround for this problem is to modify the
118
+ <code class="constant">LD_LIBRARY_PATH</code> environment variable to include the
119
+ directory where <code class="filename">libFOX.so</code> is installed. For example,
120
+ if <code class="filename">libFOX-1.4.so</code> is installed in <code class="filename">/usr/local/lib</code>, try setting:</p><pre class="screen">$ <span><strong class="command">export LD_LIBRARY_PATH=/usr/local/lib</strong></span>
121
+ $ <span><strong class="command">irb</strong></span>
122
+ irb(main):001:0&gt; <strong class="userinput"><code>require 'fox14'</code></strong>
123
+ </pre><p>If this works, you can of course permanently add the
124
+ <code class="constant">LD_LIBRARY_PATH</code> setting to your login file(s) so that
125
125
  you don't have to remember to type it each time. Another approach that
126
126
  should work for Linux is to modify your
127
- <tt class="filename">/etc/ld.so.conf</tt> file to include the installation
128
- directory (e.g. <tt class="filename">/usr/local/lib</tt>). If you'd like to do
129
- this instead, you'll need to (as root):</p><div class="orderedlist"><ol type="1" compact><li><p>Edit your <tt class="filename">/etc/ld.so.conf</tt> file and add the
130
- directory where <tt class="filename">libFOX.so</tt> is installed;
131
- and,</p></li><li><p>At the shell prompt, type <b class="command">ldconfig</b> to reload
127
+ <code class="filename">/etc/ld.so.conf</code> file to include the installation
128
+ directory (e.g. <code class="filename">/usr/local/lib</code>). If you'd like to do
129
+ this instead, you'll need to (as root):</p><div class="orderedlist"><ol type="1" compact><li><p>Edit your <code class="filename">/etc/ld.so.conf</code> file and add the
130
+ directory where <code class="filename">libFOX.so</code> is installed;
131
+ and,</p></li><li><p>At the shell prompt, type <span><strong class="command">ldconfig</strong></span> to reload
132
132
  the linker configuration.</p></li></ol></div><p><span class="emphasis"><em>"Undefined symbol..."</em></span></p><p>Another problem that has been reported by users of both Debian
133
- GNU/Linux and NetBSD 1.5 is an error message along the lines of:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">/usr/lib/libstdc++.so.2: Undefined symbol "__vt_9exception"...</pre></td></tr></table><p>The fix for this problem is reported to be to modify the FXRuby
134
- <tt class="filename">Makefile</tt> and add <tt class="option">-lgcc</tt> to the
135
- <tt class="constant">LIBS</tt> line.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="goals.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="gems.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">History and Goals&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;2.&nbsp;Installing from Gems</td></tr></table></div></body></html>
133
+ GNU/Linux and NetBSD 1.5 is an error message along the lines of:</p><pre class="screen">/usr/lib/libstdc++.so.2: Undefined symbol "__vt_9exception"...</pre><p>The fix for this problem is reported to be to modify the FXRuby
134
+ <code class="filename">Makefile</code> and add <code class="option">-lgcc</code> to the
135
+ <code class="constant">LIBS</code> line.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="goals.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="gems.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">History and Goals&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;2.&nbsp;Installing from Gems</td></tr></table></div></body></html>
data/doc/ch03s02.html CHANGED
@@ -1,23 +1,23 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Better living through buttons</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="tutorial1.html" title="Chapter&nbsp;3.&nbsp;Hello, World!"><link rel="previous" href="tutorial1.html" title="Chapter&nbsp;3.&nbsp;Hello, World!"><link rel="next" href="ch03s03.html" title="Messages"></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">Better living through buttons</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="tutorial1.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;3.&nbsp;Hello, World!</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch03s03.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e724"></a>Better living through buttons</h2></div></div><div></div></div><p>Obviously, we need to add a few things to make it more interesting.
3
+ <title>Better living through buttons</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="tutorial1.html" title="Chapter&nbsp;3.&nbsp;Hello, World!"><link rel="prev" href="tutorial1.html" title="Chapter&nbsp;3.&nbsp;Hello, World!"><link rel="next" href="ch03s03.html" title="Messages"></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">Better living through buttons</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="tutorial1.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;3.&nbsp;Hello, World!</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch03s03.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e724"></a>Better living through buttons</h2></div></div></div><p>Obviously, we need to add a few things to make it more interesting.
4
4
  Let's start by putting a button inside the main window. The
5
- <tt class="classname">FXButton</tt> class provides a standard push-button
6
- widget:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">require 'fox14'
5
+ <code class="classname">FXButton</code> class provides a standard push-button
6
+ widget:</p><pre class="programlisting">require 'fox14'
7
7
 
8
8
  include Fox
9
9
 
10
10
  theApp = FXApp.new
11
11
 
12
12
  theMainWindow = FXMainWindow.new(theApp, "Hello")
13
- <span class="bold"><b>FXButton.new(theMainWindow, "Hello, World!")</b></span>
13
+ <span class="bold"><strong>FXButton.new(theMainWindow, "Hello, World!")</strong></span>
14
14
  theApp.create
15
15
 
16
16
  theMainWindow.show
17
17
 
18
- theApp.run</pre></td></tr></table><p>As you might guess, passing <i class="parameter"><tt>theMainWindow</tt></i> as
19
- the first argument to <tt class="methodname">FXButton.new</tt> tells FXRuby
18
+ theApp.run</pre><p>As you might guess, passing <em class="parameter"><code>theMainWindow</code></em> as
19
+ the first argument to <code class="methodname">FXButton.new</code> tells FXRuby
20
20
  that the new button is a child of the main window. The second argument to
21
- <tt class="methodname">FXButton.new</tt> is a string that will be displayed
21
+ <code class="methodname">FXButton.new</code> is a string that will be displayed
22
22
  on the button. If you run the program <span class="emphasis"><em>now</em></span>, you should
23
23
  see this:</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/hello-with-button.png" align="middle"></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="tutorial1.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="tutorial1.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="ch03s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter&nbsp;3.&nbsp;Hello, World!&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Messages</td></tr></table></div></body></html>
data/doc/ch03s03.html CHANGED
@@ -1,12 +1,12 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Messages</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="tutorial1.html" title="Chapter&nbsp;3.&nbsp;Hello, World!"><link rel="previous" href="ch03s02.html" title="Better living through buttons"><link rel="next" href="ch03s04.html" title="Adding a tool tip"></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">Messages</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s02.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;3.&nbsp;Hello, World!</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch03s04.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e755"></a>Messages</h2></div></div><div></div></div><p>Now we're cookin' with Crisco, but let's press on and see what other
3
+ <title>Messages</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="tutorial1.html" title="Chapter&nbsp;3.&nbsp;Hello, World!"><link rel="prev" href="ch03s02.html" title="Better living through buttons"><link rel="next" href="ch03s04.html" title="Adding a tool tip"></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">Messages</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s02.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;3.&nbsp;Hello, World!</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch03s04.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e755"></a>Messages</h2></div></div></div><p>Now we're cookin' with Crisco, but let's press on and see what other
4
4
  things we can do to improve this. You may have noticed by now that the
5
5
  only way to quit the program is to close the window using the window
6
6
  manager's "close window" option, or to just kill the program outright. We
7
7
  can do better than that. Let's add a message handler for the
8
- <tt class="classname">FXButton</tt> such that when you click the button, it
9
- causes the program to exit:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">require 'fox14'
8
+ <code class="classname">FXButton</code> such that when you click the button, it
9
+ causes the program to exit:</p><pre class="programlisting">require 'fox14'
10
10
 
11
11
  include Fox
12
12
 
@@ -14,39 +14,39 @@ theApp = FXApp.new
14
14
 
15
15
  theMainWindow = FXMainWindow.new(theApp, "Hello")
16
16
  theButton = FXButton.new(theMainWindow, "Hello, World!")
17
- <span class="bold"><b>theButton.connect(SEL_COMMAND) do |sender, selector, data|
17
+ <span class="bold"><strong>theButton.connect(SEL_COMMAND) do |sender, selector, data|
18
18
  exit
19
- end</b></span>
19
+ end</strong></span>
20
20
  theApp.create
21
21
 
22
22
  theMainWindow.show
23
23
 
24
- theApp.run</pre></td></tr></table><p>Most FOX objects send out messages (also known as
24
+ theApp.run</pre><p>Most FOX objects send out messages (also known as
25
25
  <span class="emphasis"><em>events</em></span>) when something interesting happens. FOX
26
26
  messages have four important elements:</p><div class="orderedlist"><ol type="1"><li><p>The message <span class="emphasis"><em>sender</em></span> is the object that sends
27
- the message. In this case, the <tt class="classname">FXButton</tt>
27
+ the message. In this case, the <code class="classname">FXButton</code>
28
28
  instance is the sender.</p></li><li><p>The message <span class="emphasis"><em>type</em></span> is a predefined integer
29
29
  constant that indicates what kind of event has occurred (i.e. why this
30
30
  message is being sent). In this case, the message type is
31
- <tt class="constant">SEL_COMMAND</tt>, which indicates that the command
31
+ <code class="constant">SEL_COMMAND</code>, which indicates that the command
32
32
  associated with this widget should be invoked.</p></li><li><p>The message <span class="emphasis"><em>identifier</em></span> is another integer
33
33
  constant that is used to distinguish between different messages of the
34
34
  same type. For example, the message that tells a FOX window to make
35
- itself visible is a <tt class="constant">SEL_COMMAND</tt> message with the
36
- identifier <tt class="constant">FXWindow::ID_SHOW</tt> (where
37
- <tt class="constant">ID_SHOW</tt> is a constant defined in the
38
- <tt class="classname">FXWindow</tt> class). A different message
39
- identifier, <tt class="constant">FXWindow::ID_HIDE</tt>, tells an
40
- <tt class="classname">FXWindow</tt> instance to make itself
35
+ itself visible is a <code class="constant">SEL_COMMAND</code> message with the
36
+ identifier <code class="constant">FXWindow::ID_SHOW</code> (where
37
+ <code class="constant">ID_SHOW</code> is a constant defined in the
38
+ <code class="classname">FXWindow</code> class). A different message
39
+ identifier, <code class="constant">FXWindow::ID_HIDE</code>, tells an
40
+ <code class="classname">FXWindow</code> instance to make itself
41
41
  invisible.</p></li><li><p>The message <span class="emphasis"><em>data</em></span> is an object containing
42
42
  message-specific information. For this case (the
43
- <tt class="classname">FXButton</tt>'s <tt class="constant">SEL_COMMAND</tt>
43
+ <code class="classname">FXButton</code>'s <code class="constant">SEL_COMMAND</code>
44
44
  message, there is no interesting message data, but we'll see other
45
45
  kinds of messages where the message data is useful.</p></li></ol></div><p>For historical reasons, the message type and identifier are usually
46
46
  packed into a single 32-bit unsigned integer known as the
47
47
  <span class="emphasis"><em>selector</em></span>, and this is the value that is passed into
48
48
  the message handler block. Since we don't actually need to use the
49
- <i class="parameter"><tt>sender</tt></i>, <i class="parameter"><tt>selector</tt></i> or
50
- <i class="parameter"><tt>data</tt></i> arguments for this particular message handler,
51
- we can just ignore them and shorten the code to:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">theButton.connect(SEL_COMMAND) { exit }</pre></td></tr></table><p>Re-run the program and push the button to convince yourself that it
49
+ <em class="parameter"><code>sender</code></em>, <em class="parameter"><code>selector</code></em> or
50
+ <em class="parameter"><code>data</code></em> arguments for this particular message handler,
51
+ we can just ignore them and shorten the code to:</p><pre class="programlisting">theButton.connect(SEL_COMMAND) { exit }</pre><p>Re-run the program and push the button to convince yourself that it
52
52
  works.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch03s02.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="tutorial1.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="ch03s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Better living through buttons&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Adding a tool tip</td></tr></table></div></body></html>
data/doc/ch03s04.html CHANGED
@@ -1,10 +1,10 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Adding a tool tip</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="tutorial1.html" title="Chapter&nbsp;3.&nbsp;Hello, World!"><link rel="previous" href="ch03s03.html" title="Messages"><link rel="next" href="ch03s05.html" title="Adding an icon"></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">Adding a tool tip</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s03.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;3.&nbsp;Hello, World!</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch03s05.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e846"></a>Adding a tool tip</h2></div></div><div></div></div><p>To wrap up this introduction, we'd like to add a few finishing
3
+ <title>Adding a tool tip</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="tutorial1.html" title="Chapter&nbsp;3.&nbsp;Hello, World!"><link rel="prev" href="ch03s03.html" title="Messages"><link rel="next" href="ch03s05.html" title="Adding an icon"></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">Adding a tool tip</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s03.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;3.&nbsp;Hello, World!</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch03s05.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e846"></a>Adding a tool tip</h2></div></div></div><p>To wrap up this introduction, we'd like to add a few finishing
4
4
  touches to the program. The first addition is to add a tool tip to the
5
5
  button, such that when the mouse cursor hovers over the button for a short
6
6
  while, it will pop up a little message describing what the button
7
- does:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">require 'fox14'
7
+ does:</p><pre class="programlisting">require 'fox14'
8
8
 
9
9
  include Fox
10
10
 
@@ -13,24 +13,24 @@ theApp = FXApp.new
13
13
  theMainWindow = FXMainWindow.new(theApp, "Hello")
14
14
 
15
15
  theButton = FXButton.new(theMainWindow, "Hello, World!")
16
- <span class="bold"><b>theButton.tipText = "Push Me!"</b></span>
16
+ <span class="bold"><strong>theButton.tipText = "Push Me!"</strong></span>
17
17
  theButton.connect(SEL_COMMAND) { exit }
18
18
 
19
- <span class="bold"><b>FXToolTip.new(theApp)</b></span>
19
+ <span class="bold"><strong>FXToolTip.new(theApp)</strong></span>
20
20
 
21
21
  theApp.create
22
22
 
23
23
  theMainWindow.show
24
24
 
25
- theApp.run</pre></td></tr></table><p>There are two changes involved here. The first is to set the tool
26
- tip text for the button using the <tt class="methodname">tipText</tt>
25
+ theApp.run</pre><p>There are two changes involved here. The first is to set the tool
26
+ tip text for the button using the <code class="methodname">tipText</code>
27
27
  accessor, and for this example we're setting the button's tip text to
28
28
  "Push Me!". The second change is to create the (single)
29
- <tt class="classname">FXToolTip</tt> instance for the application. Although
30
- this program shows the <tt class="classname">FXToolTip</tt> instance being
31
- created after the <tt class="classname">FXButton</tt>, it doesn't really
29
+ <code class="classname">FXToolTip</code> instance for the application. Although
30
+ this program shows the <code class="classname">FXToolTip</code> instance being
31
+ created after the <code class="classname">FXButton</code>, it doesn't really
32
32
  matter when you do it. You just want to have instantiated the
33
- <tt class="classname">FXToolTip</tt> before you drop into the main event loop
34
- by calling <tt class="methodname">FXApp#run</tt>. If you run this version and
33
+ <code class="classname">FXToolTip</code> before you drop into the main event loop
34
+ by calling <code class="methodname">FXApp#run</code>. If you run this version and
35
35
  hover over the button for a second or so, you should see the tooltip pop
36
36
  up:</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/hello-with-tooltip.png" align="middle"></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch03s03.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="tutorial1.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="ch03s05.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Messages&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Adding an icon</td></tr></table></div></body></html>
data/doc/ch03s05.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>Adding an icon</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="tutorial1.html" title="Chapter&nbsp;3.&nbsp;Hello, World!"><link rel="previous" href="ch03s04.html" title="Adding a tool tip"><link rel="next" href="clipboardtut.html" title="Chapter&nbsp;4.&nbsp;Working With 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">Adding an icon</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s04.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;3.&nbsp;Hello, World!</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="clipboardtut.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e883"></a>Adding an icon</h2></div></div><div></div></div><p>The final change is to add an icon to the button to make things a
3
+ <title>Adding an icon</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="tutorial1.html" title="Chapter&nbsp;3.&nbsp;Hello, World!"><link rel="prev" href="ch03s04.html" title="Adding a tool tip"><link rel="next" href="clipboardtut.html" title="Chapter&nbsp;4.&nbsp;Working With 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">Adding an icon</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s04.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;3.&nbsp;Hello, World!</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="clipboardtut.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e883"></a>Adding an icon</h2></div></div></div><p>The final change is to add an icon to the button to make things a
4
4
  little more festive. FOX supports all of the popular image file formats
5
5
  (e.g. BMP, GIF, JPEG, PNG and TIFF) and you can use any of them as icons
6
6
  on buttons and labels. For this example, we'll use the one of the "Powered
7
7
  By Ruby" images created by Hal Fulton (and posted at the <a href="http://www.rubygarden.org/ruby?PoweredByRubyButtons" target="_top">Ruby Garden
8
- Wiki</a>):</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">require 'fox14'
8
+ Wiki</a>):</p><pre class="programlisting">require 'fox14'
9
9
 
10
10
  include Fox
11
11
 
@@ -15,9 +15,9 @@ theMainWindow = FXMainWindow.new(theApp, "Hello")
15
15
 
16
16
  theButton = FXButton.new(theMainWindow, "Hello, World!")
17
17
  theButton.tipText = "Push Me!"
18
- <span class="bold"><b>iconFile = File.open("pbr.jpg", "rb")
18
+ <span class="bold"><strong>iconFile = File.open("pbr.jpg", "rb")
19
19
  theButton.icon = FXJPGIcon.new(theApp, iconFile.read)
20
- iconFile.close</b></span>
20
+ iconFile.close</strong></span>
21
21
  theButton.connect(SEL_COMMAND) { exit }
22
22
 
23
23
  FXToolTip.new(theApp)
@@ -26,22 +26,22 @@ theApp.create
26
26
 
27
27
  theMainWindow.show
28
28
 
29
- theApp.run</pre></td></tr></table><p>Here, <tt class="filename">pbr.jpg</tt> is the file name of the JPEG
29
+ theApp.run</pre><p>Here, <code class="filename">pbr.jpg</code> is the file name of the JPEG
30
30
  image file. You want to be sure to open the file in
31
31
  <span class="emphasis"><em>binary</em></span> mode (i.e. including the "b" mode flag),
32
32
  because there is a difference on the Windows platform. Since it's a JPEG
33
- image, we need to use the <tt class="classname">FXJPGIcon</tt> class to
33
+ image, we need to use the <code class="classname">FXJPGIcon</code> class to
34
34
  instantiate this icon. The first argument to
35
- <tt class="methodname">FXJPGIcon.new</tt> is just a reference to the
36
- <tt class="classname">FXApp</tt> instance, and the second argument is the
35
+ <code class="methodname">FXJPGIcon.new</code> is just a reference to the
36
+ <code class="classname">FXApp</code> instance, and the second argument is the
37
37
  contents of the image file. We associate this icon object with our button
38
- using the button's <tt class="methodname">icon</tt> accessor method. If you
38
+ using the button's <code class="methodname">icon</code> accessor method. If you
39
39
  run this example, you should see:</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/hello-with-icon-1.png" align="middle"></div></div><p>When you have both text and an icon displayed on a button (or its
40
- superclass, <tt class="classname">FXLabel</tt>) the default positioning is to
40
+ superclass, <code class="classname">FXLabel</code>) the default positioning is to
41
41
  display the icon to the left of the text. For this particular example,
42
42
  however, it would probably be more appropriate to display the icon
43
43
  <span class="emphasis"><em>above</em></span> the text. We can achieve this using the
44
- button's <tt class="methodname">iconPosition</tt> accessor method:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">theButton.iconPosition = ICON_ABOVE_TEXT</pre></td></tr></table><p>If you re-run the program after adding this line, you should
44
+ button's <code class="methodname">iconPosition</code> accessor method:</p><pre class="programlisting">theButton.iconPosition = ICON_ABOVE_TEXT</pre><p>If you re-run the program after adding this line, you should
45
45
  see:</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/hello-with-icon-2.png" align="middle"></div></div><p>The last change we're going to make is to make the icon transparent.
46
46
  FOX allows you to specify that some regions of an icon should be treated
47
47
  as "transparent", meaning that whatever's underneath them shows through.
@@ -52,9 +52,9 @@ theApp.run</pre></td></tr></table><p>Here, <tt class="filename">pbr.jpg</tt> is
52
52
  it's part of the image information). You can also specify the transparency
53
53
  color explicitly if you like.</p><p>For the icon we've chosen, it's pretty obvious that the transparency
54
54
  color is white, but let's let FOX figure that out for us. We want to
55
- activate two options for the icon:</p><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc"><p>the <tt class="constant">IMAGE_ALPHACOLOR</tt> option, which tells
55
+ activate two options for the icon:</p><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc"><p>the <code class="constant">IMAGE_ALPHACOLOR</code> option, which tells
56
56
  FOX that some regions of this image should be treated as transparent;
57
- and,</p></li><li style="list-style-type: disc"><p>the <tt class="constant">IMAGE_ALPHAGUESS</tt> option, which tells
57
+ and,</p></li><li style="list-style-type: disc"><p>the <code class="constant">IMAGE_ALPHAGUESS</code> option, which tells
58
58
  FOX to guess the appropriate transparency color using the colors used
59
- in the four corners of the image.</p></li></ul></div><p>To set these options, add this line to the program:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">theButton.icon.options = IMAGE_ALPHACOLOR | IMAGE_ALPHAGUESS</pre></td></tr></table><p>and then re-run the program after making this change to see the
59
+ in the four corners of the image.</p></li></ul></div><p>To set these options, add this line to the program:</p><pre class="programlisting">theButton.icon.options = IMAGE_ALPHACOLOR | IMAGE_ALPHAGUESS</pre><p>and then re-run the program after making this change to see the
60
60
  final result:</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/hello-with-icon-3.png" align="middle"></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch03s04.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="tutorial1.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="clipboardtut.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Adding a tool tip&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;4.&nbsp;Working With the Clipboard</td></tr></table></div></body></html>