fxruby 1.6.15-x86-mswin32-60
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +456 -0
- data/README +39 -0
- data/doc/apes02.html +21 -0
- data/doc/apes03.html +39 -0
- data/doc/book.html +3 -0
- data/doc/build.html +132 -0
- data/doc/ch03s02.html +23 -0
- data/doc/ch03s03.html +52 -0
- data/doc/ch03s04.html +36 -0
- data/doc/ch03s05.html +60 -0
- data/doc/ch04s02.html +71 -0
- data/doc/ch04s03.html +37 -0
- data/doc/ch04s04.html +72 -0
- data/doc/ch05s02.html +260 -0
- data/doc/ch05s03.html +127 -0
- data/doc/changes.html +733 -0
- data/doc/clipboardtut.html +67 -0
- data/doc/differences.html +190 -0
- data/doc/dragdroptut.html +263 -0
- data/doc/events.html +36 -0
- data/doc/examples.html +104 -0
- data/doc/gems.html +73 -0
- data/doc/goals.html +41 -0
- data/doc/images/babelfish.png +0 -0
- data/doc/images/browser.png +0 -0
- data/doc/images/button.png +0 -0
- data/doc/images/call-chain-example.png +0 -0
- data/doc/images/colordialog.png +0 -0
- data/doc/images/datatarget.png +0 -0
- data/doc/images/dialog.png +0 -0
- data/doc/images/dilbert.png +0 -0
- data/doc/images/dirlist.png +0 -0
- data/doc/images/dropsite-droprejected.png +0 -0
- data/doc/images/foursplit.png +0 -0
- data/doc/images/gltest.png +0 -0
- data/doc/images/glviewer.png +0 -0
- data/doc/images/groupbox.png +0 -0
- data/doc/images/header.png +0 -0
- data/doc/images/hello-with-button.png +0 -0
- data/doc/images/hello-with-icon-1.png +0 -0
- data/doc/images/hello-with-icon-2.png +0 -0
- data/doc/images/hello-with-icon-3.png +0 -0
- data/doc/images/hello-with-tooltip.png +0 -0
- data/doc/images/hello-without-button.png +0 -0
- data/doc/images/hello.png +0 -0
- data/doc/images/hello2.png +0 -0
- data/doc/images/iconlist-bigicons.png +0 -0
- data/doc/images/iconlist-details.png +0 -0
- data/doc/images/image.png +0 -0
- data/doc/images/imageviewer.png +0 -0
- data/doc/images/inheritance.png +0 -0
- data/doc/images/mditest.png +0 -0
- data/doc/images/raabrowser.png +0 -0
- data/doc/images/scribble.png +0 -0
- data/doc/images/shutter.png +0 -0
- data/doc/images/splitter.png +0 -0
- data/doc/images/tabbook.png +0 -0
- data/doc/images/table.png +0 -0
- data/doc/images/tutorial1.png +0 -0
- data/doc/implementation.html +16 -0
- data/doc/infosources.html +33 -0
- data/doc/library.html +30 -0
- data/doc/opengl.html +73 -0
- data/doc/pt01.html +3 -0
- data/doc/pt02.html +3 -0
- data/doc/scintilla.html +36 -0
- data/doc/style.css +247 -0
- data/doc/subversion.html +21 -0
- data/doc/tutorial1.html +90 -0
- data/doc/unicode.html +56 -0
- data/examples/RAA.rb +25 -0
- data/examples/README +53 -0
- data/examples/babelfish.rb +72 -0
- data/examples/bounce.rb +159 -0
- data/examples/browser.rb +191 -0
- data/examples/button.rb +168 -0
- data/examples/custom_table_item.rb +170 -0
- data/examples/datatarget.rb +223 -0
- data/examples/dctest.rb +696 -0
- data/examples/dialog.rb +143 -0
- data/examples/dilbert.rb +66 -0
- data/examples/dirlist.rb +63 -0
- data/examples/dragdrop.rb +97 -0
- data/examples/dragsource.rb +80 -0
- data/examples/dropsite.rb +59 -0
- data/examples/foursplit.rb +97 -0
- data/examples/gltest.rb +330 -0
- data/examples/glviewer.rb +576 -0
- data/examples/groupbox.rb +392 -0
- data/examples/header.rb +149 -0
- data/examples/hello.rb +12 -0
- data/examples/hello2.rb +51 -0
- data/examples/iRAA.rb +153 -0
- data/examples/iconlist.rb +92 -0
- data/examples/icons/AngryGuyInBunnySuit.ico +0 -0
- data/examples/icons/FatBot.ico +0 -0
- data/examples/icons/FlippedySwitch.ico +0 -0
- data/examples/icons/LeGoon.ico +0 -0
- data/examples/icons/Net.ico +0 -0
- data/examples/icons/RedMacOS.ico +0 -0
- data/examples/icons/SawBlade.ico +0 -0
- data/examples/icons/backview.png +0 -0
- data/examples/icons/big.png +0 -0
- data/examples/icons/bigfolder.png +0 -0
- data/examples/icons/bigpenguin.png +0 -0
- data/examples/icons/bottomview.png +0 -0
- data/examples/icons/camera.png +0 -0
- data/examples/icons/capbutt.png +0 -0
- data/examples/icons/capnotlast.png +0 -0
- data/examples/icons/capproj.png +0 -0
- data/examples/icons/capround.png +0 -0
- data/examples/icons/colorpal.png +0 -0
- data/examples/icons/copy.png +0 -0
- data/examples/icons/cut.png +0 -0
- data/examples/icons/delimit.png +0 -0
- data/examples/icons/dippy.png +0 -0
- data/examples/icons/double_dash.png +0 -0
- data/examples/icons/filenew.png +0 -0
- data/examples/icons/fileopen.png +0 -0
- data/examples/icons/filesave.png +0 -0
- data/examples/icons/filesaveas.png +0 -0
- data/examples/icons/fonts.png +0 -0
- data/examples/icons/fox.png +0 -0
- data/examples/icons/foxicon.png +0 -0
- data/examples/icons/frontview.png +0 -0
- data/examples/icons/gem_big.png +0 -0
- data/examples/icons/gem_small.png +0 -0
- data/examples/icons/hello2.png +0 -0
- data/examples/icons/help.png +0 -0
- data/examples/icons/indent.png +0 -0
- data/examples/icons/jbevel.png +0 -0
- data/examples/icons/jmiter.png +0 -0
- data/examples/icons/jround.png +0 -0
- data/examples/icons/kill.png +0 -0
- data/examples/icons/leftview.png +0 -0
- data/examples/icons/light.png +0 -0
- data/examples/icons/minidoc.png +0 -0
- data/examples/icons/minifolder.png +0 -0
- data/examples/icons/minifolderopen.png +0 -0
- data/examples/icons/newfolder.png +0 -0
- data/examples/icons/nolight.png +0 -0
- data/examples/icons/onoff_dash.png +0 -0
- data/examples/icons/palette.png +0 -0
- data/examples/icons/parallel.png +0 -0
- data/examples/icons/paste.png +0 -0
- data/examples/icons/pattern.png +0 -0
- data/examples/icons/penguin.png +0 -0
- data/examples/icons/perspective.png +0 -0
- data/examples/icons/printicon.png +0 -0
- data/examples/icons/prop.png +0 -0
- data/examples/icons/redo.png +0 -0
- data/examples/icons/rightview.png +0 -0
- data/examples/icons/saveas.png +0 -0
- data/examples/icons/shutter1.png +0 -0
- data/examples/icons/shutter2.png +0 -0
- data/examples/icons/small.png +0 -0
- data/examples/icons/smoothlight.png +0 -0
- data/examples/icons/solid_line.png +0 -0
- data/examples/icons/tbuplevel.png +0 -0
- data/examples/icons/topview.png +0 -0
- data/examples/icons/undo.png +0 -0
- data/examples/icons/winapp.png +0 -0
- data/examples/icons/zoom.png +0 -0
- data/examples/image.rb +279 -0
- data/examples/imageviewer.rb +509 -0
- data/examples/inputs.rb +83 -0
- data/examples/mditest.rb +180 -0
- data/examples/pig.rb +77 -0
- data/examples/raabrowser.rb +122 -0
- data/examples/ratio.rb +80 -0
- data/examples/rulerview.rb +27 -0
- data/examples/scintilla-test.rb +81 -0
- data/examples/scribble-orig.rb +186 -0
- data/examples/scribble.rb +162 -0
- data/examples/shutter.rb +158 -0
- data/examples/splitter.rb +211 -0
- data/examples/styledtext.rb +82 -0
- data/examples/tabbook.rb +165 -0
- data/examples/table.rb +182 -0
- data/examples/textedit/commands.rb +114 -0
- data/examples/textedit/helpwindow.rb +299 -0
- data/examples/textedit/prefdialog.rb +239 -0
- data/examples/textedit/textedit.rb +1763 -0
- data/examples/unicode.rb +36 -0
- data/ext/fox16/fox16.so +0 -0
- data/lib/fox16/aliases.rb +5611 -0
- data/lib/fox16/calendar.rb +217 -0
- data/lib/fox16/chore.rb +105 -0
- data/lib/fox16/colors.rb +280 -0
- data/lib/fox16/core.rb +681 -0
- data/lib/fox16/dict.rb +35 -0
- data/lib/fox16/execute_nonmodal.rb +70 -0
- data/lib/fox16/glgroup.rb +166 -0
- data/lib/fox16/glshapes.rb +456 -0
- data/lib/fox16/input.rb +59 -0
- data/lib/fox16/irb.rb +178 -0
- data/lib/fox16/iterators.rb +420 -0
- data/lib/fox16/keys.rb +1374 -0
- data/lib/fox16/kwargs.rb +2736 -0
- data/lib/fox16/missingdep.rb +14 -0
- data/lib/fox16/pseudokeyboard.rb +40 -0
- data/lib/fox16/pseudomouse.rb +87 -0
- data/lib/fox16/responder.rb +70 -0
- data/lib/fox16/responder2.rb +131 -0
- data/lib/fox16/scintilla.rb +3641 -0
- data/lib/fox16/settings.rb +18 -0
- data/lib/fox16/signal.rb +71 -0
- data/lib/fox16/splashscreen.rb +82 -0
- data/lib/fox16/timeout.rb +136 -0
- data/lib/fox16/undolist.rb +455 -0
- data/lib/fox16/version.rb +9 -0
- data/rdoc-sources/FX4Splitter.rb +156 -0
- data/rdoc-sources/FX7Segment.rb +54 -0
- data/rdoc-sources/FXAccelTable.rb +102 -0
- data/rdoc-sources/FXApp.rb +545 -0
- data/rdoc-sources/FXArrowButton.rb +69 -0
- data/rdoc-sources/FXBMPIcon.rb +67 -0
- data/rdoc-sources/FXBMPImage.rb +30 -0
- data/rdoc-sources/FXBitmap.rb +115 -0
- data/rdoc-sources/FXBitmapFrame.rb +31 -0
- data/rdoc-sources/FXBitmapView.rb +44 -0
- data/rdoc-sources/FXButton.rb +59 -0
- data/rdoc-sources/FXCURCursor.rb +13 -0
- data/rdoc-sources/FXCanvas.rb +18 -0
- data/rdoc-sources/FXCheckButton.rb +58 -0
- data/rdoc-sources/FXChoiceBox.rb +49 -0
- data/rdoc-sources/FXColorBar.rb +48 -0
- data/rdoc-sources/FXColorDialog.rb +37 -0
- data/rdoc-sources/FXColorList.rb +55 -0
- data/rdoc-sources/FXColorRing.rb +49 -0
- data/rdoc-sources/FXColorSelector.rb +65 -0
- data/rdoc-sources/FXColorWell.rb +65 -0
- data/rdoc-sources/FXColorWheel.rb +57 -0
- data/rdoc-sources/FXComboBox.rb +214 -0
- data/rdoc-sources/FXComposite.rb +34 -0
- data/rdoc-sources/FXCursor.rb +67 -0
- data/rdoc-sources/FXDC.rb +720 -0
- data/rdoc-sources/FXDCPrint.rb +127 -0
- data/rdoc-sources/FXDCWindow.rb +33 -0
- data/rdoc-sources/FXDataTarget.rb +66 -0
- data/rdoc-sources/FXDebugTarget.rb +25 -0
- data/rdoc-sources/FXDelegator.rb +23 -0
- data/rdoc-sources/FXDial.rb +107 -0
- data/rdoc-sources/FXDialogBox.rb +32 -0
- data/rdoc-sources/FXDict.rb +79 -0
- data/rdoc-sources/FXDirBox.rb +55 -0
- data/rdoc-sources/FXDirDialog.rb +47 -0
- data/rdoc-sources/FXDirList.rb +149 -0
- data/rdoc-sources/FXDirSelector.rb +64 -0
- data/rdoc-sources/FXDockBar.rb +151 -0
- data/rdoc-sources/FXDockHandler.rb +26 -0
- data/rdoc-sources/FXDockSite.rb +104 -0
- data/rdoc-sources/FXDockTitle.rb +26 -0
- data/rdoc-sources/FXDocument.rb +29 -0
- data/rdoc-sources/FXDragCorner.rb +19 -0
- data/rdoc-sources/FXDrawable.rb +27 -0
- data/rdoc-sources/FXDriveBox.rb +46 -0
- data/rdoc-sources/FXExtentd.rb +85 -0
- data/rdoc-sources/FXExtentf.rb +85 -0
- data/rdoc-sources/FXFileDialog.rb +217 -0
- data/rdoc-sources/FXFileDict.rb +131 -0
- data/rdoc-sources/FXFileList.rb +208 -0
- data/rdoc-sources/FXFileSelector.rb +184 -0
- data/rdoc-sources/FXFileStream.rb +27 -0
- data/rdoc-sources/FXFoldingList.rb +504 -0
- data/rdoc-sources/FXFont.rb +361 -0
- data/rdoc-sources/FXFontDialog.rb +14 -0
- data/rdoc-sources/FXFontSelector.rb +37 -0
- data/rdoc-sources/FXFrame.rb +53 -0
- data/rdoc-sources/FXGIFCursor.rb +50 -0
- data/rdoc-sources/FXGIFIcon.rb +31 -0
- data/rdoc-sources/FXGIFImage.rb +29 -0
- data/rdoc-sources/FXGLCanvas.rb +45 -0
- data/rdoc-sources/FXGLContext.rb +40 -0
- data/rdoc-sources/FXGLObject.rb +75 -0
- data/rdoc-sources/FXGLShape.rb +69 -0
- data/rdoc-sources/FXGLViewer.rb +332 -0
- data/rdoc-sources/FXGLVisual.rb +94 -0
- data/rdoc-sources/FXGradientBar.rb +301 -0
- data/rdoc-sources/FXGroupBox.rb +36 -0
- data/rdoc-sources/FXHeader.rb +411 -0
- data/rdoc-sources/FXHorizontalFrame.rb +29 -0
- data/rdoc-sources/FXICOIcon.rb +65 -0
- data/rdoc-sources/FXICOImage.rb +31 -0
- data/rdoc-sources/FXIcon.rb +38 -0
- data/rdoc-sources/FXIconDict.rb +48 -0
- data/rdoc-sources/FXIconList.rb +450 -0
- data/rdoc-sources/FXIconSource.rb +100 -0
- data/rdoc-sources/FXId.rb +34 -0
- data/rdoc-sources/FXImage.rb +292 -0
- data/rdoc-sources/FXImageFrame.rb +36 -0
- data/rdoc-sources/FXImageView.rb +35 -0
- data/rdoc-sources/FXInputDialog.rb +80 -0
- data/rdoc-sources/FXJPGIcon.rb +70 -0
- data/rdoc-sources/FXJPGImage.rb +38 -0
- data/rdoc-sources/FXKnob.rb +76 -0
- data/rdoc-sources/FXLabel.rb +72 -0
- data/rdoc-sources/FXList.rb +443 -0
- data/rdoc-sources/FXListBox.rb +191 -0
- data/rdoc-sources/FXMDIButton.rb +67 -0
- data/rdoc-sources/FXMDIChild.rb +155 -0
- data/rdoc-sources/FXMDIClient.rb +65 -0
- data/rdoc-sources/FXMainWindow.rb +26 -0
- data/rdoc-sources/FXMatrix.rb +57 -0
- data/rdoc-sources/FXMemoryBuffer.rb +28 -0
- data/rdoc-sources/FXMemoryStream.rb +50 -0
- data/rdoc-sources/FXMenuBar.rb +23 -0
- data/rdoc-sources/FXMenuButton.rb +84 -0
- data/rdoc-sources/FXMenuCaption.rb +53 -0
- data/rdoc-sources/FXMenuCascade.rb +18 -0
- data/rdoc-sources/FXMenuCheck.rb +30 -0
- data/rdoc-sources/FXMenuCommand.rb +26 -0
- data/rdoc-sources/FXMenuPane.rb +13 -0
- data/rdoc-sources/FXMenuRadio.rb +33 -0
- data/rdoc-sources/FXMenuSeparator.rb +21 -0
- data/rdoc-sources/FXMenuTitle.rb +27 -0
- data/rdoc-sources/FXMessageBox.rb +73 -0
- data/rdoc-sources/FXObject.rb +28 -0
- data/rdoc-sources/FXOptionMenu.rb +83 -0
- data/rdoc-sources/FXPCXIcon.rb +63 -0
- data/rdoc-sources/FXPCXImage.rb +31 -0
- data/rdoc-sources/FXPNGIcon.rb +66 -0
- data/rdoc-sources/FXPNGImage.rb +34 -0
- data/rdoc-sources/FXPPMIcon.rb +36 -0
- data/rdoc-sources/FXPPMImage.rb +31 -0
- data/rdoc-sources/FXPacker.rb +63 -0
- data/rdoc-sources/FXPicker.rb +27 -0
- data/rdoc-sources/FXPopup.rb +53 -0
- data/rdoc-sources/FXPrintDialog.rb +36 -0
- data/rdoc-sources/FXProgressBar.rb +57 -0
- data/rdoc-sources/FXProgressDialog.rb +36 -0
- data/rdoc-sources/FXQuatd.rb +164 -0
- data/rdoc-sources/FXQuatf.rb +173 -0
- data/rdoc-sources/FXRGBIcon.rb +64 -0
- data/rdoc-sources/FXRGBImage.rb +31 -0
- data/rdoc-sources/FXRadioButton.rb +70 -0
- data/rdoc-sources/FXRanged.rb +100 -0
- data/rdoc-sources/FXRangef.rb +100 -0
- data/rdoc-sources/FXRealSlider.rb +101 -0
- data/rdoc-sources/FXRealSpinner.rb +140 -0
- data/rdoc-sources/FXRecentFiles.rb +77 -0
- data/rdoc-sources/FXRectangle.rb +149 -0
- data/rdoc-sources/FXRegion.rb +64 -0
- data/rdoc-sources/FXRegistry.rb +56 -0
- data/rdoc-sources/FXReplaceDialog.rb +56 -0
- data/rdoc-sources/FXRootWindow.rb +17 -0
- data/rdoc-sources/FXRuler.rb +130 -0
- data/rdoc-sources/FXRulerView.rb +225 -0
- data/rdoc-sources/FXScintilla.rb +121 -0
- data/rdoc-sources/FXScrollArea.rb +86 -0
- data/rdoc-sources/FXScrollBar.rb +107 -0
- data/rdoc-sources/FXScrollPane.rb +28 -0
- data/rdoc-sources/FXScrollWindow.rb +38 -0
- data/rdoc-sources/FXSearchDialog.rb +24 -0
- data/rdoc-sources/FXSeparator.rb +74 -0
- data/rdoc-sources/FXSettings.rb +248 -0
- data/rdoc-sources/FXShell.rb +8 -0
- data/rdoc-sources/FXShutter.rb +102 -0
- data/rdoc-sources/FXSize.rb +95 -0
- data/rdoc-sources/FXSlider.rb +98 -0
- data/rdoc-sources/FXSphered.rb +80 -0
- data/rdoc-sources/FXSpheref.rb +80 -0
- data/rdoc-sources/FXSpinner.rb +136 -0
- data/rdoc-sources/FXSplashWindow.rb +27 -0
- data/rdoc-sources/FXSplitter.rb +89 -0
- data/rdoc-sources/FXSpring.rb +61 -0
- data/rdoc-sources/FXStatusBar.rb +42 -0
- data/rdoc-sources/FXStatusLine.rb +60 -0
- data/rdoc-sources/FXStream.rb +142 -0
- data/rdoc-sources/FXStringDict.rb +38 -0
- data/rdoc-sources/FXSwitcher.rb +78 -0
- data/rdoc-sources/FXTGAIcon.rb +63 -0
- data/rdoc-sources/FXTGAImage.rb +31 -0
- data/rdoc-sources/FXTIFIcon.rb +70 -0
- data/rdoc-sources/FXTIFImage.rb +37 -0
- data/rdoc-sources/FXTabBar.rb +80 -0
- data/rdoc-sources/FXTabBook.rb +41 -0
- data/rdoc-sources/FXTabItem.rb +58 -0
- data/rdoc-sources/FXTable.rb +967 -0
- data/rdoc-sources/FXText.rb +581 -0
- data/rdoc-sources/FXTextField.rb +151 -0
- data/rdoc-sources/FXToggleButton.rb +70 -0
- data/rdoc-sources/FXToolBar.rb +61 -0
- data/rdoc-sources/FXToolBarGrip.rb +50 -0
- data/rdoc-sources/FXToolBarShell.rb +44 -0
- data/rdoc-sources/FXToolBarTab.rb +74 -0
- data/rdoc-sources/FXToolTip.rb +39 -0
- data/rdoc-sources/FXTopWindow.rb +163 -0
- data/rdoc-sources/FXTranslator.rb +32 -0
- data/rdoc-sources/FXTreeList.rb +514 -0
- data/rdoc-sources/FXTreeListBox.rb +219 -0
- data/rdoc-sources/FXTriStateButton.rb +49 -0
- data/rdoc-sources/FXVec2d.rb +96 -0
- data/rdoc-sources/FXVec2f.rb +96 -0
- data/rdoc-sources/FXVec3d.rb +113 -0
- data/rdoc-sources/FXVec3f.rb +113 -0
- data/rdoc-sources/FXVec4d.rb +129 -0
- data/rdoc-sources/FXVec4f.rb +129 -0
- data/rdoc-sources/FXVerticalFrame.rb +29 -0
- data/rdoc-sources/FXVisual.rb +79 -0
- data/rdoc-sources/FXWindow.rb +725 -0
- data/rdoc-sources/FXWizard.rb +59 -0
- data/rdoc-sources/FXXBMIcon.rb +37 -0
- data/rdoc-sources/FXXBMImage.rb +32 -0
- data/rdoc-sources/FXXPMIcon.rb +65 -0
- data/rdoc-sources/FXXPMImage.rb +31 -0
- data/rdoc-sources/README.rdoc +53 -0
- data/rdoc-sources/fxdefs.rb +90 -0
- data/tests/README +19 -0
- data/tests/TC_FXAccelTable.rb +43 -0
- data/tests/TC_FXApp.rb +16 -0
- data/tests/TC_FXArc.rb +26 -0
- data/tests/TC_FXBMPIcon.rb +15 -0
- data/tests/TC_FXBMPImage.rb +15 -0
- data/tests/TC_FXButton.rb +72 -0
- data/tests/TC_FXCheckButton.rb +57 -0
- data/tests/TC_FXComboBox.rb +63 -0
- data/tests/TC_FXDC.rb +372 -0
- data/tests/TC_FXDCPrint.rb +102 -0
- data/tests/TC_FXDCWindow.rb +23 -0
- data/tests/TC_FXDataTarget.rb +24 -0
- data/tests/TC_FXDialogBox.rb +12 -0
- data/tests/TC_FXDirList.rb +30 -0
- data/tests/TC_FXFileAssoc.rb +62 -0
- data/tests/TC_FXFileStream.rb +90 -0
- data/tests/TC_FXFoldingList.rb +32 -0
- data/tests/TC_FXFont.rb +69 -0
- data/tests/TC_FXFontDesc.rb +58 -0
- data/tests/TC_FXGLGroup.rb +32 -0
- data/tests/TC_FXGLShape.rb +28 -0
- data/tests/TC_FXGLViewer.rb +20 -0
- data/tests/TC_FXGradientBar.rb +89 -0
- data/tests/TC_FXHeader.rb +82 -0
- data/tests/TC_FXHiliteStyle.rb +23 -0
- data/tests/TC_FXIconDict.rb +52 -0
- data/tests/TC_FXIconList.rb +192 -0
- data/tests/TC_FXId.rb +19 -0
- data/tests/TC_FXImage.rb +155 -0
- data/tests/TC_FXLight.rb +33 -0
- data/tests/TC_FXList.rb +116 -0
- data/tests/TC_FXListBox.rb +49 -0
- data/tests/TC_FXMainWindow.rb +12 -0
- data/tests/TC_FXMat4f.rb +228 -0
- data/tests/TC_FXMaterial.rb +89 -0
- data/tests/TC_FXMemoryStream.rb +97 -0
- data/tests/TC_FXMenuCheck.rb +57 -0
- data/tests/TC_FXMenuCommand.rb +12 -0
- data/tests/TC_FXMenuRadio.rb +57 -0
- data/tests/TC_FXMessageBox.rb +25 -0
- data/tests/TC_FXPoint.rb +57 -0
- data/tests/TC_FXQuatf.rb +77 -0
- data/tests/TC_FXRadioButton.rb +57 -0
- data/tests/TC_FXRangef.rb +48 -0
- data/tests/TC_FXRectangle.rb +88 -0
- data/tests/TC_FXRegion.rb +54 -0
- data/tests/TC_FXRegistry.rb +27 -0
- data/tests/TC_FXScrollArea.rb +28 -0
- data/tests/TC_FXScrollWindow.rb +28 -0
- data/tests/TC_FXSegment.rb +22 -0
- data/tests/TC_FXSettings.rb +34 -0
- data/tests/TC_FXShell.rb +26 -0
- data/tests/TC_FXSize.rb +54 -0
- data/tests/TC_FXStream.rb +11 -0
- data/tests/TC_FXTable.rb +368 -0
- data/tests/TC_FXTableItem.rb +48 -0
- data/tests/TC_FXText.rb +96 -0
- data/tests/TC_FXTopWindow.rb +32 -0
- data/tests/TC_FXTreeList.rb +100 -0
- data/tests/TC_FXTreeListBox.rb +41 -0
- data/tests/TC_FXUndoList.rb +43 -0
- data/tests/TC_FXVec2d.rb +142 -0
- data/tests/TC_FXVec2f.rb +137 -0
- data/tests/TC_FXVec3d.rb +150 -0
- data/tests/TC_FXVec3f.rb +150 -0
- data/tests/TC_FXVec4f.rb +158 -0
- data/tests/TC_FXViewport.rb +30 -0
- data/tests/TC_FXXBMIcon.rb +15 -0
- data/tests/TC_FXXBMImage.rb +15 -0
- data/tests/TC_FXXPMIcon.rb +15 -0
- data/tests/TC_FXXPMImage.rb +15 -0
- data/tests/TC_Misc.rb +157 -0
- data/tests/TC_downcast.rb +15 -0
- data/tests/TS_All.rb +25 -0
- data/tests/blankpage.ps +166 -0
- data/tests/howdypage.ps +181 -0
- data/tests/stress1.rb +92 -0
- data/tests/stress2.rb +51 -0
- data/tests/stress3.rb +117 -0
- data/tests/testcase.rb +37 -0
- metadata +549 -0
@@ -0,0 +1,67 @@
|
|
1
|
+
<html><head>
|
2
|
+
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
3
|
+
<title>Chapter 4. Working With the Clipboard</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook v5 XSL Stylesheets V1.72.0"><link rel="start" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="pt01.html" title="Part I. The Basics"><link rel="prev" href="ch03s05.html" title="Adding an icon"><link rel="next" href="ch04s02.html" title="Acquiring 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">Chapter 4. Working With the Clipboard</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s05.html">Prev</a> </td><th width="60%" align="center">Part I. The Basics</th><td width="20%" align="right"> <a accesskey="n" href="ch04s02.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="clipboardtut"></a>Chapter 4. Working With the Clipboard</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="clipboardtut.html#d0e1003">Basic Application</a></span></dt><dt><span class="section"><a href="ch04s02.html">Acquiring the Clipboard</a></span></dt><dt><span class="section"><a href="ch04s03.html">Sending Data to the Clipboard</a></span></dt><dt><span class="section"><a href="ch04s04.html">Pasting Data from the Clipboard</a></span></dt></dl></div><p>Two of the standard FOX widgets, <code class="classname">FXText</code> and
|
4
|
+
<code class="classname">FXTextField</code>, provide clipboard support out of the
|
5
|
+
box. For example, you can select some text in an
|
6
|
+
<code class="classname">FXTextField</code> and then press Ctrl+C to copy that text
|
7
|
+
to the system clipboard. You can also press Ctrl+X to "cut" the selected
|
8
|
+
text to the clipboard, or Ctrl+V to paste text from the clipboard into an
|
9
|
+
<code class="classname">FXText</code> or <code class="classname">FXTextField</code> widget.
|
10
|
+
The purpose of this tutorial is to demonstrate how to interact with the
|
11
|
+
clipboard programmatically, so that you can integrate additional clipboard
|
12
|
+
support into your FXRuby applications.</p><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1003"></a>Basic Application</h2></div></div></div><p>In order to illustrate how to integrate cut and paste operations
|
13
|
+
into your application, we'll start from a simple FXRuby application that
|
14
|
+
doesn't yet provide any clipboard support. This application simply
|
15
|
+
presents a list of customers (from some external source).</p><pre class="programlisting">require 'fox16'
|
16
|
+
require 'customer'
|
17
|
+
|
18
|
+
include Fox
|
19
|
+
|
20
|
+
class ClipMainWindow < FXMainWindow
|
21
|
+
def initialize(anApp)
|
22
|
+
# Initialize base class first
|
23
|
+
super(anApp, "Clipboard Example", :opts => DECOR_ALL, :width => 400, :height => 300)
|
24
|
+
|
25
|
+
# Place the list in a sunken frame
|
26
|
+
sunkenFrame = FXVerticalFrame.new(self,
|
27
|
+
LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding => 0)
|
28
|
+
|
29
|
+
# Customer list
|
30
|
+
customerList = FXList.new(sunkenFrame, :opts => LIST_BROWSESELECT|LAYOUT_FILL_X|LAYOUT_FILL_Y)
|
31
|
+
$customers.each do |customer|
|
32
|
+
customerList.appendItem(customer.name, nil, customer)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def create
|
37
|
+
super
|
38
|
+
show(PLACEMENT_SCREEN)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
if __FILE__ == $0
|
43
|
+
FXApp.new("ClipboardExample", "FXRuby") do |theApp|
|
44
|
+
ClipMainWindow.new(theApp)
|
45
|
+
theApp.create
|
46
|
+
theApp.run
|
47
|
+
end
|
48
|
+
end
|
49
|
+
</pre><p>We're assuming that the "customer" module defines a
|
50
|
+
<code class="classname">Customer</code> class and a global array
|
51
|
+
<code class="varname">$customers</code> that contains the list of customers. For a
|
52
|
+
real world application, you might access this information from a database
|
53
|
+
or some other source, but for this example we'll just use a hard-coded
|
54
|
+
array:</p><pre class="programlisting"># customer.rb
|
55
|
+
|
56
|
+
Customer = Struct.new("Customer", :name, :address, :zip)
|
57
|
+
|
58
|
+
$customers = []
|
59
|
+
$customers << Customer.new("Reed Richards", "123 Maple, Central City, NY", 010111)
|
60
|
+
$customers << Customer.new("Sue Storm", "123 Maple, Anytown, NC", 12345)
|
61
|
+
$customers << Customer.new("Benjamin J. Grimm", "123 Maple, Anytown, NC", 12345)
|
62
|
+
$customers << Customer.new("Johnny Storm", "123 Maple, Anytown, NC", 12345)
|
63
|
+
</pre><p>The goals for the next few sections are to extend this application
|
64
|
+
so that users can select a customer from the list and copy that customer's
|
65
|
+
information to the clipboard, and subsequently paste that information into
|
66
|
+
another copy of the program (or some other clipboard-aware
|
67
|
+
application).</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch03s05.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="pt01.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch04s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Adding an icon </td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top"> Acquiring the Clipboard</td></tr></table></div></body></html>
|
@@ -0,0 +1,190 @@
|
|
1
|
+
<html><head>
|
2
|
+
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
3
|
+
<title>Appendix C. Differences between FOX and FXRuby</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook v5 XSL Stylesheets V1.72.0"><link rel="start" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="pt02.html" title="Part II. Appendices"><link rel="prev" href="scintilla.html" title="Appendix B. Using Scintilla with FXRuby"><link rel="next" href="library.html" title="Appendix D. The FXRuby Standard Library"></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">Appendix C. Differences between FOX and FXRuby</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="scintilla.html">Prev</a> </td><th width="60%" align="center">Part II. Appendices</th><td width="20%" align="right"> <a accesskey="n" href="library.html">Next</a></td></tr></table><hr></div><div class="appendix" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="differences"></a>Appendix C. Differences between FOX and FXRuby</h2></div></div></div><p>The FXRuby API follows the FOX API very closely and for the most part,
|
4
|
+
you should be able to use the standard FOX class documentation as a
|
5
|
+
reference. In some cases, however, fundamental differences between Ruby and
|
6
|
+
C++ necessitated slight changes in the API. For some other cases, FOX
|
7
|
+
classes were enhanced to take advantage of Ruby language features (such as
|
8
|
+
iterators). The purpose of this chapter is to identify some of the
|
9
|
+
differences between the C++ and Ruby interfaces to FOX.</p><p>One difference that should be easy to cope with is the substitution of
|
10
|
+
Ruby Strings for FXStrings. Any function that would normally expect an
|
11
|
+
<span class="type">FXString</span> input argument insteads takes a Ruby String.
|
12
|
+
Similarly, functions that would return an <span class="type">FXString</span> will instead
|
13
|
+
return a Ruby string. For functions that would normally accept a
|
14
|
+
<code class="constant">NULL</code> or empty string argument, just pass
|
15
|
+
<code class="constant">nil</code> or an empty string ("").</p><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4856"></a>Functions that expect arrays of objects</h2></div></div></div><p>One common pattern in FOX member function argument lists is to
|
16
|
+
expect a pointer to an array of values, followed by an integer indicating
|
17
|
+
the number of values in the array. This of course isn't necessary in Ruby,
|
18
|
+
where <code class="classname">Array</code> objects "know" their lengths. As a
|
19
|
+
result, functions such as
|
20
|
+
<code class="methodname">FXWindow::acquireClipboard()</code>, whose C++
|
21
|
+
declaration looks like this:</p><pre class="programlisting">FXbool acquireClipboard(const FXDragType *types, FXuint numTypes);</pre><p>are called from Ruby code by passing in a single
|
22
|
+
<code class="classname">Array</code> argument, e.g.</p><pre class="programlisting">myWindow.acquireClipboard(typesArray)</pre></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4876"></a>Functions that return values by reference</h2></div></div></div><p>Many FOX methods take advantage of the C++ language feature of
|
23
|
+
returning values by reference. For example, the
|
24
|
+
<code class="methodname">getCursorPos()</code> member function for class
|
25
|
+
<code class="classname">FXWindow</code> has the declaration:</p><pre class="programlisting">FXint getCursorPos(FXint& x, FXint& y, FXint& buttons) const;</pre><p>which indicates that the function takes references to three integers
|
26
|
+
(x, y and buttons). To call this function from a C++ program, you'd write
|
27
|
+
code like this:</p><pre class="programlisting">FXint x, y;
|
28
|
+
FXuint buttons;
|
29
|
+
|
30
|
+
if (window->getCursorPosition(x, y, buttons))
|
31
|
+
fprintf(stderr, "Current position is (%d, %d)\n", x, y);</pre><p>Since this idiom doesn't translate well to Ruby, some functions'
|
32
|
+
interfaces have been slightly modified. For example, the FXRuby
|
33
|
+
implementation of <code class="methodname">getCursorPos()</code> returns the
|
34
|
+
three values as an <code class="classname">Array</code>, e.g.:</p><pre class="programlisting">x, y, buttons = aWindow.getCursorPos()</pre><p>The following table shows how these kinds of functions are
|
35
|
+
implemented in FXRuby:</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><thead><tr><th align="center">Instance Method</th><th align="center">Return Value</th></tr></thead><tbody><tr><td><code class="methodname">FXDial#range</code></td><td>Returns a <code class="classname">Range</code> instance.</td></tr><tr><td><code class="methodname">FXDial#range=(aRange)</code></td><td>Accepts a <code class="classname">Range</code> instance as its
|
36
|
+
input.</td></tr><tr><td><code class="methodname">FXFontDialog#fontSelection</code></td><td>Returns the <code class="classname">FXFontDesc</code>
|
37
|
+
instance</td></tr><tr><td><code class="methodname">FXFontSelector#fontSelection</code></td><td>Returns the <code class="classname">FXFontDesc</code>
|
38
|
+
instance</td></tr><tr><td><code class="methodname">FXGLObject#bounds(range)</code></td><td>Takes an <code class="classname">FXRange</code> instance as its
|
39
|
+
input and returns a (possibly modified)
|
40
|
+
<code class="classname">FXRange</code> instance.</td></tr><tr><td><code class="methodname">FXGLViewer#eyeToScreen(eye)</code></td><td>Takes an array of eye coordinates (floats) as its input and
|
41
|
+
returns the screen point coordinate as an array of integers [sx,
|
42
|
+
sy]</td></tr><tr><td><code class="methodname">FXGLViewer#getBoreVector(sx,
|
43
|
+
sy)</code></td><td>Returns the endpoint and direction vector as an array of
|
44
|
+
arrays [point, dir]</td></tr><tr><td><code class="methodname">FXGLViewer#light</code></td><td>Returns a <code class="classname">FXLight</code> instance</td></tr><tr><td><code class="methodname">FXGLViewer#viewport</code></td><td>Returns an <code class="classname">FXViewport</code>
|
45
|
+
instance.</td></tr><tr><td><code class="methodname">FXPrinterDialog#printer</code></td><td>Returns the <code class="classname">FXPrinter</code>
|
46
|
+
instance</td></tr><tr><td><code class="methodname">FXScrollArea#position</code></td><td>Returns the position as an array of integers [x, y]</td></tr><tr><td><code class="methodname">FXSlider#range</code></td><td>Returns a <code class="classname">Range</code> instance.</td></tr><tr><td><code class="methodname">FXSlider#range=(aRange)</code></td><td>Accepts a <code class="classname">Range</code> instance as its
|
47
|
+
input.</td></tr><tr><td><code class="methodname">FXSpinner#range</code></td><td>Returns a <code class="classname">Range</code> instance.</td></tr><tr><td><code class="methodname">FXSpinner#range=(aRange)</code></td><td>Accepts a <code class="classname">Range</code> instance as its
|
48
|
+
input.</td></tr><tr><td><code class="methodname">FXText#appendText(text,
|
49
|
+
notify=false)</code></td><td>Append text to the end of the buffer.</td></tr><tr><td><code class="methodname">FXText#appendStyledText(text, style=0,
|
50
|
+
notify=false)</code></td><td>Append styled text to the end of the buffer.</td></tr><tr><td><code class="methodname">FXText#extractText(pos, n)</code></td><td>Extracts <span class="emphasis"><em>n</em></span> characters from the buffer
|
51
|
+
beginning at position <span class="emphasis"><em>pos</em></span> and returns the
|
52
|
+
result as a String.</td></tr><tr><td><code class="methodname">FXText#extractStyle(pos,
|
53
|
+
n)</code></td><td>Extracts <span class="emphasis"><em>n</em></span> style characters from the
|
54
|
+
buffer beginning at position <span class="emphasis"><em>pos</em></span> and returns
|
55
|
+
the result as a String.</td></tr><tr><td><code class="methodname">FXText#insertText(pos, text,
|
56
|
+
notify=false)</code></td><td>Insert <span class="emphasis"><em>text</em></span> at position
|
57
|
+
<span class="emphasis"><em>pos</em></span> in the buffer.</td></tr><tr><td><code class="methodname">FXText#insertStyledText(pos, text, style=0,
|
58
|
+
notify=false)</code></td><td>Insert <span class="emphasis"><em>text</em></span> at position
|
59
|
+
<span class="emphasis"><em>pos</em></span> in the buffer.</td></tr><tr><td><code class="methodname">FXText#replaceText(pos, m, text,
|
60
|
+
notify=false)</code></td><td>Replace <span class="emphasis"><em>m</em></span> characters at
|
61
|
+
<span class="emphasis"><em>pos</em></span> by <span class="emphasis"><em>text</em></span>.</td></tr><tr><td><code class="methodname">FXText#replaceStyledText(pos, m, text, style=0,
|
62
|
+
notify=false)</code></td><td>Replace <span class="emphasis"><em>m</em></span> characters at
|
63
|
+
<span class="emphasis"><em>pos</em></span> by <span class="emphasis"><em>text</em></span>.</td></tr><tr><td><code class="methodname">FXText#setDelimiters(delimiters)</code></td><td>Change delimiters of words (<span class="emphasis"><em>delimiters</em></span>
|
64
|
+
is a string).</td></tr><tr><td><code class="methodname">FXText#getDelimiters()</code></td><td>Return word delimiters as a string.</td></tr><tr><td><code class="methodname">FXWindow#cursorPosition</code></td><td>Returns an array of integers [x, y, buttons]</td></tr><tr><td><code class="methodname">FXWindow#translateCoordinatesFrom(window, x,
|
65
|
+
y)</code></td><td>Returns the translated coordinates as an array [x,
|
66
|
+
y]</td></tr><tr><td><code class="methodname">FXWindow#translateCoordinatesTo(window, x,
|
67
|
+
y)</code></td><td>Returns the translated coordinates as an array [x,
|
68
|
+
y]</td></tr></tbody></table></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e5166"></a>Iterators</h2></div></div></div><p>Several classes have been extended with an
|
69
|
+
<code class="methodname">each</code> method to provide Ruby-style iterators.
|
70
|
+
These classes include <code class="classname">FXComboBox</code>,
|
71
|
+
<code class="classname">FXGLGroup</code>, <code class="classname">FXHeader</code>,
|
72
|
+
<code class="classname">FXIconList</code>, <code class="classname">FXList</code>,
|
73
|
+
<code class="classname">FXListBox</code>, <code class="classname">FXTreeItem</code>,
|
74
|
+
<code class="classname">FXTreeList</code> and
|
75
|
+
<code class="classname">FXTreeListBox</code>. These classes also mix-in Ruby's
|
76
|
+
<code class="classname">Enumerable</code> module so that you can take full
|
77
|
+
advantage of the iterators.</p><p>The block parameters passed to your code block vary depending on the
|
78
|
+
class. For example, iterating over an <code class="classname">FXList</code>
|
79
|
+
instance yields <code class="classname">FXListItem</code> parameters:</p><pre class="programlisting">aList.each { |aListItem|
|
80
|
+
puts "text for this item = #{aListItem.getText()}"
|
81
|
+
}</pre><p>whereas iterating over an <code class="classname">FXComboBox</code> instance
|
82
|
+
yields two parameters, the item text (a string) and the item data:</p><pre class="programlisting">aComboBox.each { |itemText, itemData|
|
83
|
+
puts "text for this item = #{itemText}"
|
84
|
+
}</pre><p>The following table shows the block parameters for each of these
|
85
|
+
classes' iterators:</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><thead><tr><th align="center">Class</th><th align="center">Block Parameters</th></tr></thead><tbody><tr><td><code class="classname">FXComboBox</code></td><td>the item text (a string) and user data</td></tr><tr><td><code class="classname">FXGLGroup</code></td><td>an <code class="classname">FXGLObject</code> instance</td></tr><tr><td><code class="classname">FXHeader</code></td><td>an <code class="classname">FXHeaderItem</code> instance</td></tr><tr><td><code class="classname">FXIconList</code></td><td>an <code class="classname">FXIconItem</code> instance</td></tr><tr><td><code class="classname">FXList</code></td><td>an <code class="classname">FXListItem</code> instance</td></tr><tr><td><code class="classname">FXListBox</code></td><td>the item text (a string), icon (an
|
86
|
+
<code class="classname">FXIcon</code> instance) and user data</td></tr><tr><td><code class="classname">FXTreeItem</code></td><td>an <code class="classname">FXTreeItem</code> instance</td></tr><tr><td><code class="classname">FXTreeList</code></td><td>an <code class="classname">FXTreeItem</code> instance</td></tr><tr><td><code class="classname">FXTreeListBox</code></td><td>an <code class="classname">FXTreeItem</code> instance</td></tr></tbody></table></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e5310"></a>Attribute Accessors</h2></div></div></div><p>FOX strictly handles access to all object attributes through member
|
87
|
+
functions, e.g. <code class="methodname">setBackgroundColor</code> and
|
88
|
+
<code class="methodname">getBackgroundColor</code> or
|
89
|
+
<code class="methodname">setText</code> and <code class="methodname">getText</code>.
|
90
|
+
FXRuby exposes all of these functions but also provides aliases that look
|
91
|
+
more like regular Ruby attribute accessors. The names for these accessors
|
92
|
+
are based on the FOX method names; for example,
|
93
|
+
<code class="methodname">setBackgroundColor</code> and
|
94
|
+
<code class="methodname">getBackgroundColor</code> are aliased to
|
95
|
+
<code class="methodname">backgroundColor=</code> and
|
96
|
+
<code class="methodname">backgroundColor</code>, respectively.</p><p>In many cases these aliases allow you to write more compact and
|
97
|
+
legible code. For example, consider this code snippet:</p><pre class="programlisting">aLabel.setText(aLabel.getText() + " (modified)")</pre><p>Now consider a different code snippet, using the aliased accessor
|
98
|
+
method names:</p><pre class="programlisting">aLabel.text += " (modified)"</pre><p>While these two are functionally equivalent, the latter is a bit
|
99
|
+
easier to read and understand at first glance.</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e5349"></a>Message Passing</h2></div></div></div><p>FOX message maps are implemented as static C++ class members. With
|
100
|
+
FXRuby, you just associate messages with message handlers in the class
|
101
|
+
<code class="methodname">initialize</code> method using the
|
102
|
+
<code class="methodname">FXMAPFUNC()</code>,
|
103
|
+
<code class="methodname">FXMAPTYPE()</code>,
|
104
|
+
<code class="methodname">FXMAPTYPES()</code> or
|
105
|
+
<code class="methodname">FXMAPFUNCS()</code> methods. See almost any of the
|
106
|
+
example programs for examples of how this is done.</p><p>As in C++ FOX, the last argument passed to your message handler
|
107
|
+
functions contains message-specific data. For instance, all
|
108
|
+
<code class="constant">SEL_PAINT</code> messages pass an
|
109
|
+
<code class="classname">FXEvent</code> object through this argument to give you
|
110
|
+
some information about the size of the exposed rectangle. On the other
|
111
|
+
hand, a <code class="constant">SEL_COMMAND</code> message from an
|
112
|
+
<code class="classname">FXHeader</code> object passes the index of the selected
|
113
|
+
header item through this argument. Instead of guessing what's in this last
|
114
|
+
argument, your best bet is to instead invoke a member function on the
|
115
|
+
sending object to find out what you need, instead of relying on the data
|
116
|
+
passed through this pointer. For example, if you get a
|
117
|
+
<code class="constant">SEL_COMMAND</code> message from an
|
118
|
+
<code class="classname">FXColorWell</code> object, the data passed through that
|
119
|
+
last argument is supposed to be the new RGB color value. Instead of trying
|
120
|
+
to interpret the argument's contents, just turn around and call the color
|
121
|
+
well's <code class="methodname">getRGBA()</code> member function to retrieve its
|
122
|
+
color. Similarly, if you get a <code class="constant">SEL_COMMAND</code> message
|
123
|
+
from a tree list, call its <code class="methodname">getCurrentItem()</code>
|
124
|
+
method to find out which item was selected.</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e5398"></a>Catching Operating System Signals</h2></div></div></div><p>The <code class="methodname">FXApp#addSignal</code> and
|
125
|
+
<code class="methodname">FXApp#removeSignal</code> methods have been enhanced to
|
126
|
+
accept either a string or integer as their first argument. If it's a
|
127
|
+
string (e.g. "SIGINT" or just "INT") the code will determine the
|
128
|
+
corresponding signal number for you (similar to the standard Ruby
|
129
|
+
library's <code class="methodname">Process.kill</code> module method). For
|
130
|
+
examples of how to use this, see the <code class="filename">datatarget.rb</code> or
|
131
|
+
<code class="filename">imageviewer.rb</code> example programs.</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e5418"></a>Support for Multithreaded Applications</h2></div></div></div><p>There is some support for multithreaded FXRuby applications, but
|
132
|
+
it's not wonderful. The current implementation does what is also done in
|
133
|
+
Ruby/GTK; it turns over some idle processing time to the Ruby thread
|
134
|
+
scheduler to let other threads do their thing. As I learn more about
|
135
|
+
Ruby's threading implementation I may try something different, but this
|
136
|
+
seems to work OK for now. For a simple example, see the
|
137
|
+
<code class="filename">groupbox.rb</code> example program, in which the clock label
|
138
|
+
that appears in the lower right-hand corner is continuously updated (by a
|
139
|
+
separate thread).</p><p>If you suspect that FXRuby's threads support is interfering with
|
140
|
+
your application's performance, you may want to try tweaking the amount of
|
141
|
+
time that the main application thread "sleeps" during idle processing; do
|
142
|
+
this by setting the <code class="classname">FXApp</code> object's
|
143
|
+
<em class="structfield"><code>sleepTime</code></em> attribute. The default value for
|
144
|
+
<em class="structfield"><code>FXApp#sleepTime</code></em> is 100 milliseconds. You can
|
145
|
+
also disable the threads support completely by calling
|
146
|
+
<code class="methodname">FXApp#threadsEnabled=false</code> (and subsequently
|
147
|
+
re-enable it with
|
148
|
+
<code class="methodname">FXApp#threadsEnabled=true</code>).</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e5443"></a>Keyword-Style Arguments</h2></div></div></div><p>FXRuby 1.6.5 introduced preliminary, experimental support for using
|
149
|
+
keyword-style arguments in FXRuby method calls. The current implementation
|
150
|
+
of this feature only works for class constructors (i.e. the "new" class
|
151
|
+
methods), but the intent is to gradually extend this feature so that it
|
152
|
+
covers all FXRuby methods.</p><p>What this means in practice is that for calls to methods that have
|
153
|
+
one or more optional arguments, you can replace all of the optional
|
154
|
+
arguments with a hash that sets only the values for which the default
|
155
|
+
isn't appropriate. So, for example, consider a typical call to
|
156
|
+
<code class="methodname">FXMainWindow.new</code>:</p><pre class="programlisting">main = FXMainWindow.new(app, "Title Goes Here", nil, nil, DECOR_ALL, 0, 0, 800, 600)</pre><p>In this case, the programmer wants to set the initial window width
|
157
|
+
and height to 800 and 600. In order to do that (with the current release
|
158
|
+
of FXRuby), however, she's required to fill in all of the optional
|
159
|
+
arguments in between the window title string and the width and height
|
160
|
+
values. As anyone who's worked with FXRuby for any amount of time will
|
161
|
+
tell you, it's easy to accidentally leave out one of those intermediate
|
162
|
+
arguments and it can be difficult to figure out what's wrong
|
163
|
+
afterwards.</p><p>Now consider how this method call could be written using the new
|
164
|
+
keyword arguments support. First, the programmer would need to require the
|
165
|
+
keyword arguments library:</p><pre class="programlisting">require 'fox16/kwargs'</pre><p>Then she would look up the API documentation for the
|
166
|
+
<code class="methodname">FXMainWindow#initialize</code> method (e.g. <a xmlns:xlink="http://www.w3.org/1999/xlink" href="http://www.fxruby.org/doc/api/classes/Fox/FXMainWindow.html" target="_top">here</a>)
|
167
|
+
and see that the names of the width and height arguments are, in fact,
|
168
|
+
"width" and "height". Armed with that information, she would be able to
|
169
|
+
rewrite the previous code as:</p><pre class="programlisting">main = FXMainWindow.new(app, "Title Goes Here", :width => 800, :height => 600)</pre><p>Here, the programmer has omitted the intermediate optional arguments
|
170
|
+
(thus accepting their default values) and specified only the width and
|
171
|
+
height values. This code is obviously a lot more readable and
|
172
|
+
maintainable.</p><p>It is important to observe the difference between required and
|
173
|
+
optional arguments when using this feature. If the API documentation for a
|
174
|
+
particular method doesn't indicate that an argument has a default value,
|
175
|
+
then it is by definition not an optional argument. So one could
|
176
|
+
<span class="emphasis"><em>not</em></span> write the example as, e.g.</p><pre class="programlisting">main = FXMainWindow.new(app, :width => 800, :title => "Title Goes Here", :height => 600)</pre><p>This example is incorrect because the title argument is required,
|
177
|
+
and it must be the second argument in the call. Obviously, this means that
|
178
|
+
the optional arguments in a method call (if they're specified) will always
|
179
|
+
follow all of the required arguments.</p><p>Finally, note that the keyword arguments feature has been
|
180
|
+
implemented so that it's backwards-compatible with the original positional
|
181
|
+
arguments scheme (or it's intended to be, at any rate). What that means is
|
182
|
+
that you can immediately start making use of this feature in your existing
|
183
|
+
code, even if you don't have time to update all of the method calls to use
|
184
|
+
keyword arguments.</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e5484"></a>Debugging Tricks</h2></div></div></div><p>As a debugging tool, you can optionally catch exceptions raised in
|
185
|
+
message handlers. To turn on this feature, call the
|
186
|
+
<code class="methodname">setIgnoreExceptions(true)</code> module method. When
|
187
|
+
this is enabled, any exceptions raised in message handler functions will
|
188
|
+
cause a standard stack trace to be dumped to the standard output, but then
|
189
|
+
your application will, for better or worse, proceed normally. Thanks to
|
190
|
+
Ted Meng for this suggestion.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="scintilla.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="pt02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="library.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Appendix B. Using Scintilla with FXRuby </td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top"> Appendix D. The FXRuby Standard Library</td></tr></table></div></body></html>
|
@@ -0,0 +1,263 @@
|
|
1
|
+
<html><head>
|
2
|
+
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
3
|
+
<title>Chapter 5. Drag and Drop</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook v5 XSL Stylesheets V1.72.0"><link rel="start" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="pt01.html" title="Part I. The Basics"><link rel="prev" href="ch04s04.html" title="Pasting Data from the Clipboard"><link rel="next" href="ch05s02.html" title="Drag Sources"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 5. Drag and Drop</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s04.html">Prev</a> </td><th width="60%" align="center">Part I. The Basics</th><td width="20%" align="right"> <a accesskey="n" href="ch05s02.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="dragdroptut"></a>Chapter 5. Drag and Drop</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="dragdroptut.html#d0e1218">Drop Sites</a></span></dt><dt><span class="section"><a href="ch05s02.html">Drag Sources</a></span></dt><dt><span class="section"><a href="ch05s03.html">Putting It All Together</a></span></dt></dl></div><p>One of the more powerful features available to FOX applications is
|
4
|
+
drag-and-drop. It's also one of the more complicated to understand. For more
|
5
|
+
background, see the standard FOX documentation on <a xmlns:xlink="http://www.w3.org/1999/xlink" href="http://www.fox-toolkit.com/draganddrop.html" target="_top">Drag and
|
6
|
+
Drop</a>.</p><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1218"></a>Drop Sites</h2></div></div></div><p>We're going to start by presenting a skeleton application consisting
|
7
|
+
of a main window widget (a <code class="classname">DropSite</code> instance) that
|
8
|
+
parents an <code class="classname">FXCanvas</code> widget:</p><pre class="programlisting">require 'fox16'
|
9
|
+
|
10
|
+
include Fox
|
11
|
+
|
12
|
+
class DropSite < FXMainWindow
|
13
|
+
def initialize(anApp)
|
14
|
+
# Initialize base class
|
15
|
+
super(anApp, "Drop Site", :opts => DECOR_ALL, :width => 400, :height => 300)
|
16
|
+
|
17
|
+
# Fill main window with canvas
|
18
|
+
@canvas = FXCanvas.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
|
19
|
+
end
|
20
|
+
|
21
|
+
def create
|
22
|
+
# Create the main window and canvas
|
23
|
+
super
|
24
|
+
|
25
|
+
# Show the main window
|
26
|
+
show(PLACEMENT_SCREEN)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
if __FILE__ == $0
|
31
|
+
FXApp.new("DropSite", "FXRuby") do |theApp|
|
32
|
+
DropSite.new(theApp)
|
33
|
+
theApp.create
|
34
|
+
theApp.run
|
35
|
+
end
|
36
|
+
end
|
37
|
+
</pre><p>Since the main program (i.e. the part at the end) won't change for
|
38
|
+
the rest of the tutorial, I won't show that code anymore. Since an
|
39
|
+
<code class="classname">FXCanvas</code> widget relies on some other object (its
|
40
|
+
message target) to draw its contents, we need to handle
|
41
|
+
<code class="constant">SEL_PAINT</code> messages generated by the canvas. We'll do
|
42
|
+
that by adding a handler that clears the canvas to its current background
|
43
|
+
color:</p><pre class="programlisting">require 'fox16'
|
44
|
+
|
45
|
+
include Fox
|
46
|
+
|
47
|
+
class DropSite < FXMainWindow
|
48
|
+
def initialize(anApp)
|
49
|
+
# Initialize base class
|
50
|
+
super(anApp, "Drop Site", :opts => DECOR_ALL, :width => 400, :height => 300)
|
51
|
+
|
52
|
+
# Fill main window with canvas
|
53
|
+
@canvas = FXCanvas.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
|
54
|
+
|
55
|
+
<span class="bold"><strong> # Handle expose events on the canvas
|
56
|
+
@canvas.connect(SEL_PAINT) do |sender, sel, event|
|
57
|
+
FXDCWindow.new(@canvas, event) do |dc|
|
58
|
+
dc.foreground = @canvas.backColor
|
59
|
+
dc.fillRectangle(event.rect.x, event.rect.y, event.rect.w, event.rect.h)
|
60
|
+
end
|
61
|
+
end</strong></span>
|
62
|
+
end
|
63
|
+
|
64
|
+
def create
|
65
|
+
# Create the main window and canvas
|
66
|
+
super
|
67
|
+
|
68
|
+
# Show the main window
|
69
|
+
show(PLACEMENT_SCREEN)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
</pre><p>Run this basic version of the program to be sure that it's working
|
73
|
+
properly so far. You should simply see an empty window with a white
|
74
|
+
background.</p><p>Now, on to the fun stuff. Our goal is to be able to drag color data
|
75
|
+
from some other window, such as an <code class="classname">FXColorWell</code>
|
76
|
+
widget, and drop it onto the canvas in order to change the canvas'
|
77
|
+
background color. In order for a FOX widget to be able to accept drops at
|
78
|
+
all, we need to first call its <code class="methodname">dropEnable</code>
|
79
|
+
method:</p><pre class="programlisting">def initialize(anApp)
|
80
|
+
# Initialize base class
|
81
|
+
super(anApp, "Drop Site", :opts => DECOR_ALL, :width => 400, :height => 300)
|
82
|
+
|
83
|
+
# Fill main window with canvas
|
84
|
+
@canvas = FXCanvas.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
|
85
|
+
|
86
|
+
# Handle expose events on the canvas
|
87
|
+
@canvas.connect(SEL_PAINT) do |sender, sel, event|
|
88
|
+
FXDCWindow.new(@canvas, event) do |dc|
|
89
|
+
dc.foreground = @canvas.backColor
|
90
|
+
dc.fillRectangle(event.rect.x, event.rect.y, event.rect.w, event.rect.h)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
<span class="bold"><strong> # Enable canvas for drag-and-drop messages
|
95
|
+
@canvas.dropEnable
|
96
|
+
</strong></span>end
|
97
|
+
</pre><p>At this point, let's try a little test to see if the program does
|
98
|
+
anything interesting yet. Start by running some other FOX or FXRuby
|
99
|
+
program to use as a drag source for the color data. You should be able to
|
100
|
+
use any program that displays an FXColorWell widget, and this includes the
|
101
|
+
standard color dialog box shown here:</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/colordialog.png" align="middle"></div></div><p>Each of the small colored boxes near the bottom of the color dialog
|
102
|
+
box are color wells, and the large box on the left-hand side of the color
|
103
|
+
dialog box is also a color well. Now start your drag-and-drop test program
|
104
|
+
and try to drag a color from one of these color wells onto this window. At
|
105
|
+
this point, the mouse pointer should turn into a stop sign, indicating
|
106
|
+
that the canvas isn't accepting drops of color data yet.</p><p>To correct this problem, we need to use the canvas'
|
107
|
+
<code class="methodname">acceptDrop</code> method to indicate whether or not
|
108
|
+
we'll accept certain kinds of drops. You can call
|
109
|
+
<code class="methodname">acceptDrop</code> any time after receiving the initial
|
110
|
+
<code class="constant">SEL_DND_ENTER</code> message, but it's usually done in
|
111
|
+
response to a <code class="constant">SEL_DND_MOTION</code> message. Let's add a
|
112
|
+
handler for <code class="constant">SEL_DND_MOTION</code> messages from the canvas
|
113
|
+
in DropSite's <code class="methodname">initialize</code> method. For now, we'll unconditionally accept
|
114
|
+
drops from any drag source, regardless of what kind of data they're
|
115
|
+
offering:</p><pre class="programlisting">def initialize(anApp)
|
116
|
+
# Initialize base class
|
117
|
+
super(anApp, "Drop Site", :opts => DECOR_ALL, :width => 400, :height => 300)
|
118
|
+
|
119
|
+
# Fill main window with canvas
|
120
|
+
@canvas = FXCanvas.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
|
121
|
+
|
122
|
+
# Handle expose events on the canvas
|
123
|
+
@canvas.connect(SEL_PAINT) do |sender, sel, event|
|
124
|
+
FXDCWindow.new(@canvas, event) do |dc|
|
125
|
+
dc.foreground = @canvas.backColor
|
126
|
+
dc.fillRectangle(event.rect.x, event.rect.y, event.rect.w, event.rect.h)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
# Enable canvas for drag-and-drop messages
|
131
|
+
@canvas.dropEnable
|
132
|
+
|
133
|
+
<span class="bold"><strong> # Handle SEL_DND_MOTION messages from the canvas
|
134
|
+
@canvas.connect(SEL_DND_MOTION) do
|
135
|
+
# Accept drops unconditionally (for now)
|
136
|
+
@canvas.acceptDrop
|
137
|
+
end
|
138
|
+
</strong></span>end
|
139
|
+
</pre><p>Now try the previous test again. This time, when you try to drag
|
140
|
+
from a color well to the drop-enabled canvas, you should see the mouse
|
141
|
+
pointer turn into a small filled square. This is a visual cue to the user
|
142
|
+
indicating that the canvas will accept a drop of the drag-and-drop
|
143
|
+
data.</p><p>Now it's time to get more specific about what kind of data is being
|
144
|
+
dragged between these applications, and how to process that data. So far,
|
145
|
+
our drop-enabled canvas merely knows that you're dragging some kind of
|
146
|
+
data from a drag source, but it doesn't know what kind of data it is. We
|
147
|
+
really need to be more exclusive about what kinds of data are acceptable.
|
148
|
+
FOX uses unique drag types to distinguish between different kinds of
|
149
|
+
"draggable" data. As you'll see later, you have the freedom to define drag
|
150
|
+
types for any kind of application-specific data that you need; but for
|
151
|
+
now, we're going to use FOX's built-in drag type for color data.</p><p>Drag types (even the standard ones) must be registered before they
|
152
|
+
can be used, and so we'll start by adding a few lines to
|
153
|
+
<code class="classname">DropSite</code>'s <code class="methodname">create</code> method
|
154
|
+
to register the drag type for color data:</p><pre class="programlisting">def create
|
155
|
+
# Create the main window and canvas
|
156
|
+
super
|
157
|
+
|
158
|
+
<span class="bold"><strong> # Register the drag type for colors
|
159
|
+
FXWindow.colorType = getApp().registerDragType(FXWindow.colorTypeName)
|
160
|
+
|
161
|
+
</strong></span> # Show the main window
|
162
|
+
show(PLACEMENT_SCREEN)
|
163
|
+
end
|
164
|
+
</pre><p>Note that the first time that
|
165
|
+
<code class="methodname">registerDragType</code> is called for a particular
|
166
|
+
drag type name (such as <code class="methodname">FXWindow.colorTypeName</code>)
|
167
|
+
it will generate a unique identifier for that drag type. Subsequent calls
|
168
|
+
to <code class="methodname">registerDragType</code> for the same drag type name
|
169
|
+
will just return the previously-generated drag type. Now, we want to
|
170
|
+
modify our <code class="constant">SEL_DND_MOTION</code> handler so that it's a
|
171
|
+
little more picky about which kinds of drops it will accept:</p><pre class="programlisting"># Handle SEL_DND_MOTION messages from the canvas
|
172
|
+
@canvas.connect(SEL_DND_MOTION) do
|
173
|
+
<span class="bold"><strong> if @canvas.offeredDNDType?(FROM_DRAGNDROP, FXWindow.colorType)
|
174
|
+
@canvas.acceptDrop
|
175
|
+
end
|
176
|
+
</strong></span>end
|
177
|
+
</pre><p>Here, we call the canvas' <code class="methodname">offeredDNDType?</code>
|
178
|
+
method to ask if the drag source can provide its data in the requested
|
179
|
+
format. Only if <code class="methodname">offeredDNDType?</code> returns true will
|
180
|
+
we call <code class="methodname">acceptDrop</code> as before.</p><p>The last step is to actually handle the drop, and for that we add a
|
181
|
+
handler for the <code class="constant">SEL_DND_DROP</code> message:</p><pre class="programlisting"><span class="bold"><strong># Handle SEL_DND_DROP message from the canvas
|
182
|
+
@canvas.connect(SEL_DND_DROP) do
|
183
|
+
# Try to obtain the data as color values first
|
184
|
+
data = @canvas.getDNDData(FROM_DRAGNDROP, FXWindow.colorType)
|
185
|
+
unless data.nil?
|
186
|
+
# Update canvas background color
|
187
|
+
@canvas.backColor = Fox.fxdecodeColorData(data)
|
188
|
+
end
|
189
|
+
end</strong></span></pre><p>Assuming that the drag source is able to provide its data in the
|
190
|
+
requested format, the <code class="methodname">getDNDData</code> method will
|
191
|
+
return a string (which for our purposes is just a byte buffer). If you've
|
192
|
+
defined your own application-specific drag types, this data can of course
|
193
|
+
be anything, and we'll see examples of this in a later tutorial. But the
|
194
|
+
data for standard drag types like
|
195
|
+
<code class="methodname">FXWindow.colorType</code> can be decoded using the
|
196
|
+
appropriate built-in library functions. In this case, we use the
|
197
|
+
<code class="methodname">fxdecodeColorData</code> method to convert the bytes
|
198
|
+
into a color value that we can use.</p><p>Now comes the moment of truth. Try running your test program again
|
199
|
+
(one that displays a color well). Now, when you drag a color from a color
|
200
|
+
well and drop it onto the <code class="classname">DropSite</code> window, the
|
201
|
+
canvas should change its background color accordingly.</p><p>The complete program is listed below, and is included in the
|
202
|
+
<code class="filename">examples</code> directory under the file
|
203
|
+
name <code class="filename">dropsite.rb</code>.</p><pre class="programlisting">require 'fox16'
|
204
|
+
|
205
|
+
include Fox
|
206
|
+
|
207
|
+
class DropSite < FXMainWindow
|
208
|
+
def initialize(anApp)
|
209
|
+
# Initialize base class
|
210
|
+
super(anApp, "Drop Site", :opts => DECOR_ALL, :width => 400, :height => 300)
|
211
|
+
|
212
|
+
# Fill main window with canvas
|
213
|
+
@canvas = FXCanvas.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
|
214
|
+
|
215
|
+
# Handle expose events on the canvas
|
216
|
+
@canvas.connect(SEL_PAINT) do |sender, sel, event|
|
217
|
+
FXDCWindow.new(@canvas, event) do |dc|
|
218
|
+
dc.foreground = @canvas.backColor
|
219
|
+
dc.fillRectangle(event.rect.x, event.rect.y, event.rect.w, event.rect.h)
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
# Enable canvas for drag-and-drop messages
|
224
|
+
@canvas.dropEnable
|
225
|
+
|
226
|
+
# Handle SEL_DND_MOTION messages from the canvas
|
227
|
+
@canvas.connect(SEL_DND_MOTION) do
|
228
|
+
if @canvas.offeredDNDType?(FROM_DRAGNDROP, FXWindow.colorType)
|
229
|
+
@canvas.acceptDrop
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
# Handle SEL_DND_DROP message from the canvas
|
234
|
+
@canvas.connect(SEL_DND_DROP) do
|
235
|
+
# Try to obtain the data as color values first
|
236
|
+
data = @canvas.getDNDData(FROM_DRAGNDROP, FXWindow.colorType)
|
237
|
+
unless data.nil?
|
238
|
+
# Update canvas background color
|
239
|
+
@canvas.backColor = Fox.fxdecodeColorData(data)
|
240
|
+
end
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
def create
|
245
|
+
# Create the main window and canvas
|
246
|
+
super
|
247
|
+
|
248
|
+
# Register the drag type for colors
|
249
|
+
FXWindow.colorType = getApp().registerDragType(FXWindow.colorTypeName)
|
250
|
+
|
251
|
+
# Show the main window
|
252
|
+
show(PLACEMENT_SCREEN)
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
if __FILE__ == $0
|
257
|
+
FXApp.new("DropSite", "FXRuby") do |theApp|
|
258
|
+
DropSite.new(theApp)
|
259
|
+
theApp.create
|
260
|
+
theApp.run
|
261
|
+
end
|
262
|
+
end
|
263
|
+
</pre></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch04s04.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="pt01.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch05s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Pasting Data from the Clipboard </td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top"> Drag Sources</td></tr></table></div></body></html>
|