Please enter the commit message for your changes. Lines starting
with '' will be ignored, and an empty message aborts the commit. On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage) new file: lib/ruby-gtk2-2.0.2/AUTHORS new file: lib/ruby-gtk2-2.0.2/COPYING.LIB new file: lib/ruby-gtk2-2.0.2/NEWS new file: lib/ruby-gtk2-2.0.2/README new file: lib/ruby-gtk2-2.0.2/Rakefile new file: lib/ruby-gtk2-2.0.2/atk/COPYING.LIB new file: lib/ruby-gtk2-2.0.2/atk/README new file: lib/ruby-gtk2-2.0.2/atk/Rakefile new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/atk.def new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/depend new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/extconf.rb new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatk.c new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatk.h new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatkaction.c new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatkcomponent.c new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatkconversions.h new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatkdocument.c new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatkeditabletext.c new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatkgobjectaccessible.c new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatkhyperlink.c new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatkhypertext.c new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatkimage.c new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatkimplementor.c new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatknoopobject.c new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatknoopobjectfactory.c new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatkobject.c new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatkobjectfactory.c new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatkobjectrole.c new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatkprivate.h new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatkregistry.c new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatkrelation.c new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatkrelationset.c new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatkrelationtype.c new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatkselection.c new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatkstate.c new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatkstateset.c new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatkstreamablecontent.c new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatktable.c new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatktext.c new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatktextattribute.c new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatktextrange.c new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatktextrectangle.c new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatkutil.c new file: lib/ruby-gtk2-2.0.2/atk/ext/atk/rbatkvalue.c new file: lib/ruby-gtk2-2.0.2/atk/extconf.rb new file: lib/ruby-gtk2-2.0.2/atk/lib/atk.rb new file: lib/ruby-gtk2-2.0.2/atk/test/atk-test-utils.rb new file: lib/ruby-gtk2-2.0.2/atk/test/run-test.rb new file: lib/ruby-gtk2-2.0.2/atk/test/test-text-rectangle.rb new file: lib/ruby-gtk2-2.0.2/exec_make.rb new file: lib/ruby-gtk2-2.0.2/extconf.rb new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/COPYING.LIB new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/README new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/Rakefile new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/ext/gdk_pixbuf2/depend new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/ext/gdk_pixbuf2/extconf.rb new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/ext/gdk_pixbuf2/gdk_pixbuf2.def new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/ext/gdk_pixbuf2/rbgdk-pixbuf-format.c new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/ext/gdk_pixbuf2/rbgdk-pixbuf-loader.c new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/ext/gdk_pixbuf2/rbgdk-pixbuf.c new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/ext/gdk_pixbuf2/rbgdk-pixbuf.h new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/ext/gdk_pixbuf2/rbgdk-pixbuf2conversions.h new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/ext/gdk_pixbuf2/rbgdk-pixbuf2private.h new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/ext/gdk_pixbuf2/rbgdk-pixbufanimation.c new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/ext/gdk_pixbuf2/rbgdk-pixbufanimationiter.c new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/ext/gdk_pixbuf2/rbgdk-pixbufsimpleanim.c new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/ext/gdk_pixbuf2/rbgdk-pixdata.c new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/extconf.rb new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/lib/gdk_pixbuf2.rb new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/sample/anim.rb new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/sample/composite.rb new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/sample/flip.rb new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/sample/floppybuddy.gif new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/sample/format.rb new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/sample/gnome-foot.png new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/sample/inline.rb new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/sample/loader.rb new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/sample/pixdata.rb new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/sample/rotate.rb new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/sample/save.rb new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/sample/scale.rb new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/sample/simpleanim.rb new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/sample/utils.rb new file: lib/ruby-gtk2-2.0.2/gdk_pixbuf2/sample/xpm.rb new file: lib/ruby-gtk2-2.0.2/gio2/README new file: lib/ruby-gtk2-2.0.2/gio2/Rakefile new file: lib/ruby-gtk2-2.0.2/gio2/TODO new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/depend new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/extconf.rb new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/gio2.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/gio2.def new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/gio2.h new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgio.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgio2.h new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgio2conversions.h new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgio2private.h new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgioappinfo.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgioapplaunchcontext.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgioasyncinitable.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgioasyncresult.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiobufferedinputstream.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiobufferedoutputstream.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiocancellable.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiocharsetconverter.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiocontenttype.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgioconverter.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgioconverterinputstream.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgioconverteroutputstream.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiodatainputstream.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiodataoutputstream.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiodesktopappinfo.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiodrive.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgioemblem.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgioemblemedicon.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiofile.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiofileattribute.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiofileattributeinfo.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiofileattributeinfolist.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiofileattributematcher.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiofiledescriptorbased.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiofileenumerator.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiofileicon.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiofileinfo.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiofileinputstream.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiofileiostream.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiofilemonitor.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiofilenamecompleter.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiofileoutputstream.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiofilterinputstream.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiofilteroutputstream.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgioicon.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgioinetaddress.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgioinetsocketaddress.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgioinitable.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgioinputstream.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgioio.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgioiomodule.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgioiomodules.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgioioscheduler.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgioioschedulerjob.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgioiostream.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgioloadableicon.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiomemoryinputstream.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiomemoryoutputstream.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiomount.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiomountoperation.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgionetworkaddress.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgionetworkservice.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiooutputstream.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgioresolver.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgioseekable.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiosimpleasyncresult.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiosocket.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiosocketaddress.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiosocketaddressenumerator.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiosocketclient.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiosocketconnectable.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiosocketconnection.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiosocketconnectionfactory.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiosocketcontrolmessage.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiosocketlistener.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiosocketservice.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiosrvtarget.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiotcpconnection.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiothemedicon.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiothreadedsocketservice.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiotlscertificate.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiounixconnection.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiounixfdlist.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiounixfdmessage.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiounixinputstream.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiounixmount.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiounixmountmonitor.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiounixmountpoint.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiounixmountpoints.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiounixmounts.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiounixoutputstream.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiounixsocketaddress.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiovfs.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiovolume.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiovolumemonitor.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiozlibcompressor.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/rbgiozlibdecompressor.c new file: lib/ruby-gtk2-2.0.2/gio2/ext/gio2/util.c new file: lib/ruby-gtk2-2.0.2/gio2/extconf.rb new file: lib/ruby-gtk2-2.0.2/gio2/lib/gio2.rb new file: lib/ruby-gtk2-2.0.2/gio2/lib/gio2/deprecated.rb new file: lib/ruby-gtk2-2.0.2/gio2/test/load-test.rb new file: lib/ruby-gtk2-2.0.2/gio2/test/test_bufferedinputstream.rb new file: lib/ruby-gtk2-2.0.2/gio2/test/test_charsetconverter.rb new file: lib/ruby-gtk2-2.0.2/gio2/test/test_datainputstream.rb new file: lib/ruby-gtk2-2.0.2/gio2/test/test_fileenumerator.rb new file: lib/ruby-gtk2-2.0.2/gio2/test/test_filemonitor.rb new file: lib/ruby-gtk2-2.0.2/gio2/test/test_inetaddress.rb new file: lib/ruby-gtk2-2.0.2/glib2/COPYING.LIB new file: lib/ruby-gtk2-2.0.2/glib2/README new file: lib/ruby-gtk2-2.0.2/glib2/Rakefile new file: lib/ruby-gtk2-2.0.2/glib2/TODO new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/depend new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/extconf.rb new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/glib2.def new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbgcompat.h new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglib.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglib.h new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglib2conversions.h new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglib_bookmarkfile.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglib_convert.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglib_error.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglib_fileutils.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglib_i18n.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglib_int64.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglib_io_constants.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglib_iochannel.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglib_iochannel_win32_socket.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglib_iochannelerror.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglib_keyfile.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglib_maincontext.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglib_mainloop.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglib_messages.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglib_pollfd.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglib_shell.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglib_shellerror.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglib_source.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglib_spawn.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglib_spawnerror.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglib_threads.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglib_timer.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglib_ucs4.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglib_unichar.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglib_unicode.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglib_utf16.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglib_utf8.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglib_utils.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglib_win32.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglibdeprecated.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbglibdeprecated.h new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbgobj_boxed.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbgobj_closure.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbgobj_convert.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbgobj_enumflags.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbgobj_enums.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbgobj_flags.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbgobj_object.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbgobj_param.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbgobj_paramspecs.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbgobj_signal.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbgobj_strv.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbgobj_type.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbgobj_typeinstance.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbgobj_typeinterface.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbgobj_typemodule.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbgobj_typeplugin.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbgobj_value.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbgobj_valuearray.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbgobj_valuetypes.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbgobject.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbgobject.h new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbgprivate.h new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbgutil.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbgutil.h new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbgutil_callback.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbgutil_list.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbgutil_list.h new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbgutildeprecated.c new file: lib/ruby-gtk2-2.0.2/glib2/ext/glib2/rbgutildeprecated.h new file: lib/ruby-gtk2-2.0.2/glib2/extconf.rb new file: lib/ruby-gtk2-2.0.2/glib2/lib/glib-mkenums.rb new file: lib/ruby-gtk2-2.0.2/glib2/lib/glib2.rb new file: lib/ruby-gtk2-2.0.2/glib2/lib/glib2/deprecatable.rb new file: lib/ruby-gtk2-2.0.2/glib2/lib/gnome2-raketask.rb new file: lib/ruby-gtk2-2.0.2/glib2/lib/gnome2/rake/external-package.rb new file: lib/ruby-gtk2-2.0.2/glib2/lib/gnome2/rake/native-binary-build-task.rb new file: lib/ruby-gtk2-2.0.2/glib2/lib/gnome2/rake/package-task.rb new file: lib/ruby-gtk2-2.0.2/glib2/lib/gnome2/rake/package.rb new file: lib/ruby-gtk2-2.0.2/glib2/lib/gnome2/rake/source-download-task.rb new file: lib/ruby-gtk2-2.0.2/glib2/lib/gnome2/rake/win32-binary-build-task.rb new file: lib/ruby-gtk2-2.0.2/glib2/lib/gnome2/rake/win32-binary-download-task.rb new file: lib/ruby-gtk2-2.0.2/glib2/lib/mkmf-gnome2.rb new file: lib/ruby-gtk2-2.0.2/glib2/sample/bookmarkfile.rb new file: lib/ruby-gtk2-2.0.2/glib2/sample/idle.rb new file: lib/ruby-gtk2-2.0.2/glib2/sample/iochannel.rb new file: lib/ruby-gtk2-2.0.2/glib2/sample/keyfile.rb new file: lib/ruby-gtk2-2.0.2/glib2/sample/shell.rb new file: lib/ruby-gtk2-2.0.2/glib2/sample/spawn.rb new file: lib/ruby-gtk2-2.0.2/glib2/sample/timeout.rb new file: lib/ruby-gtk2-2.0.2/glib2/sample/timeout2.rb new file: lib/ruby-gtk2-2.0.2/glib2/sample/timer.rb new file: lib/ruby-gtk2-2.0.2/glib2/sample/type-register.rb new file: lib/ruby-gtk2-2.0.2/glib2/sample/type-register2.rb new file: lib/ruby-gtk2-2.0.2/glib2/sample/utils.rb new file: lib/ruby-gtk2-2.0.2/glib2/test/glib-test-init.rb new file: lib/ruby-gtk2-2.0.2/glib2/test/glib-test-utils.rb new file: lib/ruby-gtk2-2.0.2/glib2/test/run-test.rb new file: lib/ruby-gtk2-2.0.2/glib2/test/test_enum.rb new file: lib/ruby-gtk2-2.0.2/glib2/test/test_file_utils.rb new file: lib/ruby-gtk2-2.0.2/glib2/test/test_flags.rb new file: lib/ruby-gtk2-2.0.2/glib2/test/test_glib2.rb new file: lib/ruby-gtk2-2.0.2/glib2/test/test_iochannel.rb new file: lib/ruby-gtk2-2.0.2/glib2/test/test_key_file.rb new file: lib/ruby-gtk2-2.0.2/glib2/test/test_mkenums.rb new file: lib/ruby-gtk2-2.0.2/glib2/test/test_poll_fd.rb new file: lib/ruby-gtk2-2.0.2/glib2/test/test_signal.rb new file: lib/ruby-gtk2-2.0.2/glib2/test/test_source.rb new file: lib/ruby-gtk2-2.0.2/glib2/test/test_spawn.rb new file: lib/ruby-gtk2-2.0.2/glib2/test/test_timeout.rb new file: lib/ruby-gtk2-2.0.2/glib2/test/test_unicode.rb new file: lib/ruby-gtk2-2.0.2/glib2/test/test_utils.rb new file: lib/ruby-gtk2-2.0.2/glib2/test/test_value.rb new file: lib/ruby-gtk2-2.0.2/glib2/test/test_win32.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/COPYING.LIB new file: lib/ruby-gtk2-2.0.2/gobject-introspection/README.md new file: lib/ruby-gtk2-2.0.2/gobject-introspection/Rakefile new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/depend new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/extconf.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/gobject_introspection.def new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/rb-gi-arg-info.c new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/rb-gi-argument.c new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/rb-gi-base-info.c new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/rb-gi-boxed-info.c new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/rb-gi-callable-info.c new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/rb-gi-callback-info.c new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/rb-gi-constant-info.c new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/rb-gi-constructor-info.c new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/rb-gi-conversions.h new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/rb-gi-enum-info.c new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/rb-gi-field-info.c new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/rb-gi-flags-info.c new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/rb-gi-function-info.c new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/rb-gi-interface-info.c new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/rb-gi-loader.c new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/rb-gi-method-info.c new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/rb-gi-object-info.c new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/rb-gi-private.h new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/rb-gi-property-info.c new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/rb-gi-registered-type-info.c new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/rb-gi-repository.c new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/rb-gi-signal-info.c new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/rb-gi-struct-info.c new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/rb-gi-type-info.c new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/rb-gi-type-tag.c new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/rb-gi-types.h new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/rb-gi-union-info.c new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/rb-gi-unresolved-info.c new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/rb-gi-value-info.c new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/rb-gi-vfunc-info.c new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/rb-gobject-introspection.c new file: lib/ruby-gtk2-2.0.2/gobject-introspection/ext/gobject-introspection/rb-gobject-introspection.h new file: lib/ruby-gtk2-2.0.2/gobject-introspection/extconf.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/lib/gobject-introspection.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/lib/gobject-introspection/boxed-info.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/lib/gobject-introspection/callable-info.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/lib/gobject-introspection/collection-reader.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/lib/gobject-introspection/interface-info.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/lib/gobject-introspection/loader.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/lib/gobject-introspection/object-info.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/lib/gobject-introspection/repository.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/lib/gobject-introspection/struct-info.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/lib/gobject-introspection/union-info.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/patches/0001-Support-external-g-ir-scanner.patch new file: lib/ruby-gtk2-2.0.2/gobject-introspection/patches/cross-g-ir-scanner.diff new file: lib/ruby-gtk2-2.0.2/gobject-introspection/test/gobject-introspection-test-utils.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/test/run-test.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/test/test-arg-info.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/test/test-base-info.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/test/test-boxed-info.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/test/test-callable-info.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/test/test-callback-info.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/test/test-constant-info.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/test/test-enum-info.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/test/test-field-type.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/test/test-flags-info.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/test/test-function-info.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/test/test-interface-info.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/test/test-loader.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/test/test-object-info.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/test/test-property-info.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/test/test-registered-type-info.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/test/test-repository.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/test/test-signal-info.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/test/test-struct-info.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/test/test-type-info.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/test/test-type-tag.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/test/test-union-info.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/test/test-value-info.rb new file: lib/ruby-gtk2-2.0.2/gobject-introspection/test/test-vfunc-info.rb new file: lib/ruby-gtk2-2.0.2/gtk2/COPYING.LIB new file: lib/ruby-gtk2-2.0.2/gtk2/README new file: lib/ruby-gtk2-2.0.2/gtk2/Rakefile new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/depend new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/extconf.rb new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/global.h new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/gtk2.def new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/init.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdk.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdk.h new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkatom.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkcairo.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkcolor.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkcolormap.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkconst.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkconversions.h new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkcursor.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkdevice.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkdisplay.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkdisplaymanager.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkdragcontext.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkdraw.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkevent.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkgc.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkgeometry.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkimage.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkinput.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkkeymap.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkkeyval.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkpango.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkpangorenderer.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkpixbuf.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkpixmap.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkproperty.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkrectangle.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkregion.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkrgb.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkscreen.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkselection.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkthreads.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdktimecoord.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkvisual.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkwindow.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkwindowattr.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkx11.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtk.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtk.h new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkaboutdialog.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkaccelerator.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkaccelgroup.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkaccelgroupentry.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkaccelkey.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkaccellabel.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkaccelmap.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkaccessible.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkaction.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkactiongroup.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkadjustment.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkalignment.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkallocation.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkarrow.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkaspectframe.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkassistant.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkbbox.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkbin.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkbindingset.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkborder.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkbox.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkbuildable.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkbuilder.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkbutton.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcalendar.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcelleditable.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcelllayout.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcellrenderer.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcellrendereraccel.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcellrenderercombo.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcellrendererpixbuf.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcellrendererprogress.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcellrendererspin.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcellrendererspinner.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcellrenderertext.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcellrenderertoggle.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcellview.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcheckbutton.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcheckmenuitem.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkclipboard.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcolorbutton.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcolorsel.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcolorselectiondialog.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcombo.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcombobox.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcomboboxentry.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkconst.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcontainer.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkconversions.h new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcurve.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkdialog.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkdrag.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkdrawingarea.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkeditable.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkentry.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkentrycompletion.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkeventbox.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkexpander.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkfilechooser.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkfilechooserbutton.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkfilechooserdialog.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkfilechooserwidget.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkfilefilter.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkfilesel.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkfilesystemerror.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkfixed.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkfontbutton.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkfontselection.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkfontselectiondialog.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkframe.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkgamma.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkhandlebox.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkhbbox.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkhbox.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkhpaned.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkhruler.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkhscale.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkhscrollbar.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkhseparator.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkiconfactory.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkiconinfo.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkiconset.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkiconsize.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkiconsource.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkicontheme.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkiconview.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkimage.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkimagemenuitem.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkimcontext.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkimcontextsimple.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkimmulticontext.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkinfobar.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkinputdialog.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkinvisible.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkitem.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkitemfactory.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtklabel.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtklayout.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtklinkbutton.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkliststore.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkmacros.h new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkmenu.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkmenubar.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkmenuitem.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkmenushell.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkmenutoolbutton.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkmessagedialog.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkmisc.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtknotebook.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkobject.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkoptionmenu.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkpagesetup.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkpagesetupunixdialog.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkpaned.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkpapersize.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkplug.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkprintcontext.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkprinter.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkprintjob.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkprintoperation.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkprintoperationpreview.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkprintsettings.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkprintunixdialog.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkprogress.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkprogressbar.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkradioaction.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkradiobutton.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkradiomenuitem.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkradiotoolbutton.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkrange.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkrc.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkrcstyle.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkrecentaction.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkrecentchooser.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkrecentchooserdialog.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkrecentchoosermenu.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkrecentchooserwidget.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkrecentdata.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkrecentfilter.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkrecentfilterinfo.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkrecentinfo.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkrecentmanager.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkruler.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkscale.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkscalebutton.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkscrollbar.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkscrolledwindow.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkselection.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkselectiondata.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkseparator.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkseparatormenuitem.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkseparatortoolitem.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtksettings.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtksizegroup.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtksocket.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkspinbutton.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkspinner.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkstatusbar.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkstatusicon.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkstock.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkstyle.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktable.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktargetlist.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktearoffmenuitem.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktextappearance.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktextattributes.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktextbuffer.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktextchild.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktextiter.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktextmark.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktexttag.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktexttagtable.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktextview.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktoggleaction.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktogglebutton.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktoggletoolbutton.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktoolbar.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktoolbutton.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktoolitem.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktooltip.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktooltips.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktreedragdest.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktreedragsource.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktreeiter.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktreemodel.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktreemodelfilter.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktreemodelsort.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktreepath.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktreerowreference.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktreeselection.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktreesortable.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktreestore.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktreeview.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtktreeviewcolumn.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkuimanager.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkvbbox.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkvbox.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkviewport.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkvolumebutton.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkvpaned.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkvruler.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkvscale.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkvscrollbar.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkvseparator.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkwidget.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkwindow.c new file: lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkwindowgroup.c new file: lib/ruby-gtk2-2.0.2/gtk2/extconf.rb new file: lib/ruby-gtk2-2.0.2/gtk2/lib/gtk2.rb new file: lib/ruby-gtk2-2.0.2/gtk2/lib/gtk2/base.rb new file: lib/ruby-gtk2-2.0.2/gtk2/patches/gtk+-2.24.14-add-missing-exeext.diff new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/README new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/alphatest.png new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/apple-red.png new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/appwindow.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/background.jpg new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/builder.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/button_box.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/cairo-arc-negative.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/cairo-arc.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/cairo-clip-image.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/cairo-clip-rectangle.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/cairo-clip.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/cairo-curve-rectangle.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/cairo-curve-to.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/cairo-dash.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/cairo-fill-and-stroke.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/cairo-fill-and-stroke2.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/cairo-gradient.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/cairo-image-pattern.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/cairo-image.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/cairo-line-cap.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/cairo-line-join.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/cairo-long-lines.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/cairo-operator.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/cairo-path.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/cairo-pattern-fill.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/cairo-self-intersect.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/cairo-text-align-center.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/cairo-text-extents.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/cairo-text.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/changedisplay.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/clipboard.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/colorsel.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/common.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/demo.ui new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/dialog.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/drawingarea.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/editable_cells.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/entry_completion.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/expander.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/floppybuddy.gif new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/gnome-applets.png new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/gnome-calendar.png new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/gnome-foot.png new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/gnome-fs-directory.png new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/gnome-fs-regular.png new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/gnome-gimp.png new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/gnome-gmush.png new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/gnome-gsame.png new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/gnu-keys.png new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/gtk-logo-rgb.gif new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/hypertext.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/iconview.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/images.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/item_factory.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/list_store.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/main.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/menus.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/panes.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/pixbufs.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/printing.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/rotated_text.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/ruby-gnome2-logo.png new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/sizegroup.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/stock_browser.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/textview.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/gtk-demo/tree_store.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/aboutdialog.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/aboutdialog2.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/alpha-demo.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/assistant.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/bindings.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/button.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/button2.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/buttonbox.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/cairo-pong.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/calendar.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/checkbutton.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/colorselection.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/combo_check.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/combobox.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/composited-windows.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/cursor.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/dialog.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/dialog2.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/dnd.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/dndtreeview.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/drag-move.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/drawing.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/entry.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/entrycompletion.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/expander.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/filechooser.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/fileselection.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/frame.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/gc.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/gdkscreen.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/gnome-logo-icon.png new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/helloworld.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/iconview.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/image.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/infobar.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/itemfactory.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/itemfactory2.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/keyboard_grab.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/label.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/linkbutton.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/listview.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/menu.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/misc_button.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/mouse-gesture.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/pangorenderer.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/pointer_grab.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/print.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/properties.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/radiobutton.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/recentchooserdialog.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/rgtk+cairo.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/scalebutton.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/settings.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/statusicon.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/stock.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/style_property.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/style_property.rc new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/t-gtkplug.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/t-gtksocket.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/test.xpm new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/textbuffer_serialize.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/threads.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/to_drawable.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/togglebutton.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/toolbar.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/tooltips.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/tree_combo.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/tree_progress.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/treemodelfilter.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/treeview.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/uimanager.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/uimanager2.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/uimanager2.xml new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/window.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/misc/xbm_cursor.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/3DRings.xpm new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/FilesQueue.xpm new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/Modeller.xpm new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/README new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/button.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/buttonbox.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/check-n.xpm new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/check-y.xpm new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/checkbutton.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/circles.xbm new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/colorselect.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/dialog.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/entry.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/filesel.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/fontselection.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/gammacurve.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/labels.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/layout.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/marble.xpm new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/menu.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/notebook.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/pixmap.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/progressbar.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/radiobutton.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/range.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/reparent.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/rulers.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/sample.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/savedposition.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/scrolledwindow.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/shapedwindow.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/spinbutton.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/statusbar.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/test.xpm new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/testgtk.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/testgtkrc new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/testgtkrc2 new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/togglebutton.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/toolbar.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/tooltips.rb new file: lib/ruby-gtk2-2.0.2/gtk2/sample/testgtk/wmhints.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/gtk-test-utils.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/run-test.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/test_gc.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/test_gdk.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/test_gdk_color.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/test_gdk_display.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/test_gdk_event.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/test_gdk_gc.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/test_gdk_geometry.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/test_gdk_keymap.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/test_gdk_pango.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/test_gdk_rectangle.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/test_gdk_selection_data.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/test_gdk_window.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/test_gdk_window_attribute.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/test_gtk_about_dialog.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/test_gtk_accel_group_entry.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/test_gtk_accel_key.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/test_gtk_allocation.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/test_gtk_border.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/test_gtk_buildable.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/test_gtk_builder.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/test_gtk_entry.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/test_gtk_icon_theme.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/test_gtk_image.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/test_gtk_list_store.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/test_gtk_menu_item.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/test_gtk_rc_style.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/test_gtk_recent_data.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/test_gtk_recent_filter_info.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/test_gtk_tree_path.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/test_gtk_unix_print.rb new file: lib/ruby-gtk2-2.0.2/gtk2/test/test_gtk_widget.rb new file: lib/ruby-gtk2-2.0.2/pango/COPYING.LIB new file: lib/ruby-gtk2-2.0.2/pango/README new file: lib/ruby-gtk2-2.0.2/pango/Rakefile new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/depend new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/extconf.rb new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/pango.def new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpango.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpango.h new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangoanalysis.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangoattribute.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangoattriterator.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangoattrlist.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangocairo.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangocairocontext.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangocolor.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangocontext.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangoconversions.h new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangocoverage.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangoengine.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangofont.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangofontdescription.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangofontface.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangofontfamily.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangofontmap.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangofontmetrics.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangofontset.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangofontsetsimple.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangoglyphinfo.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangoglyphitem.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangoglyphstring.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangogravity.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangoitem.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangolanguage.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangolayout.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangolayoutiter.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangolayoutline.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangologattr.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangomatrix.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangoprivate.h new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangorectangle.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangorenderer.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangoscript.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangoscriptiter.c new file: lib/ruby-gtk2-2.0.2/pango/ext/pango/rbpangotabarray.c new file: lib/ruby-gtk2-2.0.2/pango/extconf.rb new file: lib/ruby-gtk2-2.0.2/pango/lib/pango.rb new file: lib/ruby-gtk2-2.0.2/pango/patches/harfbuzz-0.9.17-disable-uniscribe.diff new file: lib/ruby-gtk2-2.0.2/pango/patches/pango-1.34.0-enable-fc-font.diff new file: lib/ruby-gtk2-2.0.2/pango/sample/attribute.rb new file: lib/ruby-gtk2-2.0.2/pango/sample/break.rb new file: lib/ruby-gtk2-2.0.2/pango/sample/gdk_layout.rb new file: lib/ruby-gtk2-2.0.2/pango/sample/glyphstring.rb new file: lib/ruby-gtk2-2.0.2/pango/sample/item.rb new file: lib/ruby-gtk2-2.0.2/pango/sample/label.rb new file: lib/ruby-gtk2-2.0.2/pango/sample/layout.rb new file: lib/ruby-gtk2-2.0.2/pango/sample/pango_cairo.rb new file: lib/ruby-gtk2-2.0.2/pango/sample/parse.rb new file: lib/ruby-gtk2-2.0.2/pango/sample/sample.txt new file: lib/ruby-gtk2-2.0.2/pango/sample/script.rb new file: lib/ruby-gtk2-2.0.2/pango/test/pango-test-utils.rb new file: lib/ruby-gtk2-2.0.2/pango/test/run-test.rb new file: lib/ruby-gtk2-2.0.2/pango/test/test-analysis.rb new file: lib/ruby-gtk2-2.0.2/pango/test/test-attribute.rb new file: lib/ruby-gtk2-2.0.2/pango/test/test-color.rb new file: lib/ruby-gtk2-2.0.2/pango/test/test-language.rb new file: lib/ruby-gtk2-2.0.2/pango/test/test-log-attr.rb new file: lib/ruby-gtk2-2.0.2/pango/test/test-matrix.rb new file: lib/ruby-gtk2-2.0.2/pango/test/test-rectangle.rb new file: lib/ruby-gtk2-2.0.2/pango/test/test_layout.rb new file: lib/ruby-gtk2-2.0.2/run-test.rb
This commit is contained in:
42
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/aboutdialog.rb
Normal file
42
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/aboutdialog.rb
Normal file
@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
aboutdialog.rb - Ruby/GTK sample script.
|
||||
|
||||
Copyright (c) 2005,2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: aboutdialog.rb,v 1.2 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
require 'gtk2'
|
||||
|
||||
if str = Gtk.check_version(2, 6, 0)
|
||||
puts "This sample requires GTK+ 2.6.0 or later"
|
||||
puts str
|
||||
exit
|
||||
end
|
||||
|
||||
Gtk::AboutDialog.set_email_hook {|about, link|
|
||||
p "email_hook"
|
||||
p link
|
||||
}
|
||||
Gtk::AboutDialog.set_url_hook {|about, link|
|
||||
p "url_hook"
|
||||
p link
|
||||
}
|
||||
|
||||
a = Gtk::AboutDialog.new
|
||||
a.artists = ["Artist 1 <no1@foo.bar.com>", "Artist 2 <no2@foo.bar.com>"]
|
||||
a.authors = ["Author 1 <no1@foo.bar.com>", "Author 2 <no2@foo.bar.com>"]
|
||||
a.comments = "This is a sample script for Gtk::AboutDialog"
|
||||
a.copyright = "Copyright (C) 2005 Ruby-GNOME2 Project"
|
||||
a.documenters = ["Documenter 1 <no1@foo.bar.com>", "Documenter 2 <no2@foo.bar.com>"]
|
||||
a.license = "This program is licenced under the same licence as Ruby-GNOME2."
|
||||
a.logo = Gdk::Pixbuf.new("gnome-logo-icon.png")
|
||||
a.program_name = "Gtk::AboutDialog sample"
|
||||
a.translator_credits = "Translator 1\nTranslator 2\n"
|
||||
a.version = "1.0.0"
|
||||
a.website = "http://ruby-gnome2.sourceforge.jp"
|
||||
a.website_label = "Ruby-GNOME2 Project Website"
|
||||
|
||||
p a.run
|
||||
|
42
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/aboutdialog2.rb
Normal file
42
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/aboutdialog2.rb
Normal file
@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
aboutdialog2.rb - Ruby/GTK sample script.
|
||||
|
||||
Copyright (c) 2005,2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: aboutdialog2.rb,v 1.2 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
require 'gtk2'
|
||||
|
||||
if str = Gtk.check_version(2, 6, 0)
|
||||
puts "This sample requires GTK+ 2.6.0 or later"
|
||||
puts str
|
||||
exit
|
||||
end
|
||||
|
||||
Gtk::AboutDialog.set_email_hook {|about, link|
|
||||
p "email_hook"
|
||||
p link
|
||||
}
|
||||
Gtk::AboutDialog.set_url_hook {|about, link|
|
||||
p "url_hook"
|
||||
p link
|
||||
}
|
||||
|
||||
Gtk::AboutDialog.show(nil,
|
||||
"artists" => ["Artist 1 <no1@foo.bar.com>", "Artist 2 <no2@foo.bar.com>"],
|
||||
"authors" => ["Author 1 <no1@foo.bar.com>", "Author 2 <no2@foo.bar.com>"],
|
||||
"comments" => "This is a sample script for Gtk::AboutDialog",
|
||||
"copyright" => "Copyright (C) 2005 Ruby-GNOME2 Project",
|
||||
"documenters" => ["Documenter 1 <no1@foo.bar.com>", "Documenter 2 <no2@foo.bar.com>"],
|
||||
"license" => "This program is licenced under the same licence as Ruby-GNOME2.",
|
||||
"logo_icon_name" => "gtk-home",
|
||||
"program_name" => "Gtk::AboutDialog sample",
|
||||
"translator_credits" => "Translator 1 <no1@foo.bar.com>\nTranslator 2 <no2@foo.bar.com>\n",
|
||||
"version" => "1.0.0",
|
||||
"website" => "http://ruby-gnome2.sourceforge.jp",
|
||||
"website_label" => "Ruby-GNOME2 Project Website"
|
||||
)
|
||||
|
||||
Gtk.main
|
70
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/alpha-demo.rb
Executable file
70
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/alpha-demo.rb
Executable file
@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
alpha-demo.rb - alpha blended window sample script. (need xcompmgr)
|
||||
|
||||
Original: alphademo.py by Mike Hearn (*1) and David Trowbridge (*2)
|
||||
* (1) http://plan99.net/~mike/blog/2006/06/05/alpha-blended-windows-in-python/
|
||||
* (2) http://david.navi.cx/blog/?p=91
|
||||
|
||||
Translated to Ruby by Juergen Mangler <juergen.mangler@univie.ac.at>
|
||||
|
||||
Copyright (c) 2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: alpha-demo.rb,v 1.1 2007/01/06 03:55:44 ktou Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
require 'cairo'
|
||||
|
||||
class AlphaDemo < Gtk::Window
|
||||
|
||||
def initialize()
|
||||
super()
|
||||
|
||||
set_app_paintable(true)
|
||||
set_title("AlphaDemo")
|
||||
set_decorated(false)
|
||||
set_default_size(200, 220)
|
||||
signal_connect("delete_event") do
|
||||
Gtk.main_quit
|
||||
end
|
||||
set_double_buffered(false)
|
||||
|
||||
signal_connect('expose-event') do |widget, event|
|
||||
cr = widget.window.create_cairo_context
|
||||
|
||||
rgba = [1.0, 1.0, 1.0]
|
||||
rgba << 0.0 if @supports_alpha
|
||||
cr.set_source_rgba(rgba)
|
||||
cr.set_operator(Cairo::OPERATOR_SOURCE)
|
||||
cr.paint
|
||||
|
||||
twidth, theight = widget.size
|
||||
|
||||
cr.set_source_rgba(1.0, 0.2, 0.2, 0.6)
|
||||
radius = [twidth, theight].min.to_f / 2 - 0.8
|
||||
|
||||
cr.arc(twidth.to_f / 2, theight.to_f / 2, radius, 0, 2.0 * Math::PI)
|
||||
cr.fill_preserve
|
||||
cr.stroke
|
||||
end
|
||||
signal_connect('screen-changed') do |widget, old_screen|
|
||||
screen_changed(widget, old_screen)
|
||||
end
|
||||
|
||||
screen_changed(self)
|
||||
end
|
||||
|
||||
def screen_changed(widget,old_screen=nil)
|
||||
tcolormap = widget.screen.rgba_colormap
|
||||
@supports_alpha = !tcolormap.nil?
|
||||
tcolormap ||= widget.screen.rgb_colormap
|
||||
widget.set_colormap(tcolormap)
|
||||
end
|
||||
end
|
||||
|
||||
alpha = AlphaDemo.new
|
||||
alpha.show
|
||||
|
||||
Gtk.main()
|
347
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/assistant.rb
Executable file
347
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/assistant.rb
Executable file
@ -0,0 +1,347 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
test-assistant.rb - Ruby/GTK version of testassistant.c from gtk+ 2.10 sources.
|
||||
|
||||
Guillaume Cottenceau for the ruby-gnome2 project.
|
||||
|
||||
Copyright (c) 2005,2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: assistant.rb,v 1.1 2006/11/23 08:39:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
if str = Gtk.check_version(2, 10, 0)
|
||||
puts "This sample requires GTK+ 2.10.0 or later"
|
||||
puts str
|
||||
exit
|
||||
end
|
||||
|
||||
class AssistantRunner
|
||||
def initialize
|
||||
@simple_assistant = nil
|
||||
@generous_assistant = nil
|
||||
@selected_branch = "A"
|
||||
@nonlinear_assistant = nil
|
||||
@full_featured_assistant = nil
|
||||
end
|
||||
|
||||
def run_simple_assistant
|
||||
@simple_assistant = run_assistant(@simple_assistant,
|
||||
:create_simple_assistant)
|
||||
end
|
||||
|
||||
def run_generous_assistant
|
||||
@generous_assistant = run_assistant(@generous_assistant,
|
||||
:create_generous_assistant)
|
||||
end
|
||||
|
||||
def run_nonlinear_assistant
|
||||
@nonlinear_assistant = run_assistant(@nonlinear_assistant,
|
||||
:create_nonlinear_assistant)
|
||||
end
|
||||
|
||||
def run_full_featured_assistant
|
||||
@full_featured_assistant = run_assistant(@full_featured_assistant,
|
||||
:create_full_featured_assistant)
|
||||
end
|
||||
|
||||
private
|
||||
def run_assistant(assistant, assistant_create_method)
|
||||
assistant ||= send(assistant_create_method)
|
||||
if !assistant.visible?
|
||||
assistant.show
|
||||
else
|
||||
assistant.destroy
|
||||
assistant = nil
|
||||
end
|
||||
assistant
|
||||
end
|
||||
|
||||
def add_completion_test_page(assistant, text, visible, complete)
|
||||
page = Gtk::VBox.new(0, 0)
|
||||
check = Gtk::CheckButton.new("Complete")
|
||||
page.add(Gtk::Label.new(text))
|
||||
page.add(check)
|
||||
check.active = complete
|
||||
check.signal_connect('toggled') do
|
||||
complete = check.active?
|
||||
assistant.set_page_complete(page, complete)
|
||||
end
|
||||
page.show_all if visible
|
||||
assistant.append_page(page)
|
||||
assistant.set_page_title(page, text)
|
||||
assistant.set_page_complete(page, complete)
|
||||
page
|
||||
end
|
||||
|
||||
def create_test_page(text)
|
||||
Gtk::Label.new(text)
|
||||
end
|
||||
|
||||
def prepare_cb(assistant, page)
|
||||
if page.is_a?(Gtk::Label)
|
||||
puts "prepare: #{page.text}"
|
||||
elsif assistant.get_page_type(page) == Gtk::Assistant::PAGE_PROGRESS
|
||||
progress = page.child
|
||||
assistant.set_page_complete(page, false)
|
||||
progress.fraction = 0.0
|
||||
Gtk.timeout_add(300) do
|
||||
page = assistant.get_nth_page(assistant.current_page)
|
||||
progress = page.child
|
||||
value = progress.fraction = progress.fraction + 0.1
|
||||
continue = value < 1.0
|
||||
assistant.set_page_complete(page, true) unless continue
|
||||
continue
|
||||
end
|
||||
else
|
||||
puts "prepare: #{assistant.current_page}"
|
||||
end
|
||||
end
|
||||
|
||||
def create_simple_assistant
|
||||
assistant = Gtk::Assistant.new
|
||||
assistant.set_default_size(400, 300)
|
||||
assistant.signal_connect('cancel') do
|
||||
puts "cancel"
|
||||
assistant.hide
|
||||
end
|
||||
assistant.signal_connect('close') do
|
||||
puts "close"
|
||||
assistant.hide
|
||||
end
|
||||
assistant.signal_connect('apply') do
|
||||
puts "apply"
|
||||
end
|
||||
assistant.signal_connect('prepare') do |_assistant, page|
|
||||
prepare_cb(_assistant, page)
|
||||
end
|
||||
|
||||
page = create_test_page("Page 1")
|
||||
page.show
|
||||
assistant.append_page(page)
|
||||
assistant.set_page_title(page, "Page 1")
|
||||
assistant.set_page_complete(page, true)
|
||||
|
||||
page = create_test_page("Page 2")
|
||||
page.show
|
||||
assistant.append_page(page)
|
||||
assistant.set_page_title(page, "Page 2")
|
||||
assistant.set_page_type(page, :confirm)
|
||||
assistant.set_page_complete(page, true)
|
||||
end
|
||||
|
||||
def create_generous_assistant
|
||||
assistant = Gtk::Assistant.new
|
||||
assistant.set_default_size(400, 300)
|
||||
assistant.signal_connect('cancel') do
|
||||
puts "cancel"
|
||||
assistant.hide
|
||||
end
|
||||
assistant.signal_connect('close') do
|
||||
puts "close"
|
||||
assistant.hide
|
||||
end
|
||||
assistant.signal_connect('apply') do
|
||||
puts "apply"
|
||||
end
|
||||
assistant.signal_connect('prepare') do|_assistant, page|
|
||||
prepare_cb(_assistant, page)
|
||||
end
|
||||
|
||||
page = create_test_page("Introduction")
|
||||
page.show
|
||||
assistant.append_page(page)
|
||||
assistant.set_page_title(page, "Introduction")
|
||||
assistant.set_page_type(page, :intro)
|
||||
assistant.set_page_complete(page, true)
|
||||
|
||||
page = add_completion_test_page(assistant, "Content", true, false)
|
||||
next_page = add_completion_test_page(assistant, "More Content", true, true)
|
||||
|
||||
check = Gtk::CheckButton.new("Next page visible");
|
||||
check.active = true
|
||||
check.signal_connect('toggled') do
|
||||
puts "beuh"
|
||||
next_page.visible = check.active?
|
||||
end
|
||||
check.show
|
||||
page.add(check)
|
||||
|
||||
add_completion_test_page(assistant, "Even More Content", true, true)
|
||||
|
||||
page = create_test_page("Confirmation")
|
||||
page.show
|
||||
assistant.append_page(page)
|
||||
assistant.set_page_title(page, "Confirmation")
|
||||
assistant.set_page_type(page, :confirm)
|
||||
assistant.set_page_complete(page, true)
|
||||
|
||||
page = Gtk::Alignment.new(0.5, 0.5, 0.9, 0.0)
|
||||
page.add(Gtk::ProgressBar.new)
|
||||
page.show_all
|
||||
assistant.append_page(page)
|
||||
assistant.set_page_title(page, "Progress")
|
||||
assistant.set_page_type(page, :progress)
|
||||
assistant.set_page_complete(page, true)
|
||||
|
||||
page = create_test_page("Summary")
|
||||
page.show
|
||||
assistant.append_page(page)
|
||||
assistant.set_page_title(page, "Summary")
|
||||
assistant.set_page_type(page, :summary)
|
||||
assistant.set_page_complete(page, true)
|
||||
end
|
||||
|
||||
def create_nonlinear_assistant
|
||||
assistant = Gtk::Assistant.new
|
||||
assistant.set_default_size(400, 300)
|
||||
assistant.signal_connect('cancel') do
|
||||
puts "cancel"
|
||||
assistant.hide
|
||||
end
|
||||
assistant.signal_connect('close') do
|
||||
puts "close"
|
||||
assistant.hide
|
||||
end
|
||||
assistant.signal_connect('apply') do
|
||||
puts "apply"
|
||||
end
|
||||
assistant.signal_connect('prepare') do |_assistant, page|
|
||||
prepare_cb(_assistant, page)
|
||||
end
|
||||
|
||||
assistant.set_forward_page_func do |current_page|
|
||||
retval = -1
|
||||
if current_page == 0
|
||||
if @selected_branch == 'A'
|
||||
retval = 1
|
||||
else
|
||||
retval = 2
|
||||
end
|
||||
elsif current_page == 1 || current_page == 2
|
||||
retval = 3
|
||||
end
|
||||
retval
|
||||
end
|
||||
|
||||
page = Gtk::VBox.new(false, 6)
|
||||
button = Gtk::RadioButton.new('branch A')
|
||||
page.pack_start(button, false, false, 0)
|
||||
button.signal_connect('toggled') do
|
||||
@selected_branch = 'A'
|
||||
end
|
||||
button.active = true
|
||||
button = Gtk::RadioButton.new(button, 'branch B')
|
||||
page.pack_start(button, false, false, 0)
|
||||
button.signal_connect('toggled') do
|
||||
@selected_branch = 'B'
|
||||
end
|
||||
page.show_all
|
||||
assistant.append_page(page)
|
||||
assistant.set_page_title(page, "Page 1")
|
||||
assistant.set_page_complete(page, true)
|
||||
|
||||
page = create_test_page("Page 2A")
|
||||
page.show
|
||||
assistant.append_page(page)
|
||||
assistant.set_page_title(page, "Page 2A")
|
||||
assistant.set_page_complete(page, true)
|
||||
|
||||
page = create_test_page("Page 2B")
|
||||
page.show
|
||||
assistant.append_page(page)
|
||||
assistant.set_page_title(page, "Page 2B")
|
||||
assistant.set_page_complete(page, true)
|
||||
|
||||
page = create_test_page("Confirmation")
|
||||
page.show
|
||||
assistant.append_page(page)
|
||||
assistant.set_page_title(page, "Confirmation")
|
||||
assistant.set_page_type(page, :confirm)
|
||||
assistant.set_page_complete(page, true)
|
||||
end
|
||||
|
||||
def create_full_featured_assistant
|
||||
assistant = Gtk::Assistant.new
|
||||
assistant.set_default_size(400, 300)
|
||||
assistant.signal_connect('cancel') do
|
||||
puts "cancel"
|
||||
assistant.hide
|
||||
end
|
||||
assistant.signal_connect('close') do
|
||||
puts "close"
|
||||
assistant.hide
|
||||
end
|
||||
assistant.signal_connect('apply') do
|
||||
puts "apply"
|
||||
end
|
||||
assistant.signal_connect('prepare') do |_assistant, page|
|
||||
prepare_cb(_assistant, page)
|
||||
end
|
||||
|
||||
button = Gtk::Button.new(Gtk::Stock::STOP)
|
||||
button.show
|
||||
assistant.add_action_widget(button)
|
||||
|
||||
page = create_test_page("Page 1")
|
||||
page.show
|
||||
assistant.append_page(page)
|
||||
assistant.set_page_title(page, "Page 1")
|
||||
assistant.set_page_complete(page, true)
|
||||
|
||||
#- set a side image
|
||||
pixbuf = page.render_icon(Gtk::Stock::DIALOG_WARNING, :dialog)
|
||||
assistant.set_page_side_image(page, pixbuf)
|
||||
|
||||
#- set a header image
|
||||
pixbuf = page.render_icon(Gtk::Stock::DIALOG_INFO, :dialog)
|
||||
assistant.set_page_header_image(page, pixbuf)
|
||||
|
||||
page = create_test_page("Invisible page")
|
||||
assistant.append_page(page)
|
||||
|
||||
page = create_test_page("Page 3")
|
||||
page.show
|
||||
assistant.append_page(page)
|
||||
assistant.set_page_title(page, "Page 3")
|
||||
assistant.set_page_type(page, :confirm)
|
||||
assistant.set_page_complete(page, true)
|
||||
|
||||
#- set a header image
|
||||
pixbuf = page.render_icon(Gtk::Stock::DIALOG_INFO, :dialog)
|
||||
assistant.set_page_header_image(page, pixbuf)
|
||||
|
||||
assistant
|
||||
end
|
||||
end
|
||||
|
||||
runner = AssistantRunner.new
|
||||
buttons = [
|
||||
[ 'simple assistant', proc { runner.run_simple_assistant } ],
|
||||
[ 'generous assistant', proc { runner.run_generous_assistant } ],
|
||||
[ 'nonlinear assistant', proc { runner.run_nonlinear_assistant } ],
|
||||
[ 'full featured assistant', proc { runner.run_full_featured_assistant } ],
|
||||
]
|
||||
|
||||
if ENV['RTL']
|
||||
Gtk::Widget.default_direction = Gtk::Widget::TEXT_DIR_RTL
|
||||
end
|
||||
|
||||
window = Gtk::Window.new(Gtk::Window::TOPLEVEL)
|
||||
window.signal_connect('destroy') { Gtk.main_quit }
|
||||
window.signal_connect('delete-event') { false }
|
||||
|
||||
box = Gtk::VBox.new(false, 6)
|
||||
window.add(box)
|
||||
|
||||
buttons.each do |label, callback|
|
||||
button = Gtk::Button.new(label)
|
||||
button.signal_connect('clicked') do
|
||||
callback.call
|
||||
end
|
||||
box.pack_start(button, true, true, 0)
|
||||
end
|
||||
window.show_all
|
||||
Gtk.main
|
107
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/bindings.rb
Normal file
107
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/bindings.rb
Normal file
@ -0,0 +1,107 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
bindings.rb - Ruby/GTK sample script.
|
||||
|
||||
Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: bindings.rb,v 1.7 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
=begin
|
||||
Usage:
|
||||
bindings.rb <filename>
|
||||
|
||||
Following key bindings are effective in the TextView area.
|
||||
|
||||
<space> : scroll down by one page
|
||||
<backspace> : scroll up by one page
|
||||
j : move cursor donw by one line
|
||||
k : move cursor up by one line
|
||||
|
||||
clicking buttons cause following effect
|
||||
|
||||
"space" : same as pressing <space> in text view area.
|
||||
"back_space" : same as pressing <backspace> in text view area.
|
||||
"cancel j/k" : disable 'j' and 'k' binding
|
||||
=end
|
||||
require 'gtk2'
|
||||
|
||||
class Pager < Gtk::TextView
|
||||
type_register
|
||||
|
||||
# widget's key binding can be defined like this
|
||||
binding_set.add_signal(Gdk::Keyval::GDK_space, 0,
|
||||
"move_cursor",
|
||||
Gtk::MOVEMENT_PAGES, 1, false)
|
||||
binding_set.add_signal(Gdk::Keyval::GDK_BackSpace, 0,
|
||||
"move_cursor",
|
||||
Gtk::MOVEMENT_PAGES, -1, false)
|
||||
|
||||
def initialize(path)
|
||||
@path = path
|
||||
super()
|
||||
@buffer = self.buffer
|
||||
load
|
||||
set_editable(false)
|
||||
set_size_request(400, 400)
|
||||
end
|
||||
|
||||
def load
|
||||
open(@path).read.each_line do |line|
|
||||
@buffer.insert_at_cursor(line)
|
||||
end
|
||||
@buffer.place_cursor(@buffer.start_iter)
|
||||
end
|
||||
end
|
||||
|
||||
path = ARGV[0] || __FILE__
|
||||
|
||||
window = Gtk::Window.new
|
||||
window.name = "pager_window"
|
||||
sw = Gtk::ScrolledWindow.new
|
||||
vbox = Gtk::VBox.new
|
||||
hbox = Gtk::HBox.new
|
||||
pager = Pager.new(path)
|
||||
|
||||
hbox.add(button1 = Gtk::Button.new("space"))
|
||||
hbox.add(button2 = Gtk::Button.new("back_space"))
|
||||
hbox.add(button3 = Gtk::Button.new("cancel j/k"))
|
||||
|
||||
button1.signal_connect("clicked") do
|
||||
Pager.binding_set.activate(Gdk::Keyval::GDK_space, 0, pager)
|
||||
end
|
||||
button2.signal_connect("clicked") do
|
||||
pager.bindings_activate(Gdk::Keyval::GDK_BackSpace, 0)
|
||||
end
|
||||
|
||||
# Key bindings can be attached to any widget by
|
||||
# Gtk::BindingSet#add_path
|
||||
# see RC Files section of GTK+ documentation for more detail.
|
||||
bset = Gtk::BindingSet.new("j_and_k")
|
||||
bset.add_signal(Gdk::Keyval::GDK_j, 0,
|
||||
"move_cursor",
|
||||
Gtk::MOVEMENT_DISPLAY_LINES, 1, false)
|
||||
bset.add_signal(Gdk::Keyval::GDK_k, 0,
|
||||
"move_cursor",
|
||||
Gtk::MOVEMENT_DISPLAY_LINES, -1, false)
|
||||
bset.add_path(Gtk::PathType::WIDGET, "pager_window.*.Pager",
|
||||
Gtk::PathPriorityType::APPLICATION)
|
||||
|
||||
button3.signal_connect("clicked") do
|
||||
bset.entry_clear(Gdk::Keyval::GDK_j, 0)
|
||||
bset.entry_clear(Gdk::Keyval::GDK_k, 0)
|
||||
end
|
||||
|
||||
sw.add(pager)
|
||||
vbox.add(hbox).add(sw)
|
||||
window.add(vbox)
|
||||
window.show_all
|
||||
|
||||
pager.grab_focus
|
||||
|
||||
window.signal_connect("destroy") { Gtk.main_quit }
|
||||
|
||||
Gtk.main
|
||||
|
||||
|
69
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/button.rb
Normal file
69
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/button.rb
Normal file
@ -0,0 +1,69 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
button.rb - Ruby/GTK sample script.
|
||||
|
||||
Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: button.rb,v 1.10 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
window = Gtk::Window.new("buttons")
|
||||
window.border_width = 0
|
||||
|
||||
box1 = Gtk::VBox.new(false, 0)
|
||||
window.add(box1)
|
||||
|
||||
table = Gtk::Table.new(3, 3, false)
|
||||
table.set_row_spacings(5)
|
||||
table.set_column_spacings(5)
|
||||
table.set_border_width(10)
|
||||
box1.pack_start(table, true, true, 0)
|
||||
|
||||
button = []
|
||||
0.upto(8) do |i|
|
||||
button.push Gtk::Button.new("button"+(i+1).to_s)
|
||||
end
|
||||
0.upto(8) do |i|
|
||||
button[i].signal_connect("clicked") do |w|
|
||||
p [i]
|
||||
j = (i + 1) % 9
|
||||
if button[j].visible?
|
||||
button[j].hide
|
||||
else
|
||||
button[j].show
|
||||
end
|
||||
end
|
||||
button[i].show
|
||||
end
|
||||
table.attach(button[0], 0, 1, 0, 1, nil, nil, 0, 0)
|
||||
table.attach(button[1], 1, 2, 1, 2, nil, nil, 0, 0)
|
||||
table.attach(button[2], 2, 3, 2, 3, nil, nil, 0, 0)
|
||||
table.attach(button[3], 0, 1, 2, 3, nil, nil, 0, 0)
|
||||
table.attach(button[4], 2, 3, 0, 1, nil, nil, 0, 0)
|
||||
table.attach(button[5], 1, 2, 2, 3, nil, nil, 0, 0)
|
||||
table.attach(button[6], 1, 2, 0, 1, nil, nil, 0, 0)
|
||||
table.attach(button[7], 2, 3, 1, 2, nil, nil, 0, 0)
|
||||
table.attach(button[8], 0, 1, 1, 2, nil, nil, 0, 0)
|
||||
|
||||
separator = Gtk::HSeparator.new
|
||||
box1.pack_start(separator, false, true, 0)
|
||||
|
||||
box2 = Gtk::VBox.new(false, 10)
|
||||
box2.border_width = 10
|
||||
box1.pack_start(box2, false, true, 0)
|
||||
|
||||
close = Gtk::Button.new("close")
|
||||
close.signal_connect("clicked") do
|
||||
Gtk.main_quit
|
||||
end
|
||||
|
||||
box2.pack_start(close, true, true, 0)
|
||||
close.can_default = true
|
||||
close.grab_default
|
||||
|
||||
window.show_all
|
||||
|
||||
Gtk.main
|
28
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/button2.rb
Normal file
28
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/button2.rb
Normal file
@ -0,0 +1,28 @@
|
||||
#!/usr/local/bin/ruby
|
||||
=begin
|
||||
button2.rb - Ruby/GTK2 sample script.
|
||||
|
||||
Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: button2.rb,v 1.4 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
window = Gtk::Window.new("Gtk::Button sample")
|
||||
|
||||
button1 = Gtk::Button.new("_HELLO")
|
||||
button2 = Gtk::Button.new("_HELLO", false)
|
||||
button3 = Gtk::Button.new(Gtk::Stock::QUIT)
|
||||
|
||||
button3.signal_connect("clicked"){ Gtk.main_quit }
|
||||
|
||||
box = Gtk::VBox.new
|
||||
box.add(button1)
|
||||
box.add(button2)
|
||||
box.add(button3)
|
||||
|
||||
window.add(box).set_default_size(100,100).show_all
|
||||
|
||||
Gtk.main
|
93
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/buttonbox.rb
Normal file
93
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/buttonbox.rb
Normal file
@ -0,0 +1,93 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
buttonbox.rb - Ruby/GTK2 sample script.
|
||||
|
||||
Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: buttonbox.rb,v 1.9 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
def create_bbox_window(horizontal, title, pos, spacing, layout)
|
||||
window = Gtk::Window.new(title)
|
||||
window.signal_connect("delete_event") do
|
||||
window.destroy
|
||||
end
|
||||
|
||||
box1 = Gtk::VBox.new(false, 0)
|
||||
window.add(box1)
|
||||
|
||||
if horizontal
|
||||
window.set_default_size(550, 60)
|
||||
window.move(150, pos)
|
||||
bbox = Gtk::HButtonBox.new
|
||||
else
|
||||
window.set_default_size(150, 400)
|
||||
window.move(pos, 200)
|
||||
bbox = Gtk::VButtonBox.new
|
||||
end
|
||||
|
||||
bbox.layout_style = layout
|
||||
bbox.spacing = spacing
|
||||
box1.border_width = 25
|
||||
box1.pack_start(bbox, true, true, 0)
|
||||
|
||||
button = Gtk::Button.new("OK")
|
||||
bbox.add(button)
|
||||
button.signal_connect("clicked") do
|
||||
window.destroy
|
||||
end
|
||||
|
||||
button = Gtk::Button.new("Cancel")
|
||||
bbox.add(button)
|
||||
button.signal_connect("clicked") do
|
||||
window.destroy
|
||||
end
|
||||
|
||||
button = Gtk::Button.new("Help")
|
||||
bbox.add(button)
|
||||
window.show_all
|
||||
end
|
||||
|
||||
def test_hbbox
|
||||
create_bbox_window(true, "Spread", 50, 40, Gtk::ButtonBox::SPREAD)
|
||||
create_bbox_window(true, "Edge", 250, 40, Gtk::ButtonBox::EDGE)
|
||||
create_bbox_window(true, "Start", 450, 40, Gtk::ButtonBox::START)
|
||||
create_bbox_window(true, "End", 650, 15, Gtk::ButtonBox::END)
|
||||
end
|
||||
|
||||
def test_vbbox
|
||||
create_bbox_window(false, "Spread", 50, 40, Gtk::ButtonBox::SPREAD)
|
||||
create_bbox_window(false, "Edge", 250, 40, Gtk::ButtonBox::EDGE)
|
||||
create_bbox_window(false, "Start", 450, 40, Gtk::ButtonBox::START)
|
||||
create_bbox_window(false, "End", 650, 15, Gtk::ButtonBox::END)
|
||||
end
|
||||
|
||||
window = Gtk::Window.new("button box")
|
||||
window.signal_connect("delete_event") do
|
||||
Gtk.main_quit
|
||||
end
|
||||
window.border_width = 20
|
||||
|
||||
bbox = Gtk::HButtonBox.new
|
||||
window.add(bbox)
|
||||
|
||||
button = Gtk::Button.new("Horizontal")
|
||||
|
||||
button.signal_connect("clicked") do
|
||||
test_hbbox
|
||||
end
|
||||
|
||||
bbox.add(button)
|
||||
|
||||
button = Gtk::Button.new("Vertical")
|
||||
button.signal_connect("clicked") do
|
||||
test_vbbox
|
||||
end
|
||||
bbox.add(button)
|
||||
|
||||
window.show_all
|
||||
|
||||
Gtk.main
|
215
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/cairo-pong.rb
Executable file
215
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/cairo-pong.rb
Executable file
@ -0,0 +1,215 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
cairo-pong.rb - Ruby/GTK with cairo sample script.
|
||||
|
||||
Original: gtkcairo sample by Evan Martins.
|
||||
|
||||
Copyright (c) 2005,2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: cairo-pong.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require "gtk2"
|
||||
|
||||
unless Gdk.cairo_available?
|
||||
raise "GTK+ 2.8.0 or later and cairo support are required."
|
||||
end
|
||||
|
||||
module Pong
|
||||
class CenteredItem
|
||||
attr_accessor :x, :y
|
||||
attr_reader :width, :height
|
||||
|
||||
def initialize(x, y, width, height)
|
||||
@x = x
|
||||
@y = y
|
||||
@width = width
|
||||
@height = height
|
||||
end
|
||||
|
||||
def min_x
|
||||
@x - @width / 2
|
||||
end
|
||||
|
||||
def max_x
|
||||
@x + @width / 2
|
||||
end
|
||||
|
||||
def min_y
|
||||
@y - @height / 2
|
||||
end
|
||||
|
||||
def max_y
|
||||
@y + @height / 2
|
||||
end
|
||||
end
|
||||
|
||||
class CenteredCircle < CenteredItem
|
||||
def draw(cr)
|
||||
cr.translate(min_x, min_y)
|
||||
cr.scale(@width, @height)
|
||||
cr.arc(0.5, 0.5, 0.5, 0, 2 * Math::PI)
|
||||
cr.fill
|
||||
end
|
||||
end
|
||||
|
||||
class CenteredRect < CenteredItem
|
||||
def draw(cr)
|
||||
cr.translate(min_x, min_y)
|
||||
cr.scale(@width, @height)
|
||||
cr.rectangle(0, 0, 1, 1)
|
||||
cr.fill
|
||||
end
|
||||
end
|
||||
|
||||
class Ball < CenteredCircle
|
||||
attr_accessor :dx, :dy
|
||||
def initialize(dx=0.02, dy=0.02)
|
||||
super(0.8, 0.5, 0.04, 0.04)
|
||||
@dx = dx
|
||||
@dy = dy
|
||||
end
|
||||
|
||||
def update
|
||||
@x += @dx
|
||||
@y += @dy
|
||||
|
||||
# ball bouncing
|
||||
if max_y > 1
|
||||
@y = 1 - (max_y - 1)
|
||||
@dy *= -1
|
||||
elsif min_y < 0
|
||||
@y -= min_y
|
||||
@dy *= -1
|
||||
end
|
||||
|
||||
if max_x > 1
|
||||
@x = 1 - (max_x - 1)
|
||||
@dx *= -1
|
||||
elsif min_x < 0
|
||||
@x -= min_x
|
||||
@dx *= -1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class Paddle < CenteredRect
|
||||
def initialize(field, x, y)
|
||||
super(x, y, 0.05, 0.3)
|
||||
@field = field
|
||||
end
|
||||
|
||||
def update(ball)
|
||||
# is the ball coming towards us?
|
||||
if (ball.x < @x and ball.dx > 0) or
|
||||
(ball.x > @x and ball.dx < 0)
|
||||
# move to intercept it
|
||||
@y = ball.y
|
||||
end
|
||||
end
|
||||
|
||||
def ball_hit?(ball)
|
||||
ball.y > min_y and ball.y < max_y
|
||||
end
|
||||
|
||||
def update_ball(ball)
|
||||
if ball_hit?(ball)
|
||||
if ball.min_x < @x and ball.max_x > min_x # hit our left side
|
||||
ball.x -= (ball.max_x - min_x)
|
||||
ball.dx = -ball.dx
|
||||
elsif ball.max_x > @x and ball.min_x < max_x # hit our right side
|
||||
ball.x += (max_x - ball.min_x)
|
||||
ball.dx = -ball.dx
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class Field
|
||||
attr_accessor :width, :height
|
||||
|
||||
def initialize(margin=0.05)
|
||||
@margin = margin
|
||||
|
||||
@left_paddle = Paddle.new(self, @margin, 0.5)
|
||||
@right_paddle = Paddle.new(self, 1 - @margin, 0.7)
|
||||
@paddles = [@left_paddle, @right_paddle]
|
||||
@ball = Ball.new
|
||||
end
|
||||
|
||||
def update
|
||||
@paddles.each do |paddle|
|
||||
paddle.update(@ball)
|
||||
end
|
||||
@ball.update
|
||||
@paddles.each do |paddle|
|
||||
paddle.update_ball(@ball)
|
||||
end
|
||||
end
|
||||
|
||||
def draw(cr)
|
||||
cr.set_source_rgba(1, 1, 1)
|
||||
cr.rectangle(0, 0, 1, 1)
|
||||
cr.fill
|
||||
|
||||
cr.save do
|
||||
cr.set_source_rgba(0.8, 0.8, 0.8, 0.8)
|
||||
cr.set_line_join(Cairo::LINE_JOIN_ROUND)
|
||||
@paddles.each do |paddle|
|
||||
cr.save {paddle.draw(cr)}
|
||||
end
|
||||
end
|
||||
|
||||
cr.set_source_rgba(0, 0, 0)
|
||||
cr.save {@ball.draw(cr)}
|
||||
end
|
||||
end
|
||||
|
||||
class Window < Gtk::Window
|
||||
def initialize(speed=30)
|
||||
super()
|
||||
@speed = speed
|
||||
|
||||
self.title = 'Pong Demonstration'
|
||||
signal_connect('destroy') { Gtk.main_quit }
|
||||
signal_connect("key_press_event") do |widget, event|
|
||||
if event.state.control_mask? and event.keyval == Gdk::Keyval::GDK_q
|
||||
destroy
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
set_default_size(260, 200)
|
||||
|
||||
@field = Field.new
|
||||
|
||||
@drawing_area = Gtk::DrawingArea.new
|
||||
set_expose_event
|
||||
|
||||
vb = Gtk::VBox.new(false, 5)
|
||||
vb.border_width = 10
|
||||
vb.pack_start(@drawing_area, true, true, 0)
|
||||
vb.show_all
|
||||
add(vb)
|
||||
|
||||
Gtk.timeout_add(@speed) do
|
||||
@field.update
|
||||
@drawing_area.queue_draw unless @drawing_area.destroyed?
|
||||
end
|
||||
end
|
||||
|
||||
def set_expose_event
|
||||
@drawing_area.signal_connect('expose_event') do |widget, event|
|
||||
cr = widget.window.create_cairo_context
|
||||
cr.scale(*widget.window.size)
|
||||
@field.draw(cr)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Pong::Window.new.show_all
|
||||
Gtk.main
|
62
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/calendar.rb
Normal file
62
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/calendar.rb
Normal file
@ -0,0 +1,62 @@
|
||||
=begin
|
||||
calendar.rb - Gtk::Calendar sample script.
|
||||
|
||||
Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: calendar.rb,v 1.7 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
cal = Gtk::Calendar.new
|
||||
|
||||
w = Gtk::Window.new("Calendar sample")
|
||||
w.add(cal).show_all.signal_connect('delete_event') do
|
||||
Gtk.main_quit
|
||||
end
|
||||
|
||||
date = Time.new
|
||||
|
||||
cal.select_month(date.month, date.year)
|
||||
cal.select_day(date.day)
|
||||
cal.mark_day(date.day)
|
||||
#cal.clear_marks
|
||||
cal.display_options(Gtk::Calendar::SHOW_HEADING |
|
||||
Gtk::Calendar::SHOW_DAY_NAMES |
|
||||
Gtk::Calendar::NO_MONTH_CHANGE |
|
||||
Gtk::Calendar::SHOW_WEEK_NUMBERS |
|
||||
Gtk::Calendar::WEEK_START_MONDAY)
|
||||
year, month, day = cal.date
|
||||
puts "this is #{month} #{day}, #{year}"
|
||||
|
||||
cal.signal_connect('day_selected') do
|
||||
year, month, day = cal.date
|
||||
puts "selected day: #{day}"
|
||||
end
|
||||
cal.signal_connect('month_changed') do
|
||||
year, month, day = cal.date
|
||||
puts "changed month: #{month}"
|
||||
end
|
||||
cal.signal_connect('day_selected_double_click') do
|
||||
year, month, day = cal.date
|
||||
puts "dclicked day: #{day}"
|
||||
end
|
||||
cal.signal_connect('prev_month') do
|
||||
year, month, day = cal.date
|
||||
puts "prev month: #{month}"
|
||||
end
|
||||
cal.signal_connect('next_month') do
|
||||
year, month, day = cal.date
|
||||
puts "next_month: #{month}"
|
||||
end
|
||||
cal.signal_connect('prev_year') do
|
||||
year, month, day = cal.date
|
||||
puts "prev_year: #{year}"
|
||||
end
|
||||
cal.signal_connect('next_year') do
|
||||
year, month, day = cal.date
|
||||
puts "next year: #{year}"
|
||||
end
|
||||
|
||||
Gtk.main
|
46
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/checkbutton.rb
Normal file
46
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/checkbutton.rb
Normal file
@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
checkbutton.rb - Ruby/GTK2 sample script.
|
||||
|
||||
Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: checkbutton.rb,v 1.10 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
window = Gtk::Window.new("check buttons")
|
||||
window.border_width = 0
|
||||
|
||||
box1 = Gtk::VBox.new
|
||||
window.add(box1)
|
||||
|
||||
box2 = Gtk::VBox.new(false, 10)
|
||||
box2.border_width = 10
|
||||
box1.pack_start(box2)
|
||||
|
||||
button1 = Gtk::CheckButton.new("_button1")
|
||||
button2 = Gtk::CheckButton.new("_button2", false)
|
||||
button3 = Gtk::CheckButton.new(Gtk::Stock::QUIT)
|
||||
box2.add(button1)
|
||||
box2.add(button2)
|
||||
box2.add(button3)
|
||||
|
||||
box1.pack_start(Gtk::HSeparator.new)
|
||||
|
||||
box2 = Gtk::VBox.new(false, 10)
|
||||
box2.border_width = 10
|
||||
box1.pack_start(box2)
|
||||
|
||||
close = Gtk::Button.new("close")
|
||||
close.signal_connect("clicked") do
|
||||
Gtk.main_quit
|
||||
end
|
||||
box2.pack_start(close)
|
||||
close.can_default = true
|
||||
close.grab_default
|
||||
|
||||
window.show_all
|
||||
|
||||
Gtk.main
|
25
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/colorselection.rb
Normal file
25
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/colorselection.rb
Normal file
@ -0,0 +1,25 @@
|
||||
=begin
|
||||
colorselection.rb - Gtk::ColorSelection sample script.
|
||||
|
||||
Copyright (C) 2005,2006 Masao Mutoh
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: colorselection.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
settings = Gtk::Settings.default
|
||||
|
||||
# You can save the palette to use right click on the palette.
|
||||
Gtk::ColorSelection.set_change_palette_hook{|screen, colors|
|
||||
puts strs = Gtk::ColorSelection.palette_to_string(colors)
|
||||
settings.gtk_color_palette = strs
|
||||
}
|
||||
|
||||
a = Gtk::ColorSelection.new
|
||||
a.has_palette = true
|
||||
|
||||
Gtk::Window.new.add(a).show_all.signal_connect("destroy"){Gtk.main_quit}
|
||||
|
||||
Gtk.main
|
71
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/combo_check.rb
Normal file
71
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/combo_check.rb
Normal file
@ -0,0 +1,71 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
combo_check.rb - Ruby/GTK sample script.
|
||||
|
||||
Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: combo_check.rb,v 1.9 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
window = Gtk::Window.new("entry")
|
||||
window.border_width = 0
|
||||
|
||||
box1 = Gtk::VBox.new
|
||||
window.add(box1)
|
||||
|
||||
box2 = Gtk::VBox.new(false, 10)
|
||||
box2.border_width = 10
|
||||
box1.pack_start(box2)
|
||||
|
||||
entry = Gtk::Entry.new
|
||||
entry.text = "hello world"
|
||||
entry.select_region(0, -1)
|
||||
box2.pack_start(entry)
|
||||
|
||||
#
|
||||
# Gtk::Combo has been deprecated. Use Gtk::ComboBox instead.
|
||||
#
|
||||
cb = Gtk::Combo.new
|
||||
cb.set_popdown_strings(["item0",
|
||||
"item1 item1",
|
||||
"item2 item2 item2",
|
||||
"item3 item3 item3 item3",
|
||||
"item4 item4 item4 item4 item4",
|
||||
"item5 item5 item5 item5 item5 item5",
|
||||
"item6 item6 item6 item6 item6",
|
||||
"item7 item7 item7 item7",
|
||||
"item8 item8 item8",
|
||||
"item9 item9"])
|
||||
cb.entry.set_text("hello world")
|
||||
cb.entry.select_region(0, -1)
|
||||
box2.pack_start(cb, true, true, 0)
|
||||
|
||||
check = Gtk::CheckButton.new("Editable")
|
||||
box2.pack_start(check, false, true, 0)
|
||||
check.signal_connect("toggled") do
|
||||
cb.entry.set_editable(check.active?)
|
||||
entry.set_editable(check.active?)
|
||||
end
|
||||
check.state = 0
|
||||
|
||||
box1.pack_start(Gtk::HSeparator.new)
|
||||
|
||||
box2 = Gtk::VBox.new(false, 10)
|
||||
box2.border_width = 10
|
||||
box1.pack_start(box2)
|
||||
|
||||
button = Gtk::Button.new("close")
|
||||
button.signal_connect("clicked") do
|
||||
Gtk.main_quit
|
||||
end
|
||||
box2.pack_start(button)
|
||||
|
||||
button.can_default = true
|
||||
button.grab_default
|
||||
|
||||
window.show_all
|
||||
|
||||
Gtk.main
|
86
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/combobox.rb
Normal file
86
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/combobox.rb
Normal file
@ -0,0 +1,86 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
combobox.rb - Ruby/GTK sample script.
|
||||
|
||||
Copyright (c) 2004-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: combobox.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
if str = Gtk.check_version(2, 4, 0)
|
||||
puts "This sample requires GTK+ 2.4.0 or later"
|
||||
puts str
|
||||
exit
|
||||
end
|
||||
|
||||
window = Gtk::Window.new("Gtk::ComboBox sample")
|
||||
window.signal_connect("destroy"){Gtk.main_quit}
|
||||
|
||||
#
|
||||
# Text only
|
||||
#
|
||||
combo1 = Gtk::ComboBox.new
|
||||
["foo", "bar", "fuga", "hoge"].each do |val|
|
||||
combo1.append_text(val)
|
||||
end
|
||||
combo1.active = 1
|
||||
|
||||
combo1.signal_connect("changed") do
|
||||
p "combo1: #{combo1.active}, #{combo1.active_iter[0]}"
|
||||
end
|
||||
|
||||
#
|
||||
# Icon and text
|
||||
#
|
||||
model = Gtk::ListStore.new(Gdk::Pixbuf, String)
|
||||
[[Gtk::Stock::QUIT, "quit"],
|
||||
[Gtk::Stock::CANCEL, "cancel"],
|
||||
[Gtk::Stock::OK, "ok"]].each do |stock, name|
|
||||
iter = model.append
|
||||
iter[0] = window.render_icon(stock, Gtk::IconSize::MENU, "icon")
|
||||
iter[1] = name
|
||||
end
|
||||
|
||||
combo2 = Gtk::ComboBox.new(model)
|
||||
|
||||
# column 1
|
||||
renderer = Gtk::CellRendererPixbuf.new
|
||||
combo2.pack_start(renderer, false)
|
||||
combo2.set_attributes(renderer, :pixbuf => 0)
|
||||
|
||||
# column 2
|
||||
renderer = Gtk::CellRendererText.new
|
||||
combo2.pack_start(renderer, true)
|
||||
combo2.set_attributes(renderer, :text => 1)
|
||||
|
||||
combo2.active = 2
|
||||
|
||||
combo2.signal_connect("changed") do
|
||||
p "combo2: #{combo2.active}, #{combo2.active_iter[1]}"
|
||||
end
|
||||
|
||||
#
|
||||
# Gtk::ComboBoxEntry
|
||||
#
|
||||
combo3 = Gtk::ComboBoxEntry.new
|
||||
["foo", "bar", "fuga", "hoge"].each do |val|
|
||||
combo3.append_text(val)
|
||||
end
|
||||
combo3.active = 1
|
||||
|
||||
combo3.signal_connect("changed") do
|
||||
if combo3.active_iter
|
||||
p "combo3: #{combo3.active}, #{combo3.active_iter[0]}"
|
||||
end
|
||||
end
|
||||
|
||||
# Show main window
|
||||
vbox = Gtk::VBox.new
|
||||
vbox.add(combo1).add(combo2).add(combo3)
|
||||
window.add(vbox).show_all
|
||||
|
||||
Gtk.main
|
||||
|
113
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/composited-windows.rb
Normal file
113
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/composited-windows.rb
Normal file
@ -0,0 +1,113 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
composited-windows.rb - Sample script translated from http://library.gnome.org/devel/gdk/unstable/gdk-Windows.html#composited-window-example
|
||||
|
||||
Copyright (c) 2008 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
if str = Gtk.check_version(2, 12, 0)
|
||||
puts "This sample requires GTK+ 2.12.0 or later."
|
||||
puts str
|
||||
exit
|
||||
end
|
||||
|
||||
unless Gdk.cairo_available?
|
||||
puts "This sample requires Cairo support."
|
||||
exit
|
||||
end
|
||||
|
||||
|
||||
Gtk.init
|
||||
|
||||
# Make the widgets
|
||||
button = Gtk::Button.new("A Button")
|
||||
event = Gtk::EventBox.new
|
||||
window = Gtk::Window.new(Gtk::Window::TOPLEVEL)
|
||||
|
||||
# Put a red background on the window
|
||||
window.modify_bg(Gtk::STATE_NORMAL, Gdk::Color.parse("red"))
|
||||
|
||||
# Set the colourmap for the event box. Must be done before the event box is realised.
|
||||
event.colormap = event.screen.rgba_colormap
|
||||
|
||||
# Set our event box to have a fully-transparent background
|
||||
# drawn on it. Currently there is no way to simply tell GTK+
|
||||
# that "transparency" is the background colour for a widget.
|
||||
event.app_paintable = true
|
||||
|
||||
event.signal_connect('expose-event') do |widget, event|
|
||||
# This function simply draws a transparency onto a widget on the area
|
||||
# for which it receives expose events. This is intended to give the
|
||||
# event box a "transparent" background.
|
||||
#
|
||||
# In order for this to work properly, the widget must have an RGBA
|
||||
# colourmap. The widget should also be set as app-paintable since it
|
||||
# doesn't make sense for GTK+ to draw a background if we are drawing it
|
||||
# (and because GTK+ might actually replace our transparency with its
|
||||
# default background colour).
|
||||
#
|
||||
cr = widget.window.create_cairo_context
|
||||
cr.operator = Cairo::OPERATOR_CLEAR
|
||||
cr.gdk_region(event.region)
|
||||
cr.fill
|
||||
false
|
||||
end
|
||||
|
||||
# Put them inside one another
|
||||
window.border_width = 10
|
||||
window.add(event)
|
||||
event.add(button)
|
||||
|
||||
# Realize and show everything
|
||||
window.show_all
|
||||
|
||||
# Set the event box GdkWindow to be composited.
|
||||
# Obviously must be performed after event box is realised.
|
||||
event.window.composited = true
|
||||
|
||||
# Set up the compositing handler.
|
||||
# Note that we do _after_ so that the normal (red) background is drawn
|
||||
# by gtk before our compositing occurs.
|
||||
#
|
||||
window.signal_connect_after('expose-event') do |widget, event|
|
||||
# This function performs the actual compositing of the event box onto
|
||||
# the already-existing background of the window at 50% normal opacity.
|
||||
#
|
||||
# In this case we do not want app-paintable to be set on the widget
|
||||
# since we want it to draw its own (red) background. Because of this,
|
||||
# however, we must ensure that we use #signal_connect_after so that
|
||||
# this handler is called after the red has been drawn. If it was
|
||||
# called before then GTK would just blindly paint over our work.
|
||||
#
|
||||
# Note: if the child window has children, then you need a cairo 1.16
|
||||
# feature to make this work correctly.
|
||||
#
|
||||
|
||||
# get our child (in this case, the event box)
|
||||
child = widget.child
|
||||
|
||||
# create a cairo context to draw to the window
|
||||
cr = widget.window.create_cairo_context
|
||||
|
||||
# the source data is the (composited) event box
|
||||
# NOTICE: next line generates a GTK warning, it is maybe a GTK problem, it is tracked
|
||||
# at http://bugzilla.gnome.org/show_bug.cgi?id=526965
|
||||
cr.set_source_pixmap(child.window, child.allocation.x, child.allocation.y)
|
||||
|
||||
# draw no more than our expose event intersects our child
|
||||
region = Gdk::Region.new(Gdk::Rectangle.new(child.allocation.x, child.allocation.y, child.allocation.width, child.allocation.height))
|
||||
region.intersect(event.region)
|
||||
cr.gdk_region(region)
|
||||
cr.clip
|
||||
|
||||
# composite, with a 50% opacity
|
||||
cr.operator = Cairo::OPERATOR_OVER
|
||||
cr.paint(0.5)
|
||||
|
||||
false
|
||||
end
|
||||
|
||||
Gtk.main
|
32
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/cursor.rb
Normal file
32
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/cursor.rb
Normal file
@ -0,0 +1,32 @@
|
||||
=begin
|
||||
cursor.rb - Gdk::Cursor sample script.
|
||||
|
||||
Copyright (C) 2001-2006 Masao Mutoh
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: cursor.rb,v 1.7 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
window = Gtk::Window.new("Gdk::Cursor sample")
|
||||
window.realize
|
||||
|
||||
button = Gtk::Button.new("Click!")
|
||||
button.use_underline = false
|
||||
|
||||
cursors = Gdk::Cursor::Type.values - [Gdk::Cursor::CURSOR_IS_PIXMAP]
|
||||
|
||||
cnt = 0
|
||||
button.signal_connect('clicked') do
|
||||
cursor = cursors[cnt]
|
||||
p cursor.inspect
|
||||
button.set_label(cursor.inspect)
|
||||
window.window.set_cursor(Gdk::Cursor.new(cursor))
|
||||
cnt += 1
|
||||
cnt = 0 if cnt == cursors.size
|
||||
end
|
||||
window.add(button)
|
||||
window.set_default_size(400,100).show_all
|
||||
|
||||
Gtk.main
|
44
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/dialog.rb
Normal file
44
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/dialog.rb
Normal file
@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
dialog.rb - Ruby/GTK2 sample script.
|
||||
|
||||
Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: dialog.rb,v 1.6 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
window = Gtk::Window.new("Gtk::Dialog sample")
|
||||
button = Gtk::Button.new("Create Dialog")
|
||||
button.signal_connect("clicked") do
|
||||
dialog = Gtk::Dialog.new
|
||||
dialog.title = "Gtk::Dialog Sample"
|
||||
dialog.transient_for = window
|
||||
dialog.set_default_size(300, 300)
|
||||
dialog.vbox.add(Gtk::Label.new("Gtk::Dialog Sample"))
|
||||
|
||||
|
||||
dialog.add_button("OK", Gtk::Dialog::RESPONSE_OK)
|
||||
dialog.add_button(Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL)
|
||||
dialog.add_button(Gtk::Stock::CLOSE, Gtk::Dialog::RESPONSE_CLOSE)
|
||||
dialog.set_default_response(Gtk::Dialog::RESPONSE_CANCEL)
|
||||
|
||||
dialog.signal_connect("response") do |widget, response|
|
||||
case response
|
||||
when Gtk::Dialog::RESPONSE_OK
|
||||
p "OK"
|
||||
when Gtk::Dialog::RESPONSE_CANCEL
|
||||
p "Cancel"
|
||||
when Gtk::Dialog::RESPONSE_CLOSE
|
||||
p "Close"
|
||||
dialog.destroy
|
||||
end
|
||||
end
|
||||
dialog.show_all
|
||||
end
|
||||
|
||||
window.add(button).show_all.signal_connect("destroy"){Gtk.main_quit}
|
||||
|
||||
Gtk.main
|
39
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/dialog2.rb
Normal file
39
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/dialog2.rb
Normal file
@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
dialog2.rb - Ruby/GTK2 sample script.
|
||||
|
||||
Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: dialog2.rb,v 1.7 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
window = Gtk::Window.new("Gtk::Dialog sample2")
|
||||
button = Gtk::Button.new("Create Dialog")
|
||||
button.signal_connect("clicked") do
|
||||
dialog = Gtk::Dialog.new("Gtk::Dialog Sample 2", window,
|
||||
Gtk::Dialog::MODAL|Gtk::Dialog::NO_SEPARATOR,
|
||||
[Gtk::Stock::OK, Gtk::Dialog::RESPONSE_OK],
|
||||
[Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL])
|
||||
dialog.vbox.add(Gtk::Label.new("Gtk::Dialog Sample 2"))
|
||||
dialog.set_default_size(300, 300)
|
||||
dialog.vbox.show_all
|
||||
result = dialog.run
|
||||
case result
|
||||
when Gtk::Dialog::RESPONSE_OK
|
||||
p "OK"
|
||||
when Gtk::Dialog::RESPONSE_CANCEL
|
||||
p "Cancel"
|
||||
end
|
||||
dialog.destroy
|
||||
end
|
||||
|
||||
window.add(button).show_all.signal_connect("destroy"){Gtk.main_quit}
|
||||
|
||||
Gtk.main
|
||||
|
||||
|
||||
|
||||
|
65
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/dnd.rb
Normal file
65
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/dnd.rb
Normal file
@ -0,0 +1,65 @@
|
||||
=begin
|
||||
dnd.rb - Drag and Drop sample script.
|
||||
|
||||
Copyright (C) 2002-2006 Masao Mutoh
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Date: 2006/06/17 13:18:12 $
|
||||
$Id: dnd.rb,v 1.9 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
class SrcWindow < Gtk::Window
|
||||
def initialize
|
||||
super("Source Window")
|
||||
@label = Gtk::Label.new("Drag here!")
|
||||
add(@label)
|
||||
set_default_size(100, 100)
|
||||
Gtk::Drag.source_set(self, Gdk::Window::BUTTON1_MASK |
|
||||
Gdk::Window::BUTTON2_MASK,
|
||||
[["test", Gtk::Drag::TARGET_SAME_APP, 12345]],
|
||||
Gdk::DragContext::ACTION_COPY |
|
||||
Gdk::DragContext::ACTION_MOVE)
|
||||
signal_connect("drag_data_get") do |widget, context, selection_data, info, time|
|
||||
# selection_data.set("text/uri-list", 8, "hoge.txt")
|
||||
selection_data.set(Gdk::Selection::TYPE_STRING, "hoge.txt")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
class DestWindow < Gtk::Window
|
||||
def initialize
|
||||
super("Dest Window")
|
||||
|
||||
@label = Gtk::Label.new("Drop here!")
|
||||
add(@label)
|
||||
set_default_size(100, 100)
|
||||
Gtk::Drag.dest_set(self, Gtk::Drag::DEST_DEFAULT_MOTION |
|
||||
Gtk::Drag::DEST_DEFAULT_HIGHLIGHT,
|
||||
[["test", Gtk::Drag::TARGET_SAME_APP, 12345]],
|
||||
Gdk::DragContext::ACTION_COPY|Gdk::DragContext::ACTION_MOVE)
|
||||
|
||||
signal_connect("drag-data-received") do |w, dc, x, y, selectiondata, info, time|
|
||||
dc.targets.each do |target|
|
||||
if target.name == "test" ||
|
||||
selectiondata.type == Gdk::Selection::TYPE_STRING
|
||||
puts selectiondata.data
|
||||
end
|
||||
end
|
||||
end
|
||||
signal_connect("drag-drop") do |w, dc, x, y, time|
|
||||
Gtk::Drag.get_data(w, dc, dc.targets[0], time)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
win1 = SrcWindow.new
|
||||
win2 = DestWindow.new
|
||||
|
||||
win1.show_all.signal_connect("destroy"){Gtk.main_quit}
|
||||
win2.show_all.signal_connect("destroy"){Gtk.main_quit}
|
||||
|
||||
Gtk.main
|
||||
|
56
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/dndtreeview.rb
Normal file
56
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/dndtreeview.rb
Normal file
@ -0,0 +1,56 @@
|
||||
=begin
|
||||
dndtreeview.rb - Drag and Drop sample script.
|
||||
|
||||
Copyright (C) 2003-2006 Masao Mutoh
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Date: 2006/06/17 13:18:12 $
|
||||
$Id: dndtreeview.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
class TestWindow < Gtk::Window
|
||||
attr_reader :list
|
||||
|
||||
TARGET_TABLE = [["GTK_TREE_MODEL_ROW", 0, 0]]
|
||||
|
||||
def initialize()
|
||||
super("Drag and Drop Gtk::TreeView")
|
||||
|
||||
set_default_size(300,128)
|
||||
signal_connect("destroy") { Gtk.main_quit }
|
||||
|
||||
data = [["Hello", "KON-NI-CHIWA"],
|
||||
["Goodbye", "SAYO-NARA"],
|
||||
["Good morning", "OHA-YO-GOZAI-MASU"],
|
||||
["Good evening", "KON-BAN-WA"]]
|
||||
|
||||
model = Gtk::ListStore.new(String, String)
|
||||
view = Gtk::TreeView.new(model)
|
||||
renderer = Gtk::CellRendererText.new
|
||||
col1 = Gtk::TreeViewColumn.new("Data", renderer, {:text => 0})
|
||||
col2 = Gtk::TreeViewColumn.new("Data", renderer, {:text => 1})
|
||||
view.append_column(col1)
|
||||
view.append_column(col2)
|
||||
|
||||
data.each do |v1, v2|
|
||||
iter = model.append
|
||||
iter.set_value(0, v1)
|
||||
iter.set_value(1, v2)
|
||||
end
|
||||
|
||||
view.enable_model_drag_source(Gdk::Window::BUTTON1_MASK,
|
||||
TARGET_TABLE,
|
||||
Gdk::DragContext::ACTION_COPY|Gdk::DragContext::ACTION_MOVE)
|
||||
view.enable_model_drag_dest(TARGET_TABLE,
|
||||
Gdk::DragContext::ACTION_COPY|Gdk::DragContext::ACTION_MOVE)
|
||||
|
||||
add(view)
|
||||
end
|
||||
end
|
||||
|
||||
win = TestWindow.new.show_all
|
||||
|
||||
Gtk.main
|
||||
|
131
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/drag-move.rb
Normal file
131
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/drag-move.rb
Normal file
@ -0,0 +1,131 @@
|
||||
=begin
|
||||
drag-move.rb - Move widget by drag sample script.
|
||||
|
||||
Copyright (C) 2006 Kouhei Sutou
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Date: 2006/06/17 13:18:12 $
|
||||
$Id: drag-move.rb,v 1.2 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
class DraggableWidget < Gtk::EventBox
|
||||
def initialize
|
||||
super
|
||||
set_visible_window(false)
|
||||
@dragging = false
|
||||
@drag_button = 1
|
||||
set_button_press_event
|
||||
set_button_release_event
|
||||
set_motion_notify_event
|
||||
end
|
||||
|
||||
def layout
|
||||
parent
|
||||
end
|
||||
|
||||
def move(x, y)
|
||||
if layout
|
||||
layout.move(self, x, y)
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
def dragging?
|
||||
@dragging
|
||||
end
|
||||
|
||||
private
|
||||
def set_button_press_event
|
||||
signal_connect("button_press_event") do |widget, event|
|
||||
if event.button == @drag_button
|
||||
Gtk.grab_add(widget)
|
||||
x, y, w, h = widget.allocation.to_a
|
||||
drag_start(x, y, event.x_root, event.y_root)
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def set_motion_notify_event
|
||||
signal_connect("motion_notify_event") do |widget, event|
|
||||
if dragging?
|
||||
drag_motion(event.x_root, event.y_root)
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def set_button_release_event
|
||||
signal_connect("button_release_event") do |widget, event|
|
||||
if event.button == @drag_button
|
||||
Gtk.grab_remove(widget)
|
||||
drag_end
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def set_drag_move_position_event
|
||||
signal_connect("drag_move_position") do |widget, x, y|
|
||||
if layout
|
||||
layout.move(widget, x, y)
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def drag_start(x, y, base_x, base_y)
|
||||
@dragging = true
|
||||
@drag_x = x
|
||||
@drag_y = y
|
||||
@drag_base_x = base_x
|
||||
@drag_base_y = base_y
|
||||
true
|
||||
end
|
||||
|
||||
def drag_motion(base_x, base_y)
|
||||
delta_x = base_x - @drag_base_x
|
||||
delta_y = base_y - @drag_base_y
|
||||
if delta_x != 0 and delta_y != 0
|
||||
move(@drag_x + delta_x, @drag_y + delta_y)
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
def drag_end
|
||||
@dragging = false
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
window = Gtk::Window.new("Draggable Widget sample")
|
||||
window.signal_connect("destroy"){Gtk.main_quit}
|
||||
|
||||
layout = Gtk::Layout.new
|
||||
|
||||
draggable_widget = DraggableWidget.new
|
||||
draggable_widget.set_size_request(50, 50)
|
||||
layout.put(draggable_widget, 75, 75)
|
||||
|
||||
draggable_widget.signal_connect("expose_event") do |widget, event|
|
||||
x, y, w, h = widget.allocation.to_a
|
||||
fg = Gdk::GC.new(widget.window)
|
||||
widget.window.draw_arc(fg, true, x, y, w, h, 0 * 64, 360 * 64)
|
||||
false
|
||||
end
|
||||
|
||||
window.add(layout)
|
||||
|
||||
window.show_all
|
||||
|
||||
Gtk.main
|
90
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/drawing.rb
Normal file
90
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/drawing.rb
Normal file
@ -0,0 +1,90 @@
|
||||
=begin
|
||||
drawing.rb - Gtk::Drawing sample script.
|
||||
|
||||
Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: drawing.rb,v 1.7 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
class Canvas < Gtk::DrawingArea
|
||||
def initialize
|
||||
super
|
||||
signal_connect("expose_event") { |w,e| expose_event(w,e) }
|
||||
signal_connect("configure_event") { |w, e| configure_event(w,e) }
|
||||
@buffer = nil
|
||||
@bgc = nil
|
||||
end
|
||||
|
||||
def expose_event(w,e)
|
||||
unless @buffer.nil?
|
||||
rec = e.area
|
||||
w.window.draw_drawable(@bgc, @buffer, rec.x, rec.y,
|
||||
rec.x, rec.y, rec.width, rec.height)
|
||||
end
|
||||
false
|
||||
end
|
||||
|
||||
def clear(b = @buffer)
|
||||
return if b.nil?
|
||||
|
||||
g = b.size
|
||||
@bgc = self.style.bg_gc(self.state) if @bgc.nil?
|
||||
if (g[0] > 0 && g[1] > 0)
|
||||
b.draw_rectangle(@bgc, true, 0,0, g[0], g[1])
|
||||
end
|
||||
end
|
||||
|
||||
def configure_event(w,e)
|
||||
g = w.window.geometry
|
||||
if (g[2] > 0 && g[3] > 0)
|
||||
b = Gdk::Pixmap::new(w.window, g[2], g[3], -1)
|
||||
clear(b)
|
||||
if not @buffer.nil?
|
||||
g = @buffer.size
|
||||
b.draw_drawable(@bgc, @buffer, 0, 0, 0, 0, g[0], g[1])
|
||||
end
|
||||
@buffer = b
|
||||
end
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
class A < Canvas
|
||||
def initialize
|
||||
super
|
||||
signal_connect("button_press_event") { |w,e| pressed(w,e) }
|
||||
set_events(Gdk::Event::BUTTON_PRESS_MASK)
|
||||
end
|
||||
|
||||
def pressed(widget, ev)
|
||||
if not @last.nil?
|
||||
@buffer.draw_line(widget.style.fg_gc(widget.state),
|
||||
@last.x, @last.y, ev.x, ev.y)
|
||||
|
||||
x1,x2 = if (@last.x < ev.x)
|
||||
then [@last.x, ev.x]
|
||||
else [ev.x, @last.x]
|
||||
end
|
||||
y1,y2 = if (@last.y < ev.y)
|
||||
then [@last.y, ev.y]
|
||||
else [ev.y, @last.y]
|
||||
end
|
||||
widget.queue_draw_area(x1, y1, x2 - x1 + 1, y2 - y1 + 1)
|
||||
end
|
||||
@last = nil
|
||||
@last = ev
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
window = Gtk::Window.new("drawing test")
|
||||
window.signal_connect("destroy") { Gtk.main_quit }
|
||||
|
||||
canvas = A.new
|
||||
window.add(canvas)
|
||||
|
||||
window.show_all
|
||||
Gtk::main
|
34
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/entry.rb
Normal file
34
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/entry.rb
Normal file
@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
entry.rb - Ruby/GTK2 sample script.
|
||||
|
||||
Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: entry.rb,v 1.9 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
window = Gtk::Window.new("entry")
|
||||
window.border_width = 0
|
||||
|
||||
box1 = Gtk::VBox.new(false, 10)
|
||||
window.add(box1)
|
||||
|
||||
entry = Gtk::Entry.new
|
||||
|
||||
box1.add(entry)
|
||||
box1.add(Gtk::HSeparator.new)
|
||||
|
||||
button = Gtk::Button.new("close")
|
||||
button.signal_connect("clicked") do
|
||||
Gtk.main_quit
|
||||
end
|
||||
box1.add(button)
|
||||
|
||||
window.show_all
|
||||
|
||||
entry.text = "hello world"
|
||||
|
||||
Gtk.main
|
39
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/entrycompletion.rb
Normal file
39
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/entrycompletion.rb
Normal file
@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
entrycompletion.rb - Ruby/GTK sample script.
|
||||
|
||||
Copyright (c) 2004-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
Enter "G", "t" on the entry box.
|
||||
|
||||
$Id: entrycompletion.rb,v 1.4 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
if str = Gtk.check_version(2, 4, 0)
|
||||
puts "This sample requires GTK+ 2.4.0 or later"
|
||||
puts str
|
||||
exit
|
||||
end
|
||||
|
||||
window = Gtk::Window.new
|
||||
window.set_default_size(200, 200)
|
||||
|
||||
entry = Gtk::Entry.new
|
||||
completion = Gtk::EntryCompletion.new
|
||||
entry.completion = completion
|
||||
|
||||
model = Gtk::ListStore.new(String)
|
||||
["GNOME", "total", "totally"].each do |v|
|
||||
iter = model.append
|
||||
iter[0] = v
|
||||
end
|
||||
|
||||
completion.model = model
|
||||
completion.text_column = 0
|
||||
|
||||
window.add(entry).show_all.signal_connect("destroy"){Gtk.main_quit}
|
||||
|
||||
Gtk.main
|
27
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/expander.rb
Normal file
27
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/expander.rb
Normal file
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
expander.rb - Ruby/GTK2 sample script.
|
||||
|
||||
Copyright (c) 2004-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: expander.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
expander = Gtk::Expander.new("Expander Sample")
|
||||
expander.expanded = true
|
||||
|
||||
button = Gtk::Button.new("Hide this button.")
|
||||
button.signal_connect("clicked") do
|
||||
expander.expanded = false
|
||||
end
|
||||
|
||||
button.set_size_request(200, 200)
|
||||
expander.add(button)
|
||||
|
||||
Gtk::Window.new.add(expander).show_all.signal_connect("destroy"){Gtk.main_quit}
|
||||
|
||||
Gtk.main
|
||||
|
49
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/filechooser.rb
Normal file
49
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/filechooser.rb
Normal file
@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
filechooser.rb - Ruby/GTK2 sample script.
|
||||
|
||||
Copyright (c) 2004-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: filechooser.rb,v 1.5 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require "gtk2"
|
||||
|
||||
if str = Gtk.check_version(2, 4, 0)
|
||||
puts "This sample requires GTK+ 2.4.0 or later"
|
||||
puts str
|
||||
exit
|
||||
end
|
||||
|
||||
dialog = Gtk::FileChooserDialog.new("Gtk::FileChooser sample", nil,
|
||||
Gtk::FileChooser::ACTION_OPEN,
|
||||
"gnome-vfs",
|
||||
[Gtk::Stock::OPEN, Gtk::Dialog::RESPONSE_ACCEPT],
|
||||
[Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL]
|
||||
)
|
||||
|
||||
extra_button = Gtk::Button.new("Extra button")
|
||||
extra_button.signal_connect("clicked") do
|
||||
puts "extra button is clicked"
|
||||
end
|
||||
|
||||
dialog.extra_widget = extra_button
|
||||
|
||||
filter_rb = Gtk::FileFilter.new
|
||||
filter_rb.name = "Ruby Scripts"
|
||||
filter_rb.add_pattern("*.rb")
|
||||
filter_rb.add_pattern("*.rbw")
|
||||
dialog.add_filter(filter_rb)
|
||||
|
||||
filter_c = Gtk::FileFilter.new
|
||||
filter_c.name = "C sources"
|
||||
filter_c.add_pattern("*.[c|h]")
|
||||
dialog.add_filter(filter_c)
|
||||
|
||||
dialog.add_shortcut_folder("/tmp")
|
||||
|
||||
if dialog.run == Gtk::Dialog::RESPONSE_ACCEPT
|
||||
puts "filename = #{dialog.filename}"
|
||||
puts "uri = #{dialog.uri}"
|
||||
end
|
26
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/fileselection.rb
Normal file
26
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/fileselection.rb
Normal file
@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
fileselection.rb - Ruby/GTK2 sample script.
|
||||
|
||||
Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: fileselection.rb,v 1.10 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
puts "Deprecated. Use Gtk::FileChooserDialog instead."
|
||||
|
||||
window = Gtk::FileSelection.new("file selection dialog")
|
||||
window.window_position = Gtk::Window::POS_MOUSE
|
||||
window.border_width = 0
|
||||
|
||||
ret = window.run
|
||||
if ret == Gtk::Dialog::RESPONSE_OK
|
||||
puts "OK"
|
||||
puts window.filename
|
||||
elsif ret == Gtk::Dialog::RESPONSE_CANCEL
|
||||
puts "CANCEL"
|
||||
puts window.filename
|
||||
end
|
69
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/frame.rb
Normal file
69
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/frame.rb
Normal file
@ -0,0 +1,69 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
frame.rb - Ruby/GTK2 sample script.
|
||||
|
||||
Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: frame.rb,v 1.9 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
window = Gtk::Window.new("buttons")
|
||||
window.signal_connect("destroy") do
|
||||
Gtk.main_quit
|
||||
end
|
||||
window.border_width = 0
|
||||
|
||||
box1 = Gtk::VBox.new(false, 0)
|
||||
window.add(box1)
|
||||
|
||||
box2 = Gtk::HBox.new(false, 5)
|
||||
box2.border_width = 10
|
||||
box1.pack_start(box2, true, true, 0)
|
||||
|
||||
label = Gtk::Label.new("Hello World")
|
||||
frame = Gtk::Frame.new("Frame 1")
|
||||
box2.pack_start(frame, true, true, 0)
|
||||
|
||||
box3 = Gtk::VBox.new(false, 5)
|
||||
box3.border_width = 5
|
||||
frame.add(box3)
|
||||
|
||||
button = Gtk::Button.new("switch")
|
||||
button.signal_connect("clicked") do
|
||||
label.reparent(box3)
|
||||
end
|
||||
box3.pack_start(button, false, true, 0)
|
||||
box3.pack_start(label, false, true, 0)
|
||||
|
||||
frame = Gtk::Frame.new("Frame 2")
|
||||
box2.pack_start(frame, true, true, 0)
|
||||
|
||||
box4 = Gtk::VBox.new(false, 5)
|
||||
box4.border_width = 5
|
||||
frame.add(box4)
|
||||
|
||||
button = Gtk::Button.new("switch")
|
||||
button.signal_connect("clicked") do
|
||||
label.reparent(box4)
|
||||
end
|
||||
box4.pack_start(button, false, true, 0)
|
||||
|
||||
separator = Gtk::HSeparator.new
|
||||
box1.pack_start(separator, false, true, 0)
|
||||
|
||||
box2 = Gtk::HBox.new(false, 10)
|
||||
box2.border_width = 10
|
||||
box1.pack_start(box2, false, true, 0)
|
||||
|
||||
button = Gtk::Button.new("close")
|
||||
button.signal_connect("clicked") do
|
||||
Gtk.main_quit
|
||||
end
|
||||
box2.pack_start(button)
|
||||
|
||||
window.show_all
|
||||
|
||||
Gtk.main
|
59
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/gc.rb
Normal file
59
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/gc.rb
Normal file
@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
gc.rb - Ruby/GTK sample script.
|
||||
|
||||
Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: gc.rb,v 1.6 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
window = Gtk::Window.new("Gdk::GC sample")
|
||||
window.set_default_size(300, 300)
|
||||
window.app_paintable = true
|
||||
window.realize
|
||||
|
||||
drawable = window.window
|
||||
gc = Gdk::GC.new(drawable)
|
||||
|
||||
red = Gdk::Color.new(65535, 0, 0)
|
||||
green = Gdk::Color.new(0, 65535, 0)
|
||||
colormap = Gdk::Colormap.system
|
||||
colormap.alloc_color(red, false, true)
|
||||
colormap.alloc_color(green, false, true)
|
||||
|
||||
window.signal_connect("expose-event") do |win, evt|
|
||||
gc.set_foreground(red)
|
||||
gc.set_background(green)
|
||||
|
||||
gc.set_line_attributes(5, Gdk::GC::LINE_SOLID, Gdk::GC::CAP_NOT_LAST, Gdk::GC::JOIN_MITER)
|
||||
drawable.draw_line(gc, 20, 10, 150, 10)
|
||||
gc.set_line_attributes(5, Gdk::GC::LINE_ON_OFF_DASH, Gdk::GC::CAP_NOT_LAST, Gdk::GC::JOIN_MITER)
|
||||
drawable.draw_line(gc, 20, 30, 150, 30)
|
||||
gc.set_line_attributes(5, Gdk::GC::LINE_DOUBLE_DASH, Gdk::GC::CAP_NOT_LAST, Gdk::GC::JOIN_MITER)
|
||||
drawable.draw_line(gc, 20, 50, 150, 50)
|
||||
|
||||
gc.set_line_attributes(30, Gdk::GC::LINE_SOLID, Gdk::GC::CAP_NOT_LAST, Gdk::GC::JOIN_MITER)
|
||||
drawable.draw_line(gc, 20, 100, 120, 100)
|
||||
gc.set_line_attributes(30, Gdk::GC::LINE_SOLID, Gdk::GC::CAP_BUTT, Gdk::GC::JOIN_MITER)
|
||||
drawable.draw_line(gc, 20, 140, 120, 140)
|
||||
gc.set_line_attributes(30, Gdk::GC::LINE_SOLID, Gdk::GC::CAP_ROUND, Gdk::GC::JOIN_MITER)
|
||||
drawable.draw_line(gc, 20, 180, 120, 180)
|
||||
gc.set_line_attributes(30, Gdk::GC::LINE_SOLID, Gdk::GC::CAP_PROJECTING, Gdk::GC::JOIN_MITER)
|
||||
drawable.draw_line(gc, 20, 220, 120, 220)
|
||||
|
||||
gc.set_line_attributes(40, Gdk::GC::LINE_SOLID, Gdk::GC::CAP_NOT_LAST, Gdk::GC::JOIN_MITER)
|
||||
drawable.draw_lines(gc, [[200, 80], [220, 30], [280, 50]])
|
||||
gc.set_line_attributes(40, Gdk::GC::LINE_SOLID, Gdk::GC::CAP_NOT_LAST, Gdk::GC::JOIN_ROUND)
|
||||
drawable.draw_lines(gc, [[200, 170], [220, 120], [280, 140]])
|
||||
gc.set_line_attributes(40, Gdk::GC::LINE_SOLID, Gdk::GC::CAP_NOT_LAST, Gdk::GC::JOIN_BEVEL)
|
||||
drawable.draw_lines(gc, [[200, 260], [220, 210], [280, 230]])
|
||||
end
|
||||
|
||||
window.show_all.signal_connect("destroy"){Gtk.main_quit}
|
||||
|
||||
Gtk.main
|
||||
|
||||
|
32
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/gdkscreen.rb
Normal file
32
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/gdkscreen.rb
Normal file
@ -0,0 +1,32 @@
|
||||
=begin
|
||||
gdkscreen.rb - Gdk::Screen sample script.
|
||||
|
||||
Copyright (C) 2004-2006 Masao Mutoh
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: gdkscreen.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
screen = Gdk::Screen.default
|
||||
settings_map = [
|
||||
"gtk-double-click-time",
|
||||
"gtk-dnd-drag-threshold",
|
||||
"gtk-can-change-accels",
|
||||
"gtk-color-palette",
|
||||
"gtk-font-name",
|
||||
"gtk-icon-sizes",
|
||||
"gtk-key-theme-name",
|
||||
"gtk-toolbar-style",
|
||||
"gtk-toolbar-icon-size",
|
||||
"gtk-im-preedit-style",
|
||||
"gtk-im-status-style",
|
||||
"gtk-cursor-blink",
|
||||
"gtk-cursor-blink-time",
|
||||
"gtk-theme-name"
|
||||
]
|
||||
|
||||
settings_map.each do |v|
|
||||
puts "#{v}: #{screen.get_setting(v)}"
|
||||
end
|
BIN
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/gnome-logo-icon.png
Normal file
BIN
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/gnome-logo-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.0 KiB |
35
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/helloworld.rb
Normal file
35
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/helloworld.rb
Normal file
@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
helloworld.rb - Ruby/GTK2 first sample script.
|
||||
|
||||
Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: helloworld.rb,v 1.7 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
button = Gtk::Button.new("Hello World")
|
||||
button.signal_connect("clicked") {
|
||||
puts "Hello World"
|
||||
}
|
||||
|
||||
window = Gtk::Window.new("Hello World sample")
|
||||
window.signal_connect("delete_event") {
|
||||
puts "delete event occurred"
|
||||
#true
|
||||
false
|
||||
}
|
||||
|
||||
window.signal_connect("destroy") {
|
||||
puts "destroy event occurred"
|
||||
Gtk.main_quit
|
||||
}
|
||||
|
||||
window.border_width = 10
|
||||
window.add(button)
|
||||
window.show_all
|
||||
|
||||
Gtk.main
|
||||
|
38
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/iconview.rb
Normal file
38
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/iconview.rb
Normal file
@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
iconview.rb - Ruby/GTK2 sample script.
|
||||
|
||||
Copyright (c) 2005,2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: iconview.rb,v 1.2 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
TEXT_COLUMN = 0
|
||||
PIXBUF_COLUMN = 1
|
||||
|
||||
model = Gtk::ListStore.new(String, Gdk::Pixbuf)
|
||||
|
||||
iv = Gtk::IconView.new(model)
|
||||
|
||||
iv.text_column = TEXT_COLUMN
|
||||
iv.pixbuf_column = PIXBUF_COLUMN
|
||||
|
||||
Dir.glob("../gtk-demo/gnome*.png").each do |f|
|
||||
iter = model.append
|
||||
iter[TEXT_COLUMN] = File.basename(f)
|
||||
iter[PIXBUF_COLUMN] = Gdk::Pixbuf.new(f)
|
||||
end
|
||||
|
||||
iv.signal_connect("item_activated") do |iv, path|
|
||||
iter = model.get_iter(path)
|
||||
p iter [0]
|
||||
end
|
||||
|
||||
win = Gtk::Window.new("Gtk::IconView sample")
|
||||
win.signal_connect("destroy"){Gtk.main_quit}
|
||||
win.add(iv).set_default_size(300,300).show_all
|
||||
|
||||
Gtk.main
|
42
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/image.rb
Normal file
42
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/image.rb
Normal file
@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
image.rb - Ruby/GTK sample script.
|
||||
|
||||
Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: image.rb,v 1.9 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
window = Gtk::Window.new("Image")
|
||||
window.signal_connect("destroy") do
|
||||
Gtk.main_quit
|
||||
end
|
||||
window.border_width = 0
|
||||
|
||||
box1 = Gtk::VBox.new(false, 10)
|
||||
box1.border_width = 10
|
||||
|
||||
button = Gtk::Button.new
|
||||
box1.add(button)
|
||||
|
||||
label = Gtk::Label.new("Gtk::Image\ntest")
|
||||
image = Gtk::Image.new("test.xpm")
|
||||
|
||||
box2 = Gtk::HBox.new(false, 5).add(image).add(label)
|
||||
|
||||
button.add(box2)
|
||||
|
||||
box1.add(Gtk::HSeparator.new)
|
||||
|
||||
button = Gtk::Button.new("close")
|
||||
button.signal_connect("clicked") do
|
||||
Gtk.main_quit
|
||||
end
|
||||
box1.add(button)
|
||||
|
||||
window.add(box1).show_all
|
||||
|
||||
Gtk.main
|
24
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/infobar.rb
Executable file
24
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/infobar.rb
Executable file
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
label=Gtk::Label.new.show
|
||||
|
||||
info=Gtk::InfoBar.new
|
||||
info.no_show_all=true
|
||||
info.content_area.add(label)
|
||||
info.add_button(Gtk::Stock::OK, Gtk::ResponseType::OK)
|
||||
info.signal_connect('response'){|info, response| info.hide}
|
||||
|
||||
w=Gtk::Window.new
|
||||
w.add(info)
|
||||
w.show_all
|
||||
w.signal_connect("delete_event"){Gtk.main_quit}
|
||||
|
||||
GLib::Timeout.add_seconds(1){
|
||||
label.text='ERROR'
|
||||
info.message_type=Gtk::MessageType::ERROR
|
||||
info.show
|
||||
false
|
||||
}
|
||||
Gtk.main
|
73
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/itemfactory.rb
Normal file
73
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/itemfactory.rb
Normal file
@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
itemfactory.rb - Ruby/GTK sample script.
|
||||
|
||||
Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
*NOTE* Gtk::ItemFactory has been deprecated. Use Gtk::UIManager instead.
|
||||
|
||||
$Id: itemfactory.rb,v 1.7 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
puts "Deprecated. Use Gtk::UIManager instead."
|
||||
|
||||
window = Gtk::Window.new("Gtk::ItemFactory")
|
||||
window.signal_connect("destroy") do
|
||||
Gtk.main_quit
|
||||
end
|
||||
window.signal_connect("delete_event") do
|
||||
Gtk.main_quit
|
||||
end
|
||||
|
||||
accelgroup = Gtk::AccelGroup.new
|
||||
window.add_accel_group(accelgroup)
|
||||
|
||||
ifp = Gtk::ItemFactory.new(Gtk::ItemFactory::TYPE_MENU_BAR, "<main>", accelgroup)
|
||||
|
||||
cal_stock = Proc.new {|d, item| p "StockItem, #{d}"}
|
||||
cal_quit = Proc.new{p "Quit"; Gtk.main_quit}
|
||||
cal_check = Proc.new {|d, item| p "CheckItem, #{d}"}
|
||||
cal_toggle = Proc.new {|d, item| p "ToggleItem, #{d}"}
|
||||
cal_radio = Proc.new {|d, item| p "RadioItem, #{d}"}
|
||||
cal_misc = Proc.new {|d, item| p "Misc #{d}"}
|
||||
ifp.create_items([
|
||||
["/_Stock"],
|
||||
["/_Stock/_New", "<StockItem>", "<control>N", Gtk::Stock::NEW, cal_stock, 1],
|
||||
["/_Stock/_Open", "<StockItem>", "<control>O", Gtk::Stock::OPEN, cal_stock, 2],
|
||||
["/_Stock/_Quit", "<StockItem>", "<control>Q", Gtk::Stock::QUIT, cal_quit],
|
||||
|
||||
["/_Check"],
|
||||
["/_Check/Check_1", "<CheckItem>", "", "", cal_check, 1],
|
||||
["/_Check/Check_2", "<CheckItem>", "", "", cal_check, 2],
|
||||
|
||||
["/_Toggle"],
|
||||
["/_Toggle/Toggle_1", "<ToggleItem>", "", "", cal_toggle, 1],
|
||||
["/_Toggle/Toggle_2", "<ToggleItem>", "", "", cal_toggle, 2],
|
||||
["/_Toggle/Toggle_3", "<ToggleItem>", "", "", cal_toggle, 3],
|
||||
|
||||
["/_Radio", "<Branch>"],
|
||||
["/_Radio/Radio_1", "<RadioItem>", nil, nil, cal_radio, 1],
|
||||
["/_Radio/Radio_2", "/Radio/Radio1", nil, nil, cal_radio, 2],
|
||||
["/_Radio/Radio_3", "/Radio/Radio1", nil, nil, cal_radio, 3],
|
||||
|
||||
["/_Misc", "<LastBranch>"],
|
||||
["/_Misc/Tearoff", "<Tearoff>"],
|
||||
["/_Misc/Title", "<Title>"],
|
||||
["/_Misc/Image", "<ImageItem>", "", Gdk::Pixbuf.new("gnome-logo-icon.png"), cal_misc, 1],
|
||||
["/_Misc/Separator", "<Separator>"],
|
||||
["/_Misc/Item", "<Item>", nil, nil, cal_misc, 2]
|
||||
])
|
||||
|
||||
ifp.get_widget("/Stock/Open").sensitive = false
|
||||
ifp.delete_item("/Toggle/Toggle2")
|
||||
|
||||
vbox = Gtk::VBox.new
|
||||
vbox.add(ifp.get_widget("<main>"))
|
||||
vbox.add(Gtk::Label.new("Gtk::ItemFactory sample").set_size_request(400, 200))
|
||||
window.add(vbox)
|
||||
window.show_all
|
||||
|
||||
Gtk.main
|
74
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/itemfactory2.rb
Normal file
74
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/itemfactory2.rb
Normal file
@ -0,0 +1,74 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
itemfactory2.rb - Ruby/GTK sample script.
|
||||
|
||||
Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
*NOTE* Gtk::ItemFactory has been deprecated. Use Gtk::UIManager instead.
|
||||
|
||||
$Id: itemfactory2.rb,v 1.8 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
puts "Deprecated. Use Gtk::UIManager instead."
|
||||
|
||||
window = Gtk::Window.new("Gtk::ItemFactory2")
|
||||
window.signal_connect("destroy") do
|
||||
Gtk.main_quit
|
||||
end
|
||||
window.signal_connect("delete_event") do
|
||||
Gtk.main_quit
|
||||
end
|
||||
|
||||
accelgroup = Gtk::AccelGroup.new
|
||||
window.add_accel_group(accelgroup)
|
||||
|
||||
ifp = Gtk::ItemFactory.new(Gtk::ItemFactory::TYPE_MENU_BAR, "<main>", accelgroup)
|
||||
|
||||
ifp.create_item("/_Stock")
|
||||
ifp.create_item("/_Stock/_New", "<StockItem>", "<control>N", Gtk::Stock::NEW, 1) do |v, _|
|
||||
p "StockItem #{v}"
|
||||
end
|
||||
item = ifp.create_item("/_Stock/_Open", "<StockItem>", "<control>O", Gtk::Stock::OPEN, 2) do |v, _|
|
||||
p "StockItem #{v}"
|
||||
end
|
||||
ifp.create_item("/_Stock/_Quit", "<StockItem>", "<control>Q", Gtk::Stock::QUIT, 3) do |v, _|
|
||||
p "Quit"
|
||||
Gtk.main_quit
|
||||
end
|
||||
|
||||
ifp.create_item("/_Item")
|
||||
ifp.create_item("/_Item/Item_1", "<Item>"){p "Item1"}
|
||||
ifp.create_item("/_Item/Item_2", "<Item>"){p "Item2"}
|
||||
|
||||
ifp.create_item("/_Check")
|
||||
ifp.create_item("/_Check/Check_1", "<CheckItem>"){p "Check1"}
|
||||
ifp.create_item("/_Check/Check_2", "<CheckItem>"){p "Check2"}
|
||||
|
||||
ifp.create_item("/_Toggle")
|
||||
ifp.create_item("/_Toggle/Toggle_1", "<ToggleItem>", nil, nil, 1){|v, _| p "Toggle#{v}"}
|
||||
ifp.create_item("/_Toggle/Toggle_2", "<ToggleItem>", nil, nil, 2){|v, _| p "Toggle#{v}"}
|
||||
|
||||
ifp.create_item("/_Radio")
|
||||
ifp.create_item("/_Radio/Radio_1", "<RadioItem>", nil, nil, 1){|v, _| p "Radio#{v}"}
|
||||
ifp.create_item("/_Radio/Radio_2", "/Radio/Radio1", nil, nil, 2){|v, _| p "Radio#{v}"}
|
||||
ifp.create_item("/_Radio/Radio_3", "/Radio/Radio1", nil, nil, 3){|v, _| p "Radio#{v}"}
|
||||
|
||||
ifp.create_item("/_Misc", "<LastBranch>")
|
||||
ifp.create_item("/_Misc/Tearoff", "<Tearoff>")
|
||||
ifp.create_item("/_Misc/Title", "<Title>")
|
||||
ifp.create_item("/_Misc/Seperator", "<Separator>")
|
||||
ifp.create_item("/_Misc/Image", "<ImageItem>", "", Gdk::Pixbuf.new("gnome-logo-icon.png")) do
|
||||
p "ImageItem"
|
||||
end
|
||||
|
||||
ifp.get_widget("/Stock/Open").sensitive = false
|
||||
vbox = Gtk::VBox.new
|
||||
vbox.add(ifp.get_widget("<main>"))
|
||||
vbox.add(Gtk::Label.new("Gtk::ItemFactory sample").set_size_request(400, 200))
|
||||
window.add(vbox)
|
||||
window.show_all
|
||||
|
||||
Gtk.main
|
29
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/keyboard_grab.rb
Normal file
29
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/keyboard_grab.rb
Normal file
@ -0,0 +1,29 @@
|
||||
=begin
|
||||
keyboard_grab.rb - Gdk::Window#keyboard_grab/ungrab sample script.
|
||||
|
||||
Copyright (C) 2001-2006 Masao Mutoh
|
||||
This program is licenced under the same licence as Ruby-GNOME.
|
||||
|
||||
$Date: 2006/06/17 13:18:12 $
|
||||
$Id: keyboard_grab.rb,v 1.5 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
window = Gtk::Window.new("Keyboard Grab/Ungrab sample")
|
||||
|
||||
button1 = Gtk::Button.new("Grab Keyboard!")
|
||||
button2 = Gtk::Button.new("Ungrab Keyboard!")
|
||||
|
||||
button1.signal_connect('clicked') do
|
||||
Gdk.keyboard_grab(window.window, true, Gdk::Event::CURRENT_TIME)
|
||||
end
|
||||
|
||||
button2.signal_connect('clicked') do
|
||||
Gdk.keyboard_ungrab(Gdk::Event::CURRENT_TIME)
|
||||
end
|
||||
|
||||
window.add(Gtk::VBox.new.add(button1).add(button2))
|
||||
window.set_default_size(200,100).show_all.signal_connect("destroy"){Gtk.main_quit}
|
||||
|
||||
Gtk.main
|
33
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/label.rb
Normal file
33
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/label.rb
Normal file
@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
label.rb - Ruby/GTK2 sample script.
|
||||
|
||||
Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: label.rb,v 1.8 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
win = Gtk::Window.new("Gtk::Label sample")
|
||||
win.signal_connect("destroy"){Gtk.main_quit}
|
||||
label1 = Gtk::Label.new("_Not Use Mnemonic")
|
||||
label1.selectable = true
|
||||
label2 = Gtk::Label.new("_Use Mnemonic", true)
|
||||
label3 = Gtk::Label.new.set_markup(%Q[<markup><span size="xx-large" weight="bold" foreground="blue"><u>Ruby-GNOME2</u></span> is <span foreground="red" size="x-large"><i>cool</i></span>!</markup>], true)
|
||||
label4 = Gtk::Label.new.set_markup(%Q[<span foreground="#999900">_Not Use Mnemonic</span>])
|
||||
label5 = Gtk::Label.new.set_markup(%Q[<span foreground="#009999">_Use Mnemonic</span>], true)
|
||||
|
||||
box = Gtk::VBox.new
|
||||
box.add(label1)
|
||||
box.add(label2)
|
||||
box.add(label3)
|
||||
box.add(label4)
|
||||
box.add(label5)
|
||||
win.add(box).show_all
|
||||
|
||||
# This can be called after realized only.
|
||||
label1.select_region(3, 8)
|
||||
|
||||
Gtk.main
|
42
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/linkbutton.rb
Normal file
42
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/linkbutton.rb
Normal file
@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
linkbutton.rb - Gtk::LinkButton sample.
|
||||
|
||||
Copyright (c) 2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: linkbutton.rb,v 1.1 2006/10/21 16:58:00 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
window = Gtk::Window.new("Gtk::LinkButton sample")
|
||||
window.signal_connect("destroy"){Gtk.main_quit}
|
||||
|
||||
vbox = Gtk::VBox.new
|
||||
|
||||
# URI only
|
||||
button1 = Gtk::LinkButton.new("http://ruby-gnome2.sourceforge.jp/")
|
||||
button1.signal_connect("clicked") do
|
||||
puts button1.uri
|
||||
end
|
||||
vbox.pack_start(button1)
|
||||
|
||||
# URI with a label
|
||||
button2 = Gtk::LinkButton.new("http://ruby-gnome2.sourceforge.jp/",
|
||||
"Ruby-GNOME2 Website")
|
||||
button2.signal_connect("clicked") do
|
||||
puts button2.uri
|
||||
end
|
||||
|
||||
# Global setting instead of using clicked signals.
|
||||
Gtk::LinkButton.set_uri_hook {|button, link|
|
||||
puts "set_uri_hook: " + link
|
||||
}
|
||||
|
||||
vbox.pack_start(button2)
|
||||
|
||||
window.add(vbox)
|
||||
window.show_all
|
||||
|
||||
Gtk.main
|
92
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/listview.rb
Normal file
92
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/listview.rb
Normal file
@ -0,0 +1,92 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
listview.rb - Ruby/GTK sample script.
|
||||
|
||||
Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: listview.rb,v 1.11 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
window = Gtk::Window.new("Gtk::ListStore sample")
|
||||
window.border_width = 0
|
||||
|
||||
box1 = Gtk::VBox.new(false, 0)
|
||||
window.add(box1)
|
||||
|
||||
box2 = Gtk::VBox.new(false, 10)
|
||||
box2.border_width = 10
|
||||
box1.pack_start(box2, true, true, 0)
|
||||
|
||||
scrolled_win = Gtk::ScrolledWindow.new
|
||||
scrolled_win.set_policy(Gtk::POLICY_AUTOMATIC,Gtk::POLICY_AUTOMATIC)
|
||||
box2.pack_start(scrolled_win, true, true, 0)
|
||||
|
||||
data = [
|
||||
"hello",
|
||||
"world",
|
||||
"blah",
|
||||
"foo",
|
||||
"bar",
|
||||
"argh",
|
||||
"spencer",
|
||||
"is a",
|
||||
"wussy",
|
||||
"programmer"
|
||||
]
|
||||
|
||||
model = Gtk::ListStore.new(String)
|
||||
column = Gtk::TreeViewColumn.new("Data",
|
||||
Gtk::CellRendererText.new, {:text => 0})
|
||||
treeview = Gtk::TreeView.new(model)
|
||||
treeview.append_column(column)
|
||||
treeview.selection.set_mode(Gtk::SELECTION_SINGLE)
|
||||
scrolled_win.add_with_viewport(treeview)
|
||||
|
||||
data.each do |v|
|
||||
iter = model.append
|
||||
iter[0] = v
|
||||
end
|
||||
|
||||
button = Gtk::Button.new("add")
|
||||
button.set_flags(Gtk::Widget::CAN_FOCUS)
|
||||
|
||||
i = 0
|
||||
button.signal_connect("clicked") do
|
||||
iter = model.append
|
||||
iter[0] = "add item #{i}"
|
||||
i += 1
|
||||
end
|
||||
|
||||
box2.pack_start(button, false, true, 0)
|
||||
|
||||
button = Gtk::Button.new("remove")
|
||||
button.set_flags(Gtk::Widget::CAN_FOCUS)
|
||||
button.signal_connect("clicked") do
|
||||
iter = treeview.selection.selected
|
||||
model.remove(iter) if iter
|
||||
end
|
||||
box2.pack_start(button, false, true, 0)
|
||||
|
||||
separator = Gtk::HSeparator.new
|
||||
box1.pack_start(separator, false, true, 0)
|
||||
separator.show
|
||||
|
||||
box2 = Gtk::VBox.new(false, 10)
|
||||
box2.border_width = 10
|
||||
box1.pack_start(box2, false, true, 0)
|
||||
|
||||
button = Gtk::Button.new("close")
|
||||
button.signal_connect("clicked") do
|
||||
Gtk.main_quit
|
||||
end
|
||||
box2.pack_start(button, true, true, 0)
|
||||
button.set_flags(Gtk::Widget::CAN_DEFAULT)
|
||||
button.grab_default
|
||||
|
||||
window.set_default_size(300, 300)
|
||||
window.show_all
|
||||
|
||||
Gtk.main
|
81
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/menu.rb
Normal file
81
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/menu.rb
Normal file
@ -0,0 +1,81 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
menu.rb - Ruby/GTK2 sample script.
|
||||
|
||||
Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: menu.rb,v 1.8 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
def create_menu(depth)
|
||||
return nil if depth < 1
|
||||
|
||||
menu = Gtk::Menu.new
|
||||
group = nil
|
||||
submenu = nil
|
||||
|
||||
for i in 0..4
|
||||
buf = sprintf("item %2d - %d", depth, i + 1)
|
||||
menuitem = Gtk::RadioMenuItem.new(group, buf)
|
||||
group = menuitem.group
|
||||
menu.append(menuitem)
|
||||
if depth > 1
|
||||
menuitem.set_submenu create_menu(depth - 1)
|
||||
end
|
||||
end
|
||||
menu
|
||||
end
|
||||
|
||||
window = Gtk::Window.new("menus")
|
||||
window.signal_connect("destroy") do
|
||||
Gtk.main_quit
|
||||
end
|
||||
window.border_width = 0
|
||||
|
||||
box1 = Gtk::VBox.new(false, 0)
|
||||
window.add(box1)
|
||||
|
||||
menubar = Gtk::MenuBar.new
|
||||
box1.pack_start(menubar, false, true, 0)
|
||||
|
||||
menu = create_menu(2)
|
||||
menuitem = Gtk::MenuItem.new("test\nline2")
|
||||
menuitem.set_submenu(menu)
|
||||
menubar.append(menuitem)
|
||||
|
||||
menuitem = Gtk::MenuItem.new("foo")
|
||||
menuitem.set_submenu(create_menu(3))
|
||||
menubar.append(menuitem)
|
||||
|
||||
menuitem = Gtk::MenuItem.new("bar")
|
||||
menuitem.set_submenu(create_menu(4))
|
||||
menubar.append(menuitem)
|
||||
|
||||
box2 = Gtk::VBox.new(false, 10)
|
||||
box2.border_width = 10
|
||||
box1.pack_start(box2, true, true, 0)
|
||||
|
||||
optionmenu = Gtk::OptionMenu.new
|
||||
optionmenu.set_menu(create_menu(1))
|
||||
optionmenu.set_history(4)
|
||||
box2.pack_start(optionmenu, true, true, 0)
|
||||
|
||||
separator = Gtk::HSeparator.new
|
||||
box1.pack_start(separator, false, true, 0)
|
||||
|
||||
box2 = Gtk::HBox.new(false, 10)
|
||||
box2.border_width = 10
|
||||
box1.pack_start(box2, false, true, 0)
|
||||
|
||||
button = Gtk::Button.new("close")
|
||||
button.signal_connect("clicked") do
|
||||
window.destroy
|
||||
end
|
||||
box2.pack_start(button, true, true, 0)
|
||||
|
||||
window.show_all
|
||||
|
||||
Gtk.main
|
59
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/misc_button.rb
Normal file
59
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/misc_button.rb
Normal file
@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
misc_button.rb - Ruby/GTK sample script.
|
||||
|
||||
Copyright (c) 2004-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: misc_button.rb,v 1.2 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
if str = Gtk.check_version(2, 4, 0)
|
||||
puts "This sample requires GTK+ 2.4.0 or later"
|
||||
puts str
|
||||
exit
|
||||
end
|
||||
|
||||
box = Gtk::VBox.new
|
||||
|
||||
#Gtk::ColorButton
|
||||
colorbutton = Gtk::ColorButton.new
|
||||
colorbutton.signal_connect("color-set") do
|
||||
p colorbutton.color.to_a
|
||||
end
|
||||
box.add(colorbutton)
|
||||
|
||||
|
||||
#Gtk::FontButton
|
||||
fontbutton = Gtk::FontButton.new
|
||||
fontbutton.signal_connect("font-set") do
|
||||
p fontbutton.font_name
|
||||
end
|
||||
box.add(fontbutton)
|
||||
|
||||
#Gtk::FileChooserButton(GTK+-2.6.0 or later)
|
||||
if str = Gtk.check_version(2, 6, 0)
|
||||
puts "Gtk::FileChooserButton requires GTK+ 2.6.0 or later"
|
||||
else
|
||||
filebutton = Gtk::FileChooserButton.new("Gtk::FileChooserButton",
|
||||
Gtk::FileChooser::ACTION_OPEN)
|
||||
filebutton.filename = GLib.home_dir
|
||||
filebutton.signal_connect("current-folder-changed") do |w, e|
|
||||
p filebutton.filename
|
||||
end
|
||||
|
||||
box.add(filebutton)
|
||||
end
|
||||
|
||||
#Quit
|
||||
quitbutton = Gtk::Button.new("Quit")
|
||||
quitbutton.signal_connect("clicked") do
|
||||
Gtk.main_quit
|
||||
end
|
||||
box.add(quitbutton)
|
||||
|
||||
Gtk::Window.new.add(box).set_default_size(200, 100).show_all
|
||||
|
||||
Gtk.main
|
465
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/mouse-gesture.rb
Normal file
465
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/mouse-gesture.rb
Normal file
@ -0,0 +1,465 @@
|
||||
=begin
|
||||
mouse-gesture.rb - mouse gesture sample script.
|
||||
|
||||
Copyright (C) 2005,2006 Kouhei Sutou
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Date: 2006/06/17 13:18:12 $
|
||||
$Id: mouse-gesture.rb,v 1.2 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
unless Gdk.cairo_available?
|
||||
STDERR.puts("need cairo and rcairo support for this sample")
|
||||
exit 1
|
||||
end
|
||||
|
||||
class GestureProcessor
|
||||
DEFAULT_THRESHOLD = 16
|
||||
DEFAULT_SKEW_THRESHOLD_ANGLE = 30
|
||||
|
||||
attr_accessor :threshold, :skew_threshold_angle
|
||||
attr_reader :motions
|
||||
|
||||
def initialize(threshold=nil, skew_threshold_angle=nil)
|
||||
@threshold = threshold || DEFAULT_THRESHOLD
|
||||
@skew_threshold_angle = skew_threshold_angle
|
||||
@skew_threshold_angle ||= DEFAULT_SKEW_THRESHOLD_ANGLE
|
||||
reset
|
||||
end
|
||||
|
||||
def started?
|
||||
@started
|
||||
end
|
||||
|
||||
MOTIONS = %w(L R U D UL UR LL LR)
|
||||
|
||||
def available_motion?(motion)
|
||||
MOTIONS.include?(motion)
|
||||
end
|
||||
|
||||
def start(x, y)
|
||||
@prev_x = @x = x
|
||||
@prev_y = @y = y
|
||||
@started = true
|
||||
@motions = []
|
||||
end
|
||||
|
||||
def update_position(x, y)
|
||||
mx = x - @prev_x
|
||||
my = y - @prev_y
|
||||
|
||||
motion = judge_motion(mx, my)
|
||||
if motion
|
||||
@prev_x = @x = x
|
||||
@prev_y = @y = y
|
||||
if @motions.last == motion
|
||||
false
|
||||
else
|
||||
@motions << motion
|
||||
true
|
||||
end
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
def reset
|
||||
@started = false
|
||||
@x = @y = -1
|
||||
@motions = []
|
||||
end
|
||||
|
||||
def to_a
|
||||
@motions
|
||||
end
|
||||
|
||||
def position
|
||||
[@x, @y]
|
||||
end
|
||||
|
||||
private
|
||||
def judge_motion(mx, my)
|
||||
mxa = mx.abs
|
||||
mya = my.abs
|
||||
distance = Math.sqrt(mxa ** 2 + mya ** 2)
|
||||
upper_theta = (45 + @skew_threshold_angle) * (Math::PI / 180.0)
|
||||
lower_theta = (45 - @skew_threshold_angle) * (Math::PI / 180.0)
|
||||
if distance > @threshold and
|
||||
mya < Math.tan(upper_theta) * mxa and
|
||||
mya > Math.tan(lower_theta) * mxa
|
||||
judge_corner_motion(mx, my)
|
||||
elsif mxa > @threshold or mya > @threshold
|
||||
judge_cross_motion(mx, my)
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
def judge_corner_motion(mx, my)
|
||||
if mx < 0
|
||||
if my < 0
|
||||
"UL"
|
||||
else
|
||||
"LL"
|
||||
end
|
||||
else
|
||||
if my < 0
|
||||
"UR"
|
||||
else
|
||||
"LR"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def judge_cross_motion(mx, my)
|
||||
if mx.abs > my.abs
|
||||
if mx < 0
|
||||
"L"
|
||||
else
|
||||
"R"
|
||||
end
|
||||
else
|
||||
if my < 0
|
||||
"U"
|
||||
else
|
||||
"D"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class Gesture < Gtk::EventBox
|
||||
DEFAULT_BACK_RGBA = [0.2, 0.2, 0.2, 0.5]
|
||||
DEFAULT_LINE_RGBA = [1, 0, 0, 1]
|
||||
DEFAULT_NEXT_RGBA = [0, 1, 0, 0.8]
|
||||
DEFAULT_CURRENT_RGBA = [1, 0, 1, 0.8]
|
||||
|
||||
def initialize(conf={})
|
||||
super()
|
||||
set_visible_window(false)
|
||||
conf ||= {}
|
||||
@back_rgba = conf[:back_rgba] || DEFAULT_BACK_RGBA
|
||||
@line_rgba = conf[:line_rgba] || DEFAULT_LINE_RGBA
|
||||
@next_rgba = conf[:next_rgba] || DEFAULT_NEXT_RGBA
|
||||
@current_rgba = conf[:current_rgba] || DEFAULT_CURRENT_RGBA
|
||||
@processor = GestureProcessor.new(conf[:threshold],
|
||||
conf[:skew_threshold_angle])
|
||||
@actions = []
|
||||
set_expose_event
|
||||
set_motion_notify_event
|
||||
set_button_release_event
|
||||
end
|
||||
|
||||
def add_action(sequence, action=Proc.new)
|
||||
invalid_motion = sequence.find do |motion|
|
||||
not @processor.available_motion?(motion)
|
||||
end
|
||||
raise "invalid motion: #{invalid_motion}" if invalid_motion
|
||||
@actions << [sequence, action]
|
||||
end
|
||||
|
||||
def start(widget, button, x, y, base_x, base_y)
|
||||
Gtk.grab_add(self)
|
||||
@widget = widget
|
||||
@button = button
|
||||
@processor.start(x, y)
|
||||
@base_x = base_x
|
||||
@base_y = base_y
|
||||
@cr = window.create_cairo_context
|
||||
@cr.set_source_rgba(@line_rgba)
|
||||
@cr.move_to(x, y)
|
||||
end
|
||||
|
||||
private
|
||||
def perform_action
|
||||
act = action
|
||||
act.call(@widget) if act
|
||||
@processor.reset
|
||||
end
|
||||
|
||||
def action
|
||||
motions = @processor.motions
|
||||
@actions.each do |sequence, act|
|
||||
return act if sequence == motions
|
||||
end
|
||||
nil
|
||||
end
|
||||
|
||||
def available_motions
|
||||
motions = @processor.motions
|
||||
@actions.collect do |sequence, act|
|
||||
if sequence == motions
|
||||
sequence.last
|
||||
else
|
||||
nil
|
||||
end
|
||||
end.compact.uniq
|
||||
end
|
||||
|
||||
def next_available_motions
|
||||
motions = @processor.motions
|
||||
@actions.collect do |sequence, act|
|
||||
if sequence[0..-2] == motions
|
||||
sequence.last
|
||||
else
|
||||
nil
|
||||
end
|
||||
end.compact.uniq
|
||||
end
|
||||
|
||||
def match?
|
||||
not action.nil?
|
||||
end
|
||||
|
||||
def set_expose_event
|
||||
signal_connect("expose_event") do |widget, event|
|
||||
if @processor.started?
|
||||
cr = widget.window.create_cairo_context
|
||||
|
||||
cr.rectangle(*widget.allocation.to_a)
|
||||
cr.set_source_rgba(@back_rgba)
|
||||
cr.fill
|
||||
|
||||
cr.set_source_rgba(@next_rgba)
|
||||
draw_available_marks(cr, next_available_motions)
|
||||
|
||||
if action
|
||||
cr.set_source_rgba(@current_rgba)
|
||||
draw_mark(cr, *@processor.position)
|
||||
end
|
||||
|
||||
@cr.stroke_preserve
|
||||
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def draw_mark(cr, x=nil, y=nil, radius=nil)
|
||||
x ||= @processor.position[0]
|
||||
y ||= @processor.position[1]
|
||||
radius ||= @processor.threshold
|
||||
cr.save do
|
||||
cr.translate(x, y)
|
||||
cr.scale(radius, radius)
|
||||
cr.arc(0, 0, 0.5, 0, 2 * Math::PI)
|
||||
cr.fill
|
||||
end
|
||||
end
|
||||
|
||||
def draw_available_marks(cr, motions)
|
||||
motions.each do |motion|
|
||||
adjust_x = calc_position_ratio(motion, %w(R), %w(L), %w(UR LR), %w(UL LL))
|
||||
adjust_y = calc_position_ratio(motion, %w(D), %w(U), %w(LR LL), %w(UR UL))
|
||||
|
||||
threshold = @processor.threshold
|
||||
x, y = @processor.position
|
||||
x += threshold * adjust_x
|
||||
y += threshold * adjust_y
|
||||
draw_mark(cr, x, y, threshold)
|
||||
end
|
||||
end
|
||||
|
||||
def calc_position_ratio(motion, inc, dec, inc_skew, dec_skew)
|
||||
case motion
|
||||
when *inc
|
||||
1
|
||||
when *inc_skew
|
||||
1 / Math.sqrt(2)
|
||||
when *dec
|
||||
-1
|
||||
when *dec_skew
|
||||
-1 / Math.sqrt(2)
|
||||
else
|
||||
0
|
||||
end
|
||||
end
|
||||
|
||||
def set_motion_notify_event
|
||||
signal_connect("motion_notify_event") do |widget, event|
|
||||
if @processor.started?
|
||||
x = @base_x + event.x
|
||||
y = @base_y + event.y
|
||||
@cr.line_to(x, y)
|
||||
@cr.save do
|
||||
if @processor.update_position(x, y)
|
||||
queue_draw
|
||||
end
|
||||
end
|
||||
@cr.stroke_preserve
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def set_button_release_event
|
||||
signal_connect("button_release_event") do |widget, event|
|
||||
if event.button == @button and @processor.started?
|
||||
Gtk.grab_remove(self)
|
||||
perform_action
|
||||
hide
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class GesturedWidget < Gtk::EventBox
|
||||
DEFAULT_GESTURE_BUTTON = 3
|
||||
|
||||
def initialize(gesture_button=nil)
|
||||
super()
|
||||
set_visible_window(false)
|
||||
@gesture_button = gesture_button || DEFAULT_GESTURE_BUTTON
|
||||
set_button_press_event
|
||||
end
|
||||
|
||||
def layout
|
||||
parent
|
||||
end
|
||||
|
||||
def gesture(x, y, base_x, base_y)
|
||||
if layout
|
||||
layout.gesture(self, @gesture_button, x, y, base_x, base_y)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def set_button_press_event
|
||||
signal_connect("button_press_event") do |widget, event|
|
||||
if event.button == @gesture_button
|
||||
x, y, w, h = widget.allocation.to_a
|
||||
gesture(x + event.x, y + event.y, x, y)
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class Layout < Gtk::Layout
|
||||
def initialize()
|
||||
super()
|
||||
@gesture = Gesture.new()
|
||||
put(@gesture, 0, 0)
|
||||
end
|
||||
|
||||
def gesture(widget, button, x, y, base_x, base_y)
|
||||
remove(@gesture)
|
||||
put(@gesture, 0, 0)
|
||||
_, _, w, h = allocation.to_a
|
||||
@gesture.set_size_request(w, h)
|
||||
@gesture.show
|
||||
@gesture.start(widget, button, x, y, base_x, base_y)
|
||||
end
|
||||
|
||||
def add_gesture_action(sequence, action=Proc.new)
|
||||
@gesture.add_action(sequence, action)
|
||||
end
|
||||
end
|
||||
|
||||
window = Gtk::Window.new("Mouse Gesture sample")
|
||||
|
||||
layout = Layout.new
|
||||
|
||||
gestured_widget = GesturedWidget.new
|
||||
gestured_widget.set_size_request(50, 50)
|
||||
gestured_widget.signal_connect("expose_event") do |widget, event|
|
||||
x, y, w, h = widget.allocation.to_a
|
||||
cr = widget.window.create_cairo_context
|
||||
cr.set_source_rgba([0.8, 0.8, 0.3, 1])
|
||||
cr.translate(x, y)
|
||||
cr.scale(w, h)
|
||||
cr.arc(0.5, 0.5, 0.5, -0.1, 360)
|
||||
cr.fill
|
||||
false
|
||||
end
|
||||
|
||||
layout.put(gestured_widget, 75, 75)
|
||||
|
||||
|
||||
gestured_widget2 = GesturedWidget.new
|
||||
gestured_widget2.set_size_request(100, 50)
|
||||
gestured_widget2.signal_connect("expose_event") do |widget, event|
|
||||
x, y, w, h = widget.allocation.to_a
|
||||
cr = widget.window.create_cairo_context
|
||||
cr.set_source_rgba([0.3, 0.3, 0.8, 1])
|
||||
cr.translate(x, y)
|
||||
cr.scale(w, h)
|
||||
cr.arc(0.5, 0.5, 0.5, -0.1, 360)
|
||||
cr.fill
|
||||
false
|
||||
end
|
||||
|
||||
layout.put(gestured_widget2, 0, 25)
|
||||
|
||||
|
||||
# gesture handlers
|
||||
expand_size = 20
|
||||
|
||||
expand_left = Proc.new do |widget|
|
||||
x = layout.child_get_property(widget, :x)
|
||||
y = layout.child_get_property(widget, :y)
|
||||
w, h = widget.size_request
|
||||
layout.move(widget, x - expand_size, y)
|
||||
widget.set_size_request(w + expand_size, h)
|
||||
end
|
||||
|
||||
expand_right = Proc.new do |widget|
|
||||
x = layout.child_get_property(widget, :x)
|
||||
y = layout.child_get_property(widget, :y)
|
||||
w, h = widget.size_request
|
||||
layout.move(widget, x, y)
|
||||
widget.set_size_request(w + expand_size, h)
|
||||
end
|
||||
|
||||
expand_top = Proc.new do |widget|
|
||||
x = layout.child_get_property(widget, :x)
|
||||
y = layout.child_get_property(widget, :y)
|
||||
w, h = widget.size_request
|
||||
layout.move(widget, x, y - expand_size)
|
||||
widget.set_size_request(w, h + expand_size)
|
||||
end
|
||||
|
||||
expand_bottom = Proc.new do |widget|
|
||||
x = layout.child_get_property(widget, :x)
|
||||
y = layout.child_get_property(widget, :y)
|
||||
w, h = widget.size_request
|
||||
layout.move(widget, x, y)
|
||||
widget.set_size_request(w, h + expand_size)
|
||||
end
|
||||
|
||||
layout.add_gesture_action(["L"]) do |widget|
|
||||
expand_left.call(widget)
|
||||
end
|
||||
|
||||
layout.add_gesture_action(["U"]) do |widget|
|
||||
expand_top.call(widget)
|
||||
end
|
||||
|
||||
layout.add_gesture_action(["LL"]) do |widget|
|
||||
expand_left.call(widget)
|
||||
expand_bottom.call(widget)
|
||||
end
|
||||
|
||||
layout.add_gesture_action(["R", "LR"]) do |widget|
|
||||
expand_right.call(widget)
|
||||
expand_bottom.call(widget)
|
||||
expand_right.call(widget)
|
||||
end
|
||||
|
||||
|
||||
window.add(layout)
|
||||
window.signal_connect("destroy"){Gtk.main_quit}
|
||||
|
||||
window.show_all
|
||||
|
||||
Gtk.main
|
66
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/pangorenderer.rb
Normal file
66
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/pangorenderer.rb
Normal file
@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
pangorenderer.rb - Ruby/GTK sample script.
|
||||
|
||||
Copyright (c) 2005,2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: pangorenderer.rb,v 1.5 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
RADIUS = 80
|
||||
N_WORDS = 16
|
||||
|
||||
if str = Gtk.check_version(2, 6, 0)
|
||||
puts "This sample requires GTK+ 2.6.0 or later"
|
||||
puts str
|
||||
exit
|
||||
end
|
||||
|
||||
win = Gtk::Window.new("Gdk::PangoRenderer sample")
|
||||
win.signal_connect("destroy"){Gtk.main_quit}
|
||||
win.set_default_size(400, 400)
|
||||
win.realize
|
||||
|
||||
matrix = Pango::Matrix.new
|
||||
|
||||
renderer = Gdk::PangoRenderer.default
|
||||
renderer.drawable = win.window
|
||||
renderer.gc = Gdk::GC.new(win.window)
|
||||
width, height = win.size
|
||||
|
||||
device_radius = [width, height].min / 6.0
|
||||
|
||||
matrix.translate!(device_radius + (width - 2 * device_radius) / 2.0,
|
||||
device_radius + (height - 2 * device_radius) / 2.0)
|
||||
matrix.scale!(device_radius / RADIUS, device_radius / RADIUS)
|
||||
|
||||
context = Gdk::Pango.context
|
||||
layout = Pango::Layout.new(context)
|
||||
layout.text = "Ruby-GNOME2"
|
||||
layout.font_description = Pango::FontDescription.new("Sans Bold 14")
|
||||
|
||||
background = Gdk::Color.new(65535, 65535, 65535)
|
||||
Gdk::Colormap.system.alloc_color(background, false, true)
|
||||
win.window.background = background
|
||||
|
||||
win.signal_connect("expose_event") do
|
||||
(0...N_WORDS).each do |i|
|
||||
rotated_matrix = matrix.dup
|
||||
angle = 360 * i / N_WORDS.to_f
|
||||
color = Gdk::Color.new(65535 * rand, 65535 * rand, 65535 * rand)
|
||||
renderer.set_override_color(Pango::Renderer::PART_FOREGROUND, color)
|
||||
|
||||
rotated_matrix.rotate!(angle)
|
||||
context.set_matrix(rotated_matrix)
|
||||
layout.context_changed
|
||||
width, height = layout.size
|
||||
renderer.draw_layout(layout, width / 2, RADIUS * Pango::SCALE)
|
||||
end
|
||||
end
|
||||
|
||||
win.show_all
|
||||
|
||||
Gtk.main
|
34
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/pointer_grab.rb
Normal file
34
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/pointer_grab.rb
Normal file
@ -0,0 +1,34 @@
|
||||
=begin
|
||||
pointer_grab.rb - Gdk::Window#pointer_grab/ungrab sample script.
|
||||
|
||||
Copyright (C) 2001-2006 Masao Mutoh<mutoh@highway.ne.jp>
|
||||
This program is licenced under the same licence as Ruby-GNOME.
|
||||
|
||||
$Date: 2006/06/17 13:18:12 $
|
||||
$Id: pointer_grab.rb,v 1.5 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
window = Gtk::Window.new("Pointer grab/ungrab sample")
|
||||
|
||||
cursor = Gdk::Cursor.new(Gdk::Cursor::WATCH)
|
||||
button1 = Gtk::Button.new("Grab Window!")
|
||||
button2 = Gtk::Button.new("Ungrab Window!")
|
||||
|
||||
button1.signal_connect('clicked') do
|
||||
Gdk.pointer_grab(window.window, true, Gdk::Event::BUTTON_PRESS_MASK,
|
||||
window.window, cursor, Gdk::Event::CURRENT_TIME)
|
||||
p Gdk.pointer_is_grabbed?
|
||||
end
|
||||
|
||||
button2.signal_connect('clicked') do
|
||||
Gdk.pointer_ungrab(Gdk::Event::CURRENT_TIME)
|
||||
p Gdk.pointer_is_grabbed?
|
||||
end
|
||||
|
||||
window.add(Gtk::VBox.new.add(button1).add(button2))
|
||||
window.set_default_size(200,100).show_all
|
||||
window.signal_connect("destroy"){Gtk.main_quit}
|
||||
|
||||
Gtk.main
|
247
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/print.rb
Normal file
247
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/print.rb
Normal file
@ -0,0 +1,247 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
print.rb - Gtk::Print* sample
|
||||
|
||||
Copyright (C) 2007 Mathieu Blondel
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: print.rb,v 1.1 2007/08/05 15:41:31 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
# Values returned by a Pango::Layout or set in a Pango::Layout
|
||||
# are always multiple of Pango::SCALE. Those are convenience methods to
|
||||
# deal with that.
|
||||
class Pango::Layout
|
||||
def size_in_points
|
||||
self.size.collect { |v| v / Pango::SCALE }
|
||||
end
|
||||
|
||||
def width_in_points
|
||||
self.size[0] / Pango::SCALE
|
||||
end
|
||||
|
||||
def height_in_points
|
||||
self.size[1] / Pango::SCALE
|
||||
end
|
||||
|
||||
def width_in_points=(width)
|
||||
self.width = width * Pango::SCALE
|
||||
end
|
||||
end
|
||||
|
||||
class Print < Gtk::PrintOperation
|
||||
|
||||
FONT = Pango::FontDescription.new("sans 12")
|
||||
FONT_SMALL = Pango::FontDescription.new("sans 8")
|
||||
|
||||
FONT_SIZE = 12
|
||||
FONT_SMALL_SIZE = 8
|
||||
|
||||
def initialize (parent_window, text)
|
||||
super()
|
||||
@parent_window = parent_window
|
||||
@text = text
|
||||
|
||||
# with this option disabled, the origin is the the upper left corner
|
||||
# *taking into consideration margins* !
|
||||
self.use_full_page = false
|
||||
self.unit = Gtk::PaperSize::UNIT_POINTS
|
||||
|
||||
# set default paper size
|
||||
page_setup = Gtk::PageSetup.new
|
||||
paper_size = Gtk::PaperSize.new(Gtk::PaperSize.default)
|
||||
page_setup.paper_size_and_default_margins = paper_size
|
||||
self.default_page_setup = page_setup
|
||||
|
||||
# show a progress bar
|
||||
self.show_progress = true
|
||||
|
||||
# You must choose between "paginate" and "begin-print".
|
||||
# "begin-print" is emitted only once and "paginate" is emitted
|
||||
# until the block returns true.
|
||||
# In both cases, you must set the number of pages at the end with
|
||||
# Gtk::PrintOperation#n_pages=
|
||||
signal_connect("begin-print") do |pop, context|
|
||||
puts "calls begin-print"
|
||||
cr = context.cairo_context
|
||||
paragraphs = @text.split("\n")
|
||||
layouts = []
|
||||
paragraphs.each do |para|
|
||||
layouts << create_layout(cr, para)
|
||||
end
|
||||
|
||||
# distribute paragraph layouts among pages
|
||||
@page_layouts = []
|
||||
|
||||
curr_height = 0
|
||||
n_pages = 0
|
||||
layouts.each do |layout|
|
||||
height = layout.height_in_points
|
||||
if curr_height + height > real_page_height
|
||||
n_pages += 1
|
||||
curr_height = 0
|
||||
end
|
||||
@page_layouts[n_pages] ||= []
|
||||
@page_layouts[n_pages] << layout
|
||||
curr_height += height
|
||||
end
|
||||
|
||||
pop.n_pages = n_pages + 1
|
||||
end
|
||||
|
||||
signal_connect("draw-page") do |pop, context, page_num|
|
||||
puts "calls draw-page %d" % page_num
|
||||
|
||||
cr = context.cairo_context
|
||||
|
||||
x, y = [0,0] # this means we start at the upper left margin
|
||||
|
||||
if @page_layouts[page_num]
|
||||
@page_layouts[page_num].each do |layout|
|
||||
cr.move_to(x,y)
|
||||
cr.show_pango_layout(layout)
|
||||
y += layout.height_in_points
|
||||
end
|
||||
total_pages = @page_layouts.length
|
||||
else
|
||||
total_pages = 1
|
||||
end
|
||||
|
||||
# page_num starts at 0
|
||||
draw_footer(cr, page_num + 1, total_pages)
|
||||
end
|
||||
end
|
||||
|
||||
def run_print_dialog
|
||||
res = run(ACTION_PRINT_DIALOG, @parent_window)
|
||||
case res
|
||||
when RESULT_ERROR
|
||||
puts "error"
|
||||
when RESULT_CANCEL
|
||||
puts "cancelled"
|
||||
when RESULT_APPLY
|
||||
puts "applied"
|
||||
when RESULT_IN_PROGRESS
|
||||
puts "in progress"
|
||||
end
|
||||
end
|
||||
|
||||
def run_preview
|
||||
res = run(ACTION_PREVIEW, @parent_window)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def page_height
|
||||
setup = self.default_page_setup
|
||||
# this takes margins into consideration, contrary to get_paper_height
|
||||
setup.get_page_height(Gtk::PaperSize::UNIT_POINTS)
|
||||
end
|
||||
|
||||
def page_width
|
||||
setup = self.default_page_setup
|
||||
width = setup.get_page_width(Gtk::PaperSize::UNIT_POINTS)
|
||||
end
|
||||
|
||||
def real_page_height
|
||||
page_height - footer_height
|
||||
end
|
||||
|
||||
def footer_height
|
||||
5 * FONT_SMALL_SIZE
|
||||
end
|
||||
|
||||
def create_layout(cr, text)
|
||||
layout = cr.create_pango_layout
|
||||
|
||||
layout.width_in_points = page_width
|
||||
layout.font_description = FONT
|
||||
layout.wrap = Pango::Layout::WRAP_CHAR
|
||||
layout.ellipsize = Pango::Layout::ELLIPSIZE_NONE
|
||||
layout.single_paragraph_mode = false
|
||||
|
||||
layout.text = text
|
||||
|
||||
layout
|
||||
end
|
||||
|
||||
def draw_footer(cr, nth_page, total_page)
|
||||
layout = cr.create_pango_layout
|
||||
layout.alignment = Pango::Layout::ALIGN_RIGHT
|
||||
layout.font_description = FONT_SMALL
|
||||
layout.text = "Page %d/%d" % [nth_page, total_page] + "\n" + \
|
||||
Time.now.strftime("Printed on %Y/%m/%d at %H:%M") + "\n" + \
|
||||
"Powered by Ruby-GNOME2!"
|
||||
width, height = layout.size_in_points
|
||||
x, y = [page_width, page_height]
|
||||
x -= width
|
||||
y -= height
|
||||
cr.move_to(x, y)
|
||||
cr.show_pango_layout(layout)
|
||||
cr.rel_move_to(width, -2)
|
||||
cr.rel_line_to(-page_width, 0)
|
||||
cr.stroke
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Window < Gtk::Window
|
||||
|
||||
def initialize
|
||||
super
|
||||
|
||||
signal_connect("delete-event") { Gtk.main_quit }
|
||||
|
||||
set_default_size(600, 600)
|
||||
|
||||
@textview = Gtk::TextView.new
|
||||
@textview.wrap_mode = Gtk::TextTag::WRAP_WORD
|
||||
|
||||
hbox = Gtk::HBox.new
|
||||
|
||||
page_setup_button = Gtk::Button.new
|
||||
page_setup_button.label = "Page setup"
|
||||
page_setup_button.signal_connect("clicked") do
|
||||
@page_setup = Print::run_page_setup_dialog(self, # parent window
|
||||
@page_setup)
|
||||
end
|
||||
|
||||
print_preview_button = Gtk::Button.new(Gtk::Stock::PRINT_PREVIEW)
|
||||
print_preview_button.signal_connect("clicked") do
|
||||
printop = Print.new(self, @textview.buffer.text)
|
||||
printop.default_page_setup = @page_setup if @page_setup
|
||||
printop.run_preview
|
||||
end
|
||||
|
||||
print_button = Gtk::Button.new(Gtk::Stock::PRINT)
|
||||
print_button.signal_connect("clicked") do
|
||||
printop = Print.new(self, @textview.buffer.text)
|
||||
printop.default_page_setup = @page_setup if @page_setup
|
||||
printop.run_print_dialog
|
||||
end
|
||||
|
||||
[page_setup_button, print_preview_button, print_button].each do |b|
|
||||
hbox.pack_start(b, true, true) # expand, fill
|
||||
end
|
||||
|
||||
scrollbar = Gtk::VScrollbar.new
|
||||
|
||||
vbox = Gtk::VBox.new
|
||||
scroll = Gtk::ScrolledWindow.new.add(@textview)
|
||||
scroll.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
||||
vbox.pack_start(scroll)
|
||||
vbox.pack_end(hbox, false, false)
|
||||
|
||||
add(vbox)
|
||||
|
||||
show_all
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Window.new
|
||||
|
||||
Gtk.main
|
85
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/properties.rb
Executable file
85
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/properties.rb
Executable file
@ -0,0 +1,85 @@
|
||||
=begin
|
||||
properties.rb -
|
||||
|
||||
GLib::Object#properties and Gtk::Container#child_properties sample script.
|
||||
|
||||
Copyright (C) 2004-2006 Masao Mutoh
|
||||
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: properties.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
class MyButton < Gtk::Button
|
||||
type_register
|
||||
|
||||
def initialize(label = nil)
|
||||
# XXX:
|
||||
# When type_register() is used.
|
||||
# super is equivalent to GLib::Object#initialize.
|
||||
super("label" => label)
|
||||
@fuga = 0
|
||||
@hoge = 0
|
||||
end
|
||||
|
||||
# define new property "fuga"
|
||||
install_property(GLib::Param::Int.new("fuga", # name
|
||||
"Fuga", # nick
|
||||
"fuga fuga", # blurb
|
||||
0, # min
|
||||
10000, # max
|
||||
0, # default
|
||||
GLib::Param::READABLE |
|
||||
GLib::Param::WRITABLE))
|
||||
|
||||
# define new property "hoge"
|
||||
install_child_property(GLib::Param::Int.new("hoge", # name
|
||||
"Hoge", # nick
|
||||
"hoge hoge", # blurb
|
||||
0, # min
|
||||
10000, # max
|
||||
0, # default
|
||||
GLib::Param::READABLE |
|
||||
GLib::Param::WRITABLE))
|
||||
|
||||
# implementation of the property "fuga"
|
||||
def fuga
|
||||
puts "MyButton#fuga is called"
|
||||
@fuga
|
||||
end
|
||||
def fuga=(arg)
|
||||
puts "MyButton#fuga= is called"
|
||||
@fuga = arg
|
||||
notify("fuga")
|
||||
end
|
||||
|
||||
# implementation of the property "hoge"
|
||||
def get_hoge(child)
|
||||
puts "MyButton#get_hoge is called"
|
||||
@hoge
|
||||
end
|
||||
def set_hoge(child, arg)
|
||||
puts "MyButton#set_hoge is called"
|
||||
@hoge = arg
|
||||
end
|
||||
end
|
||||
|
||||
b = MyButton.new("Hello")
|
||||
p b
|
||||
p b.label
|
||||
p b.gtype
|
||||
|
||||
p MyButton.properties
|
||||
p b.get_property("fuga")
|
||||
b.set_property("fuga", 1)
|
||||
p b.get_property("fuga")
|
||||
|
||||
p MyButton.child_properties
|
||||
p child = b.child
|
||||
p b.child_get_property(child, "hoge")
|
||||
b.child_set_property(child, "hoge", 2)
|
||||
p b.child_get_property(child, "hoge")
|
||||
|
||||
p MyButton.ancestors
|
47
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/radiobutton.rb
Normal file
47
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/radiobutton.rb
Normal file
@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
radiobutton.rb - Ruby/GTK2 sample script.
|
||||
|
||||
Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: radiobutton.rb,v 1.10 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
window = Gtk::Window.new("Gtk::RadioButton sample")
|
||||
window.signal_connect("destroy"){Gtk.main_quit}
|
||||
|
||||
box1 = Gtk::VBox.new
|
||||
window.add(box1)
|
||||
|
||||
box2 = Gtk::VBox.new(false, 10)
|
||||
box2.border_width = 10
|
||||
box1.add(box2)
|
||||
|
||||
button1 = Gtk::RadioButton.new("_button1")
|
||||
button2 = Gtk::RadioButton.new(button1, "_button2", false)
|
||||
button3 = Gtk::RadioButton.new(button1, Gtk::Stock::QUIT)
|
||||
|
||||
box2.add(button1).add(button2).add(button3)
|
||||
|
||||
box1.add(Gtk::HSeparator.new)
|
||||
|
||||
box2 = Gtk::VBox.new(false, 10)
|
||||
box2.border_width = 10
|
||||
box1.add(box2)
|
||||
|
||||
close = Gtk::Button.new("close")
|
||||
close.signal_connect("clicked") do
|
||||
Gtk.main_quit
|
||||
end
|
||||
box2.add(close)
|
||||
|
||||
close.can_default = true
|
||||
close.grab_default
|
||||
|
||||
window.signal_connect("destroy"){Gtk.main_quit}
|
||||
window.show_all
|
||||
|
||||
Gtk.main
|
59
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/recentchooserdialog.rb
Normal file
59
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/recentchooserdialog.rb
Normal file
@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
recentchooserdialog.rb - Ruby/GTK2 sample script.
|
||||
|
||||
Copyright (c) 2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: recentchooserdialog.rb,v 1.2 2006/11/15 23:46:13 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
if str = Gtk.check_version(2, 10, 0)
|
||||
puts "This sample requires GTK+ 2.10.0 or later"
|
||||
puts str
|
||||
exit
|
||||
end
|
||||
|
||||
dialog = Gtk::RecentChooserDialog.new("Recent Chooser Dialog Sample",
|
||||
nil,
|
||||
[Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL],
|
||||
[Gtk::Stock::OPEN, Gtk::Dialog::RESPONSE_ACCEPT])
|
||||
|
||||
dialog.signal_connect("response") do |widget, response|
|
||||
case response
|
||||
when Gtk::Dialog::RESPONSE_ACCEPT
|
||||
info = dialog.current_item
|
||||
if info
|
||||
puts "----"
|
||||
puts info.uri
|
||||
puts info.display_name
|
||||
puts info.description
|
||||
puts info.mime_type
|
||||
puts info.added
|
||||
puts info.modified
|
||||
puts info.visited
|
||||
puts info.private_hint?
|
||||
p info.application_info("gedit")
|
||||
p info.applications
|
||||
puts info.last_application
|
||||
p info.groups
|
||||
puts info.has_group?("web")
|
||||
puts info.has_application?("gedit")
|
||||
puts info.get_icon(64)
|
||||
puts info.short_name
|
||||
puts info.uri_display
|
||||
puts info.age
|
||||
puts info.local?
|
||||
puts info.exist?
|
||||
end
|
||||
else
|
||||
p "Close"
|
||||
dialog.destroy
|
||||
Gtk.main_quit
|
||||
end
|
||||
end
|
||||
dialog.show_all
|
||||
|
||||
Gtk.main
|
44
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/rgtk+cairo.rb
Normal file
44
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/rgtk+cairo.rb
Normal file
@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
rgtk+cairo.rb - Ruby/GTK2 using Ruby/Cairo sample script.
|
||||
|
||||
Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
Heavily inspired from png.rb example of rcairo.
|
||||
|
||||
$Id: rgtk+cairo.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
require 'cairo'
|
||||
|
||||
w = Gtk::Window.new.add(vb = Gtk::VBox.new)
|
||||
vb.add(da = Gtk::DrawingArea.new)
|
||||
da.set_size_request(200, 200)
|
||||
|
||||
da.signal_connect('expose-event') { |widget, event|
|
||||
cr = widget.window.create_cairo_context
|
||||
|
||||
# fill background with white
|
||||
cr.set_source_rgba(1.0, 1.0, 1.0)
|
||||
cr.paint
|
||||
|
||||
# create shape
|
||||
cr.move_to(50, 50)
|
||||
cr.curve_to(100, 25, 100, 75, 150, 50)
|
||||
cr.line_to(150, 150)
|
||||
cr.line_to(50, 150)
|
||||
cr.close_path
|
||||
|
||||
cr.set_source_rgb(0.0, 0.0, 0.0)
|
||||
cr.fill_preserve
|
||||
cr.set_source_rgb(1.0, 0.0, 0.0)
|
||||
cr.set_line_join(Cairo::LINE_JOIN_MITER)
|
||||
cr.set_line_width(4)
|
||||
cr.stroke
|
||||
}
|
||||
|
||||
w.signal_connect("destroy"){Gtk.main_quit}
|
||||
w.show_all
|
||||
Gtk.main
|
25
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/scalebutton.rb
Normal file
25
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/scalebutton.rb
Normal file
@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
scalebutton.rb - Very simple Gtk::ScaleButton example.
|
||||
|
||||
Copyright (c) 2007 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: scalebutton.rb,v 1.1 2007/07/12 14:04:54 ggc Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
if str = Gtk.check_version(2, 12, 0)
|
||||
puts "This sample requires GTK+ 2.12.0 or later"
|
||||
puts str
|
||||
exit
|
||||
end
|
||||
|
||||
window = Gtk::Window.new
|
||||
window.add(scale = Gtk::ScaleButton.new(Gtk::IconSize::BUTTON))
|
||||
scale.set_icons(['gtk-goto-bottom', 'gtk-goto-top', 'gtk-execute'])
|
||||
scale.signal_connect('value-changed') { |widget, value| puts "value changed: #{value}" }
|
||||
window.show_all
|
||||
|
||||
Gtk.main
|
41
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/settings.rb
Normal file
41
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/settings.rb
Normal file
@ -0,0 +1,41 @@
|
||||
=begin
|
||||
setting.rb - Gtk::Settings sample script.
|
||||
|
||||
Copyright (C) 2004-2006 Masao Mutoh
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: settings.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
spec = GLib::Param::Int.new("integer", # name
|
||||
"Integer", # nick
|
||||
"Integer integer", # blurb
|
||||
0, # min
|
||||
10000, # max
|
||||
0, # default
|
||||
GLib::Param::READABLE|
|
||||
GLib::Param::WRITABLE)
|
||||
|
||||
enum = GLib::Param::Enum.new("enum", # name
|
||||
"Enum", # nick
|
||||
"Enum enum", # blurb
|
||||
GLib::Type["GdkCursorType"], #type
|
||||
Gdk::Cursor::ARROW, #default
|
||||
GLib::Param::READABLE|
|
||||
GLib::Param::WRITABLE)
|
||||
|
||||
flags = GLib::Param::Flags.new("flags", # name
|
||||
"Flags", # nick
|
||||
"Flags flags", # blurb
|
||||
GLib::Type["GdkEventMask"], #type
|
||||
Gdk::Event::LEAVE_NOTIFY_MASK, #default
|
||||
GLib::Param::READABLE|
|
||||
GLib::Param::WRITABLE)
|
||||
|
||||
p Gtk::Settings.rc_property_parse_color(spec, "{2222,44444,65535}").to_a
|
||||
p Gtk::Settings.rc_property_parse_enum(enum, "watch")
|
||||
p Gtk::Settings.rc_property_parse_flags(flags, "(scroll-mask|structure-mask)")
|
||||
p Gtk::Settings.rc_property_parse_requisition(spec, "{100, 200}")
|
||||
p Gtk::Settings.rc_property_parse_border(spec, "{100, 200, 300, 400}").to_a
|
123
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/statusicon.rb
Normal file
123
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/statusicon.rb
Normal file
@ -0,0 +1,123 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
status_icon.rb - Gtk::StatusIcon sample.
|
||||
|
||||
This sample refers gtk/tests/teststatusicon.c of GTK+-2.10.x.
|
||||
|
||||
Copyright (c) 2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: statusicon.rb,v 1.1 2006/11/17 18:12:41 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
if str = Gtk.check_version(2, 10, 0)
|
||||
puts "This sample requires GTK+ 2.10.0 or later"
|
||||
puts str
|
||||
exit
|
||||
end
|
||||
|
||||
class StatusIconSample < Gtk::StatusIcon
|
||||
STATUS_INFO = 0
|
||||
STATUS_QUESTION = 1
|
||||
|
||||
def initialize
|
||||
super
|
||||
@status = STATUS_INFO
|
||||
update_icon
|
||||
|
||||
set_blinking(true)
|
||||
signal_connect("activate"){
|
||||
icon_activated
|
||||
}
|
||||
signal_connect("popup-menu"){|w, button, activate_time|
|
||||
menu = Gtk::Menu.new
|
||||
checkmenuitem = Gtk::CheckMenuItem.new("Blink")
|
||||
checkmenuitem.active = blinking?
|
||||
checkmenuitem.signal_connect("activate"){|w|
|
||||
set_blinking(w.active?)
|
||||
}
|
||||
menu.append(checkmenuitem)
|
||||
|
||||
menuitem = Gtk::MenuItem.new("Quit")
|
||||
menuitem.signal_connect("activate"){
|
||||
set_visible(false)
|
||||
Gtk.main_quit
|
||||
}
|
||||
menu.append(menuitem)
|
||||
menu.show_all
|
||||
menu.popup(nil, nil, button, activate_time)
|
||||
}
|
||||
|
||||
timeout_func
|
||||
end
|
||||
|
||||
def update_icon
|
||||
if @status == STATUS_INFO
|
||||
set_icon_name(Gtk::Stock::DIALOG_INFO)
|
||||
set_tooltip("Some Information ...")
|
||||
else
|
||||
set_icon_name(Gtk::Stock::DIALOG_QUESTION)
|
||||
set_tooltip("Some Question ...")
|
||||
end
|
||||
end
|
||||
|
||||
def timeout_func
|
||||
GLib::Timeout.add(2000) {
|
||||
if @status == STATUS_INFO
|
||||
@status = STATUS_QUESTION
|
||||
else
|
||||
@status = STATUS_INFO
|
||||
end
|
||||
update_icon
|
||||
true
|
||||
}
|
||||
end
|
||||
|
||||
def icon_activated
|
||||
unless @dialog
|
||||
@dialog = Gtk::MessageDialog.new(nil, 0,
|
||||
Gtk::MessageDialog::QUESTION,
|
||||
Gtk::MessageDialog::BUTTONS_CLOSE,
|
||||
"You wanna test the status icon?")
|
||||
@dialog.window_position = Gtk::Window::POS_CENTER
|
||||
|
||||
@dialog.signal_connect("response"){ @dialog.hide }
|
||||
@dialog.signal_connect("delete_event"){ @dialog.hide_on_delete }
|
||||
|
||||
toggle = Gtk::ToggleButton.new("_Show the icon")
|
||||
@dialog.vbox.pack_end(toggle, true, true, 6)
|
||||
toggle.active = visible?
|
||||
toggle.signal_connect("toggled"){|w|
|
||||
set_visible(w.active?)
|
||||
}
|
||||
|
||||
toggle = Gtk::ToggleButton.new("_Blink the icon")
|
||||
@dialog.vbox.pack_end(toggle, true, true, 6)
|
||||
toggle.active = blinking?
|
||||
toggle.signal_connect("toggled"){|w|
|
||||
set_blinking(w.active?)
|
||||
}
|
||||
|
||||
toggle = Gtk::ToggleButton.new("_Change the icon")
|
||||
@dialog.vbox.pack_end(toggle, true, true, 6)
|
||||
toggle.active = (@timeout != 0)
|
||||
toggle.signal_connect("toggled"){
|
||||
if @timeout and @timeout > 0
|
||||
GLib::Source.remove(@timeout)
|
||||
@timeout = 0
|
||||
else
|
||||
@timeout = timeout_func
|
||||
end
|
||||
}
|
||||
end
|
||||
@dialog.show_all
|
||||
@dialog.present
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
StatusIconSample.new
|
||||
|
||||
Gtk.main
|
36
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/stock.rb
Normal file
36
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/stock.rb
Normal file
@ -0,0 +1,36 @@
|
||||
=begin
|
||||
stock.rb - Gtk::Stock sample script.
|
||||
|
||||
Copyright (C) 2001-2006 Masao Mutoh
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: stock.rb,v 1.7 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
window = Gtk::Window.new("Gtk::Stock sample")
|
||||
window.signal_connect("destroy"){Gtk.main_quit}
|
||||
|
||||
stocks = Gtk::Stock.constants.sort
|
||||
|
||||
image = Gtk::Image.new
|
||||
label = Gtk::Label.new
|
||||
button = Gtk::Button.new("Click!")
|
||||
cnt = 0
|
||||
button.signal_connect("clicked") do
|
||||
stock_name = "Gtk::Stock::#{stocks[cnt]}"
|
||||
label.set_text(stock_name)
|
||||
image.set(eval(stock_name), Gtk::IconSize::DIALOG)
|
||||
if cnt < stocks.size - 1
|
||||
cnt += 1
|
||||
else
|
||||
cnt = 0
|
||||
end
|
||||
end
|
||||
|
||||
box = Gtk::VBox.new.add(image).add(label).add(button)
|
||||
window.add(box).set_default_size(200,200).show_all
|
||||
|
||||
Gtk.main
|
||||
|
67
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/style_property.rb
Executable file
67
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/style_property.rb
Executable file
@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
style_property.rb - Ruby/GTK2 sample script.
|
||||
|
||||
Copyright (c) 2004,2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: style_property.rb,v 1.4 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
class MyButton < Gtk::Button
|
||||
type_register
|
||||
|
||||
def initialize(label = nil)
|
||||
# When type_register() is used.
|
||||
# super is equivalent to GLib::Object#initialize.
|
||||
super("label" => label)
|
||||
end
|
||||
|
||||
install_style_property(GLib::Param::Int.new("foo", # name
|
||||
"Foo", # nick
|
||||
"FOO", # blurb
|
||||
0, #min
|
||||
100, #max
|
||||
5, #default
|
||||
GLib::Param::READABLE |
|
||||
GLib::Param::WRITABLE)) do |pspec, str|
|
||||
p pspec, str
|
||||
str.to_i + 10 #return the converted value.
|
||||
end
|
||||
|
||||
install_style_property(GLib::Param::Enum.new("bar", # name
|
||||
"Bar", # nick
|
||||
"BAR", # blurb
|
||||
GLib::Type["GdkCursorType"], #Enum type
|
||||
Gdk::Cursor::ARROW, #default
|
||||
GLib::Param::READABLE |
|
||||
GLib::Param::WRITABLE)) do |pspec, str|
|
||||
p pspec, str
|
||||
if str.strip! == "boat"
|
||||
Gdk::Cursor::BOAT
|
||||
else
|
||||
pspec.default
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Gtk::RC.parse("./style_property.rc")
|
||||
|
||||
win = Gtk::Window.new("Gtk::RC sample")
|
||||
b = MyButton.new("Hello")
|
||||
b.signal_connect("clicked"){ Gtk.main_quit }
|
||||
|
||||
p MyButton.style_properties
|
||||
|
||||
win.set_default_size(100, 100)
|
||||
win.add(b).show_all
|
||||
win.signal_connect("destroy"){ Gtk.main_quit }
|
||||
|
||||
# You need to call them after "Gtk::Widget#show"
|
||||
# (Or in expose event).
|
||||
p b.style_get_property("foo")
|
||||
p cursor = b.style_get_property("bar")
|
||||
|
||||
Gtk.main
|
19
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/style_property.rc
Normal file
19
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/style_property.rc
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
style_property.rc - Ruby/GTK sample rc file for style_property.rb.
|
||||
|
||||
Copyright (c) 2004 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: style_property.rc,v 1.1 2004/01/25 15:52:38 mutoh Exp $
|
||||
*/
|
||||
style "test-default"
|
||||
{
|
||||
bg[NORMAL] = { 0.80, 0.80, 0.40 }
|
||||
MyButton::focus-line-width = 3
|
||||
MyButton::focus-line-pattern = "\10\2"
|
||||
MyButton::foo = 30
|
||||
MyButton::bar = boat
|
||||
}
|
||||
|
||||
class "MyButton" style "test-default"
|
||||
|
58
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/t-gtkplug.rb
Normal file
58
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/t-gtkplug.rb
Normal file
@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
=begin
|
||||
Sample script using Gtk::Socket and Gtk::Plug.
|
||||
|
||||
$ ruby t-gtksocket.rb
|
||||
|
||||
Written by Alex Boussinet <mailto:dbug@wanadoo.fr> for testing purpose only.
|
||||
|
||||
Copyright (c) 2003-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: t-gtkplug.rb,v 1.5 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
class MyGtkPlug
|
||||
def initialize(xid, plug)
|
||||
plug = "Button" if plug.nil?
|
||||
if xid.nil?
|
||||
@window = Gtk::Window.new("Gtk::Plug Test")
|
||||
@window.set_default_size(250, 50)
|
||||
else
|
||||
@window = Gtk::Plug.new(xid.to_i)
|
||||
end
|
||||
@window.window_position = Gtk::Window::POS_CENTER
|
||||
@window.signal_connect("delete_event"){Gtk.main_quit}
|
||||
@vbox = Gtk::VBox.new(true, 5)
|
||||
@window.add(@vbox)
|
||||
@button1 = Gtk::Button.new(plug)
|
||||
@button1.signal_connect("clicked"){ $stderr.puts plug}
|
||||
@button2 = Gtk::Button.new("Exit")
|
||||
@button2.signal_connect("clicked"){Gtk.main_quit}
|
||||
# Exit button to test an unexpected end of child process by Gtk::Socket
|
||||
@vbox.add(@button1)
|
||||
@vbox.add(@button2)
|
||||
@window.show_all
|
||||
end
|
||||
end
|
||||
|
||||
xid = nil
|
||||
ARGV.each_index { |i|
|
||||
arg = ARGV.at(i)
|
||||
if arg == "-x"
|
||||
if arg.length > 2
|
||||
xid = arg[2..-1]
|
||||
else
|
||||
xid = ARGV.at(i + 1)
|
||||
ARGV.delete_at(i + 1)
|
||||
end
|
||||
xid = nil if xid.to_i <= 0
|
||||
ARGV.delete_at(i)
|
||||
end
|
||||
}
|
||||
|
||||
MyGtkPlug.new(xid, ARGV.shift)
|
||||
Gtk.main
|
65
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/t-gtksocket.rb
Normal file
65
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/t-gtksocket.rb
Normal file
@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
Sample script using Gtk::Socket and Gtk::Plug.
|
||||
|
||||
$ ruby t-gtksocket.rb
|
||||
|
||||
Written by Alex Boussinet <mailto:dbug@wanadoo.fr> for testing purpose only.
|
||||
|
||||
Copyright (c) 2003-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: t-gtksocket.rb,v 1.5 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
class MyGtkSocket < Gtk::Window
|
||||
def initialize
|
||||
super("Gtk::Socket Test")
|
||||
set_window_position(Gtk::Window::POS_CENTER)
|
||||
signal_connect("delete_event"){Gtk::main_quit}
|
||||
|
||||
@buttons = []
|
||||
6.times {|n|
|
||||
@buttons << Gtk::Button.new("Plug #{n}")
|
||||
@buttons.last.signal_connect("clicked"){ plug(n) }
|
||||
}
|
||||
|
||||
@table = Gtk::Table.new(1, 2)
|
||||
@table.set_size_request(320, 200)
|
||||
add(@table)
|
||||
@vbox = Gtk::VBox.new(true, 5)
|
||||
@buttons.each{|b| @vbox.add(b) }
|
||||
@vbox.set_size_request(150, 190)
|
||||
@table.attach(@vbox, 0, 1, 0, 1, Gtk::FILL, Gtk::FILL, 5, 5)
|
||||
@socket = Gtk::Socket.new
|
||||
@table.attach(@socket, 1, 2, 0, 1, Gtk::FILL, Gtk::FILL, 5, 5)
|
||||
@socket.set_size_request(150, 150)
|
||||
|
||||
show_all
|
||||
@xid = @socket.id
|
||||
@pid = 0
|
||||
end
|
||||
|
||||
def plug(arg)
|
||||
if @pid != 0
|
||||
Process.kill("SIGKILL", @pid)
|
||||
Process.waitpid(@pid)
|
||||
begin
|
||||
@table.remove(@socket) unless @socket.destroyed?
|
||||
rescue ArgumentError
|
||||
# socket has been destroyed because child process finished unexpectedly
|
||||
end
|
||||
@socket = Gtk::Socket.new
|
||||
@table.attach(@socket, 1, 2, 0, 1, Gtk::FILL, Gtk::FILL, 5, 5)
|
||||
@socket.set_size_request(150, 190)
|
||||
@socket.show
|
||||
@xid = @socket.id
|
||||
end
|
||||
@pid = fork { exec "ruby t-gtkplug.rb -x #{@xid} Plug#{arg}" }
|
||||
end
|
||||
end
|
||||
|
||||
MyGtkSocket.new
|
||||
Gtk.main
|
92
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/test.xpm
Normal file
92
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/test.xpm
Normal file
@ -0,0 +1,92 @@
|
||||
/* XPM */
|
||||
static char *openfile[] = {
|
||||
/* width height num_colors chars_per_pixel */
|
||||
" 20 19 66 2",
|
||||
/* colors */
|
||||
".. c None",
|
||||
".# c #000000",
|
||||
".a c #dfdfdf",
|
||||
".b c #7f7f7f",
|
||||
".c c #006f6f",
|
||||
".d c #00efef",
|
||||
".e c #009f9f",
|
||||
".f c #004040",
|
||||
".g c #00bfbf",
|
||||
".h c #ff0000",
|
||||
".i c #ffffff",
|
||||
".j c #7f0000",
|
||||
".k c #007070",
|
||||
".l c #00ffff",
|
||||
".m c #00a0a0",
|
||||
".n c #004f4f",
|
||||
".o c #00cfcf",
|
||||
".p c #8f8f8f",
|
||||
".q c #6f6f6f",
|
||||
".r c #a0a0a0",
|
||||
".s c #7f7f00",
|
||||
".t c #007f7f",
|
||||
".u c #5f5f5f",
|
||||
".v c #707070",
|
||||
".w c #00f0f0",
|
||||
".x c #009090",
|
||||
".y c #ffff00",
|
||||
".z c #0000ff",
|
||||
".A c #00afaf",
|
||||
".B c #00d0d0",
|
||||
".C c #00dfdf",
|
||||
".D c #005f5f",
|
||||
".E c #00b0b0",
|
||||
".F c #001010",
|
||||
".G c #00c0c0",
|
||||
".H c #000f0f",
|
||||
".I c #00007f",
|
||||
".J c #005050",
|
||||
".K c #002f2f",
|
||||
".L c #dfcfcf",
|
||||
".M c #dfd0d0",
|
||||
".N c #006060",
|
||||
".O c #00e0e0",
|
||||
".P c #00ff00",
|
||||
".Q c #002020",
|
||||
".R c #dfc0c0",
|
||||
".S c #008080",
|
||||
".T c #001f1f",
|
||||
".U c #003f3f",
|
||||
".V c #007f00",
|
||||
".W c #00000f",
|
||||
".X c #000010",
|
||||
".Y c #00001f",
|
||||
".Z c #000020",
|
||||
".0 c #00002f",
|
||||
".1 c #000030",
|
||||
".2 c #00003f",
|
||||
".3 c #000040",
|
||||
".4 c #00004f",
|
||||
".5 c #000050",
|
||||
".6 c #00005f",
|
||||
".7 c #000060",
|
||||
".8 c #00006f",
|
||||
".9 c #000070",
|
||||
"#. c #7f7f80",
|
||||
"## c #9f9f9f",
|
||||
/* pixels */
|
||||
"........................................",
|
||||
"........................................",
|
||||
"........................................",
|
||||
".......................#.#.#............",
|
||||
".....................#.......#...#......",
|
||||
"...............................#.#......",
|
||||
".......#.#.#.................#.#.#......",
|
||||
".....#.y.i.y.#.#.#.#.#.#.#..............",
|
||||
".....#.i.y.i.y.i.y.i.y.i.#..............",
|
||||
".....#.y.i.y.i.y.i.y.i.y.#..............",
|
||||
".....#.i.y.i.y.#.#.#.#.#.#.#.#.#.#.#....",
|
||||
".....#.y.i.y.#.s.s.s.s.s.s.s.s.s.#......",
|
||||
".....#.i.y.#.s.s.s.s.s.s.s.s.s.#........",
|
||||
".....#.y.#.s.s.s.s.s.s.s.s.s.#..........",
|
||||
".....#.#.s.s.s.s.s.s.s.s.s.#............",
|
||||
".....#.#.#.#.#.#.#.#.#.#.#..............",
|
||||
"........................................",
|
||||
"........................................",
|
||||
"........................................"
|
||||
};
|
130
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/textbuffer_serialize.rb
Normal file
130
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/textbuffer_serialize.rb
Normal file
@ -0,0 +1,130 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
textbuffer_serialize.rb - Ruby/GTK sample script.
|
||||
|
||||
Copyright (c) 2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: textbuffer_serialize.rb,v 1.1 2006/11/23 08:39:13 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
if str = Gtk.check_version(2, 10, 0)
|
||||
puts "This sample requires GTK+ 2.10.0 or later"
|
||||
puts str
|
||||
exit
|
||||
end
|
||||
|
||||
current_folder = ENV['HOME'] || "."
|
||||
file_name = "serialized.dat"
|
||||
|
||||
textview = Gtk::TextView.new
|
||||
textview.set_size_request(600, 400)
|
||||
buffer = textview.buffer
|
||||
buffer.text = DATA.read
|
||||
format = buffer.serialize_formats[0]
|
||||
buffer.register_serialize_target(nil)
|
||||
buffer.register_deserialize_target(nil)
|
||||
|
||||
window = Gtk::Window.new("Gtk::TextBuffer Serialize Demo")
|
||||
vbox = Gtk::VBox.new
|
||||
|
||||
serialize_button = Gtk::FileChooserButton.new("Serialize to a file",
|
||||
Gtk::FileChooser::ACTION_OPEN)
|
||||
deserialize_button = Gtk::FileChooserButton.new("Serialize to a file",
|
||||
Gtk::FileChooser::ACTION_OPEN)
|
||||
|
||||
serialize_button.current_folder = current_folder
|
||||
deserialize_button.current_folder = current_folder
|
||||
|
||||
toolbar = Gtk::Toolbar.new
|
||||
|
||||
toolbar.append(Gtk::Stock::OPEN, "Deserialize from a file") do
|
||||
dialog = Gtk::FileChooserDialog.new("Deserialize from a file",
|
||||
window,
|
||||
Gtk::FileChooser::ACTION_OPEN,
|
||||
nil,
|
||||
[Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL],
|
||||
[Gtk::Stock::OPEN, Gtk::Dialog::RESPONSE_ACCEPT])
|
||||
|
||||
dialog.filename = File.expand_path(file_name)
|
||||
if dialog.run == Gtk::Dialog::RESPONSE_ACCEPT
|
||||
file_name = dialog.filename
|
||||
File.open(file_name, "rb") {|io|
|
||||
buffer.delete(buffer.start_iter, buffer.end_iter)
|
||||
buffer.deserialize(buffer, format, buffer.start_iter, io.read)
|
||||
}
|
||||
end
|
||||
dialog.destroy
|
||||
end
|
||||
|
||||
toolbar.append(Gtk::Stock::SAVE, "Serialize to a file") do
|
||||
dialog = Gtk::FileChooserDialog.new("Serialize from a file",
|
||||
window,
|
||||
Gtk::FileChooser::ACTION_SAVE,
|
||||
nil,
|
||||
[Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL],
|
||||
[Gtk::Stock::OPEN, Gtk::Dialog::RESPONSE_ACCEPT])
|
||||
dialog.current_name = file_name
|
||||
if dialog.run == Gtk::Dialog::RESPONSE_ACCEPT
|
||||
file_name = dialog.filename
|
||||
File.open(file_name, "wb") {|io|
|
||||
io.write(buffer.serialize(buffer, format, buffer.start_iter, buffer.end_iter))
|
||||
}
|
||||
end
|
||||
dialog.destroy
|
||||
end
|
||||
|
||||
toolbar.append(Gtk::Stock::CLEAR, "Clear all") do
|
||||
buffer.delete(buffer.start_iter, buffer.end_iter)
|
||||
end
|
||||
toolbar.append_space
|
||||
toolbar.append(Gtk::Stock::SELECT_COLOR, "Color the region") do
|
||||
dialog = Gtk::ColorSelectionDialog.new("Color the region")
|
||||
if dialog.run == Gtk::Dialog::RESPONSE_OK
|
||||
bounds = buffer.selection_bounds
|
||||
color = dialog.colorsel.current_color
|
||||
tag_name = color.to_a.inspect
|
||||
unless tag = buffer.tag_table.lookup(tag_name)
|
||||
tag = Gtk::TextTag.new(tag_name).set_foreground_gdk(color)
|
||||
end
|
||||
buffer.tag_table.add(tag)
|
||||
buffer.apply_tag(tag, bounds[0], bounds[1])
|
||||
end
|
||||
dialog.destroy
|
||||
end
|
||||
|
||||
toolbar.append(Gtk::Stock::SELECT_FONT, "Set a font to the region") do
|
||||
dialog = Gtk::FontSelectionDialog.new("Set font to the region")
|
||||
if dialog.run == Gtk::Dialog::RESPONSE_OK
|
||||
bounds = buffer.selection_bounds
|
||||
font = dialog.font_name
|
||||
unless tag = buffer.tag_table.lookup(font)
|
||||
tag = Gtk::TextTag.new(font).set_font(font)
|
||||
end
|
||||
buffer.tag_table.add(tag)
|
||||
buffer.apply_tag(tag, bounds[0], bounds[1])
|
||||
end
|
||||
dialog.destroy
|
||||
end
|
||||
|
||||
toolbar.append_space
|
||||
toolbar.append(Gtk::Stock::QUIT, "Quit this application") do
|
||||
Gtk.main_quit
|
||||
end
|
||||
|
||||
vbox.pack_start(toolbar, false, false).add(Gtk::ScrolledWindow.new.add(textview))
|
||||
window.add(vbox)
|
||||
window.show_all
|
||||
window.signal_connect("destroy") { Gtk.main_quit }
|
||||
|
||||
Gtk.main
|
||||
|
||||
__END__
|
||||
This is a sample script for rich text serialization/deserialization.
|
||||
|
||||
1. Edit this text using font/color buttons.
|
||||
2. Click save button and save this text (= serialize this as rich text to a file)
|
||||
3. Click clear button and clear this text buffer.
|
||||
4. Click load button and load the file which you save (= deserialize this).
|
72
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/threads.rb
Normal file
72
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/threads.rb
Normal file
@ -0,0 +1,72 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
threads.rb - Ruby/GTK2 sample script.
|
||||
|
||||
Copyright (c) 2003-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: threads.rb,v 1.5 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
require 'thread'
|
||||
|
||||
label = Gtk::Label.new
|
||||
|
||||
Thread.new {
|
||||
(0...1000).each { |cnt|
|
||||
p "A:" + cnt.to_s
|
||||
label.label = "A:" + cnt.to_s
|
||||
sleep(2)
|
||||
}
|
||||
}
|
||||
|
||||
start_button = Gtk::Button.new("start")
|
||||
stop_button = Gtk::Button.new("stop")
|
||||
|
||||
start_button.signal_connect("clicked") do
|
||||
start_button.sensitive=false
|
||||
@th = Thread.new {
|
||||
(0...10).each { |cnt|
|
||||
p "B:" + cnt.to_s
|
||||
label.label = "B:" + cnt.to_s
|
||||
sleep(2)
|
||||
}
|
||||
@th = nil
|
||||
start_button.sensitive = true
|
||||
start_button.grab_focus
|
||||
stop_button.sensitive = false
|
||||
}
|
||||
stop_button.sensitive = true
|
||||
stop_button.grab_focus
|
||||
end
|
||||
|
||||
stop_button.signal_connect("clicked") do
|
||||
if @th
|
||||
@th.kill
|
||||
puts "killed"
|
||||
@th = nil
|
||||
start_button.sensitive = true
|
||||
start_button.grab_focus
|
||||
stop_button.sensitive = false
|
||||
end
|
||||
end
|
||||
|
||||
stop_button.sensitive = false
|
||||
|
||||
box = Gtk::VBox.new.
|
||||
set_size_request(100,100)
|
||||
|
||||
box << label << start_button << stop_button
|
||||
|
||||
win = Gtk::Window.new << box
|
||||
|
||||
win.show_all.signal_connect("delete_event") do
|
||||
p "Exiting..."
|
||||
Gtk.main_quit
|
||||
Thread.list.each {|t| t.kill }
|
||||
end
|
||||
|
||||
Gtk.main
|
||||
|
||||
|
42
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/to_drawable.rb
Normal file
42
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/to_drawable.rb
Normal file
@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
to_drawable.rb - Gdk::Pixbuf(GDK methods) sample script.
|
||||
|
||||
Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: to_drawable.rb,v 1.6 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
filename = ARGV[0]
|
||||
unless filename
|
||||
puts "ruby #{$0} filename"
|
||||
exit(1)
|
||||
end
|
||||
|
||||
pixbuf = Gdk::Pixbuf.new(filename)
|
||||
|
||||
w = Gtk::Window.new("Drawable sample")
|
||||
w.realize
|
||||
w.signal_connect('delete-event') do
|
||||
Gtk.main_quit
|
||||
end
|
||||
|
||||
d = Gtk::DrawingArea.new
|
||||
gc = Gdk::GC.new(w.window)
|
||||
d.signal_connect('expose-event') do |w, e|
|
||||
unless e.count > 0
|
||||
width = w.allocation.width
|
||||
height = w.allocation.height
|
||||
pixbuf = pixbuf.scale(width, height)
|
||||
d.window.draw_pixbuf(gc, pixbuf, 0, 0, 0, 0,
|
||||
width, height, Gdk::RGB::DITHER_NORMAL, 0, 0)
|
||||
end
|
||||
true
|
||||
end
|
||||
w.add(d)
|
||||
w.show_all
|
||||
|
||||
Gtk.main
|
34
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/togglebutton.rb
Normal file
34
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/togglebutton.rb
Normal file
@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
togglebutton.rb - Ruby/GTK sample script.
|
||||
|
||||
Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: togglebutton.rb,v 1.10 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
window = Gtk::Window.new("Gtk::ToggleButton sample")
|
||||
window.border_width = 10
|
||||
|
||||
box = Gtk::VBox.new(false, 10)
|
||||
window.add(box)
|
||||
|
||||
button1 = Gtk::ToggleButton.new("_button1")
|
||||
button2 = Gtk::ToggleButton.new("_button2", false)
|
||||
button3 = Gtk::ToggleButton.new(Gtk::Stock::QUIT)
|
||||
box.add(button1).add(button2).add(button3)
|
||||
|
||||
box.pack_start(Gtk::HSeparator.new)
|
||||
|
||||
close = Gtk::Button.new("close")
|
||||
close.signal_connect("clicked") do
|
||||
Gtk.main_quit
|
||||
end
|
||||
box.add(close)
|
||||
|
||||
window.show_all
|
||||
|
||||
Gtk.main
|
55
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/toolbar.rb
Normal file
55
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/toolbar.rb
Normal file
@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
toolbar.rb - Ruby/GTK2 sample script.
|
||||
|
||||
Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: toolbar.rb,v 1.11 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
window = Gtk::Window.new("Gtk::Toolbar sample")
|
||||
|
||||
window.signal_connect("destroy") do
|
||||
Gtk.main_quit
|
||||
end
|
||||
|
||||
toolbar = Gtk::Toolbar.new
|
||||
|
||||
toolbar.append("Horizontal", "Horizontal toolbar layout", "Toolbar/Horizontal",
|
||||
Gtk::Image.new("test.xpm")) do
|
||||
toolbar.orientation = Gtk::ORIENTATION_HORIZONTAL
|
||||
end
|
||||
toolbar.append("Vertical", "Vertical toolbar layout", "Toolbar/Vertical",
|
||||
Gtk::Image.new("test.xpm")) do
|
||||
toolbar.orientation = Gtk::ORIENTATION_VERTICAL
|
||||
end
|
||||
toolbar.append_space
|
||||
toolbar.append("Icons", "Only show toolbar icons", "Toolbar/IconsOnly",
|
||||
Gtk::Image.new("test.xpm")) do
|
||||
toolbar.toolbar_style = Gtk::Toolbar::ICONS
|
||||
end
|
||||
toolbar.append("Text", "Only show toolbar text", "Toolbar/TextOnly",
|
||||
Gtk::Image.new("test.xpm")) do
|
||||
toolbar.toolbar_style = Gtk::Toolbar::TEXT
|
||||
end
|
||||
toolbar.append("Both", "Show toolbar icons and text", "Toolbar/Both",
|
||||
Gtk::Image.new("test.xpm")) do
|
||||
toolbar.toolbar_style = Gtk::Toolbar::BOTH
|
||||
end
|
||||
toolbar.append_space
|
||||
toolbar.append("Enable", "Enable tooltips",nil,
|
||||
Gtk::Image.new("test.xpm")) do
|
||||
toolbar.tooltips = true
|
||||
end
|
||||
toolbar.append("Disable", "Disable tooltips",nil,
|
||||
Gtk::Image.new("test.xpm")) do
|
||||
toolbar.tooltips = false
|
||||
end
|
||||
|
||||
window.add(toolbar)
|
||||
window.show_all
|
||||
|
||||
Gtk.main
|
204
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/tooltips.rb
Normal file
204
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/tooltips.rb
Normal file
@ -0,0 +1,204 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
tooltips.rb - Demonstrates the new tooltip API of Gtk+ 2.12;
|
||||
rg2 translation from gtk/tests/testtooltips.c.
|
||||
|
||||
Copyright (c) 2007 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: tooltips.rb,v 1.1 2007/07/10 13:17:34 ggc Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
if str = Gtk.check_version(2, 12, 0)
|
||||
puts "This sample requires GTK+ 2.12.0 or later"
|
||||
puts str
|
||||
exit
|
||||
end
|
||||
|
||||
def treeview_query_tooltip(treeview, keyboard_tip, x, y, tooltip)
|
||||
if keyboard_tip
|
||||
# Keyboard mode
|
||||
path, = treeview.cursor
|
||||
if not path
|
||||
return false
|
||||
end
|
||||
else
|
||||
bin_x, bin_y = treeview.convert_widget_to_bin_window_coords(x, y)
|
||||
# Mouse mode
|
||||
path, = treeview.get_path_at_pos(bin_x, bin_y)
|
||||
if not path
|
||||
return false
|
||||
end
|
||||
end
|
||||
data = treeview.model.get_value(treeview.model.get_iter(path), 0)
|
||||
tooltip.markup = "<b>Path #{path}:</b> #{data}"
|
||||
return true
|
||||
end
|
||||
|
||||
def textview_query_tooltip(textview, keyboard_tip, x, y, tooltip, tag)
|
||||
if keyboard_tip
|
||||
iter = textview.buffer.get_iter_at_offset(textview.buffer.cursor_position)
|
||||
else
|
||||
bx, by = textview.window_to_buffer_coords(Gtk::TextView::WINDOW_TEXT, x, y)
|
||||
iter, = textview.get_iter_at_position(bx, by)
|
||||
end
|
||||
if iter.has_tag?(tag)
|
||||
tooltip.text = 'Tooltip on text tag'
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
def drawingarea_query_tooltip(keyboard_tip, x, y, tooltip, rectangles)
|
||||
if keyboard_tip
|
||||
return false
|
||||
end
|
||||
for r in rectangles
|
||||
if r.x < x && x < r.x + 50 && r.y < y && y < r.y + 50
|
||||
tooltip.markup = r.tooltip
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
Gtk.init
|
||||
|
||||
window = Gtk::Window.new(Gtk::Window::TOPLEVEL)
|
||||
window.title = 'Tooltips test'
|
||||
window.border_width = 10
|
||||
window.signal_connect('delete-event') { Gtk.main_quit }
|
||||
|
||||
box = Gtk::VBox.new(false, 3)
|
||||
window.add(box)
|
||||
|
||||
# A check button using the tooltip-markup property
|
||||
button = Gtk::CheckButton.new('This one uses the tooltip-markup property')
|
||||
button.tooltip_text = 'Hello, I am a static tooltip.'
|
||||
box.pack_start(button, false, false, 0)
|
||||
|
||||
raise if button.tooltip_text != 'Hello, I am a static tooltip.'
|
||||
raise if button.tooltip_markup != 'Hello, I am a static tooltip.'
|
||||
|
||||
# A check button using the query-tooltip signal
|
||||
button = Gtk::CheckButton.new('I use the query-tooltip signal')
|
||||
button.has_tooltip = true
|
||||
button.signal_connect('query-tooltip') { |widget, x, y, keyboard_tip, tooltip|
|
||||
tooltip.markup = widget.label
|
||||
tooltip.set_icon_from_stock(Gtk::Stock::DELETE, Gtk::IconSize::MENU)
|
||||
true
|
||||
}
|
||||
box.pack_start(button, false, false, 0)
|
||||
|
||||
# A label
|
||||
label = Gtk::Label.new('I am just a label')
|
||||
label.selectable = false
|
||||
label.tooltip_text = 'Label & and tooltip'
|
||||
box.pack_start(label, false, false, 0)
|
||||
|
||||
raise if label.tooltip_text != "Label & and tooltip"
|
||||
raise if label.tooltip_markup != "Label & and tooltip"
|
||||
|
||||
# A selectable label
|
||||
label = Gtk::Label.new('I am a selectable label')
|
||||
label.selectable = true
|
||||
label.tooltip_markup = '<b>Another</b> Label tooltip'
|
||||
box.pack_start(label, false, false, 0)
|
||||
|
||||
raise if label.tooltip_text != 'Another Label tooltip'
|
||||
raise if label.tooltip_markup != '<b>Another</b> Label tooltip'
|
||||
|
||||
# Another one, with a custom tooltip window
|
||||
button = Gtk::CheckButton.new('This one has a custom tooltip window!')
|
||||
box.pack_start(button, false, false, 0)
|
||||
|
||||
tooltip_window = Gtk::Window.new(Gtk::Window::POPUP)
|
||||
tooltip_button = Gtk::Label.new('blaat!')
|
||||
tooltip_window.add(tooltip_button)
|
||||
tooltip_button.show
|
||||
|
||||
button.tooltip_window = tooltip_window
|
||||
button.signal_connect('query-tooltip') { |widget, x, y, keyboard_tip, tooltip|
|
||||
widget.tooltip_window.modify_bg(Gtk::StateType::NORMAL, Gdk::Color.new(0, 65535, 0))
|
||||
true
|
||||
}
|
||||
button.has_tooltip = true
|
||||
|
||||
# An insensitive button
|
||||
button = Gtk::Button.new('This one is insensitive')
|
||||
button.sensitive = false
|
||||
button.tooltip_text = 'Insensitive!'
|
||||
box.pack_start(button, false, false, 0)
|
||||
|
||||
# Tree view
|
||||
store = Gtk::TreeStore.new(String)
|
||||
iter = store.insert(nil, 0, ['File Manager'])
|
||||
iter = store.insert(nil, 0, ['Gossip'])
|
||||
iter = store.insert(nil, 0, ['System Settings'])
|
||||
iter = store.insert(nil, 0, ['The GIMP'])
|
||||
iter = store.insert(nil, 0, ['Terminal'])
|
||||
iter = store.insert(nil, 0, ['Word Processor'])
|
||||
treeview = Gtk::TreeView.new(store)
|
||||
treeview.set_size_request(200, 240)
|
||||
treeview.append_column(Gtk::TreeViewColumn.new('Test', Gtk::CellRendererText.new, { :text => 0 }))
|
||||
treeview.has_tooltip = true
|
||||
treeview.signal_connect('query-tooltip') { |widget, x, y, keyboard_tip, tooltip|
|
||||
treeview_query_tooltip(widget, keyboard_tip, x, y, tooltip)
|
||||
}
|
||||
treeview.selection.signal_connect('changed') { treeview.trigger_tooltip_query }
|
||||
# Set a tooltip on the column
|
||||
column = treeview.get_column(0)
|
||||
column.clickable = true
|
||||
#column.button.tooltip_text = 'Header' .button not available
|
||||
box.pack_start(treeview, false, false, 2)
|
||||
|
||||
# Text view
|
||||
buffer = Gtk::TextBuffer.new
|
||||
buffer.insert(buffer.end_iter, 'Hello, the text ')
|
||||
tag = buffer.create_tag('bold', { 'weight' => Pango::WEIGHT_BOLD })
|
||||
buffer.insert(buffer.end_iter, 'in bold', tag)
|
||||
buffer.insert(buffer.end_iter, ' has a tooltip!')
|
||||
textview = Gtk::TextView.new(buffer)
|
||||
textview.set_size_request(200, 50)
|
||||
textview.has_tooltip = true
|
||||
textview.signal_connect('query-tooltip') { |widget, x, y, keyboard_tip, tooltip|
|
||||
textview_query_tooltip(widget, keyboard_tip, x, y, tooltip, tag)
|
||||
}
|
||||
box.pack_start(textview, false, false, 2)
|
||||
|
||||
# Drawing area
|
||||
if Gdk.cairo_available?
|
||||
Rectangle = Struct.new("Rectangle", :x, :y, :r, :g, :b, :tooltip)
|
||||
rectangles = [ Rectangle.new(10, 10, 0.0, 0.0, 0.9, "Blue box!"),
|
||||
Rectangle.new(200, 170, 1.0, 0.0, 0.0, "Red thing"),
|
||||
Rectangle.new(100, 50, 0.8, 0.8, 0.0, "Yellow thing") ]
|
||||
drawingarea = Gtk::DrawingArea.new
|
||||
drawingarea.set_size_request(320, 240)
|
||||
drawingarea.has_tooltip = true
|
||||
drawingarea.signal_connect('expose_event') {
|
||||
cr = drawingarea.window.create_cairo_context
|
||||
cr.rectangle(0, 0, drawingarea.allocation.width, drawingarea.allocation.height)
|
||||
cr.set_source_rgb(1.0, 1.0, 1.0)
|
||||
cr.fill
|
||||
rectangles.each { |r|
|
||||
cr.rectangle(r.x, r.y, 50, 50)
|
||||
cr.set_source_rgb(r.r, r.g, r.b)
|
||||
cr.stroke
|
||||
cr.rectangle(r.x, r.y, 50, 50)
|
||||
cr.set_source_rgba(r.r, r.g, r.b, 0.5)
|
||||
cr.fill
|
||||
}
|
||||
}
|
||||
drawingarea.signal_connect('query-tooltip') { |widget, x, y, keyboard_tip, tooltip|
|
||||
drawingarea_query_tooltip(keyboard_tip, x, y, tooltip, rectangles)
|
||||
}
|
||||
box.pack_start(drawingarea, false, false, 2)
|
||||
else
|
||||
warn "Part of this sample needs Cairo support. Make sure your ruby-gtk2 is compiled with Cairo support, and rcairo is installed."
|
||||
end
|
||||
|
||||
window.show_all
|
||||
Gtk.main
|
85
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/tree_combo.rb
Normal file
85
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/tree_combo.rb
Normal file
@ -0,0 +1,85 @@
|
||||
=begin
|
||||
tree_combo.rb - Gtk::TreeView and Gtk::CellRendererCombo
|
||||
sample script.
|
||||
|
||||
Copyright (C) 2006 Masao Mutoh
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: tree_combo.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
if str = Gtk.check_version(2, 6, 0)
|
||||
puts "This sample requires GTK+ 2.6.0 or later"
|
||||
puts str
|
||||
exit
|
||||
end
|
||||
|
||||
T_APPLICATION = 0
|
||||
T_COMBO_TEXT_COLUMN = 1
|
||||
T_COMBO_MODEL = 2
|
||||
T_COMBO_HAS_ENTRY = 3
|
||||
T_COMBO_EDITABLE = 4
|
||||
T_COMBO_TEXT = 5
|
||||
|
||||
# The COMPUTER combo model
|
||||
combo_model = Gtk::ListStore.new(String)
|
||||
|
||||
["Ruby", "Perl", "Python", "Java"].each do |v|
|
||||
iter = combo_model.append
|
||||
iter[0] = v
|
||||
end
|
||||
|
||||
|
||||
# The table model.
|
||||
model = Gtk::ListStore.new(String, # T_APPLICATION
|
||||
Integer, # T_COMBO_TEXT_COLUMN
|
||||
Gtk::ListStore, # T_COMBO_MODEL
|
||||
TrueClass, # T_COMBO_HAS_ENTRY
|
||||
TrueClass, # T_COMBO_EDITABLE
|
||||
String) # T_COMBO_TEXT
|
||||
|
||||
view = Gtk::TreeView.new(model)
|
||||
|
||||
# 1st column(Text)
|
||||
trenderer = Gtk::CellRendererText.new
|
||||
tcol = Gtk::TreeViewColumn.new("Application", trenderer,
|
||||
:text => T_APPLICATION)
|
||||
view.append_column(tcol)
|
||||
|
||||
# 2nd column(Combo)
|
||||
crenderer = Gtk::CellRendererCombo.new
|
||||
crenderer.signal_connect("edited") do |renderer, path, text|
|
||||
model.get_iter(path)[T_COMBO_TEXT] = text
|
||||
end
|
||||
|
||||
ccol = Gtk::TreeViewColumn.new("Language", crenderer,
|
||||
:text_column => T_COMBO_TEXT_COLUMN,
|
||||
:model => T_COMBO_MODEL,
|
||||
:has_entry => T_COMBO_HAS_ENTRY,
|
||||
:editable => T_COMBO_EDITABLE,
|
||||
:text => T_COMBO_TEXT)
|
||||
view.append_column(ccol)
|
||||
|
||||
|
||||
# Create rows.
|
||||
(1..2).each do |v|
|
||||
iter = model.append
|
||||
iter[T_APPLICATION] = "application #{v}"
|
||||
iter[T_COMBO_MODEL] = combo_model
|
||||
iter[T_COMBO_HAS_ENTRY] = false
|
||||
iter[T_COMBO_EDITABLE] = true
|
||||
iter[T_COMBO_TEXT] = combo_model.get_iter("0")[0]
|
||||
end
|
||||
|
||||
win = Gtk::Window.new
|
||||
win.signal_connect("delete_event"){
|
||||
Gtk.main_quit
|
||||
}
|
||||
|
||||
win.add(view).show_all
|
||||
|
||||
Gtk.main
|
||||
|
69
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/tree_progress.rb
Normal file
69
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/tree_progress.rb
Normal file
@ -0,0 +1,69 @@
|
||||
=begin
|
||||
tree_progress.rb - Gtk::TreeView and Gtk::CellRendererProgress
|
||||
sample script.
|
||||
|
||||
Copyright (C) 2004-2006 Darren Willis, Masao Mutoh
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: tree_progress.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
if str = Gtk.check_version(2, 6, 0)
|
||||
puts "This sample requires GTK+ 2.6.0 or later"
|
||||
puts str
|
||||
exit
|
||||
end
|
||||
|
||||
win = Gtk::Window.new("Gtk::CellRendererProgress sample")
|
||||
win.set_default_size(300, 50)
|
||||
model = Gtk::ListStore.new(String, Float)
|
||||
view = Gtk::TreeView.new(model)
|
||||
|
||||
prog = model.append
|
||||
prog[0] = "bar 1"
|
||||
prog[1] = 50
|
||||
|
||||
prog1 = model.append
|
||||
prog1[0] = "bar 2"
|
||||
prog1[1] = 5
|
||||
|
||||
prog2 = model.append
|
||||
prog2[0] = "bar 3"
|
||||
prog2[1] = 10
|
||||
|
||||
arenderer = Gtk::CellRendererText.new
|
||||
acol = Gtk::TreeViewColumn.new("words", arenderer, :text => 0)
|
||||
view.append_column(acol)
|
||||
|
||||
prenderer = Gtk::CellRendererProgress.new
|
||||
pcol = Gtk::TreeViewColumn.new("Progress", prenderer, :value => 1)
|
||||
view.append_column(pcol)
|
||||
|
||||
win.signal_connect("delete_event"){
|
||||
Gtk.main_quit
|
||||
}
|
||||
|
||||
win.add(view)
|
||||
win.show_all
|
||||
|
||||
dir = 1
|
||||
thr = Thread.new do
|
||||
loop {
|
||||
prog2[1] += dir
|
||||
if prog2[1] > 100
|
||||
prog2[1] = 100
|
||||
dir = - dir
|
||||
end
|
||||
if prog2[1] < 0
|
||||
prog2[1] = 0
|
||||
dir = - dir
|
||||
end
|
||||
sleep 0.01
|
||||
}
|
||||
end
|
||||
|
||||
Gtk.main
|
||||
|
55
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/treemodelfilter.rb
Normal file
55
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/treemodelfilter.rb
Normal file
@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
treemodelfilter.rb - Gtk::TreeModelFilter sample
|
||||
|
||||
Copyright (c) 2004,2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: treemodelfilter.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
require 'gtk2'
|
||||
|
||||
if str = Gtk.check_version(2, 4, 0)
|
||||
puts "This sample requires GTK+ 2.4.0 or later"
|
||||
puts str
|
||||
exit
|
||||
end
|
||||
|
||||
ls = Gtk::ListStore.new(String, Integer)
|
||||
|
||||
column1 = Gtk::TreeViewColumn.new("data1",
|
||||
Gtk::CellRendererText.new, {:text => 0})
|
||||
column2 = Gtk::TreeViewColumn.new("data2",
|
||||
Gtk::CellRendererText.new, {:text => 1})
|
||||
|
||||
mf = Gtk::TreeModelFilter.new(ls)
|
||||
mf.set_visible_func do |model, iter|
|
||||
/a/ =~ iter[0]
|
||||
end
|
||||
|
||||
mf.set_modify_func(String, String) do |model, iter, column|
|
||||
child_iter = model.convert_iter_to_child_iter(iter)
|
||||
if column == 0
|
||||
child_iter[0]
|
||||
else
|
||||
"#{child_iter[1]} * 2 = #{child_iter[1] * 2}"
|
||||
end
|
||||
end
|
||||
|
||||
treeview = Gtk::TreeView.new(mf)
|
||||
treeview.append_column(column1)
|
||||
treeview.append_column(column2)
|
||||
|
||||
[
|
||||
["aaa", 1], ["aab", 2], ["aac", 3],
|
||||
["bba", 4], ["bbb", 5], ["bbc", 6]
|
||||
].each do |str, num|
|
||||
iter = ls.append
|
||||
iter[0] = str
|
||||
iter[1] = num
|
||||
end
|
||||
|
||||
win = Gtk::Window.new("Gtk::TreeModelFilter sample")
|
||||
win.signal_connect("destroy"){Gtk.main_quit}
|
||||
win.add(treeview).show_all.signal_connect("destroy"){Gtk.main_quit}
|
||||
Gtk.main
|
71
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/treeview.rb
Normal file
71
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/treeview.rb
Normal file
@ -0,0 +1,71 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
treeview.rb - Gtk::TreeView sample
|
||||
|
||||
Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: treeview.rb,v 1.8 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
window = Gtk::Window.new("Gtk::TreeView sample")
|
||||
|
||||
# Create data
|
||||
model = Gtk::TreeStore.new(String, String, Gdk::Color, Float, Gdk::Pixbuf)
|
||||
|
||||
# column 1
|
||||
root_iter = model.append(nil)
|
||||
root_iter[0] = "Root"
|
||||
root_iter[1] = "red"
|
||||
root_iter[2] = Gdk::Color.new(0, 65535, 0)
|
||||
root_iter[3] = 5.0
|
||||
|
||||
# column 2
|
||||
root_iter[4] = window.render_icon(Gtk::Stock::NEW, Gtk::IconSize::DIALOG, "icon1")
|
||||
|
||||
child_iter1 = model.append(root_iter)
|
||||
child_iter1[0] = "Child_Iter1"
|
||||
child_iter1[1] = "green"
|
||||
child_iter1[2] = Gdk::Color.new(65535, 0, 0)
|
||||
child_iter1[3] = 3.0
|
||||
|
||||
# column 2
|
||||
child_iter1[4] = window.render_icon(Gtk::Stock::OPEN, Gtk::IconSize::MENU, "icon2")
|
||||
|
||||
child_iter2 = model.append(root_iter)
|
||||
child_iter2[0] = "Child_Iter2"
|
||||
child_iter2[1] = "yellow"
|
||||
child_iter2[2] = Gdk::Color.new(0, 0, 65535)
|
||||
child_iter2[3] = 0.9
|
||||
|
||||
# column 2
|
||||
child_iter2[4] = window.render_icon(Gtk::Stock::QUIT, Gtk::IconSize::BUTTON, "icon3")
|
||||
|
||||
|
||||
# Create view
|
||||
tv = Gtk::TreeView.new(model)
|
||||
|
||||
# column 1
|
||||
renderer = Gtk::CellRendererText.new
|
||||
column = Gtk::TreeViewColumn.new("Gtk::CellRenderText", renderer, {
|
||||
:text => 0,
|
||||
:background => 1,
|
||||
:foreground_gdk => 2,
|
||||
:scale => 3,
|
||||
})
|
||||
tv.append_column(column)
|
||||
|
||||
# column 2
|
||||
renderer = Gtk::CellRendererPixbuf.new
|
||||
column = Gtk::TreeViewColumn.new("Gtk::CellRenderPixbuf", renderer, {
|
||||
:pixbuf => 4
|
||||
})
|
||||
|
||||
tv.append_column(column)
|
||||
|
||||
window.add(tv).set_default_size(300, 300).show_all
|
||||
window.signal_connect("destroy"){Gtk.main_quit}
|
||||
|
||||
Gtk.main
|
148
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/uimanager.rb
Normal file
148
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/uimanager.rb
Normal file
@ -0,0 +1,148 @@
|
||||
=begin
|
||||
uimanager.rb -
|
||||
|
||||
Copyright (C) 2004-2006 Masao Mutoh
|
||||
|
||||
Original version is demos/gtk-demo/ui_manager.c.
|
||||
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: uimanager.rb,v 1.6 2007/07/12 14:53:09 ggc Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
if str = Gtk.check_version(2, 4, 0)
|
||||
puts "This sample requires GTK+ 2.4.0 or later"
|
||||
puts str
|
||||
exit
|
||||
end
|
||||
|
||||
if not Gtk.check_version(2, 12, 0)
|
||||
recentmenuitem = "<menuitem name='recent' action='recent'/>"
|
||||
else
|
||||
recentmenuitem = ""
|
||||
end
|
||||
|
||||
ui_info = %Q[
|
||||
<ui>
|
||||
<menubar name='MenuBar'>
|
||||
<menu action='FileMenu'>
|
||||
<menuitem action='New'/>
|
||||
<menuitem action='Open'/>
|
||||
#{recentmenuitem}
|
||||
<menuitem action='Save'/>
|
||||
<menuitem action='SaveAs'/>
|
||||
<separator/>
|
||||
<menuitem action='Quit'/>
|
||||
</menu>
|
||||
<menu action='PreferencesMenu'>
|
||||
<menu action='ColorMenu'>
|
||||
<menuitem action='Red'/>
|
||||
<menuitem action='Green'/>
|
||||
<menuitem action='Blue'/>
|
||||
</menu>
|
||||
<menu action='ShapeMenu'>
|
||||
<menuitem action='Square'/>
|
||||
<menuitem action='Rectangle'/>
|
||||
<menuitem action='Oval'/>
|
||||
</menu>
|
||||
<menuitem action='Bold'/>
|
||||
</menu>
|
||||
<menu action='HelpMenu'>
|
||||
<menuitem action='About'/>
|
||||
</menu>
|
||||
</menubar>
|
||||
<toolbar name='ToolBar'>
|
||||
<toolitem action='Open'/>
|
||||
<toolitem action='Quit'/>
|
||||
<separator action='Sep1'/>
|
||||
<toolitem action='Logo'/>
|
||||
</toolbar>
|
||||
</ui>]
|
||||
|
||||
callback = Proc.new {|actiongroup, action|
|
||||
puts "`#{action.name}' is clicked. "
|
||||
if action.is_a? Gtk::ToggleAction
|
||||
puts "active? = #{action.active?}"
|
||||
end
|
||||
}
|
||||
|
||||
callback_quit = Proc.new {
|
||||
p "Quit is called."
|
||||
Gtk.main_quit
|
||||
}
|
||||
|
||||
callback_radio = Proc.new {|action, current|
|
||||
puts "action = `#{action.name}'"
|
||||
puts "current = `#{current.name}'"
|
||||
}
|
||||
|
||||
actions = [
|
||||
["FileMenu", nil, "_File"],
|
||||
["PreferencesMenu", nil, "_Preferences"],
|
||||
["ColorMenu", nil, "_Color"],
|
||||
["ShapeMenu", nil, "_Shape"],
|
||||
["HelpMenu", nil, "_Help"],
|
||||
["New", Gtk::Stock::NEW, "_New", "<control>N", "Create a new file", callback],
|
||||
["Open", Gtk::Stock::OPEN, "_Open", "<control>O", "Open a file", callback],
|
||||
["Save", Gtk::Stock::SAVE, "_Save", "<control>S", "Save current file", callback],
|
||||
["SaveAs", Gtk::Stock::SAVE, "Save _As...", nil, "Save to a file", callback],
|
||||
["Quit", Gtk::Stock::QUIT, "_Quit", "<control>Q", "Quit", callback_quit],
|
||||
["About", nil, "_About", "<control>A", "About", callback],
|
||||
["Logo", "demo-gtk-logo", nil, nil, "GTK+", callback]
|
||||
]
|
||||
|
||||
toggle_actions = [
|
||||
["Bold", Gtk::Stock::BOLD, "_Bold", "<control>B", "Bold", callback, true]
|
||||
]
|
||||
|
||||
color_radio_actions = [
|
||||
["Red", nil, "_Red", "<control>R", "Blood", 0],
|
||||
["Green", nil, "_Green", "<control>G", "Grass", 1],
|
||||
["Blue", nil, "_Blue", "<control>B", "Sky", 2]
|
||||
]
|
||||
|
||||
shape_radio_actions = [
|
||||
["Square", nil, "_Square", "<control>S", "Square", 0],
|
||||
["Rectangle", nil, "_Rectangle", "<control>R", "Rectangle", 1],
|
||||
["Oval", nil, "_Oval", "<control>O", "Egg", 2]
|
||||
]
|
||||
|
||||
window = Gtk::Window.new("Gtk::UIManager sample")
|
||||
|
||||
actiongroup = Gtk::ActionGroup.new("Actions")
|
||||
actiongroup.add_actions(actions)
|
||||
actiongroup.add_toggle_actions(toggle_actions)
|
||||
actiongroup.add_radio_actions(color_radio_actions, 1) do |action, current|
|
||||
puts "action = `#{action.name}'"
|
||||
puts "current = `#{current.name}'"
|
||||
end
|
||||
actiongroup.add_radio_actions(shape_radio_actions, 2, callback_radio)
|
||||
|
||||
if not Gtk.check_version(2, 12, 0)
|
||||
action = Gtk::RecentAction.new('recent', 'Open Recent', nil, 'gtk-open')
|
||||
[ 'item-activated', 'activate' ].each { |signal|
|
||||
action.signal_connect(signal) { |action|
|
||||
puts "`Recent' #{signal}, uri=#{action.current_uri || 'no item selected'}"
|
||||
}
|
||||
}
|
||||
actiongroup.add_action(action)
|
||||
end
|
||||
|
||||
uimanager = Gtk::UIManager.new
|
||||
uimanager.insert_action_group(actiongroup, 0)
|
||||
window.add_accel_group(uimanager.accel_group)
|
||||
|
||||
uimanager.add_ui(ui_info)
|
||||
|
||||
vbox = Gtk::VBox.new
|
||||
vbox.pack_start(uimanager["/MenuBar"], false, false)
|
||||
vbox.pack_start(Gtk::Label.new("Gtk::UIManager Sample"))
|
||||
window.add(vbox)
|
||||
window.set_default_size(100, 100).show_all
|
||||
|
||||
window.signal_connect("destroy"){Gtk.main_quit}
|
||||
|
||||
Gtk.main
|
||||
|
91
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/uimanager2.rb
Normal file
91
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/uimanager2.rb
Normal file
@ -0,0 +1,91 @@
|
||||
=begin
|
||||
uimanager2.rb -
|
||||
|
||||
Copyright (C) 2004-2006 Masao Mutoh
|
||||
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: uimanager2.rb,v 1.5 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
require 'gtk2'
|
||||
|
||||
if str = Gtk.check_version(2, 4, 0)
|
||||
puts "This sample requires GTK+ 2.4.0 or later"
|
||||
puts str
|
||||
exit
|
||||
end
|
||||
|
||||
callback = Proc.new {|actiongroup, action|
|
||||
puts "`#{action.name}' is clicked. "
|
||||
if action.is_a? Gtk::ToggleAction
|
||||
puts "active? = #{action.active?}"
|
||||
end
|
||||
}
|
||||
|
||||
callback_quit = Proc.new {
|
||||
p "Quit is called."
|
||||
Gtk.main_quit
|
||||
}
|
||||
|
||||
callback_radio = Proc.new {|action, current|
|
||||
puts "action = `#{action.name}'"
|
||||
puts "current = `#{current.name}'"
|
||||
}
|
||||
|
||||
actions = [
|
||||
["FileMenu", nil, "_File"],
|
||||
["PreferencesMenu", nil, "_Preferences"],
|
||||
["ColorMenu", nil, "_Color"],
|
||||
["ShapeMenu", nil, "_Shape"],
|
||||
["HelpMenu", nil, "_Help"],
|
||||
["New", Gtk::Stock::NEW, "_New", "<control>N", "Create a new file", callback],
|
||||
["Open", Gtk::Stock::OPEN, "_Open", "<control>O", "Open a file", callback],
|
||||
["Save", Gtk::Stock::SAVE, "_Save", "<control>S", "Save current file", callback],
|
||||
["SaveAs", Gtk::Stock::SAVE, "Save _As...", nil, "Save to a file", callback],
|
||||
["Quit", Gtk::Stock::QUIT, "_Quit", "<control>Q", "Quit", callback_quit],
|
||||
["About", nil, "_About", "<control>A", "About", callback],
|
||||
["Logo", "demo-gtk-logo", nil, nil, "GTK+", callback]
|
||||
]
|
||||
|
||||
toggle_actions = [
|
||||
["Bold", Gtk::Stock::BOLD, "_Bold", "<control>B", "Bold", callback, true]
|
||||
]
|
||||
|
||||
color_radio_actions = [
|
||||
["Red", nil, "_Red", "<control>R", "Blood", 0],
|
||||
["Green", nil, "_Green", "<control>G", "Grass", 1],
|
||||
["Blue", nil, "_Blue", "<control>B", "Sky", 2]
|
||||
]
|
||||
|
||||
shape_radio_actions = [
|
||||
["Square", nil, "_Square", "<control>S", "Square", 0],
|
||||
["Rectangle", nil, "_Rectangle", "<control>R", "Rectangle", 1],
|
||||
["Oval", nil, "_Oval", "<control>O", "Egg", 2]
|
||||
]
|
||||
|
||||
window = Gtk::Window.new("Gtk::UIManager sample2")
|
||||
window.signal_connect("destroy"){Gtk.main_quit}
|
||||
|
||||
actiongroup = Gtk::ActionGroup.new("Actions")
|
||||
actiongroup.add_actions(actions)
|
||||
actiongroup.add_toggle_actions(toggle_actions)
|
||||
actiongroup.add_radio_actions(color_radio_actions, 1) do |action, current|
|
||||
puts "action = `#{action.name}'"
|
||||
puts "current = `#{current.name}'"
|
||||
end
|
||||
actiongroup.add_radio_actions(shape_radio_actions, 2, callback_radio)
|
||||
|
||||
uimanager = Gtk::UIManager.new
|
||||
uimanager.insert_action_group(actiongroup, 0)
|
||||
window.add_accel_group(uimanager.accel_group)
|
||||
|
||||
uimanager.add_ui("./uimanager2.xml")
|
||||
|
||||
vbox = Gtk::VBox.new
|
||||
vbox.pack_start(uimanager["/MenuBar"], false, false)
|
||||
vbox.pack_start(Gtk::Label.new("Gtk::UIManager Sample"))
|
||||
window.add(vbox)
|
||||
window.set_default_size(100, 100).show_all
|
||||
|
||||
Gtk.main
|
||||
|
36
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/uimanager2.xml
Normal file
36
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/uimanager2.xml
Normal file
@ -0,0 +1,36 @@
|
||||
<?xml version="1.0"?>
|
||||
<ui>
|
||||
<menubar name='MenuBar'>
|
||||
<menu action='FileMenu'>
|
||||
<menuitem action='New'/>
|
||||
<menuitem action='Open'/>
|
||||
<menuitem action='Save'/>
|
||||
<menuitem action='SaveAs'/>
|
||||
<separator/>
|
||||
<menuitem action='Quit'/>
|
||||
</menu>
|
||||
<menu action='PreferencesMenu'>
|
||||
<menu action='ColorMenu'>
|
||||
<menuitem action='Red'/>
|
||||
<menuitem action='Green'/>
|
||||
<menuitem action='Blue'/>
|
||||
</menu>
|
||||
<menu action='ShapeMenu'>
|
||||
<menuitem action='Square'/>
|
||||
<menuitem action='Rectangle'/>
|
||||
<menuitem action='Oval'/>
|
||||
</menu>
|
||||
<menuitem action='Bold'/>
|
||||
</menu>
|
||||
<menu action='HelpMenu'>
|
||||
<menuitem action='About'/>
|
||||
</menu>
|
||||
</menubar>
|
||||
<toolbar name='ToolBar'>
|
||||
<toolitem action='Open'/>
|
||||
<toolitem action='Quit'/>
|
||||
<separator action='Sep1'/>
|
||||
<toolitem action='Logo'/>
|
||||
</toolbar>
|
||||
</ui>
|
||||
|
24
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/window.rb
Normal file
24
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/window.rb
Normal file
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env ruby
|
||||
=begin
|
||||
window.rb - Gtk::Window sample.
|
||||
|
||||
Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Id: window.rb,v 1.9 2006/10/21 16:58:00 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
window = Gtk::Window.new("Gtk::Window sample")
|
||||
window.signal_connect("destroy"){Gtk.main_quit}
|
||||
|
||||
button = Gtk::Button.new("Hello World")
|
||||
button.signal_connect("clicked") do
|
||||
puts "hello world"
|
||||
Gtk.main_quit
|
||||
end
|
||||
window.add(button)
|
||||
window.show_all
|
||||
|
||||
Gtk.main
|
43
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/xbm_cursor.rb
Normal file
43
lib/ruby-gtk2-2.0.2/gtk2/sample/misc/xbm_cursor.rb
Normal file
@ -0,0 +1,43 @@
|
||||
=begin
|
||||
xbm_cursor.rb - Gdk::Cursor sample script.
|
||||
|
||||
Copyright (C) 2001-2006 Masao Mutoh
|
||||
This program is licenced under the same licence as Ruby-GNOME2.
|
||||
|
||||
$Date: 2006/06/17 13:18:12 $
|
||||
$Id: xbm_cursor.rb,v 1.6 2006/06/17 13:18:12 mutoh Exp $
|
||||
=end
|
||||
|
||||
require 'gtk2'
|
||||
|
||||
cursor_bits = [
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xf0, 0x3f, 0x00, 0xe0, 0x78, 0x00, 0xe0, 0x70, 0x00, 0xe0, 0x70, 0x00,
|
||||
0xe0, 0x38, 0x00, 0xe0, 0x1f, 0x00, 0xe0, 0x1d, 0x00, 0xe0, 0x38, 0x00,
|
||||
0xe0, 0x78, 0x00, 0xe0, 0xf0, 0x00, 0xf0, 0xf3, 0x01, 0xf0, 0xe3, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00].pack("c*")
|
||||
|
||||
cursor_mask_bits = [
|
||||
0x63, 0x8e, 0x0f, 0x67, 0x8e, 0x0f, 0x06, 0xc6, 0x07, 0x04, 0x00, 0x00,
|
||||
0xf0, 0x3f, 0x08, 0xe7, 0x78, 0x0e, 0xe7, 0x70, 0x0f, 0xe4, 0x70, 0x03,
|
||||
0xe0, 0x38, 0x00, 0xe7, 0x1f, 0x0c, 0xe7, 0x1d, 0x0f, 0xe0, 0x38, 0x0e,
|
||||
0xe0, 0x78, 0x08, 0xe7, 0xf0, 0x00, 0xf7, 0xf3, 0x01, 0xf0, 0xe3, 0x01,
|
||||
0x04, 0x00, 0x00, 0x46, 0x24, 0x06, 0x67, 0x66, 0x0e, 0x67, 0x66, 0x0e].pack("c*")
|
||||
|
||||
window = Gtk::Window.new("Gdk::Cursor sample")
|
||||
window.signal_connect("destroy"){Gtk.main_quit}
|
||||
window.realize
|
||||
|
||||
source = Gdk::Pixmap.create_from_data(window.window, cursor_bits, 19, 19)
|
||||
mask = Gdk::Pixmap.create_from_data(window.window, cursor_mask_bits, 19, 19)
|
||||
|
||||
fg = Gdk::Color.new(65535, 0, 0)
|
||||
bg = Gdk::Color.new(65535, 65535, 0)
|
||||
|
||||
cursor = Gdk::Cursor.new(source, mask, fg, bg, 10, 10)
|
||||
|
||||
window.window.set_cursor(cursor)
|
||||
window.add(Gtk::Label.new("Put your cursor on this window."))
|
||||
window.set_default_size(200, 100).show_all
|
||||
|
||||
Gtk.main
|
Reference in New Issue
Block a user