fxruby 1.4.6 → 1.4.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (251) hide show
  1. data/doc/apes02.html +6 -6
  2. data/doc/apes03.html +11 -11
  3. data/doc/book.html +1 -1
  4. data/doc/build.html +63 -63
  5. data/doc/ch03s02.html +7 -7
  6. data/doc/ch03s03.html +18 -18
  7. data/doc/ch03s04.html +11 -11
  8. data/doc/ch03s05.html +14 -14
  9. data/doc/ch04s02.html +14 -14
  10. data/doc/ch04s03.html +15 -15
  11. data/doc/ch04s04.html +28 -28
  12. data/doc/ch05s02.html +49 -49
  13. data/doc/ch05s03.html +8 -8
  14. data/doc/changes.html +176 -176
  15. data/doc/clipboardtut.html +11 -11
  16. data/doc/cvs.html +10 -10
  17. data/doc/differences.html +4 -4
  18. data/doc/dragdroptut.html +50 -50
  19. data/doc/events.html +11 -11
  20. data/doc/examples.html +47 -47
  21. data/doc/gems.html +37 -37
  22. data/doc/goals.html +4 -4
  23. data/doc/images/iconlist-bigicons.png +0 -0
  24. data/doc/images/iconlist-details.png +0 -0
  25. data/doc/implementation.html +4 -4
  26. data/doc/infosources.html +6 -6
  27. data/doc/library.html +19 -19
  28. data/doc/opengl.html +31 -31
  29. data/doc/pt01.html +1 -1
  30. data/doc/pt02.html +1 -1
  31. data/doc/scintilla.html +15 -15
  32. data/doc/todo.html +5 -5
  33. data/doc/tutorial1.html +34 -34
  34. data/examples/dilbert.rb +1 -1
  35. data/ext/fox14/FXRbApp.cpp +1 -1
  36. data/ext/fox14/FXRbDataTarget.cpp +1 -1
  37. data/ext/fox14/FXRbGLViewer.cpp +1 -1
  38. data/ext/fox14/FXRuby.cpp +1 -1
  39. data/ext/fox14/core_wrap.cpp +0 -12
  40. data/ext/fox14/dialogs_wrap.cpp +43 -19
  41. data/ext/fox14/frames_wrap.cpp +1130 -308
  42. data/ext/fox14/fx3d_wrap.cpp +38 -13
  43. data/ext/fox14/icons_wrap.cpp +24 -6
  44. data/ext/fox14/image_wrap.cpp +24 -6
  45. data/ext/fox14/include/FXMemoryBuffer.h +1 -1
  46. data/ext/fox14/include/FXRb4Splitter.h +1 -1
  47. data/ext/fox14/include/FXRb7Segment.h +1 -1
  48. data/ext/fox14/include/FXRbAccelTable.h +1 -1
  49. data/ext/fox14/include/FXRbApp.h +1 -1
  50. data/ext/fox14/include/FXRbArrowButton.h +1 -1
  51. data/ext/fox14/include/FXRbBMPIcon.h +1 -1
  52. data/ext/fox14/include/FXRbBMPImage.h +1 -1
  53. data/ext/fox14/include/FXRbBitmap.h +1 -1
  54. data/ext/fox14/include/FXRbBitmapFrame.h +1 -1
  55. data/ext/fox14/include/FXRbBitmapView.h +1 -1
  56. data/ext/fox14/include/FXRbButton.h +1 -1
  57. data/ext/fox14/include/FXRbCURCursor.h +1 -1
  58. data/ext/fox14/include/FXRbCanvas.h +1 -1
  59. data/ext/fox14/include/FXRbCheckButton.h +1 -1
  60. data/ext/fox14/include/FXRbChoiceBox.h +1 -1
  61. data/ext/fox14/include/FXRbColorBar.h +1 -1
  62. data/ext/fox14/include/FXRbColorDialog.h +1 -1
  63. data/ext/fox14/include/FXRbColorSelector.h +1 -1
  64. data/ext/fox14/include/FXRbColorWell.h +1 -1
  65. data/ext/fox14/include/FXRbColorWheel.h +1 -1
  66. data/ext/fox14/include/FXRbComboBox.h +1 -1
  67. data/ext/fox14/include/FXRbCommon.h +1 -1
  68. data/ext/fox14/include/FXRbComposite.h +1 -1
  69. data/ext/fox14/include/FXRbCursor.h +1 -1
  70. data/ext/fox14/include/FXRbDC.h +1 -1
  71. data/ext/fox14/include/FXRbDCPrint.h +1 -1
  72. data/ext/fox14/include/FXRbDCWindow.h +1 -1
  73. data/ext/fox14/include/FXRbDataTarget.h +1 -1
  74. data/ext/fox14/include/FXRbDebugTarget.h +1 -1
  75. data/ext/fox14/include/FXRbDelegator.h +1 -1
  76. data/ext/fox14/include/FXRbDial.h +1 -1
  77. data/ext/fox14/include/FXRbDialogBox.h +1 -1
  78. data/ext/fox14/include/FXRbDict.h +1 -1
  79. data/ext/fox14/include/FXRbDirBox.h +1 -1
  80. data/ext/fox14/include/FXRbDirDialog.h +1 -1
  81. data/ext/fox14/include/FXRbDirList.h +1 -1
  82. data/ext/fox14/include/FXRbDirSelector.h +1 -1
  83. data/ext/fox14/include/FXRbDockBar.h +1 -1
  84. data/ext/fox14/include/FXRbDockHandler.h +1 -1
  85. data/ext/fox14/include/FXRbDockSite.h +1 -1
  86. data/ext/fox14/include/FXRbDockTitle.h +1 -1
  87. data/ext/fox14/include/FXRbDocument.h +1 -1
  88. data/ext/fox14/include/FXRbDragCorner.h +1 -1
  89. data/ext/fox14/include/FXRbDrawable.h +1 -1
  90. data/ext/fox14/include/FXRbDriveBox.h +1 -1
  91. data/ext/fox14/include/FXRbFileDialog.h +1 -1
  92. data/ext/fox14/include/FXRbFileDict.h +1 -1
  93. data/ext/fox14/include/FXRbFileList.h +1 -1
  94. data/ext/fox14/include/FXRbFileSelector.h +1 -1
  95. data/ext/fox14/include/FXRbFoldingList.h +1 -1
  96. data/ext/fox14/include/FXRbFont.h +1 -1
  97. data/ext/fox14/include/FXRbFontDialog.h +1 -1
  98. data/ext/fox14/include/FXRbFontSelector.h +1 -1
  99. data/ext/fox14/include/FXRbFrame.h +1 -1
  100. data/ext/fox14/include/FXRbGIFCursor.h +1 -1
  101. data/ext/fox14/include/FXRbGIFIcon.h +1 -1
  102. data/ext/fox14/include/FXRbGIFImage.h +1 -1
  103. data/ext/fox14/include/FXRbGLCanvas.h +1 -1
  104. data/ext/fox14/include/FXRbGLContext.h +1 -1
  105. data/ext/fox14/include/FXRbGLObject.h +1 -1
  106. data/ext/fox14/include/FXRbGLShape.h +1 -1
  107. data/ext/fox14/include/FXRbGLViewer.h +1 -1
  108. data/ext/fox14/include/FXRbGLVisual.h +1 -1
  109. data/ext/fox14/include/FXRbGradientBar.h +1 -1
  110. data/ext/fox14/include/FXRbGroupBox.h +1 -1
  111. data/ext/fox14/include/FXRbHeader.h +1 -1
  112. data/ext/fox14/include/FXRbHorizontalFrame.h +1 -1
  113. data/ext/fox14/include/FXRbICOIcon.h +1 -1
  114. data/ext/fox14/include/FXRbICOImage.h +1 -1
  115. data/ext/fox14/include/FXRbIcon.h +1 -1
  116. data/ext/fox14/include/FXRbIconList.h +1 -1
  117. data/ext/fox14/include/FXRbIconSource.h +1 -1
  118. data/ext/fox14/include/FXRbId.h +1 -1
  119. data/ext/fox14/include/FXRbImage.h +1 -1
  120. data/ext/fox14/include/FXRbImageFrame.h +1 -1
  121. data/ext/fox14/include/FXRbImageView.h +1 -1
  122. data/ext/fox14/include/FXRbInputDialog.h +1 -1
  123. data/ext/fox14/include/FXRbJPGIcon.h +1 -1
  124. data/ext/fox14/include/FXRbJPGImage.h +1 -1
  125. data/ext/fox14/include/FXRbLabel.h +1 -1
  126. data/ext/fox14/include/FXRbList.h +1 -1
  127. data/ext/fox14/include/FXRbListBox.h +1 -1
  128. data/ext/fox14/include/FXRbMDIButton.h +1 -1
  129. data/ext/fox14/include/FXRbMDIChild.h +1 -1
  130. data/ext/fox14/include/FXRbMDIClient.h +1 -1
  131. data/ext/fox14/include/FXRbMainWindow.h +1 -1
  132. data/ext/fox14/include/FXRbMatrix.h +1 -1
  133. data/ext/fox14/include/FXRbMenuBar.h +1 -1
  134. data/ext/fox14/include/FXRbMenuButton.h +1 -1
  135. data/ext/fox14/include/FXRbMenuCaption.h +1 -1
  136. data/ext/fox14/include/FXRbMenuCascade.h +1 -1
  137. data/ext/fox14/include/FXRbMenuCheck.h +1 -1
  138. data/ext/fox14/include/FXRbMenuCommand.h +1 -1
  139. data/ext/fox14/include/FXRbMenuPane.h +1 -1
  140. data/ext/fox14/include/FXRbMenuRadio.h +1 -1
  141. data/ext/fox14/include/FXRbMenuSeparator.h +1 -1
  142. data/ext/fox14/include/FXRbMenuTitle.h +1 -1
  143. data/ext/fox14/include/FXRbMessageBox.h +1 -1
  144. data/ext/fox14/include/FXRbObject.h +1 -1
  145. data/ext/fox14/include/FXRbOptionMenu.h +1 -1
  146. data/ext/fox14/include/FXRbPCXIcon.h +1 -1
  147. data/ext/fox14/include/FXRbPCXImage.h +1 -1
  148. data/ext/fox14/include/FXRbPNGIcon.h +1 -1
  149. data/ext/fox14/include/FXRbPNGImage.h +1 -1
  150. data/ext/fox14/include/FXRbPPMIcon.h +1 -1
  151. data/ext/fox14/include/FXRbPPMImage.h +1 -1
  152. data/ext/fox14/include/FXRbPacker.h +1 -1
  153. data/ext/fox14/include/FXRbPicker.h +1 -1
  154. data/ext/fox14/include/FXRbPopup.h +1 -1
  155. data/ext/fox14/include/FXRbPrintDialog.h +1 -1
  156. data/ext/fox14/include/FXRbProgressBar.h +1 -1
  157. data/ext/fox14/include/FXRbProgressDialog.h +1 -1
  158. data/ext/fox14/include/FXRbRGBIcon.h +1 -1
  159. data/ext/fox14/include/FXRbRGBImage.h +1 -1
  160. data/ext/fox14/include/FXRbRadioButton.h +1 -1
  161. data/ext/fox14/include/FXRbRealSlider.h +1 -1
  162. data/ext/fox14/include/FXRbRealSpinner.h +1 -1
  163. data/ext/fox14/include/FXRbRecentFiles.h +1 -1
  164. data/ext/fox14/include/FXRbRegistry.h +1 -1
  165. data/ext/fox14/include/FXRbReplaceDialog.h +1 -1
  166. data/ext/fox14/include/FXRbRootWindow.h +1 -1
  167. data/ext/fox14/include/FXRbRuler.h +1 -1
  168. data/ext/fox14/include/FXRbScintilla.h +1 -1
  169. data/ext/fox14/include/FXRbScrollArea.h +1 -1
  170. data/ext/fox14/include/FXRbScrollBar.h +1 -1
  171. data/ext/fox14/include/FXRbScrollPane.h +1 -1
  172. data/ext/fox14/include/FXRbScrollWindow.h +1 -1
  173. data/ext/fox14/include/FXRbSearchDialog.h +1 -1
  174. data/ext/fox14/include/FXRbSeparator.h +1 -1
  175. data/ext/fox14/include/FXRbSettings.h +1 -1
  176. data/ext/fox14/include/FXRbShell.h +1 -1
  177. data/ext/fox14/include/FXRbShutter.h +1 -1
  178. data/ext/fox14/include/FXRbSlider.h +1 -1
  179. data/ext/fox14/include/FXRbSpinner.h +1 -1
  180. data/ext/fox14/include/FXRbSplashWindow.h +1 -1
  181. data/ext/fox14/include/FXRbSplitter.h +1 -1
  182. data/ext/fox14/include/FXRbSpring.h +1 -1
  183. data/ext/fox14/include/FXRbStatusBar.h +1 -1
  184. data/ext/fox14/include/FXRbStatusLine.h +1 -1
  185. data/ext/fox14/include/FXRbStream.h +1 -1
  186. data/ext/fox14/include/FXRbStringDict.h +1 -1
  187. data/ext/fox14/include/FXRbSwitcher.h +1 -1
  188. data/ext/fox14/include/FXRbTGAIcon.h +1 -1
  189. data/ext/fox14/include/FXRbTGAImage.h +1 -1
  190. data/ext/fox14/include/FXRbTIFIcon.h +1 -1
  191. data/ext/fox14/include/FXRbTIFImage.h +1 -1
  192. data/ext/fox14/include/FXRbTabBar.h +1 -1
  193. data/ext/fox14/include/FXRbTabBook.h +1 -1
  194. data/ext/fox14/include/FXRbTabItem.h +1 -1
  195. data/ext/fox14/include/FXRbTable.h +1 -1
  196. data/ext/fox14/include/FXRbText.h +1 -1
  197. data/ext/fox14/include/FXRbTextField.h +1 -1
  198. data/ext/fox14/include/FXRbToggleButton.h +1 -1
  199. data/ext/fox14/include/FXRbToolBar.h +1 -1
  200. data/ext/fox14/include/FXRbToolBarGrip.h +1 -1
  201. data/ext/fox14/include/FXRbToolBarShell.h +1 -1
  202. data/ext/fox14/include/FXRbToolBarTab.h +1 -1
  203. data/ext/fox14/include/FXRbToolTip.h +1 -1
  204. data/ext/fox14/include/FXRbTopWindow.h +1 -1
  205. data/ext/fox14/include/FXRbTreeList.h +1 -1
  206. data/ext/fox14/include/FXRbTreeListBox.h +1 -1
  207. data/ext/fox14/include/FXRbTriStateButton.h +1 -1
  208. data/ext/fox14/include/FXRbVerticalFrame.h +1 -1
  209. data/ext/fox14/include/FXRbVisual.h +1 -1
  210. data/ext/fox14/include/FXRbWindow.h +1 -1
  211. data/ext/fox14/include/FXRbWizard.h +1 -1
  212. data/ext/fox14/include/FXRbXBMIcon.h +1 -1
  213. data/ext/fox14/include/FXRbXBMImage.h +1 -1
  214. data/ext/fox14/include/FXRbXPMIcon.h +1 -1
  215. data/ext/fox14/include/FXRbXPMImage.h +1 -1
  216. data/ext/fox14/include/FXRuby.h +1 -1
  217. data/ext/fox14/label_wrap.cpp +23 -8
  218. data/ext/fox14/markfuncs.cpp +8 -1
  219. data/ext/fox14/mdi_wrap.cpp +47 -17
  220. data/ext/fox14/menu_wrap.cpp +34 -10
  221. data/ext/fox14/scintilla_wrap.cpp +31 -7
  222. data/ext/fox14/table_wrap.cpp +31 -7
  223. data/ext/fox14/text_wrap.cpp +31 -7
  224. data/ext/fox14/treelist_wrap.cpp +31 -7
  225. data/ext/fox14/ui_wrap.cpp +497 -154
  226. data/ext/fox14/unregisterOwnedObjects.cpp +1 -1
  227. data/lib/fox14/aliases.rb +3 -3
  228. data/lib/fox14/colors.rb +282 -282
  229. data/lib/fox14/core.rb +7 -0
  230. data/lib/fox14/splashscreen.rb +83 -83
  231. data/lib/fox14/version.rb +1 -1
  232. data/rdoc-sources/FX4Splitter.rb +138 -138
  233. data/rdoc-sources/FXFoldingList.rb +2 -2
  234. data/rdoc-sources/FXQuatd.rb +171 -1
  235. data/rdoc-sources/FXQuatf.rb +175 -1
  236. data/rdoc-sources/FXWindow.rb +0 -3
  237. data/tests/TC_FXComboBox.rb +10 -1
  238. data/tests/TC_FXDirList.rb +1 -1
  239. data/tests/TC_FXGLViewer.rb +2 -0
  240. data/tests/TC_FXHeader.rb +1 -1
  241. data/tests/TC_FXIconList.rb +1 -1
  242. data/tests/TC_FXId.rb +1 -1
  243. data/tests/TC_FXListBox.rb +1 -1
  244. data/tests/TC_FXMenuCommand.rb +0 -14
  245. data/tests/TC_FXTable.rb +0 -32
  246. data/tests/TC_FXTableItem.rb +1 -1
  247. data/tests/TC_FXTreeList.rb +1 -1
  248. data/tests/TC_FXTreeListBox.rb +1 -1
  249. data/web/top.html +15 -15
  250. metadata +2 -3
  251. data/ChangeLog +0 -11094
data/doc/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>
data/doc/ch05s02.html CHANGED
@@ -1,8 +1,8 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Drag Sources</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="dragdroptut.html" title="Chapter&nbsp;5.&nbsp;Drag and Drop"><link rel="previous" 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></div></div><p>As before, we're going to start by presenting a skeleton application
4
- consisting of a main window widget (a <tt class="classname">DragSource</tt>
5
- instance) that parents an <tt class="classname">FXCanvas</tt> widget:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">require 'rubygems'
3
+ <title>Drag Sources</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="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
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
6
  require_gem 'fxruby'
7
7
 
8
8
  include Fox
@@ -45,22 +45,22 @@ if __FILE__ == $0
45
45
  end
46
46
  end
47
47
 
48
- </pre></td></tr></table><p>Since the main program (i.e. the part at the end) won't change for
48
+ </pre><p>Since the main program (i.e. the part at the end) won't change for
49
49
  the rest of the tutorial, I won't show that code anymore. Furthermore, the
50
- <tt class="classname">DragSource</tt> class has a few things in common with
51
- the <tt class="classname">DropSite</tt> class from the previous example,
52
- namely:</p><div class="itemizedlist"><ul type="disc"><li><p>We've defined a <tt class="constant">SEL_PAINT</tt> handler for the
50
+ <code class="classname">DragSource</code> class has a few things in common with
51
+ the <code class="classname">DropSite</code> class from the previous example,
52
+ namely:</p><div class="itemizedlist"><ul type="disc"><li><p>We've defined a <code class="constant">SEL_PAINT</code> handler for the
53
53
  canvas widget that just clears the canvas to its current background
54
54
  color; and,</p></li><li><p>The drag type for colors
55
- (<tt class="constant">FXWindow.colorType</tt>) is registered in the
56
- <tt class="classname">DragSource</tt>'s <tt class="methodname">create()</tt>
55
+ (<code class="constant">FXWindow.colorType</code>) is registered in the
56
+ <code class="classname">DragSource</code>'s <code class="methodname">create()</code>
57
57
  method.</p></li></ul></div><p>As before, you may want to run this basic version of the program to
58
58
  be sure that it's working properly so far. You should simply see an empty
59
59
  window with a red background.</p><p>Now for this application, we want a drag operation to begin when the
60
60
  user presses the left mouse button inside the canvas and starts "dragging"
61
61
  away from the canvas. So the first change we need to make is to add a
62
- handler for the <tt class="constant">SEL_LEFTBUTTONPRESS</tt> message from the
63
- canvas:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">@canvas.connect(SEL_LEFTBUTTONPRESS) {
62
+ handler for the <code class="constant">SEL_LEFTBUTTONPRESS</code> message from the
63
+ canvas:</p><pre class="programlisting">@canvas.connect(SEL_LEFTBUTTONPRESS) {
64
64
  #
65
65
  # Capture (grab) the mouse when the button goes down, so that all future
66
66
  # mouse events will be reported to this widget, even if those events occur
@@ -72,32 +72,32 @@ end
72
72
  dragTypes = [FXWindow.colorType]
73
73
  @canvas.beginDrag(dragTypes)
74
74
  }
75
- </pre></td></tr></table><p>Note that there are usually two things you're going to want to do in
76
- the <tt class="constant">SEL_LEFTBUTTONPRESS</tt> handler for a drag source.
77
- The first is to call <tt class="methodname">grab()</tt> on the window that
78
- acts as the drag source. Calling <tt class="methodname">grab()</tt>
75
+ </pre><p>Note that there are usually two things you're going to want to do in
76
+ 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>
79
79
  "captures" the mouse in the sense that subsequent mouse motion events will
80
80
  be reported as if they occurred inside the grab window. This is important,
81
81
  since in our case we're going to be dragging from this window to some
82
82
  other window, possibly a window in a different application
83
83
  altogether.</p><p>The second thing you'll want to do in the
84
- <tt class="constant">SEL_LEFTBUTTONPRESS</tt> handler for a drag source is to
85
- call <tt class="methodname">beginDrag()</tt>. This not only kicks the
84
+ <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
86
86
  application into drag-and-drop mode, but also provides a way for you to
87
87
  inform the system about the formats of data (i.e. the drag types) that
88
88
  this drag source is able to provide. For this example, the drag source is
89
89
  just going to offer one drag type.</p><p>Since releasing the left mouse button should end the drag operation,
90
90
  it's important to also add a handler for the
91
- <tt class="constant">SEL_LEFTBUTTONRELEASE</tt> message:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">@canvas.connect(SEL_LEFTBUTTONRELEASE) {
91
+ <code class="constant">SEL_LEFTBUTTONRELEASE</code> message:</p><pre class="programlisting">@canvas.connect(SEL_LEFTBUTTONRELEASE) {
92
92
  @canvas.ungrab
93
93
  @canvas.endDrag
94
94
  }
95
- </pre></td></tr></table><p>This is pretty much the mirror image of our
96
- <tt class="constant">SEL_LEFTBUTTONPRESS</tt> handler. We call
97
- <tt class="methodname">ungrab()</tt> to release the mouse capture, and
98
- <tt class="methodname">endDrag()</tt> to clean up the drag-and-drop
99
- state.</p><p>The next change is to add a <tt class="constant">SEL_MOTION</tt> handler,
100
- to handle mouse motion events during the drag operation:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">@canvas.connect(SEL_MOTION) { |sender, sel, event|
95
+ </pre><p>This is pretty much the mirror image of our
96
+ <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
99
+ 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|
101
101
  if @canvas.dragging?
102
102
  @canvas.handleDrag(event.root_x, event.root_y)
103
103
  unless @canvas.didAccept == DRAG_REJECT
@@ -107,39 +107,39 @@ end
107
107
  end
108
108
  end
109
109
  }
110
- </pre></td></tr></table><p>The <tt class="methodname">dragging?</tt> method returns true if we're
110
+ </pre><p>The <code class="methodname">dragging?</code> method returns true if we're
111
111
  in the middle of a drag-and-drop operation for the drag source window,
112
- i.e. after the call to <tt class="methodname">beginDrag()</tt> but before the
113
- call to <tt class="methodname">endDrag()</tt>. If we're not currently
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
114
114
  processing a drag operation, we're not really interested in mouse motion
115
115
  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 <tt class="methodname">handleDrag()</tt> on the drag source
116
+ we need to call <code class="methodname">handleDrag()</code> on the drag source
117
117
  window. FOX uses this information to send drag-and-drop messages (such as
118
- <tt class="constant">SEL_DND_ENTER</tt>, <tt class="constant">SEL_DND_MOTION</tt>
119
- and <tt class="constant">SEL_DND_LEAVE</tt>) to the window that the mouse is
118
+ <code class="constant">SEL_DND_ENTER</code>, <code class="constant">SEL_DND_MOTION</code>
119
+ and <code class="constant">SEL_DND_LEAVE</code>) to the window that the mouse is
120
120
  currently over. Note that the coordinates passed to
121
- <tt class="methodname">handleDrag()</tt> are root window coordinates, and not
121
+ <code class="methodname">handleDrag()</code> are root window coordinates, and not
122
122
  window-local coordinates.</p><p>Another good thing to consider doing here is to change the shape of
123
123
  the cursor depending on the drop site's response to the drag-and-drop
124
124
  messages from the drag source. For this example, we change the drag cursor
125
125
  to one of FOX's built-in cursor shapes
126
- (<tt class="constant">DEF_SWATCH_CURSOR</tt>) if we get any response other than
127
- <tt class="constant">DRAG_REJECT</tt> from the drop site. If the drop site
126
+ (<code class="constant">DEF_SWATCH_CURSOR</code>) if we get any response other than
127
+ <code class="constant">DRAG_REJECT</code> from the drop site. If the drop site
128
128
  rejects this drag source's overtures, we instead change the drag cursor to
129
129
  a cursor that resembles a stop sign
130
- (<tt class="constant">DEF_DNDSTOP_CURSOR</tt>).</p><p>I've purposely avoided suggesting that you run the program for the
130
+ (<code class="constant">DEF_DNDSTOP_CURSOR</code>).</p><p>I've purposely avoided suggesting that you run the program for the
131
131
  last couple of changes, since until now there wasn't going to be any
132
132
  visual indication that anything interesting was happening. But now you
133
133
  should be able to run the application in its current state and see a few
134
134
  things.</p><p>A first test is to confirm that the cursor shape changes to the
135
135
  "stop" sign when you attempt to drag over some window that isn't willing
136
- to accept a drop of the <tt class="constant">FXWindow.colorType</tt> drag type.
136
+ to accept a drop of the <code class="constant">FXWindow.colorType</code> drag type.
137
137
  Start up one of the other FXRuby example programs (such as the
138
- <tt class="filename">scribble.rb</tt> example) alongside your drag source
138
+ <code class="filename">scribble.rb</code> example) alongside your drag source
139
139
  program, and then try "dragging" from the drag source's canvas onto the
140
140
  Scribble program's canvas. During the drag attempt, the cursor should
141
141
  maintain its shape as a "stop" sign since the canvas in the
142
- <tt class="filename">scribble.rb</tt> example isn't drop-enabled.</p><p>Your next test can confirm that the cursor shape changes to the
142
+ <code class="filename">scribble.rb</code> example isn't drop-enabled.</p><p>Your next test can confirm that the cursor shape changes to the
143
143
  "swatch" cursor (a small square) when you attempt to drag over a window
144
144
  that is drop-enabled, and which is willing to accepts drops of this drag
145
145
  type. The obvious choice is the example from the previous section (the
@@ -150,16 +150,16 @@ end
150
150
  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
151
  transfer. At any time during a drag-and-drop operation, a drop site may
152
152
  request a copy of the drag-and-drop data by calling the
153
- <tt class="methodname">getDNDData()</tt> method (as described in the previous
153
+ <code class="methodname">getDNDData()</code> method (as described in the previous
154
154
  section). When this happens, FOX sends a
155
- <tt class="constant">SEL_DND_REQUEST</tt> message to the current drag source
156
- window, and so we now add a handler for that message:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">@canvas.connect(SEL_DND_REQUEST) { |sender, sel, event|
155
+ <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|
157
157
  if event.target == FXWindow.colorType
158
158
  @canvas.setDNDData(FROM_DRAGNDROP, FXWindow.colorType, Fox.fxencodeColorData(@canvas.backColor))
159
159
  end
160
160
  }
161
- </pre></td></tr></table><p>The first important thing to note here is that the
162
- <tt class="varname">target</tt> field of the <tt class="classname">FXEvent</tt>
161
+ </pre><p>The first important thing to note here is that the
162
+ <code class="varname">target</code> field of the <code class="classname">FXEvent</code>
163
163
  instance will contain the drag type requested by the drop site. If your
164
164
  drag source offers its data in multiple formats, you definitely need to
165
165
  check this in order to know how to package-up the data for transfer.
@@ -167,17 +167,17 @@ end
167
167
  this example) it's still a good idea to check the requested type, since a
168
168
  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
169
  the data to the drop site by calling
170
- <tt class="methodname">setDNDData()</tt>. As with the call to
171
- <tt class="methodname">getDNDData()</tt> for our previous drop site program,
170
+ <code class="methodname">setDNDData()</code>. As with the call to
171
+ <code class="methodname">getDNDData()</code> for our previous drop site program,
172
172
  you want to be sure to specify the origin of the data
173
- (<tt class="constant">FROM_DRAGNDROP</tt>), the drag type
174
- (<tt class="constant">FXWindow.colorType</tt>) and the data itself as a binary
173
+ (<code class="constant">FROM_DRAGNDROP</code>), the drag type
174
+ (<code class="constant">FXWindow.colorType</code>) and the data itself as a binary
175
175
  string.</p><p>As a final test of the completed program, try dragging from this
176
176
  window to some drop-enabled window (as described earlier). Now, when you
177
177
  release the left mouse button to complete the "drop", the drop site should
178
178
  change its color to red.</p><p>The complete program is listed below, and is included in the
179
- <tt class="filename">examples</tt> directory under the file
180
- name <tt class="filename">dragsource.rb</tt>.</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">require 'rubygems'
179
+ <code class="filename">examples</code> directory under the file
180
+ name <code class="filename">dragsource.rb</code>.</p><pre class="programlisting">require 'rubygems'
181
181
  require_gem 'fxruby'
182
182
 
183
183
  include Fox
@@ -259,4 +259,4 @@ if __FILE__ == $0
259
259
  end
260
260
  end
261
261
 
262
- </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="dragdroptut.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="dragdroptut.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="ch05s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter&nbsp;5.&nbsp;Drag and Drop&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Putting It All Together</td></tr></table></div></body></html>
262
+ </pre></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="dragdroptut.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="dragdroptut.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="ch05s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter&nbsp;5.&nbsp;Drag and Drop&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Putting It All Together</td></tr></table></div></body></html>
data/doc/ch05s03.html CHANGED
@@ -1,6 +1,6 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Putting It All Together</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="dragdroptut.html" title="Chapter&nbsp;5.&nbsp;Drag and Drop"><link rel="previous" href="ch05s02.html" title="Drag Sources"><link rel="next" href="examples.html" title="Chapter&nbsp;6.&nbsp;Examples"></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="examples.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></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 XSL Stylesheets V1.68.1"><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="examples.html" title="Chapter&nbsp;6.&nbsp;Examples"></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="examples.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
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,11 +8,11 @@
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 <tt class="methodname">dropEnable()</tt>, to make
12
- <tt class="classname">DragSource</tt>'s canvas drop-enabled;</p></li><li><p>A handler for the <tt class="constant">SEL_DND_MOTION</tt> message;
13
- and,</p></li><li><p>A handler for the <tt class="constant">SEL_DND_DROP</tt>
11
+ missing are:</p><div class="itemizedlist"><ul type="disc"><li><p>A call to <code class="methodname">dropEnable()</code>, to make
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
+ 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
15
- <tt class="filename">dropsite.rb</tt> into <tt class="filename">dragsource.rb</tt>,
15
+ <code class="filename">dropsite.rb</code> into <code class="filename">dragsource.rb</code>,
16
16
  you should end up with a program that can act as both a drag source and a
17
17
  drop site. To test this program, you should be able to start up two
18
18
  separate copies side-by-side and then drag from one to the other. Since,
@@ -22,8 +22,8 @@
22
22
  FXRuby example that has displays a color dialog) and drag colors back and
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
- <tt class="filename">examples</tt> directory under the file
26
- name <tt class="filename">dragdrop.rb</tt>.</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">require 'rubygems'
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
27
  require_gem 'fxruby'
28
28
 
29
29
  include Fox
@@ -125,4 +125,4 @@ if __FILE__ == $0
125
125
  end
126
126
  end
127
127
 
128
- </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="ch05s02.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="dragdroptut.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="examples.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Drag Sources&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;6.&nbsp;Examples</td></tr></table></div></body></html>
128
+ </pre></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch05s02.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="dragdroptut.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="examples.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Drag Sources&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;6.&nbsp;Examples</td></tr></table></div></body></html>