fxruby 1.4.6 → 1.4.7
Sign up to get free protection for your applications and to get access to all the features.
- data/doc/apes02.html +6 -6
- data/doc/apes03.html +11 -11
- data/doc/book.html +1 -1
- data/doc/build.html +63 -63
- data/doc/ch03s02.html +7 -7
- data/doc/ch03s03.html +18 -18
- data/doc/ch03s04.html +11 -11
- data/doc/ch03s05.html +14 -14
- data/doc/ch04s02.html +14 -14
- data/doc/ch04s03.html +15 -15
- data/doc/ch04s04.html +28 -28
- data/doc/ch05s02.html +49 -49
- data/doc/ch05s03.html +8 -8
- data/doc/changes.html +176 -176
- data/doc/clipboardtut.html +11 -11
- data/doc/cvs.html +10 -10
- data/doc/differences.html +4 -4
- data/doc/dragdroptut.html +50 -50
- data/doc/events.html +11 -11
- data/doc/examples.html +47 -47
- data/doc/gems.html +37 -37
- data/doc/goals.html +4 -4
- data/doc/images/iconlist-bigicons.png +0 -0
- data/doc/images/iconlist-details.png +0 -0
- data/doc/implementation.html +4 -4
- data/doc/infosources.html +6 -6
- data/doc/library.html +19 -19
- data/doc/opengl.html +31 -31
- data/doc/pt01.html +1 -1
- data/doc/pt02.html +1 -1
- data/doc/scintilla.html +15 -15
- data/doc/todo.html +5 -5
- data/doc/tutorial1.html +34 -34
- data/examples/dilbert.rb +1 -1
- data/ext/fox14/FXRbApp.cpp +1 -1
- data/ext/fox14/FXRbDataTarget.cpp +1 -1
- data/ext/fox14/FXRbGLViewer.cpp +1 -1
- data/ext/fox14/FXRuby.cpp +1 -1
- data/ext/fox14/core_wrap.cpp +0 -12
- data/ext/fox14/dialogs_wrap.cpp +43 -19
- data/ext/fox14/frames_wrap.cpp +1130 -308
- data/ext/fox14/fx3d_wrap.cpp +38 -13
- data/ext/fox14/icons_wrap.cpp +24 -6
- data/ext/fox14/image_wrap.cpp +24 -6
- data/ext/fox14/include/FXMemoryBuffer.h +1 -1
- data/ext/fox14/include/FXRb4Splitter.h +1 -1
- data/ext/fox14/include/FXRb7Segment.h +1 -1
- data/ext/fox14/include/FXRbAccelTable.h +1 -1
- data/ext/fox14/include/FXRbApp.h +1 -1
- data/ext/fox14/include/FXRbArrowButton.h +1 -1
- data/ext/fox14/include/FXRbBMPIcon.h +1 -1
- data/ext/fox14/include/FXRbBMPImage.h +1 -1
- data/ext/fox14/include/FXRbBitmap.h +1 -1
- data/ext/fox14/include/FXRbBitmapFrame.h +1 -1
- data/ext/fox14/include/FXRbBitmapView.h +1 -1
- data/ext/fox14/include/FXRbButton.h +1 -1
- data/ext/fox14/include/FXRbCURCursor.h +1 -1
- data/ext/fox14/include/FXRbCanvas.h +1 -1
- data/ext/fox14/include/FXRbCheckButton.h +1 -1
- data/ext/fox14/include/FXRbChoiceBox.h +1 -1
- data/ext/fox14/include/FXRbColorBar.h +1 -1
- data/ext/fox14/include/FXRbColorDialog.h +1 -1
- data/ext/fox14/include/FXRbColorSelector.h +1 -1
- data/ext/fox14/include/FXRbColorWell.h +1 -1
- data/ext/fox14/include/FXRbColorWheel.h +1 -1
- data/ext/fox14/include/FXRbComboBox.h +1 -1
- data/ext/fox14/include/FXRbCommon.h +1 -1
- data/ext/fox14/include/FXRbComposite.h +1 -1
- data/ext/fox14/include/FXRbCursor.h +1 -1
- data/ext/fox14/include/FXRbDC.h +1 -1
- data/ext/fox14/include/FXRbDCPrint.h +1 -1
- data/ext/fox14/include/FXRbDCWindow.h +1 -1
- data/ext/fox14/include/FXRbDataTarget.h +1 -1
- data/ext/fox14/include/FXRbDebugTarget.h +1 -1
- data/ext/fox14/include/FXRbDelegator.h +1 -1
- data/ext/fox14/include/FXRbDial.h +1 -1
- data/ext/fox14/include/FXRbDialogBox.h +1 -1
- data/ext/fox14/include/FXRbDict.h +1 -1
- data/ext/fox14/include/FXRbDirBox.h +1 -1
- data/ext/fox14/include/FXRbDirDialog.h +1 -1
- data/ext/fox14/include/FXRbDirList.h +1 -1
- data/ext/fox14/include/FXRbDirSelector.h +1 -1
- data/ext/fox14/include/FXRbDockBar.h +1 -1
- data/ext/fox14/include/FXRbDockHandler.h +1 -1
- data/ext/fox14/include/FXRbDockSite.h +1 -1
- data/ext/fox14/include/FXRbDockTitle.h +1 -1
- data/ext/fox14/include/FXRbDocument.h +1 -1
- data/ext/fox14/include/FXRbDragCorner.h +1 -1
- data/ext/fox14/include/FXRbDrawable.h +1 -1
- data/ext/fox14/include/FXRbDriveBox.h +1 -1
- data/ext/fox14/include/FXRbFileDialog.h +1 -1
- data/ext/fox14/include/FXRbFileDict.h +1 -1
- data/ext/fox14/include/FXRbFileList.h +1 -1
- data/ext/fox14/include/FXRbFileSelector.h +1 -1
- data/ext/fox14/include/FXRbFoldingList.h +1 -1
- data/ext/fox14/include/FXRbFont.h +1 -1
- data/ext/fox14/include/FXRbFontDialog.h +1 -1
- data/ext/fox14/include/FXRbFontSelector.h +1 -1
- data/ext/fox14/include/FXRbFrame.h +1 -1
- data/ext/fox14/include/FXRbGIFCursor.h +1 -1
- data/ext/fox14/include/FXRbGIFIcon.h +1 -1
- data/ext/fox14/include/FXRbGIFImage.h +1 -1
- data/ext/fox14/include/FXRbGLCanvas.h +1 -1
- data/ext/fox14/include/FXRbGLContext.h +1 -1
- data/ext/fox14/include/FXRbGLObject.h +1 -1
- data/ext/fox14/include/FXRbGLShape.h +1 -1
- data/ext/fox14/include/FXRbGLViewer.h +1 -1
- data/ext/fox14/include/FXRbGLVisual.h +1 -1
- data/ext/fox14/include/FXRbGradientBar.h +1 -1
- data/ext/fox14/include/FXRbGroupBox.h +1 -1
- data/ext/fox14/include/FXRbHeader.h +1 -1
- data/ext/fox14/include/FXRbHorizontalFrame.h +1 -1
- data/ext/fox14/include/FXRbICOIcon.h +1 -1
- data/ext/fox14/include/FXRbICOImage.h +1 -1
- data/ext/fox14/include/FXRbIcon.h +1 -1
- data/ext/fox14/include/FXRbIconList.h +1 -1
- data/ext/fox14/include/FXRbIconSource.h +1 -1
- data/ext/fox14/include/FXRbId.h +1 -1
- data/ext/fox14/include/FXRbImage.h +1 -1
- data/ext/fox14/include/FXRbImageFrame.h +1 -1
- data/ext/fox14/include/FXRbImageView.h +1 -1
- data/ext/fox14/include/FXRbInputDialog.h +1 -1
- data/ext/fox14/include/FXRbJPGIcon.h +1 -1
- data/ext/fox14/include/FXRbJPGImage.h +1 -1
- data/ext/fox14/include/FXRbLabel.h +1 -1
- data/ext/fox14/include/FXRbList.h +1 -1
- data/ext/fox14/include/FXRbListBox.h +1 -1
- data/ext/fox14/include/FXRbMDIButton.h +1 -1
- data/ext/fox14/include/FXRbMDIChild.h +1 -1
- data/ext/fox14/include/FXRbMDIClient.h +1 -1
- data/ext/fox14/include/FXRbMainWindow.h +1 -1
- data/ext/fox14/include/FXRbMatrix.h +1 -1
- data/ext/fox14/include/FXRbMenuBar.h +1 -1
- data/ext/fox14/include/FXRbMenuButton.h +1 -1
- data/ext/fox14/include/FXRbMenuCaption.h +1 -1
- data/ext/fox14/include/FXRbMenuCascade.h +1 -1
- data/ext/fox14/include/FXRbMenuCheck.h +1 -1
- data/ext/fox14/include/FXRbMenuCommand.h +1 -1
- data/ext/fox14/include/FXRbMenuPane.h +1 -1
- data/ext/fox14/include/FXRbMenuRadio.h +1 -1
- data/ext/fox14/include/FXRbMenuSeparator.h +1 -1
- data/ext/fox14/include/FXRbMenuTitle.h +1 -1
- data/ext/fox14/include/FXRbMessageBox.h +1 -1
- data/ext/fox14/include/FXRbObject.h +1 -1
- data/ext/fox14/include/FXRbOptionMenu.h +1 -1
- data/ext/fox14/include/FXRbPCXIcon.h +1 -1
- data/ext/fox14/include/FXRbPCXImage.h +1 -1
- data/ext/fox14/include/FXRbPNGIcon.h +1 -1
- data/ext/fox14/include/FXRbPNGImage.h +1 -1
- data/ext/fox14/include/FXRbPPMIcon.h +1 -1
- data/ext/fox14/include/FXRbPPMImage.h +1 -1
- data/ext/fox14/include/FXRbPacker.h +1 -1
- data/ext/fox14/include/FXRbPicker.h +1 -1
- data/ext/fox14/include/FXRbPopup.h +1 -1
- data/ext/fox14/include/FXRbPrintDialog.h +1 -1
- data/ext/fox14/include/FXRbProgressBar.h +1 -1
- data/ext/fox14/include/FXRbProgressDialog.h +1 -1
- data/ext/fox14/include/FXRbRGBIcon.h +1 -1
- data/ext/fox14/include/FXRbRGBImage.h +1 -1
- data/ext/fox14/include/FXRbRadioButton.h +1 -1
- data/ext/fox14/include/FXRbRealSlider.h +1 -1
- data/ext/fox14/include/FXRbRealSpinner.h +1 -1
- data/ext/fox14/include/FXRbRecentFiles.h +1 -1
- data/ext/fox14/include/FXRbRegistry.h +1 -1
- data/ext/fox14/include/FXRbReplaceDialog.h +1 -1
- data/ext/fox14/include/FXRbRootWindow.h +1 -1
- data/ext/fox14/include/FXRbRuler.h +1 -1
- data/ext/fox14/include/FXRbScintilla.h +1 -1
- data/ext/fox14/include/FXRbScrollArea.h +1 -1
- data/ext/fox14/include/FXRbScrollBar.h +1 -1
- data/ext/fox14/include/FXRbScrollPane.h +1 -1
- data/ext/fox14/include/FXRbScrollWindow.h +1 -1
- data/ext/fox14/include/FXRbSearchDialog.h +1 -1
- data/ext/fox14/include/FXRbSeparator.h +1 -1
- data/ext/fox14/include/FXRbSettings.h +1 -1
- data/ext/fox14/include/FXRbShell.h +1 -1
- data/ext/fox14/include/FXRbShutter.h +1 -1
- data/ext/fox14/include/FXRbSlider.h +1 -1
- data/ext/fox14/include/FXRbSpinner.h +1 -1
- data/ext/fox14/include/FXRbSplashWindow.h +1 -1
- data/ext/fox14/include/FXRbSplitter.h +1 -1
- data/ext/fox14/include/FXRbSpring.h +1 -1
- data/ext/fox14/include/FXRbStatusBar.h +1 -1
- data/ext/fox14/include/FXRbStatusLine.h +1 -1
- data/ext/fox14/include/FXRbStream.h +1 -1
- data/ext/fox14/include/FXRbStringDict.h +1 -1
- data/ext/fox14/include/FXRbSwitcher.h +1 -1
- data/ext/fox14/include/FXRbTGAIcon.h +1 -1
- data/ext/fox14/include/FXRbTGAImage.h +1 -1
- data/ext/fox14/include/FXRbTIFIcon.h +1 -1
- data/ext/fox14/include/FXRbTIFImage.h +1 -1
- data/ext/fox14/include/FXRbTabBar.h +1 -1
- data/ext/fox14/include/FXRbTabBook.h +1 -1
- data/ext/fox14/include/FXRbTabItem.h +1 -1
- data/ext/fox14/include/FXRbTable.h +1 -1
- data/ext/fox14/include/FXRbText.h +1 -1
- data/ext/fox14/include/FXRbTextField.h +1 -1
- data/ext/fox14/include/FXRbToggleButton.h +1 -1
- data/ext/fox14/include/FXRbToolBar.h +1 -1
- data/ext/fox14/include/FXRbToolBarGrip.h +1 -1
- data/ext/fox14/include/FXRbToolBarShell.h +1 -1
- data/ext/fox14/include/FXRbToolBarTab.h +1 -1
- data/ext/fox14/include/FXRbToolTip.h +1 -1
- data/ext/fox14/include/FXRbTopWindow.h +1 -1
- data/ext/fox14/include/FXRbTreeList.h +1 -1
- data/ext/fox14/include/FXRbTreeListBox.h +1 -1
- data/ext/fox14/include/FXRbTriStateButton.h +1 -1
- data/ext/fox14/include/FXRbVerticalFrame.h +1 -1
- data/ext/fox14/include/FXRbVisual.h +1 -1
- data/ext/fox14/include/FXRbWindow.h +1 -1
- data/ext/fox14/include/FXRbWizard.h +1 -1
- data/ext/fox14/include/FXRbXBMIcon.h +1 -1
- data/ext/fox14/include/FXRbXBMImage.h +1 -1
- data/ext/fox14/include/FXRbXPMIcon.h +1 -1
- data/ext/fox14/include/FXRbXPMImage.h +1 -1
- data/ext/fox14/include/FXRuby.h +1 -1
- data/ext/fox14/label_wrap.cpp +23 -8
- data/ext/fox14/markfuncs.cpp +8 -1
- data/ext/fox14/mdi_wrap.cpp +47 -17
- data/ext/fox14/menu_wrap.cpp +34 -10
- data/ext/fox14/scintilla_wrap.cpp +31 -7
- data/ext/fox14/table_wrap.cpp +31 -7
- data/ext/fox14/text_wrap.cpp +31 -7
- data/ext/fox14/treelist_wrap.cpp +31 -7
- data/ext/fox14/ui_wrap.cpp +497 -154
- data/ext/fox14/unregisterOwnedObjects.cpp +1 -1
- data/lib/fox14/aliases.rb +3 -3
- data/lib/fox14/colors.rb +282 -282
- data/lib/fox14/core.rb +7 -0
- data/lib/fox14/splashscreen.rb +83 -83
- data/lib/fox14/version.rb +1 -1
- data/rdoc-sources/FX4Splitter.rb +138 -138
- data/rdoc-sources/FXFoldingList.rb +2 -2
- data/rdoc-sources/FXQuatd.rb +171 -1
- data/rdoc-sources/FXQuatf.rb +175 -1
- data/rdoc-sources/FXWindow.rb +0 -3
- data/tests/TC_FXComboBox.rb +10 -1
- data/tests/TC_FXDirList.rb +1 -1
- data/tests/TC_FXGLViewer.rb +2 -0
- data/tests/TC_FXHeader.rb +1 -1
- data/tests/TC_FXIconList.rb +1 -1
- data/tests/TC_FXId.rb +1 -1
- data/tests/TC_FXListBox.rb +1 -1
- data/tests/TC_FXMenuCommand.rb +0 -14
- data/tests/TC_FXTable.rb +0 -32
- data/tests/TC_FXTableItem.rb +1 -1
- data/tests/TC_FXTreeList.rb +1 -1
- data/tests/TC_FXTreeListBox.rb +1 -1
- data/web/top.html +15 -15
- metadata +2 -3
- 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.
|
4
|
-
the bottom of the main window for copying and pasting:</p><
|
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 4. Working With the Clipboard"><link rel="prev" href="clipboardtut.html" title="Chapter 4. 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> </td><th width="60%" align="center">Chapter 4. Working With the Clipboard</th><td width="20%" align="right"> <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 < 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"><
|
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
|
-
</
|
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
|
-
</
|
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
|
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
|
-
<
|
51
|
-
handler for the "Copy" button press which does just that:</p><
|
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
|
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 (<
|
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 <
|
66
|
-
<
|
67
|
-
<
|
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
|
-
<
|
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> </td><td width="20%" align="center"><a accesskey="u" href="clipboardtut.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch04s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 4. Working With the Clipboard </td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top"> 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.
|
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 4. 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> </td><th width="60%" align="center">Chapter 4. Working With the Clipboard</th><td width="20%" align="right"> <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
|
-
<
|
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
|
-
<
|
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
|
-
<
|
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
|
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 (<
|
17
|
-
(<
|
18
|
-
argument to <
|
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
|
-
<
|
21
|
-
the string returned by the call to <
|
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 <
|
27
|
+
store its string data. The <code class="methodname">fxencodeStringData()</code>
|
28
28
|
method (and the corresponding
|
29
|
-
<
|
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
|
-
<
|
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><
|
37
|
-
</pre></
|
36
|
+
text should look something like:</p><pre class="programlisting">#<struct Struct::Customer name="Joe Smith", address="123 Maple, Anytown, NC", zip=12345>
|
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> </td><td width="20%" align="center"><a accesskey="u" href="clipboardtut.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch04s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Acquiring the Clipboard </td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top"> 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.
|
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 4. Working With the Clipboard"><link rel="prev" href="ch04s03.html" title="Sending Data to the Clipboard"><link rel="next" href="dragdroptut.html" title="Chapter 5. 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> </td><th width="60%" align="center">Chapter 4. Working With the Clipboard</th><td width="20%" align="right"> <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><
|
9
|
-
</pre
|
8
|
+
currently stored on the clipboard:</p><pre class="programlisting">#<struct Struct::Customer name="Joe Smith", address="123 Maple, Anytown, NC", zip=12345>
|
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><
|
13
|
-
type for <
|
14
|
-
one line to our main window's <
|
15
|
-
method:</p><
|
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"><
|
18
|
-
</
|
17
|
+
<span class="bold"><strong> @customerDragType = getApp().registerDragType("application/x-customer")
|
18
|
+
</strong></span> show(PLACEMENT_SCREEN)
|
19
19
|
end
|
20
|
-
</pre
|
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 <
|
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 <
|
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"><
|
32
|
-
</
|
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
|
37
|
-
<
|
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
|
-
<
|
41
|
-
<
|
42
|
-
<
|
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
|
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><
|
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
|
64
|
-
inverse of the <
|
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 <
|
67
|
-
<
|
68
|
-
we're performing (e.g. <
|
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) <
|
72
|
-
<
|
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> </td><td width="20%" align="center"><a accesskey="u" href="clipboardtut.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="dragdroptut.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Sending Data to the Clipboard </td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 5. 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.
|
4
|
-
consisting of a main window widget (a <
|
5
|
-
instance) that parents an <
|
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 5. Drag and Drop"><link rel="prev" href="dragdroptut.html" title="Chapter 5. 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> </td><th width="60%" align="center">Chapter 5. Drag and Drop</th><td width="20%" align="right"> <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
|
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
|
-
<
|
51
|
-
the <
|
52
|
-
namely:</p><div class="itemizedlist"><ul type="disc"><li><p>We've defined a <
|
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
|
-
(<
|
56
|
-
<
|
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 <
|
63
|
-
canvas:</p><
|
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
|
76
|
-
the <
|
77
|
-
The first is to call <
|
78
|
-
acts as the drag source. Calling <
|
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
|
-
<
|
85
|
-
call <
|
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
|
-
<
|
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
|
96
|
-
<
|
97
|
-
<
|
98
|
-
<
|
99
|
-
state.</p><p>The next change is to add a <
|
100
|
-
to handle mouse motion events during the drag operation:</p><
|
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
|
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 <
|
113
|
-
call to <
|
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 <
|
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
|
-
<
|
119
|
-
and <
|
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
|
-
<
|
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
|
-
(<
|
127
|
-
<
|
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
|
-
(<
|
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 <
|
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
|
-
<
|
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
|
-
<
|
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
|
-
<
|
153
|
+
<code class="methodname">getDNDData()</code> method (as described in the previous
|
154
154
|
section). When this happens, FOX sends a
|
155
|
-
<
|
156
|
-
window, and so we now add a handler for that message:</p><
|
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
|
162
|
-
<
|
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
|
-
<
|
171
|
-
<
|
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
|
-
(<
|
174
|
-
(<
|
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
|
-
<
|
180
|
-
name <
|
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></
|
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> </td><td width="20%" align="center"><a accesskey="u" href="dragdroptut.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch05s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 5. Drag and Drop </td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top"> 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.
|
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 5. Drag and Drop"><link rel="prev" href="ch05s02.html" title="Drag Sources"><link rel="next" href="examples.html" title="Chapter 6. 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> </td><th width="60%" align="center">Chapter 5. Drag and Drop</th><td width="20%" align="right"> <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 <
|
12
|
-
<
|
13
|
-
and,</p></li><li><p>A handler for the <
|
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
|
-
<
|
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
|
-
<
|
26
|
-
name <
|
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></
|
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> </td><td width="20%" align="center"><a accesskey="u" href="dragdroptut.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="examples.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Drag Sources </td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 6. Examples</td></tr></table></div></body></html>
|