fxruby 1.6.1 → 1.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) 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 +263 -193
  15. data/doc/clipboardtut.html +57 -45
  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 +48 -48
  21. data/doc/gems.html +37 -37
  22. data/doc/goals.html +4 -4
  23. data/doc/implementation.html +4 -4
  24. data/doc/infosources.html +6 -6
  25. data/doc/library.html +19 -19
  26. data/doc/opengl.html +31 -31
  27. data/doc/pt01.html +1 -1
  28. data/doc/pt02.html +1 -1
  29. data/doc/scintilla.html +15 -15
  30. data/doc/style.css +3 -0
  31. data/doc/todo.html +5 -5
  32. data/doc/tutorial1.html +34 -34
  33. data/doc/unicode.html +56 -0
  34. data/ext/fox16/dialogs_wrap.cpp +38 -14
  35. data/ext/fox16/frames_wrap.cpp +856 -22
  36. data/ext/fox16/fx3d_wrap.cpp +169 -144
  37. data/ext/fox16/icons_wrap.cpp +24 -6
  38. data/ext/fox16/image_wrap.cpp +24 -6
  39. data/ext/fox16/label_wrap.cpp +23 -8
  40. data/ext/fox16/markfuncs.cpp +8 -1
  41. data/ext/fox16/mdi_wrap.cpp +53 -23
  42. data/ext/fox16/menu_wrap.cpp +43 -19
  43. data/ext/fox16/scintilla_wrap.cpp +31 -7
  44. data/ext/fox16/table_wrap.cpp +31 -7
  45. data/ext/fox16/text_wrap.cpp +31 -7
  46. data/ext/fox16/treelist_wrap.cpp +300 -276
  47. data/ext/fox16/ui_wrap.cpp +385 -26
  48. data/lib/fox16/aliases.rb +3 -0
  49. data/lib/fox16/version.rb +1 -1
  50. data/rdoc-sources/FXFoldingList.rb +2 -2
  51. data/tests/TC_FXDirList.rb +1 -1
  52. data/tests/TC_FXGLViewer.rb +2 -0
  53. data/tests/TC_FXHeader.rb +1 -1
  54. data/tests/TC_FXIconList.rb +1 -1
  55. data/tests/TC_FXId.rb +1 -1
  56. data/tests/TC_FXList.rb +1 -1
  57. data/tests/TC_FXListBox.rb +1 -1
  58. data/tests/TC_FXMenuCommand.rb +0 -14
  59. data/tests/TC_FXTable.rb +0 -32
  60. data/tests/TC_FXTableItem.rb +1 -1
  61. data/tests/TC_FXTreeList.rb +1 -1
  62. data/tests/TC_FXTreeListBox.rb +1 -1
  63. metadata +5 -4
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 'fox16'
7
+ does:</p><pre class="programlisting">require 'fox16'
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 'fox16'
8
+ Wiki</a>):</p><pre class="programlisting">require 'fox16'
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>
data/doc/ch04s02.html CHANGED
@@ -1,7 +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><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="clipboardtut.html" title="Chapter&nbsp;4.&nbsp;Working With the Clipboard"><link rel="previous" 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></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><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">require 'rubygems'
3
+ <title>Acquiring the Clipboard</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.68.1"><link rel="start" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="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
5
  require_gem 'fxruby'
6
6
  require 'customer'
7
7
 
@@ -11,14 +11,14 @@ class ClipMainWindow &lt; FXMainWindow
11
11
  def initialize(anApp)
12
12
  # Initialize base class first
13
13
  super(anApp, "Clipboard Example", nil, nil, DECOR_ALL, 0, 0, 400, 300)
14
- <span class="bold"><b>
14
+ <span class="bold"><strong>
15
15
  # Horizontal frame contains buttons
16
16
  buttons = FXHorizontalFrame.new(self, LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|PACK_UNIFORM_WIDTH)
17
- </b></span><span class="bold"><b>
17
+ </strong></span><span class="bold"><strong>
18
18
  # Cut and paste buttons
19
19
  copyButton = FXButton.new(buttons, "Copy")
20
20
  pasteButton = FXButton.new(buttons, "Paste")
21
- </b></span>
21
+ </strong></span>
22
22
  # Place the list in a sunken frame
23
23
  sunkenFrame = FXVerticalFrame.new(self, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK,
24
24
  0, 0, 0, 0, 0, 0, 0, 0)
@@ -43,12 +43,12 @@ if __FILE__ == $0
43
43
  theApp.run
44
44
  end
45
45
  end
46
- </pre></td></tr></table><p>Note that the lines which appear in bold face are those which have
46
+ </pre><p>Note that the lines which appear in bold face are those which have
47
47
  been added (or changed) since the previous source code listing.</p><p>The clipboard is a kind of shared resource in the operating system.
48
48
  Copying (or cutting) data to the clipboard begins with some window in your
49
49
  application requesting "ownership" of the clipboard by calling the
50
- <tt class="methodname">acquireClipboard()</tt> instance method. Let's add a
51
- handler for the "Copy" button press which does just that:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"># User clicks Copy
50
+ <code class="methodname">acquireClipboard()</code> instance method. Let's add a
51
+ handler for the "Copy" button press which does just that:</p><pre class="programlisting"># User clicks Copy
52
52
  copyButton.connect(SEL_COMMAND) do
53
53
  customer = customerList.getItemData(customerList.currentItem)
54
54
  types = [ FXWindow.stringType ]
@@ -56,17 +56,17 @@ copyButton.connect(SEL_COMMAND) do
56
56
  @clippedCustomer = customer
57
57
  end
58
58
  end
59
- </pre></td></tr></table><p>The <tt class="methodname">acquireClipboard()</tt> method takes as its
59
+ </pre><p>The <code class="methodname">acquireClipboard()</code> method takes as its
60
60
  input an array of drag types. A <span class="emphasis"><em>drag type</em></span> is just a
61
61
  unique value, assigned by the window system, that identifies a particular
62
62
  kind of data. In this case, we're using one of FOX's pre-registered drag
63
- types (<tt class="constant">stringType</tt>) to indicate that we have some
63
+ types (<code class="constant">stringType</code>) to indicate that we have some
64
64
  string data to place on the clipboard. Later, we'll see how to register
65
- customized, application-specific drag types as well.</p><p>The <tt class="methodname">acquireClipboard()</tt> method returns
66
- <tt class="constant">true</tt> on success; since we called
67
- <tt class="methodname">acquireClipboard()</tt> on the main window, this means
65
+ customized, application-specific drag types as well.</p><p>The <code class="methodname">acquireClipboard()</code> method returns
66
+ <code class="constant">true</code> on success; since we called
67
+ <code class="methodname">acquireClipboard()</code> on the main window, this means
68
68
  that the main window is now the clipboard owner. At this time, we want to
69
69
  save a reference to the currently selected customer in the
70
- <tt class="varname">@clippedCustomer</tt> instance variable so that if its value
70
+ <code class="varname">@clippedCustomer</code> instance variable so that if its value
71
71
  is requested later, we'll be able to return the
72
72
  <span class="emphasis"><em>correct</em></span> customer's information.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="clipboardtut.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="clipboardtut.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="ch04s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter&nbsp;4.&nbsp;Working With the Clipboard&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Sending Data to the Clipboard</td></tr></table></div></body></html>
data/doc/ch04s03.html CHANGED
@@ -1,37 +1,37 @@
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><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="clipboardtut.html" title="Chapter&nbsp;4.&nbsp;Working With the Clipboard"><link rel="previous" 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></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 XSL Stylesheets V1.68.1"><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.
4
4
  as a result of a "paste" operation) FOX will send a
5
- <tt class="constant">SEL_CLIPBOARD_REQUEST</tt> message to the current
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
7
- <tt class="methodname">acquireClipboard()</tt>. For our example, the main
7
+ <code class="methodname">acquireClipboard()</code>. For our example, the main
8
8
  window is acting as the clipboard owner and so it needs to handle the
9
- <tt class="constant">SEL_CLIPBOARD_REQUEST</tt> message:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"># Handle clipboard request
9
+ <code class="constant">SEL_CLIPBOARD_REQUEST</code> message:</p><pre class="programlisting"># Handle clipboard request
10
10
  self.connect(SEL_CLIPBOARD_REQUEST) do
11
11
  setDNDData(FROM_CLIPBOARD, FXWindow.stringType, Fox.fxencodeStringData(@clippedCustomer.to_s))
12
12
  end
13
- </pre></td></tr></table><p>The <tt class="methodname">setDNDData()</tt> method takes three
13
+ </pre><p>The <code class="methodname">setDNDData()</code> method takes three
14
14
  arguments. The first argument tells FOX which kind of data transfer we're
15
15
  trying to accomplish; as it turns out, this method can be used for
16
- drag-and-drop (<tt class="constant">FROM_DRAGNDROP</tt>) and X11 selection
17
- (<tt class="constant">FROM_SELECTION</tt>) data transfer as well. The second
18
- argument to <tt class="methodname">setDNDData()</tt> is the drag type for the
16
+ drag-and-drop (<code class="constant">FROM_DRAGNDROP</code>) and X11 selection
17
+ (<code class="constant">FROM_SELECTION</code>) data transfer as well. The second
18
+ argument to <code class="methodname">setDNDData()</code> is the drag type for the
19
19
  data and the last argument is the data itself, a binary string.</p><p>If you're wondering why we need to call the
20
- <tt class="methodname">fxencodeStringData()</tt> module method to preprocess
21
- the string returned by the call to <tt class="methodname">Customer#to_s</tt>,
20
+ <code class="methodname">fxencodeStringData()</code> module method to preprocess
21
+ the string returned by the call to <code class="methodname">Customer#to_s</code>,
22
22
  that's a reasonable thing to wonder about. In order for FOX to play nice
23
23
  with other clipboard-aware applications, it must be able to store string
24
24
  data on the clipboard in the format expected by those applications.
25
25
  Unfortunately, that expected format is platform-dependent and does not
26
26
  always correspond directly to the format that Ruby uses internally to
27
- store its string data. The <tt class="methodname">fxencodeStringData()</tt>
27
+ store its string data. The <code class="methodname">fxencodeStringData()</code>
28
28
  method (and the corresponding
29
- <tt class="methodname">fxdecodeStringData()</tt> method) provide you with a
29
+ <code class="methodname">fxdecodeStringData()</code> method) provide you with a
30
30
  platform-independent way of sending (or receiving) string data with the
31
- <tt class="constant">stringType</tt> drag type.</p><p>If you run the program as it currently stands, you should now be
31
+ <code class="constant">stringType</code> drag type.</p><p>If you run the program as it currently stands, you should now be
32
32
  able to select a customer from the list, click the "Copy" button and then
33
33
  paste the selected customer data (as a string) into some other
34
34
  application. For example, if you're trying this tutorial on a Windows
35
35
  machine, try pasting into a copy of Notepad or Microsoft Word. The pasted
36
- text should look something like:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">#&lt;struct Struct::Customer name="Joe Smith", address="123 Maple, Anytown, NC", zip=12345&gt;
37
- </pre></td></tr></table></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch04s02.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="clipboardtut.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="ch04s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Acquiring the Clipboard&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Pasting Data from the Clipboard</td></tr></table></div></body></html>
36
+ text should look something like:</p><pre class="programlisting">#&lt;struct Struct::Customer name="Joe Smith", address="123 Maple, Anytown, NC", zip=12345&gt;
37
+ </pre></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch04s02.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="clipboardtut.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="ch04s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Acquiring the Clipboard&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Pasting Data from the Clipboard</td></tr></table></div></body></html>
data/doc/ch04s04.html CHANGED
@@ -1,45 +1,45 @@
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><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="clipboardtut.html" title="Chapter&nbsp;4.&nbsp;Working With the Clipboard"><link rel="previous" 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></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 XSL Stylesheets V1.68.1"><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
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
7
7
  say, if we were to receive the customer data in the format that it's
8
- currently stored on the clipboard:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">#&lt;struct Struct::Customer name="Joe Smith", address="123 Maple, Anytown, NC", zip=12345&gt;
9
- </pre></td></tr></table><p>We'd have to parse that string and try to extract the relevant data
8
+ currently stored on the clipboard:</p><pre class="programlisting">#&lt;struct Struct::Customer name="Joe Smith", address="123 Maple, Anytown, NC", zip=12345&gt;
9
+ </pre><p>We'd have to parse that string and try to extract the relevant data
10
10
  from it. We can do better than that. The approach we'll use instead is to
11
11
  serialize and deserialize the objects using YAML. First, make sure that
12
- the YAML module is loaded by adding this line:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">require 'yaml'</pre></td></tr></table><p>somewhere near the top of the program. Next, register a custom drag
13
- type for <tt class="classname">Customer</tt> objects. We can do that by adding
14
- one line to our main window's <tt class="methodname">create</tt> instance
15
- method:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">def create
12
+ the YAML module is loaded by adding this line:</p><pre class="programlisting">require 'yaml'</pre><p>somewhere near the top of the program. Next, register a custom drag
13
+ type for <code class="classname">Customer</code> objects. We can do that by adding
14
+ one line to our main window's <code class="methodname">create</code> instance
15
+ method:</p><pre class="programlisting">def create
16
16
  super
17
- <span class="bold"><b> @customerDragType = getApp().registerDragType("application/x-customer")
18
- </b></span> show(PLACEMENT_SCREEN)
17
+ <span class="bold"><strong> @customerDragType = getApp().registerDragType("application/x-customer")
18
+ </strong></span> show(PLACEMENT_SCREEN)
19
19
  end
20
- </pre></td></tr></table><p>Note that by convention, the name of the drag type is the MIME type
20
+ </pre><p>Note that by convention, the name of the drag type is the MIME type
21
21
  for the data, but any unique string will do. In our case, we'll use the
22
22
  string "application/x-customer" to identify the drag type for our
23
- YAML-serialized <tt class="classname">Customer</tt> objects.</p><p>With that in place, we can now go back and slightly change some of
23
+ YAML-serialized <code class="classname">Customer</code> objects.</p><p>With that in place, we can now go back and slightly change some of
24
24
  our previous code. When we acquire the clipboard, we'd now like to be able
25
25
  to offer the selected customer's information either as plain text (i.e.
26
26
  the previous format) <span class="emphasis"><em>or</em></span> as a YAML document, so we'll
27
27
  include <span class="emphasis"><em>both</em></span> of these types in the array of drag
28
- types passed to <tt class="methodname">acquireClipboard()</tt>:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"># User clicks Copy
28
+ types passed to <code class="methodname">acquireClipboard()</code>:</p><pre class="programlisting"># User clicks Copy
29
29
  copyButton.connect(SEL_COMMAND) do
30
30
  customer = customerList.getItemData(customerList.currentItem)
31
- <span class="bold"><b> types = [ FXWindow.stringType, @customerDragType ]
32
- </b></span> if acquireClipboard(types)
31
+ <span class="bold"><strong> types = [ FXWindow.stringType, @customerDragType ]
32
+ </strong></span> if acquireClipboard(types)
33
33
  @clippedCustomer = customer
34
34
  end
35
35
  end
36
- </pre></td></tr></table><p>Similarly, when we're handling the
37
- <tt class="constant">SEL_CLIPBOARD_REQUEST</tt> message, we now need to pay
36
+ </pre><p>Similarly, when we're handling the
37
+ <code class="constant">SEL_CLIPBOARD_REQUEST</code> message, we now need to pay
38
38
  attention to which drag type (i.e. which data format) the requestor
39
39
  specified. We can do that by inspecting the
40
- <tt class="methodname">target</tt> attribute of the
41
- <tt class="classname">FXEvent</tt> instance passed along with the
42
- <tt class="constant">SEL_CLIPBOARD_REQUEST</tt> message:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"># Handle clipboard request
40
+ <code class="methodname">target</code> attribute of the
41
+ <code class="classname">FXEvent</code> instance passed along with the
42
+ <code class="constant">SEL_CLIPBOARD_REQUEST</code> message:</p><pre class="programlisting"># Handle clipboard request
43
43
  self.connect(SEL_CLIPBOARD_REQUEST) do |sender, sel, event|
44
44
  case event.target
45
45
  when FXWindow.stringType
@@ -50,9 +50,9 @@ self.connect(SEL_CLIPBOARD_REQUEST) do |sender, sel, event|
50
50
  # Ignore requests for unrecognized drag types
51
51
  end
52
52
  end
53
- </pre></td></tr></table><p>With these changes in place, we can now add a handler for the
53
+ </pre><p>With these changes in place, we can now add a handler for the
54
54
  "Paste" button which requests the clipboard data in YAML format,
55
- deserializes it, and then adds an item to the customer list:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"># User clicks Paste
55
+ deserializes it, and then adds an item to the customer list:</p><pre class="programlisting"># User clicks Paste
56
56
  pasteButton.connect(SEL_COMMAND) do
57
57
  data = getDNDData(FROM_CLIPBOARD, @customerDragType)
58
58
  if data
@@ -60,13 +60,13 @@ pasteButton.connect(SEL_COMMAND) do
60
60
  customerList.appendItem(customer.name, nil, customer)
61
61
  end
62
62
  end
63
- </pre></td></tr></table><p>The <tt class="methodname">getDNDData()</tt> method used here is the
64
- inverse of the <tt class="methodname">setDNDData()</tt> method we used
63
+ </pre><p>The <code class="methodname">getDNDData()</code> method used here is the
64
+ inverse of the <code class="methodname">setDNDData()</code> method we used
65
65
  earlier to push data to some other application requesting our clipboard
66
- data. As with <tt class="methodname">setDNDData()</tt>, the arguments to
67
- <tt class="methodname">getDNDData()</tt> indicate the kind of data transfer
68
- we're performing (e.g. <tt class="constant">FROM_CLIPBOARD</tt>) and the drag
66
+ data. As with <code class="methodname">setDNDData()</code>, the arguments to
67
+ <code class="methodname">getDNDData()</code> indicate the kind of data transfer
68
+ we're performing (e.g. <code class="constant">FROM_CLIPBOARD</code>) and the drag
69
69
  type for the data we're requesting. If some failure occurs (usually,
70
70
  because the clipboard owner can't provide its data in the requested
71
- format) <tt class="methodname">getDNDData()</tt> will simply return
72
- <tt class="constant">nil</tt>.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch04s03.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="clipboardtut.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="dragdroptut.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Sending Data to the Clipboard&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Chapter&nbsp;5.&nbsp;Drag and Drop</td></tr></table></div></body></html>
71
+ format) <code class="methodname">getDNDData()</code> will simply return
72
+ <code class="constant">nil</code>.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch04s03.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="clipboardtut.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="dragdroptut.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Sending Data to the Clipboard&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Chapter&nbsp;5.&nbsp;Drag and Drop</td></tr></table></div></body></html>