fxruby 1.6.7 → 1.6.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. data/doc/apes02.html +2 -2
  2. data/doc/apes03.html +1 -1
  3. data/doc/book.html +1 -1
  4. data/doc/build.html +24 -24
  5. data/doc/ch03s02.html +1 -1
  6. data/doc/ch03s03.html +1 -1
  7. data/doc/ch03s04.html +1 -1
  8. data/doc/ch03s05.html +1 -1
  9. data/doc/ch04s02.html +6 -7
  10. data/doc/ch04s03.html +1 -1
  11. data/doc/ch04s04.html +1 -1
  12. data/doc/ch05s02.html +44 -46
  13. data/doc/ch05s03.html +21 -22
  14. data/doc/changes.html +31 -24
  15. data/doc/clipboardtut.html +7 -8
  16. data/doc/differences.html +9 -9
  17. data/doc/dragdroptut.html +52 -55
  18. data/doc/events.html +7 -7
  19. data/doc/examples.html +24 -24
  20. data/doc/gems.html +10 -10
  21. data/doc/goals.html +8 -6
  22. data/doc/implementation.html +1 -1
  23. data/doc/infosources.html +5 -5
  24. data/doc/library.html +5 -5
  25. data/doc/opengl.html +5 -5
  26. data/doc/pt01.html +1 -1
  27. data/doc/pt02.html +1 -1
  28. data/doc/scintilla.html +8 -8
  29. data/doc/style.css +246 -2
  30. data/doc/subversion.html +1 -1
  31. data/doc/tutorial1.html +2 -2
  32. data/doc/unicode.html +2 -2
  33. data/examples/babelfish.rb +0 -1
  34. data/examples/bounce.rb +0 -1
  35. data/examples/button.rb +0 -1
  36. data/examples/datatarget.rb +0 -1
  37. data/examples/dialog.rb +0 -1
  38. data/examples/dilbert.rb +0 -1
  39. data/examples/dirlist.rb +0 -1
  40. data/examples/dragdrop.rb +0 -1
  41. data/examples/dragsource.rb +0 -1
  42. data/examples/dropsite.rb +1 -2
  43. data/examples/foursplit.rb +0 -1
  44. data/examples/gltest.rb +0 -1
  45. data/examples/glviewer.rb +0 -1
  46. data/examples/groupbox.rb +0 -1
  47. data/examples/header.rb +0 -1
  48. data/examples/iconlist.rb +0 -1
  49. data/examples/image.rb +0 -1
  50. data/examples/imageviewer.rb +0 -1
  51. data/examples/inputs.rb +0 -1
  52. data/examples/mditest.rb +0 -1
  53. data/examples/pig.rb +0 -1
  54. data/examples/raabrowser.rb +0 -1
  55. data/examples/ratio.rb +0 -1
  56. data/examples/rulerview.rb +0 -1
  57. data/examples/scribble.rb +0 -1
  58. data/examples/shutter.rb +0 -1
  59. data/examples/splitter.rb +0 -1
  60. data/examples/tabbook.rb +0 -1
  61. data/examples/table.rb +0 -1
  62. data/ext/fox16/FXRuby.cpp +3 -4
  63. data/lib/fox16/version.rb +1 -1
  64. metadata +2 -3
  65. data/doc/todo.html +0 -40
@@ -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><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook v5 XSL Stylesheets V1.72.0"><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="d0e5280"></a>Object Life Cycles and Garbage Collection</h2></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 v5 XSL Stylesheets V1.72.0"><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="d0e5267"></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,
@@ -18,4 +18,4 @@ myButton = FXButton.new(parentWin, "Hello, World!", myIcon)</pre><p>It's importa
18
18
  returned from most class instance methods; they are references to already-
19
19
  existing objects. For example, <code class="methodname">FXStatusBar#statusline
20
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="d0e5299"></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>
21
+ instance.</p><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e5286"></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>
@@ -1,6 +1,6 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Virtual Functions</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook v5 XSL Stylesheets V1.72.0"><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="subversion.html" title="Appendix&nbsp;F.&nbsp;Getting the Sources from Subversion"></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="subversion.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="d0e5333"></a>Virtual Functions</h2></div></div></div><p>
3
+ <title>Virtual Functions</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook v5 XSL Stylesheets V1.72.0"><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="subversion.html" title="Appendix&nbsp;F.&nbsp;Getting the Sources from Subversion"></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="subversion.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="d0e5320"></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
@@ -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><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook v5 XSL Stylesheets V1.72.0"><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.6</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; 2006 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="unicode.html">6. Unicode and FXRuby</a></span></dt><dd><dl><dt><span class="section"><a href="unicode.html#d0e1608">Basic Application</a></span></dt></dl></dd><dt><span class="chapter"><a href="examples.html">7. Examples</a></span></dt><dt><span class="chapter"><a href="events.html">8. FXRuby's Message-Target System</a></span></dt><dt><span class="chapter"><a href="todo.html">9. To-do list</a></span></dt><dt><span class="chapter"><a href="infosources.html">10. Other Sources of Information</a></span></dt><dt><span class="chapter"><a href="changes.html">11. 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#d0e5261">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#d0e5299">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="subversion.html">F. Getting the Sources from Subversion</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>
3
+ <title>Developing Graphical User Interfaces with FXRuby</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook v5 XSL Stylesheets V1.72.0"><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.6</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; 2006 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#d0e614">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#d0e1003">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#d0e1218">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="unicode.html">6. Unicode and FXRuby</a></span></dt><dd><dl><dt><span class="section"><a href="unicode.html#d0e1628">Basic Application</a></span></dt></dl></dd><dt><span class="chapter"><a href="examples.html">7. Examples</a></span></dt><dt><span class="chapter"><a href="events.html">8. FXRuby's Message-Target System</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#d0e5248">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#d0e5286">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="subversion.html">F. Getting the Sources from Subversion</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>
@@ -8,21 +8,21 @@
8
8
  consult <a xmlns:xlink="http://www.w3.org/1999/xlink" href="http://www.fox-toolkit.net/cgi-bin/wiki.pl?Mac_OS_X" target="_top">this
9
9
  page</a> from the <a xmlns:xlink="http://www.w3.org/1999/xlink" 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><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="d0e109"></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><pre class="screen">$ <span><strong class="command">tar xzf FXRuby-1.6.0.tar.gz</strong></span></pre><p>This will create a new directory called <code class="filename">FXRuby-1.6.0</code>. Change to the top-level
13
+ tarball and unpack it by typing:</p><pre class="screen">$ <span><strong class="command">tar xzf FXRuby-1.6.7.tar.gz</strong></span></pre><p>This will create a new directory called <code class="filename">FXRuby-1.6.7</code>. Change to the top-level
14
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
15
  the FOX include files and library in the standard <code class="filename">/usr/local/include/fox-1.6</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
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
- --with-fox-include=/home/lyle/fox-1.6.3/include \
19
- --with-fox-lib=/home/lyle/fox-1.6.3/src/.libs</strong></span></pre><p>Once the build has been configured, you can start the build by
18
+ --with-fox-include=/home/lyle/fox-1.6.25/include \
19
+ --with-fox-lib=/home/lyle/fox-1.6.25/src/.libs</strong></span></pre><p>Once the build has been configured, you can start the build by
20
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
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
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 'fox'</code></strong>
25
+ irb(main):001:0&gt; <strong class="userinput"><code>require 'fox16'</code></strong>
26
26
  true
27
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
@@ -30,19 +30,19 @@ irb(main):002:0&gt;</pre><p>If the import failed (usually with a message along t
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><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="d0e180"></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. <code class="filename">C:\ruby-1.8.4</code>) and then typing:</p><pre class="screen">C:\ruby-1.8.4&gt;<span><strong class="command">win32\configure</strong></span>
37
+ tarball, changing into the top-level source code directory (e.g. <code class="filename">C:\ruby-1.8.6</code>) and then typing:</p><pre class="screen">C:\ruby-1.8.6&gt;<span><strong class="command">win32\configure</strong></span>
38
38
  type 'nmake' to make ruby for mswin32.
39
- C:\ruby-1.8.4&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.4&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
39
+ C:\ruby-1.8.6&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.6&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
- code distribution.</p><p>Now you can configure the FXRuby build by typing:</p><pre class="screen">C:\FXRuby-1.6.0&gt;<span><strong class="command">ruby install.rb config --make-prog=nmake -- \
43
- --with-fox-include=C:\fox-1.6.3\include \
44
- --with-fox-lib=C:\fox-1.6.3\lib</strong></span></pre><p>Once the build has been configured, you can start the build by
45
- typing:</p><pre class="screen">C:\FXRuby-1.6.0&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,
42
+ code distribution.</p><p>Now you can configure the FXRuby build by typing:</p><pre class="screen">C:\FXRuby-1.6.7&gt;<span><strong class="command">ruby install.rb config --make-prog=nmake -- \
43
+ --with-fox-include=C:\fox-1.6.25\include \
44
+ --with-fox-lib=C:\fox-1.6.25\lib</strong></span></pre><p>Once the build has been configured, you can start the build by
45
+ typing:</p><pre class="screen">C:\FXRuby-1.6.7&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,
46
46
  so this might be a good time to take a coffee break. Because Visual C++ is
47
47
  such a strict compiler (usually a good thing), you will probably run into
48
48
  a few problems with non-ANSI declarations in the Ruby header files. If you
@@ -50,8 +50,8 @@ C:\ruby-1.8.4&gt;<span><strong class="command">nmake</strong></span></pre><p>Aft
50
50
  for a list of things that could go wrong, and workarounds for those
51
51
  problems. None of them are showstoppers and none require you to restart
52
52
  the compile from scratch (just type <span><strong class="command">ruby install.rb
53
- 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.6.0&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
54
- probably fire up <code class="filename">irb</code> and try to import FXRuby:</p><pre class="screen">C:\FXRuby-1.6.0&gt; <span><strong class="command">irb</strong></span>
53
+ 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.6.7&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
54
+ probably fire up <code class="filename">irb</code> and try to import FXRuby:</p><pre class="screen">C:\FXRuby-1.6.7&gt; <span><strong class="command">irb</strong></span>
55
55
  irb(main):001:0&gt; <strong class="userinput"><code>require 'fox16'</code></strong>
56
56
  true
57
57
  irb(main):002:0&gt;</pre><p>If the import failed (usually with a message along the lines of
@@ -99,25 +99,25 @@ core_wrap.cpp:108596: virtual memory exhausted</pre><p>This failure was due to t
99
99
  (<code class="constant">CFLAGS</code>) in the <code class="filename">Makefile</code> by hand
100
100
  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
101
101
  is typically installed as a shared library named
102
- <code class="filename">libFOX-1.4.so</code>. After all of the source files for
102
+ <code class="filename">libFOX-1.6.so</code>. After all of the source files for
103
103
  FXRuby are compiled, the last step is to link all of the FXRuby object
104
104
  files together with the FOX library (and possibly other system libraries)
105
- to produce a new shared library, named <code class="filename">fox14.so</code>, that
105
+ to produce a new shared library, named <code class="filename">fox16.so</code>, that
106
106
  Ruby can import as an extension module.</p><p>There are a few things that can go wrong when you try to import this
107
107
  extension into Ruby. A common problem is that the operating system cannot
108
- locate the FOX shared library (<code class="filename">libFOX-1.4.so</code>) when it
108
+ locate the FOX shared library (<code class="filename">libFOX-1.6.so</code>) when it
109
109
  tries to dynamically load the FXRuby extension module; when this happens,
110
110
  the error message will look something like:</p><pre class="screen">$ <span><strong class="command">irb</strong></span>
111
- irb(main):001:0&gt; <strong class="userinput"><code>require 'fox'</code></strong>
112
- 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
111
+ irb(main):001:0&gt; <strong class="userinput"><code>require 'fox16'</code></strong>
112
+ LoadError: libFOX-1.6.so: cannot open shared object file: No such file or directory - /usr/local/lib/ruby/1.8/i686-linux/fox16.so
113
113
  from (irb):1:in 'require'
114
114
  from (irb):1
115
115
  </pre><p>One workaround for this problem is to modify the
116
116
  <code class="constant">LD_LIBRARY_PATH</code> environment variable to include the
117
- directory where <code class="filename">libFOX.so</code> is installed. For example,
118
- 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>
117
+ directory where <code class="filename">libFOX-1.6.so</code> is installed. For example,
118
+ if <code class="filename">libFOX-1.6.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>
119
119
  $ <span><strong class="command">irb</strong></span>
120
- irb(main):001:0&gt; <strong class="userinput"><code>require 'fox'</code></strong>
120
+ irb(main):001:0&gt; <strong class="userinput"><code>require 'fox16'</code></strong>
121
121
  </pre><p>If this works, you can of course permanently add the
122
122
  <code class="constant">LD_LIBRARY_PATH</code> setting to your login file(s) so that
123
123
  you don't have to remember to type it each time. Another approach that
@@ -125,7 +125,7 @@ irb(main):001:0&gt; <strong class="userinput"><code>require 'fox'</code></strong
125
125
  <code class="filename">/etc/ld.so.conf</code> file to include the installation
126
126
  directory (e.g. <code class="filename">/usr/local/lib</code>). If you'd like to do
127
127
  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
128
- directory where <code class="filename">libFOX.so</code> is installed;
128
+ directory where <code class="filename">libFOX-1.6.so</code> is installed;
129
129
  and,</p></li><li><p>At the shell prompt, type <span><strong class="command">ldconfig</strong></span> to reload
130
130
  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
131
131
  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
@@ -1,6 +1,6 @@
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><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook v5 XSL Stylesheets V1.72.0"><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.
3
+ <title>Better living through buttons</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook v5 XSL Stylesheets V1.72.0"><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="d0e741"></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
5
  <code class="classname">FXButton</code> class provides a standard push-button
6
6
  widget:</p><pre class="programlisting">require 'fox16'
@@ -1,6 +1,6 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Messages</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook v5 XSL Stylesheets V1.72.0"><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
3
+ <title>Messages</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook v5 XSL Stylesheets V1.72.0"><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="d0e772"></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
@@ -1,6 +1,6 @@
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><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook v5 XSL Stylesheets V1.72.0"><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
3
+ <title>Adding a tool tip</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook v5 XSL Stylesheets V1.72.0"><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="d0e863"></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
@@ -1,6 +1,6 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Adding an icon</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook v5 XSL Stylesheets V1.72.0"><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
3
+ <title>Adding an icon</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook v5 XSL Stylesheets V1.72.0"><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="d0e900"></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
@@ -1,8 +1,7 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Acquiring the Clipboard</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook v5 XSL Stylesheets V1.72.0"><link rel="start" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="clipboardtut.html" title="Chapter&nbsp;4.&nbsp;Working With the Clipboard"><link rel="prev" href="clipboardtut.html" title="Chapter&nbsp;4.&nbsp;Working With the Clipboard"><link rel="next" href="ch04s03.html" title="Sending Data to 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">Acquiring the Clipboard</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="clipboardtut.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;4.&nbsp;Working With the Clipboard</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch04s03.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="d0e1005"></a>Acquiring the Clipboard</h2></div></div></div><p>Let's begin by augmenting the GUI to include a row of buttons along
4
- the bottom of the main window for copying and pasting:</p><pre class="programlisting">require 'rubygems'
5
- require_gem 'fxruby'
3
+ <title>Acquiring the Clipboard</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook v5 XSL Stylesheets V1.72.0"><link rel="start" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="clipboardtut.html" title="Chapter&nbsp;4.&nbsp;Working With the Clipboard"><link rel="prev" href="clipboardtut.html" title="Chapter&nbsp;4.&nbsp;Working With the Clipboard"><link rel="next" href="ch04s03.html" title="Sending Data to 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">Acquiring the Clipboard</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="clipboardtut.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;4.&nbsp;Working With the Clipboard</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch04s03.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="d0e1022"></a>Acquiring the Clipboard</h2></div></div></div><p>Let's begin by augmenting the GUI to include a row of buttons along
4
+ the bottom of the main window for copying and pasting:</p><pre class="programlisting">require 'fox16'
6
5
  require 'customer'
7
6
 
8
7
  include Fox
@@ -10,7 +9,7 @@ include Fox
10
9
  class ClipMainWindow &lt; FXMainWindow
11
10
  def initialize(anApp)
12
11
  # Initialize base class first
13
- super(anApp, "Clipboard Example", nil, nil, DECOR_ALL, 0, 0, 400, 300)
12
+ super(anApp, "Clipboard Example", :opts =&gt; DECOR_ALL, :width =&gt; 400, :height =&gt; 300)
14
13
  <span class="bold"><strong>
15
14
  # Horizontal frame contains buttons
16
15
  buttons = FXHorizontalFrame.new(self, LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|PACK_UNIFORM_WIDTH)
@@ -20,11 +19,11 @@ class ClipMainWindow &lt; FXMainWindow
20
19
  pasteButton = FXButton.new(buttons, "Paste")
21
20
  </strong></span>
22
21
  # Place the list in a sunken frame
23
- sunkenFrame = FXVerticalFrame.new(self, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK,
24
- 0, 0, 0, 0, 0, 0, 0, 0)
22
+ sunkenFrame = FXVerticalFrame.new(self,
23
+ LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding =&gt; 0)
25
24
 
26
25
  # Customer list
27
- customerList = FXList.new(sunkenFrame, nil, 0, LIST_BROWSESELECT|LAYOUT_FILL_X|LAYOUT_FILL_Y)
26
+ customerList = FXList.new(sunkenFrame, :opts =&gt; LIST_BROWSESELECT|LAYOUT_FILL_X|LAYOUT_FILL_Y)
28
27
  $customers.each do |customer|
29
28
  customerList.appendItem(customer.name, nil, customer)
30
29
  end
@@ -1,6 +1,6 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Sending Data to the Clipboard</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook v5 XSL Stylesheets V1.72.0"><link rel="start" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="clipboardtut.html" title="Chapter&nbsp;4.&nbsp;Working With the Clipboard"><link rel="prev" href="ch04s02.html" title="Acquiring the Clipboard"><link rel="next" href="ch04s04.html" title="Pasting Data from 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">Sending Data to the Clipboard</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s02.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;4.&nbsp;Working With the Clipboard</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch04s04.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="d0e1054"></a>Sending Data to the Clipboard</h2></div></div></div><p>Whenever some other window requests the clipboard's contents (e.g.
3
+ <title>Sending Data to the Clipboard</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook v5 XSL Stylesheets V1.72.0"><link rel="start" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="clipboardtut.html" title="Chapter&nbsp;4.&nbsp;Working With the Clipboard"><link rel="prev" href="ch04s02.html" title="Acquiring the Clipboard"><link rel="next" href="ch04s04.html" title="Pasting Data from 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">Sending Data to the Clipboard</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s02.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;4.&nbsp;Working With the Clipboard</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch04s04.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="d0e1071"></a>Sending Data to the Clipboard</h2></div></div></div><p>Whenever some other window requests the clipboard's contents (e.g.
4
4
  as a result of a "paste" operation) FOX will send a
5
5
  <code class="constant">SEL_CLIPBOARD_REQUEST</code> message to the current
6
6
  clipboard owner. Remember, the clipboard owner is the window that called
@@ -1,6 +1,6 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Pasting Data from the Clipboard</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook v5 XSL Stylesheets V1.72.0"><link rel="start" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="clipboardtut.html" title="Chapter&nbsp;4.&nbsp;Working With the Clipboard"><link rel="prev" href="ch04s03.html" title="Sending Data to the Clipboard"><link rel="next" href="dragdroptut.html" title="Chapter&nbsp;5.&nbsp;Drag and Drop"></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">Pasting Data from the Clipboard</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s03.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;4.&nbsp;Working With the Clipboard</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="dragdroptut.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="d0e1105"></a>Pasting Data from the Clipboard</h2></div></div></div><p>We've seen one side of the equation, copying string data to the
3
+ <title>Pasting Data from the Clipboard</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook v5 XSL Stylesheets V1.72.0"><link rel="start" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="clipboardtut.html" title="Chapter&nbsp;4.&nbsp;Working With the Clipboard"><link rel="prev" href="ch04s03.html" title="Sending Data to the Clipboard"><link rel="next" href="dragdroptut.html" title="Chapter&nbsp;5.&nbsp;Drag and Drop"></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">Pasting Data from the Clipboard</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s03.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;4.&nbsp;Working With the Clipboard</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="dragdroptut.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="d0e1122"></a>Pasting Data from the Clipboard</h2></div></div></div><p>We've seen one side of the equation, copying string data to the
4
4
  clipboard. But before we can "round-trip" that customer data and paste it
5
5
  back into another copy of our customer list application, we're clearly
6
6
  going to need to transfer the data in some more useful format. That is to
@@ -1,28 +1,27 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Drag Sources</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook v5 XSL Stylesheets V1.72.0"><link rel="start" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="dragdroptut.html" title="Chapter&nbsp;5.&nbsp;Drag and Drop"><link rel="prev" href="dragdroptut.html" title="Chapter&nbsp;5.&nbsp;Drag and Drop"><link rel="next" href="ch05s03.html" title="Putting It All Together"></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">Drag Sources</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="dragdroptut.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;5.&nbsp;Drag and Drop</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch05s03.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="d0e1353"></a>Drag Sources</h2></div></div></div><p>As before, we're going to start by presenting a skeleton application
3
+ <title>Drag Sources</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook v5 XSL Stylesheets V1.72.0"><link rel="start" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="dragdroptut.html" title="Chapter&nbsp;5.&nbsp;Drag and Drop"><link rel="prev" href="dragdroptut.html" title="Chapter&nbsp;5.&nbsp;Drag and Drop"><link rel="next" href="ch05s03.html" title="Putting It All Together"></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">Drag Sources</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="dragdroptut.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;5.&nbsp;Drag and Drop</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch05s03.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="d0e1373"></a>Drag Sources</h2></div></div></div><p>As before, we're going to start by presenting a skeleton application
4
4
  consisting of a main window widget (a <code class="classname">DragSource</code>
5
- instance) that parents an <code class="classname">FXCanvas</code> widget:</p><pre class="programlisting">require 'rubygems'
6
- require_gem 'fxruby'
5
+ instance) that parents an <code class="classname">FXCanvas</code> widget:</p><pre class="programlisting">require 'fox16'
7
6
 
8
7
  include Fox
9
8
 
10
9
  class DragSource &lt; FXMainWindow
11
10
  def initialize(anApp)
12
11
  # Initialize base class
13
- super(anApp, "Drag Source", nil, nil, DECOR_ALL, 0, 0, 400, 300)
12
+ super(anApp, "Drag Source", :opts =&gt; DECOR_ALL, :width =&gt; 400, :height =&gt; 300)
14
13
 
15
14
  # Fill main window with canvas
16
- @canvas = FXCanvas.new(self, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y)
15
+ @canvas = FXCanvas.new(self, :opts =&gt; LAYOUT_FILL_X|LAYOUT_FILL_Y)
17
16
  @canvas.backColor = "red"
18
17
 
19
18
  # Handle expose events on the canvas
20
- @canvas.connect(SEL_PAINT) { |sender, sel, event|
21
- FXDCWindow.new(@canvas, event) { |dc|
19
+ @canvas.connect(SEL_PAINT) do |sender, sel, event|
20
+ FXDCWindow.new(@canvas, event) do |dc|
22
21
  dc.foreground = @canvas.backColor
23
22
  dc.fillRectangle(event.rect.x, event.rect.y, event.rect.w, event.rect.h)
24
- }
25
- }
23
+ end
24
+ end
26
25
  end
27
26
 
28
27
  def create
@@ -53,14 +52,14 @@ end
53
52
  canvas widget that just clears the canvas to its current background
54
53
  color; and,</p></li><li><p>The drag type for colors
55
54
  (<code class="constant">FXWindow.colorType</code>) is registered in the
56
- <code class="classname">DragSource</code>'s <code class="methodname">create()</code>
55
+ <code class="classname">DragSource</code>'s <code class="methodname">create</code>
57
56
  method.</p></li></ul></div><p>As before, you may want to run this basic version of the program to
58
57
  be sure that it's working properly so far. You should simply see an empty
59
58
  window with a red background.</p><p>Now for this application, we want a drag operation to begin when the
60
59
  user presses the left mouse button inside the canvas and starts "dragging"
61
60
  away from the canvas. So the first change we need to make is to add a
62
61
  handler for the <code class="constant">SEL_LEFTBUTTONPRESS</code> message from the
63
- canvas:</p><pre class="programlisting">@canvas.connect(SEL_LEFTBUTTONPRESS) {
62
+ canvas:</p><pre class="programlisting">@canvas.connect(SEL_LEFTBUTTONPRESS) do
64
63
  #
65
64
  # Capture (grab) the mouse when the button goes down, so that all future
66
65
  # mouse events will be reported to this widget, even if those events occur
@@ -71,33 +70,33 @@ end
71
70
  # Advertise which drag types we can offer
72
71
  dragTypes = [FXWindow.colorType]
73
72
  @canvas.beginDrag(dragTypes)
74
- }
73
+ end
75
74
  </pre><p>Note that there are usually two things you're going to want to do in
76
75
  the <code class="constant">SEL_LEFTBUTTONPRESS</code> handler for a drag source.
77
- The first is to call <code class="methodname">grab()</code> on the window that
78
- acts as the drag source. Calling <code class="methodname">grab()</code>
76
+ The first is to call <code class="methodname">grab</code> on the window that
77
+ acts as the drag source. Calling <code class="methodname">grab</code>
79
78
  "captures" the mouse in the sense that subsequent mouse motion events will
80
79
  be reported as if they occurred inside the grab window. This is important,
81
80
  since in our case we're going to be dragging from this window to some
82
81
  other window, possibly a window in a different application
83
82
  altogether.</p><p>The second thing you'll want to do in the
84
83
  <code class="constant">SEL_LEFTBUTTONPRESS</code> handler for a drag source is to
85
- call <code class="methodname">beginDrag()</code>. This not only kicks the
84
+ call <code class="methodname">beginDrag</code>. This not only kicks the
86
85
  application into drag-and-drop mode, but also provides a way for you to
87
86
  inform the system about the formats of data (i.e. the drag types) that
88
87
  this drag source is able to provide. For this example, the drag source is
89
88
  just going to offer one drag type.</p><p>Since releasing the left mouse button should end the drag operation,
90
89
  it's important to also add a handler for the
91
- <code class="constant">SEL_LEFTBUTTONRELEASE</code> message:</p><pre class="programlisting">@canvas.connect(SEL_LEFTBUTTONRELEASE) {
90
+ <code class="constant">SEL_LEFTBUTTONRELEASE</code> message:</p><pre class="programlisting">@canvas.connect(SEL_LEFTBUTTONRELEASE) do
92
91
  @canvas.ungrab
93
92
  @canvas.endDrag
94
- }
93
+ end
95
94
  </pre><p>This is pretty much the mirror image of our
96
95
  <code class="constant">SEL_LEFTBUTTONPRESS</code> handler. We call
97
- <code class="methodname">ungrab()</code> to release the mouse capture, and
98
- <code class="methodname">endDrag()</code> to clean up the drag-and-drop
96
+ <code class="methodname">ungrab</code> to release the mouse capture, and
97
+ <code class="methodname">endDrag</code> to clean up the drag-and-drop
99
98
  state.</p><p>The next change is to add a <code class="constant">SEL_MOTION</code> handler,
100
- to handle mouse motion events during the drag operation:</p><pre class="programlisting">@canvas.connect(SEL_MOTION) { |sender, sel, event|
99
+ to handle mouse motion events during the drag operation:</p><pre class="programlisting">@canvas.connect(SEL_MOTION) do |sender, sel, event|
101
100
  if @canvas.dragging?
102
101
  @canvas.handleDrag(event.root_x, event.root_y)
103
102
  unless @canvas.didAccept == DRAG_REJECT
@@ -106,19 +105,19 @@ end
106
105
  @canvas.dragCursor = getApp().getDefaultCursor(DEF_DNDSTOP_CURSOR)
107
106
  end
108
107
  end
109
- }
108
+ end
110
109
  </pre><p>The <code class="methodname">dragging?</code> method returns true if we're
111
110
  in the middle of a drag-and-drop operation for the drag source window,
112
- i.e. after the call to <code class="methodname">beginDrag()</code> but before the
113
- call to <code class="methodname">endDrag()</code>. If we're not currently
111
+ i.e. after the call to <code class="methodname">beginDrag</code> but before the
112
+ call to <code class="methodname">endDrag</code>. If we're not currently
114
113
  processing a drag operation, we're not really interested in mouse motion
115
114
  events for the canvas.</p><p>If we <span class="emphasis"><em>are</em></span> processing a drag operation, however,
116
- we need to call <code class="methodname">handleDrag()</code> on the drag source
115
+ we need to call <code class="methodname">handleDrag</code> on the drag source
117
116
  window. FOX uses this information to send drag-and-drop messages (such as
118
117
  <code class="constant">SEL_DND_ENTER</code>, <code class="constant">SEL_DND_MOTION</code>
119
118
  and <code class="constant">SEL_DND_LEAVE</code>) to the window that the mouse is
120
119
  currently over. Note that the coordinates passed to
121
- <code class="methodname">handleDrag()</code> are root window coordinates, and not
120
+ <code class="methodname">handleDrag</code> are root window coordinates, and not
122
121
  window-local coordinates.</p><p>Another good thing to consider doing here is to change the shape of
123
122
  the cursor depending on the drop site's response to the drag-and-drop
124
123
  messages from the drag source. For this example, we change the drag cursor
@@ -150,14 +149,14 @@ end
150
149
  over a drop-enabled window, the cursor should change its shape.</p><p>The last (and most important) step is to actually complete the data
151
150
  transfer. At any time during a drag-and-drop operation, a drop site may
152
151
  request a copy of the drag-and-drop data by calling the
153
- <code class="methodname">getDNDData()</code> method (as described in the previous
152
+ <code class="methodname">getDNDData</code> method (as described in the previous
154
153
  section). When this happens, FOX sends a
155
154
  <code class="constant">SEL_DND_REQUEST</code> message to the current drag source
156
- window, and so we now add a handler for that message:</p><pre class="programlisting">@canvas.connect(SEL_DND_REQUEST) { |sender, sel, event|
155
+ window, and so we now add a handler for that message:</p><pre class="programlisting">@canvas.connect(SEL_DND_REQUEST) do |sender, sel, event|
157
156
  if event.target == FXWindow.colorType
158
157
  @canvas.setDNDData(FROM_DRAGNDROP, FXWindow.colorType, Fox.fxencodeColorData(@canvas.backColor))
159
158
  end
160
- }
159
+ end
161
160
  </pre><p>The first important thing to note here is that the
162
161
  <code class="varname">target</code> field of the <code class="classname">FXEvent</code>
163
162
  instance will contain the drag type requested by the drop site. If your
@@ -167,8 +166,8 @@ end
167
166
  this example) it's still a good idea to check the requested type, since a
168
167
  rogue drop site could ask for the data in some unexpected format.</p><p>Assuming that the drag type is as expected, the last step is send
169
168
  the data to the drop site by calling
170
- <code class="methodname">setDNDData()</code>. As with the call to
171
- <code class="methodname">getDNDData()</code> for our previous drop site program,
169
+ <code class="methodname">setDNDData</code>. As with the call to
170
+ <code class="methodname">getDNDData</code> for our previous drop site program,
172
171
  you want to be sure to specify the origin of the data
173
172
  (<code class="constant">FROM_DRAGNDROP</code>), the drag type
174
173
  (<code class="constant">FXWindow.colorType</code>) and the data itself as a binary
@@ -177,30 +176,29 @@ end
177
176
  release the left mouse button to complete the "drop", the drop site should
178
177
  change its color to red.</p><p>The complete program is listed below, and is included in the
179
178
  <code class="filename">examples</code> directory under the file
180
- name <code class="filename">dragsource.rb</code>.</p><pre class="programlisting">require 'rubygems'
181
- require_gem 'fxruby'
179
+ name <code class="filename">dragsource.rb</code>.</p><pre class="programlisting">require 'fox16'
182
180
 
183
181
  include Fox
184
182
 
185
183
  class DragSource &lt; FXMainWindow
186
184
  def initialize(anApp)
187
185
  # Initialize base class
188
- super(anApp, "Drag Source", nil, nil, DECOR_ALL, 0, 0, 400, 300)
186
+ super(anApp, "Drag Source", :opts =&gt; DECOR_ALL, :width =&gt; 400, :height =&gt; 300)
189
187
 
190
188
  # Fill main window with canvas
191
- @canvas = FXCanvas.new(self, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y)
189
+ @canvas = FXCanvas.new(self, :opts =&gt; LAYOUT_FILL_X|LAYOUT_FILL_Y)
192
190
  @canvas.backColor = "red"
193
191
 
194
192
  # Handle expose events on the canvas
195
- @canvas.connect(SEL_PAINT) { |sender, sel, event|
196
- FXDCWindow.new(@canvas, event) { |dc|
193
+ @canvas.connect(SEL_PAINT) do |sender, sel, event|
194
+ FXDCWindow.new(@canvas, event) do |dc|
197
195
  dc.foreground = @canvas.backColor
198
196
  dc.fillRectangle(event.rect.x, event.rect.y, event.rect.w, event.rect.h)
199
- }
200
- }
197
+ end
198
+ end
201
199
 
202
200
  # Handle left button press
203
- @canvas.connect(SEL_LEFTBUTTONPRESS) {
201
+ @canvas.connect(SEL_LEFTBUTTONPRESS) do
204
202
  #
205
203
  # Capture (grab) the mouse when the button goes down, so that all future
206
204
  # mouse events will be reported to this widget, even if those events occur
@@ -211,10 +209,10 @@ class DragSource &lt; FXMainWindow
211
209
  # Advertise which drag types we can offer
212
210
  dragTypes = [FXWindow.colorType]
213
211
  @canvas.beginDrag(dragTypes)
214
- }
212
+ end
215
213
 
216
214
  # Handle mouse motion events
217
- @canvas.connect(SEL_MOTION) { |sender, sel, event|
215
+ @canvas.connect(SEL_MOTION) do |sender, sel, event|
218
216
  if @canvas.dragging?
219
217
  @canvas.handleDrag(event.root_x, event.root_y)
220
218
  unless @canvas.didAccept == DRAG_REJECT
@@ -223,20 +221,20 @@ class DragSource &lt; FXMainWindow
223
221
  @canvas.dragCursor = getApp().getDefaultCursor(DEF_DNDSTOP_CURSOR)
224
222
  end
225
223
  end
226
- }
224
+ end
227
225
 
228
226
  # Handle left button release
229
- @canvas.connect(SEL_LEFTBUTTONRELEASE) {
227
+ @canvas.connect(SEL_LEFTBUTTONRELEASE) do
230
228
  @canvas.ungrab
231
229
  @canvas.endDrag
232
- }
230
+ end
233
231
 
234
232
  # Handle request for DND data
235
- @canvas.connect(SEL_DND_REQUEST) { |sender, sel, event|
233
+ @canvas.connect(SEL_DND_REQUEST) do |sender, sel, event|
236
234
  if event.target == FXWindow.colorType
237
235
  @canvas.setDNDData(FROM_DRAGNDROP, FXWindow.colorType, Fox.fxencodeColorData(@canvas.backColor))
238
236
  end
239
- }
237
+ end
240
238
  end
241
239
 
242
240
  def create
@@ -1,6 +1,6 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Putting It All Together</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook v5 XSL Stylesheets V1.72.0"><link rel="start" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="dragdroptut.html" title="Chapter&nbsp;5.&nbsp;Drag and Drop"><link rel="prev" href="ch05s02.html" title="Drag Sources"><link rel="next" href="unicode.html" title="Chapter&nbsp;6.&nbsp;Unicode and FXRuby"></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">Putting It All Together</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch05s02.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;5.&nbsp;Drag and Drop</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="unicode.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="d0e1547"></a>Putting It All Together</h2></div></div></div><p>We've studied drag-and-drop enabled applications from two points of
3
+ <title>Putting It All Together</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook v5 XSL Stylesheets V1.72.0"><link rel="start" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="dragdroptut.html" title="Chapter&nbsp;5.&nbsp;Drag and Drop"><link rel="prev" href="ch05s02.html" title="Drag Sources"><link rel="next" href="unicode.html" title="Chapter&nbsp;6.&nbsp;Unicode and FXRuby"></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">Putting It All Together</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch05s02.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;5.&nbsp;Drag and Drop</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="unicode.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="d0e1567"></a>Putting It All Together</h2></div></div></div><p>We've studied drag-and-drop enabled applications from two points of
4
4
  view, that of a drag source and that of a drop site. But for most
5
5
  applications, you'll want a window to act as both a drag source
6
6
  <span class="emphasis"><em>and</em></span> a drop site. As it turns out, this is just a
@@ -8,7 +8,7 @@
8
8
  sections.</p><p>If we use our completed drag source example program from the
9
9
  previous section as a starting point, and then compare it to the drop site
10
10
  example from the first section, it is apparent that the only "pieces"
11
- missing are:</p><div class="itemizedlist"><ul type="disc"><li><p>A call to <code class="methodname">dropEnable()</code>, to make
11
+ missing are:</p><div class="itemizedlist"><ul type="disc"><li><p>A call to <code class="methodname">dropEnable</code>, to make
12
12
  <code class="classname">DragSource</code>'s canvas drop-enabled;</p></li><li><p>A handler for the <code class="constant">SEL_DND_MOTION</code> message;
13
13
  and,</p></li><li><p>A handler for the <code class="constant">SEL_DND_DROP</code>
14
14
  message.</p></li></ul></div><p>If you merge those three short bits of code from
@@ -23,33 +23,32 @@
23
23
  forth between all three programs. You could spend days doing this and
24
24
  never leave the house.</p><p>The complete program is listed below, and is included in the
25
25
  <code class="filename">examples</code> directory under the file
26
- name <code class="filename">dragdrop.rb</code>.</p><pre class="programlisting">require 'rubygems'
27
- require_gem 'fxruby'
26
+ name <code class="filename">dragdrop.rb</code>.</p><pre class="programlisting">require 'fox16'
28
27
 
29
28
  include Fox
30
29
 
31
30
  class DragDropWindow &lt; FXMainWindow
32
31
  def initialize(anApp)
33
32
  # Initialize base class
34
- super(anApp, "Drag and Drop", nil, nil, DECOR_ALL, 0, 0, 400, 300)
33
+ super(anApp, "Drag and Drop", :opts =&gt; DECOR_ALL, :width =&gt; 400, :height =&gt; 300)
35
34
 
36
35
  # Fill main window with canvas
37
- @canvas = FXCanvas.new(self, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y)
36
+ @canvas = FXCanvas.new(self, :opts =&gt; LAYOUT_FILL_X|LAYOUT_FILL_Y)
38
37
  @canvas.backColor = "red"
39
38
 
40
39
  # Enable canvas for drag-and-drop messages
41
40
  @canvas.dropEnable
42
41
 
43
42
  # Handle expose events on the canvas
44
- @canvas.connect(SEL_PAINT) { |sender, sel, event|
45
- FXDCWindow.new(@canvas, event) { |dc|
43
+ @canvas.connect(SEL_PAINT) do |sender, sel, event|
44
+ FXDCWindow.new(@canvas, event) do |dc|
46
45
  dc.foreground = @canvas.backColor
47
46
  dc.fillRectangle(event.rect.x, event.rect.y, event.rect.w, event.rect.h)
48
- }
49
- }
47
+ end
48
+ end
50
49
 
51
50
  # Handle left button press
52
- @canvas.connect(SEL_LEFTBUTTONPRESS) {
51
+ @canvas.connect(SEL_LEFTBUTTONPRESS) do
53
52
  #
54
53
  # Capture (grab) the mouse when the button goes down, so that all future
55
54
  # mouse events will be reported to this widget, even if those events occur
@@ -60,10 +59,10 @@ class DragDropWindow &lt; FXMainWindow
60
59
  # Advertise which drag types we can offer
61
60
  dragTypes = [FXWindow.colorType]
62
61
  @canvas.beginDrag(dragTypes)
63
- }
62
+ end
64
63
 
65
64
  # Handle mouse motion events
66
- @canvas.connect(SEL_MOTION) { |sender, sel, event|
65
+ @canvas.connect(SEL_MOTION) do |sender, sel, event|
67
66
  if @canvas.dragging?
68
67
  @canvas.handleDrag(event.root_x, event.root_y)
69
68
  unless @canvas.didAccept == DRAG_REJECT
@@ -72,37 +71,37 @@ class DragDropWindow &lt; FXMainWindow
72
71
  @canvas.dragCursor = getApp().getDefaultCursor(DEF_DNDSTOP_CURSOR)
73
72
  end
74
73
  end
75
- }
74
+ end
76
75
 
77
76
  # Handle SEL_DND_MOTION messages from the canvas
78
- @canvas.connect(SEL_DND_MOTION) {
77
+ @canvas.connect(SEL_DND_MOTION) do
79
78
  if @canvas.offeredDNDType?(FROM_DRAGNDROP, FXWindow.colorType)
80
79
  @canvas.acceptDrop
81
80
  end
82
- }
81
+ end
83
82
 
84
83
  # Handle left button release
85
- @canvas.connect(SEL_LEFTBUTTONRELEASE) {
84
+ @canvas.connect(SEL_LEFTBUTTONRELEASE) do
86
85
  @canvas.ungrab
87
86
  @canvas.endDrag
88
- }
87
+ end
89
88
 
90
89
  # Handle SEL_DND_DROP message from the canvas
91
- @canvas.connect(SEL_DND_DROP) {
90
+ @canvas.connect(SEL_DND_DROP) do
92
91
  # Try to obtain the data as color values first
93
92
  data = @canvas.getDNDData(FROM_DRAGNDROP, FXWindow.colorType)
94
93
  unless data.nil?
95
94
  # Update canvas background color
96
95
  @canvas.backColor = Fox.fxdecodeColorData(data)
97
96
  end
98
- }
97
+ end
99
98
 
100
99
  # Handle request for DND data
101
- @canvas.connect(SEL_DND_REQUEST) { |sender, sel, event|
100
+ @canvas.connect(SEL_DND_REQUEST) do |sender, sel, event|
102
101
  if event.target == FXWindow.colorType
103
102
  @canvas.setDNDData(FROM_DRAGNDROP, FXWindow.colorType, Fox.fxencodeColorData(@canvas.backColor))
104
103
  end
105
- }
104
+ end
106
105
  end
107
106
 
108
107
  def create