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:
Quentin
2013-12-17 11:20:08 +01:00
parent 2e835fac51
commit 26e8968796
929 changed files with 121236 additions and 0 deletions

View File

@ -0,0 +1,7 @@
gtk-demo for Ruby/GTK
To run, do
ruby main.rb
in this directory.

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -0,0 +1,233 @@
# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: appwindow.rb,v 1.7 2005/03/05 15:01:16 mutoh Exp $
=begin
= Application main window
Demonstrates a typical application window, with menubar, toolbar, statusbar.
=end
require 'common'
module Demo
class AppWindow < BasicWindow
def initialize
register_stock_icons
## Create toplevel window
super('Application Window')
table = Gtk::Table.new(1, 4, false)
add(table)
## Create the menubar
accel_group = Gtk::AccelGroup.new
add_accel_group(accel_group)
item_factory = Gtk::ItemFactory.new(Gtk::ItemFactory::TYPE_MENU_BAR,
'<main>', accel_group)
# create menu items
menuitem_cb = proc do |data, widget|
# TODO: Show item-factory's path to menu item
dialog = Gtk::MessageDialog.new(self,
Gtk::Dialog::DESTROY_WITH_PARENT,
Gtk::MessageDialog::INFO,
Gtk::MessageDialog::BUTTONS_CLOSE,
"You selected or toggled the menu item \"#{Gtk::ItemFactory.path_from_widget(widget)}\"")
# Close dialog on user response
dialog.signal_connect('response') do |widget, data|
widget.destroy
end
dialog.show
end
menu_items = [
["/_File"],
["/_File/_New",
"<StockItem>", "<control>N", Gtk::Stock::NEW, menuitem_cb],
["/_File/_Open",
"<StockItem>", "<control>O", Gtk::Stock::OPEN, menuitem_cb],
["/File/_Save",
"<StockItem>", "<control>S", Gtk::Stock::SAVE, menuitem_cb],
["/File/Save _As...",
"<StockItem>", nil, Gtk::Stock::SAVE, menuitem_cb],
["/File/sep1",
"<Separator>", nil, nil, menuitem_cb],
["/File/Quit",
"<StockItem>", "<control>Q", Gtk::Stock::QUIT, menuitem_cb],
["/_Preferences"],
["/_Preferences/_Color"],
["/_Preferences/Color/_Red",
"<RadioItem>", nil, nil, menuitem_cb],
["/_Preferences/Color/_Green",
"/Preferences/Color/Red", nil, nil, menuitem_cb],
["/_Preferences/Color/_Blue",
"/Preferences/Color/Red", nil, nil, menuitem_cb],
["/Preferences/_Shape"],
["/Preferences/Shape/_Square",
"<RadioItem>", nil, nil, menuitem_cb],
["/Preferences/Shape/_Rectangle",
"/Preferences/Shape/Square", nil, nil, menuitem_cb],
["/Preferences/Shape/_Oval",
"/Preferences/Shape/Square", nil, nil, menuitem_cb],
# If you wanted this to be right justified you would use
# "<LastBranch>", not "<Branch>". Right justified help menu
# items are generally considered a bad idea now days.
["/_Help"],
["/Help/_About", "<Item>", nil, nil, Proc.new{about_cb}],
]
item_factory.create_items(menu_items)
table.attach(item_factory.get_widget('<main>'),
# X direction # Y direction
0, 1, 0, 1,
Gtk::EXPAND | Gtk::FILL, 0,
0, 0)
## Create the toolbar
toolbar = Gtk::Toolbar.new
# toolbar.set_toolbar_style(Gtk::Toolbar::BOTH)
toolbar.append(Gtk::Stock::OPEN,
"This is a demo button with an 'open' icon"
) do toolbar_cb end
toolbar.append(Gtk::Stock::QUIT,
"This is a demo button with an 'quit' icon"
) do toolbar_cb end
toolbar.append_space
toolbar.append(:demo_gtk_logo,
"This is a demo button with an 'gtk' icon"
) do toolbar_cb end
table.attach(toolbar,
# X direction # Y direction
0, 1, 1, 2,
Gtk::EXPAND | Gtk::FILL, 0,
0, 0)
## Create document
sw = Gtk::ScrolledWindow.new
sw.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
sw.shadow_type = Gtk::SHADOW_IN
table.attach(sw,
# X direction # Y direction
0, 1, 2, 3,
Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL,
0, 0)
set_default_size(200, 200)
contents = Gtk::TextView.new
sw.add(contents)
## Create statusbar
statusbar = Gtk::Statusbar.new
table.attach(statusbar,
# X direction # Y direction
0, 1, 3, 4,
Gtk::EXPAND | Gtk::FILL, 0,
0, 0)
# Show text widget info in the statusbar
buffer = contents.buffer
buffer.signal_connect('changed') do |buffer|
update_statusbar(buffer, statusbar)
end
# cursor moved
buffer.signal_connect('mark_set') do |buffer, iter, mark|
update_statusbar(buffer, statusbar)
end
end
def toolbar_cb(*args)
dialog = Gtk::MessageDialog.new(self,
Gtk::Dialog::DESTROY_WITH_PARENT,
Gtk::MessageDialog::INFO,
Gtk::MessageDialog::BUTTONS_CLOSE,
"You selected a toolbar button")
# Close dialog on user response
dialog.signal_connect('response') do |widget, data|
widget.destroy
end
dialog.show
end
def about_cb(*args)
unless Gtk.check_version?(2, 6, 0)
puts "This sample requires GTK+ 2.6.0 or later"
return
end
authors = ["Peter Mattis", "Spencer Kimball", "Josh MacDonald", "and many more..."]
documentors = ["Owen Taylor", "Tony Gale", "Mattias Clasen <mclasen@redhat.com>",
"and many more..."]
license = %Q[
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Gnome Library; see the file COPYING.LIB.If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
]
transparent = Gdk::Pixbuf.new(Demo.find_file("gtk-logo-rgb.gif")).add_alpha(true, 0xff, 0xff, 0xff)
Gtk::AboutDialog.set_email_hook {|about, link|
puts "send mail to #{link}"
}
Gtk::AboutDialog.set_url_hook {|about, link|
puts "show url #{link}"
}
Gtk::AboutDialog.show(self,
:name => "GTK+ Code Demos",
:version => Gtk::VERSION.join("."),
:copyright => "(C) 1997-2004 The GTK+ Team",
:license => license,
:website => "http://www.gtk.org",
:comments => "Program to demonstrate GTK+ functions.",
:authors => authors,
:documenters => documentors,
:logo => transparent)
end
def update_statusbar(buffer, statusbar)
statusbar.pop(0)
iter = buffer.get_iter_at_mark(buffer.get_mark('insert'))
statusbar.push(0,
"Cursor at row #{iter.line} column #{iter.line_offset} - #{buffer.char_count} chars in document")
end
def register_stock_icons
# Register our stock items
Gtk::Stock.add(:demo_gtk_logo, '_GTK!')
# Add out custom icon factory to the list of defaults
factory = Gtk::IconFactory.new
factory.add_default
filename = Demo.find_file('gtk-logo-rgb.gif')
pixbuf = Gdk::Pixbuf.new(filename)
transparent = pixbuf.add_alpha(true, 0xff, 0xff, 0xff)
icon_set = Gtk::IconSet.new(transparent)
factory.add('demo_gtk_logo', icon_set)
end
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -0,0 +1,51 @@
# Copyright (c) 2008 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
=begin
= Interface Builder
Demonstrates an interface loaded from a XML description.
=end
require 'common'
module Demo
class Dialog < Demo::BasicWindow
def initialize
super('Interface Builder')
available = Gtk.check_version?(2, 12, 0)
if available
label = Gtk::Label.new("Build an interface from XML description.")
else
label = Gtk::Label.new("You need GTK+ >= 2.12.0 to run this demo.")
end
add(label)
return unless available
@builder = Gtk::Builder.new
filename = File.join(File.dirname(__FILE__), "demo.ui")
@builder << filename
@builder.connect_signals {|name| method(name)}
@window = @builder["window1"]
@window.show_all
signal_connect("destroy") do
@window.destroy unless @window.destroyed?
end
end
private
def quit_activate
@window.destroy
destroy unless destroyed?
end
def about_activate
dialog = @builder["aboutdialog1"]
dialog.run
dialog.hide
end
end
end

View File

@ -0,0 +1,84 @@
# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: button_box.rb,v 1.3 2005/02/12 23:02:43 kzys Exp $
=begin
= Button Boxes
The Button Box widgets are used to arrange buttons with padding.
=end
require 'common'
module Demo
class ButtonBox < BasicWindow
def initialize
super('Button Boxes')
set_border_width(10)
main_vbox = Gtk::VBox.new(false, 0)
add(main_vbox)
frame_horiz = Gtk::Frame.new('Horizontal Button Boxes')
main_vbox.pack_start(frame_horiz, true, true, 10)
vbox = Gtk::VBox.new(false, 0)
vbox.set_border_width(10)
frame_horiz.add(vbox)
vbox.pack_start(create_bbox(true, 'Spread', 40, Gtk::ButtonBox::SPREAD),
true, true, 0)
vbox.pack_start(create_bbox(true, 'Edge', 40, Gtk::ButtonBox::EDGE),
true, true, 5)
vbox.pack_start(create_bbox(true, 'Start', 40, Gtk::ButtonBox::START),
true, true, 5)
vbox.pack_start(create_bbox(true, 'End', 40, Gtk::ButtonBox::END),
true, true, 5)
frame_vert = Gtk::Frame.new('Vertical Button Boxes')
main_vbox.pack_start(frame_vert, true, true, 10)
hbox = Gtk::HBox.new(false, 0)
hbox.set_border_width(10)
frame_vert.add(hbox)
hbox.pack_start(create_bbox(false, 'Spread', 30, Gtk::ButtonBox::SPREAD),
true, true, 0)
hbox.pack_start(create_bbox(false, 'Edge', 30, Gtk::ButtonBox::EDGE),
true, true, 5)
hbox.pack_start(create_bbox(false, 'Start', 30, Gtk::ButtonBox::START),
true, true, 5)
hbox.pack_start(create_bbox(false, 'End', 30, Gtk::ButtonBox::END),
true, true, 5)
end
def create_bbox(horizontal, title, spacing, layout)
frame = Gtk::Frame.new(title)
bbox = if horizontal
Gtk::HButtonBox.new
else
Gtk::VButtonBox.new
end
bbox.set_border_width(5)
frame.add(bbox)
bbox.layout_style = layout
bbox.set_spacing(spacing)
[Gtk::Stock::OK, Gtk::Stock::CANCEL, Gtk::Stock::HELP].each do |stock|
button = Gtk::Button.new(stock)
bbox.add(button)
end
return frame
end
end
end

View File

@ -0,0 +1,41 @@
# Copyright (c) 2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: cairo-arc-negative.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $
=begin
= cairo/Arc Negative
This demo shows how to use GDK and cairo to draw arc in negative.
From http://cairographics.org/samples/arc_negative.html.
=end
require 'common'
module Demo
class CairoArcNegative < CairoWindow
CENTER_X = 0.5
CENTER_Y = 0.5
RADIUS = 0.4
ANGLE1 = 45.0 * (Math::PI / 180.0) # angles are specified
ANGLE2 = 180.0 * (Math::PI / 180.0) # in radians
def initialize
super('cairo arc_negative')
end
def draw(cr)
cr.arc_negative(CENTER_X, CENTER_Y, RADIUS, ANGLE1, ANGLE2)
cr.stroke
# draw helping lines
cr.set_source_rgba(1, 0.2, 0.2, 0.6)
cr.arc(CENTER_X, CENTER_Y, 0.05, 0, 2 * Math::PI)
cr.fill
cr.set_line_width(0.03)
cr.arc(CENTER_X, CENTER_Y, RADIUS, ANGLE1, ANGLE1)
cr.line_to(CENTER_X, CENTER_Y)
cr.arc(CENTER_X, CENTER_Y, RADIUS, ANGLE2, ANGLE2)
cr.line_to(CENTER_X, CENTER_Y)
cr.stroke
end
end
end

View File

@ -0,0 +1,41 @@
# Copyright (c) 2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: cairo-arc.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $
=begin
= cairo/Arc
This demo shows how to use GDK and cairo to draw arc.
From http://cairographics.org/samples/arc.html.
=end
require 'common'
module Demo
class CairoArc < CairoWindow
CENTER_X = 0.5
CENTER_Y = 0.5
RADIUS = 0.4
ANGLE1 = 45.0 * (Math::PI / 180.0) # angles are specified
ANGLE2 = 180.0 * (Math::PI / 180.0) # in radians
def initialize
super('cairo arc')
end
def draw(cr)
cr.arc(CENTER_X, CENTER_Y, RADIUS, ANGLE1, ANGLE2)
cr.stroke
# draw helping lines
cr.set_source_rgba(1, 0.2, 0.2, 0.6)
cr.arc(CENTER_X, CENTER_Y, 0.05, 0, 2 * Math::PI)
cr.fill
cr.set_line_width(0.03)
cr.arc(CENTER_X, CENTER_Y, RADIUS, ANGLE1, ANGLE1)
cr.line_to(CENTER_X, CENTER_Y)
cr.arc(CENTER_X, CENTER_Y, RADIUS, ANGLE2, ANGLE2)
cr.line_to(CENTER_X, CENTER_Y)
cr.stroke
end
end
end

View File

@ -0,0 +1,51 @@
# Copyright (c) 2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: cairo-clip-image.rb,v 1.2 2005/10/16 12:07:32 mutoh Exp $
=begin
= cairo/Clip Image
This demo shows how to use GDK and cairo to use clip for image.
From http://cairographics.org/samples/clip_image.html.
=end
require 'common'
module Demo
class CairoClipImage < CairoWindow
def initialize
super('cairo clip image')
end
def draw(cr)
cr.save do
cr.arc(0.5, 0.5, 0.4, 0, 2 * Math::PI)
cr.clip
cr.new_path
loader = Gdk::PixbufLoader.new
File.open("background.jpg", "rb") do |f|
loader.last_write(f.read)
end
pixbuf = loader.pixbuf
cr.scale(1.0 / pixbuf.width, 1.0 / pixbuf.height)
cr.set_source_pixbuf(pixbuf, 0, 0)
cr.paint
end
cr.save do
cr.arc(0.5, 0.5, 0.3, 0, 2 * Math::PI)
cr.clip
cr.new_path
image = Cairo::ImageSurface.from_png("ruby-gnome2-logo.png")
cr.scale(1.0 / image.width, 1.0 / image.height)
cr.set_source(image, 0, 0)
cr.paint
end
end
end
end

View File

@ -0,0 +1,35 @@
# Copyright (c) 2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: cairo-clip-rectangle.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $
=begin
= cairo/Clip Rectangle
This demo shows how to use GDK and cairo to clip as rectangle.
From http://cairographics.org/samples/xxx_clip_rectangle.html.
=end
require 'common'
module Demo
class CairoClipRectangle < CairoWindow
def initialize
super('cairo clip rectangle')
end
def draw(cr)
cr.new_path
cr.move_to(0.25, 0.25)
cr.line_to(0.25, 0.75)
cr.line_to(0.75, 0.75)
cr.line_to(0.75, 0.25)
cr.line_to(0.25, 0.25)
cr.close_path
cr.clip
cr.move_to(0, 0)
cr.line_to(1, 1)
cr.stroke
end
end
end

View File

@ -0,0 +1,35 @@
# Copyright (c) 2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: cairo-clip.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $
=begin
= cairo/Clip
This demo shows how to use GDK and cairo to use clip.
From http://cairographics.org/samples/clip.html.
=end
require 'common'
module Demo
class CairoClip < CairoWindow
def initialize
super('cairo clip')
end
def draw(cr)
cr.arc(0.5, 0.5, 0.3, 0, 2 * Math::PI)
cr.clip
cr.new_path
cr.rectangle(0, 0, 1, 1)
cr.fill
cr.set_source_rgba(0, 1, 0)
cr.move_to(0, 0)
cr.line_to(1, 1)
cr.move_to(1, 0)
cr.line_to(0, 1)
cr.stroke
end
end
end

View File

@ -0,0 +1,76 @@
# Copyright (c) 2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: cairo-curve-rectangle.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $
=begin
= cairo/Curve Rectangle
This demo shows how to use GDK and cairo to draw curve rectangle.
From http://cairographics.org/samples/curve_rectangle.html.
=end
require 'common'
module Demo
class CairoCurveRectangle < CairoWindow
# a custom shape, that could be wrapped in a function
X0 = 0.1 #< parameters like Cairo::Context#rectangle
Y0 = 0.1
RECT_WIDTH = 0.8
RECT_HEIGHT = 0.8
RADIUS = 0.4 #< and an approximate curvature radius
X1 = X0 + RECT_WIDTH
Y1 = Y0 + RECT_HEIGHT
def initialize
super('cairo curve rectangle')
end
def draw(cr)
return if (RECT_WIDTH <= 0 || RECT_HEIGHT <= 0)
if (RECT_WIDTH / 2 < RADIUS)
if (RECT_HEIGHT / 2 < RADIUS)
cr.move_to(X0, (Y0 + Y1) / 2)
cr.curve_to(X0 ,Y0, X0, Y0, (X0 + X1) / 2, Y0)
cr.curve_to(X1, Y0, X1, Y0, X1, (Y0 + Y1) / 2)
cr.curve_to(X1, Y1, X1, Y1, (X1 + X0) / 2, Y1)
cr.curve_to(X0, Y1, X0, Y1, X0, (Y0 + Y1) / 2)
else
cr.move_to(X0, Y0 + RADIUS)
cr.curve_to(X0 ,Y0, X0, Y0, (X0 + X1) / 2, Y0)
cr.curve_to(X1, Y0, X1, Y0, X1, Y0 + RADIUS)
cr.line_to(X1 , Y1 - RADIUS)
cr.curve_to(X1, Y1, X1, Y1, (X1 + X0) / 2, Y1)
cr.curve_to(X0, Y1, X0, Y1, X0, Y1- RADIUS)
end
else
if (RECT_HEIGHT / 2 < RADIUS)
cr.move_to(X0, (Y0 + Y1) / 2)
cr.curve_to(X0, Y0, X0 , Y0, X0 + RADIUS, Y0)
cr.line_to(X1 - RADIUS, Y0)
cr.curve_to(X1, Y0, X1, Y0, X1, (Y0 + Y1) / 2)
cr.curve_to(X1, Y1, X1, Y1, X1 - RADIUS, Y1)
cr.line_to(X0 + RADIUS, Y1)
cr.curve_to(X0, Y1, X0, Y1, X0, (Y0 + Y1) / 2)
else
cr.move_to(X0, Y0 + RADIUS)
cr.curve_to(X0 , Y0, X0 , Y0, X0 + RADIUS, Y0)
cr.line_to(X1 - RADIUS, Y0)
cr.curve_to(X1, Y0, X1, Y0, X1, Y0 + RADIUS)
cr.line_to(X1 , Y1 - RADIUS)
cr.curve_to(X1, Y1, X1, Y1, X1 - RADIUS, Y1)
cr.line_to(X0 + RADIUS, Y1)
cr.curve_to(X0, Y1, X0, Y1, X0, Y1- RADIUS)
end
end
cr.close_path
cr.set_source_rgba(0.5,0.5,1)
cr.fill_preserve
cr.set_source_rgba(0.5, 0, 0, 0.5)
cr.stroke
end
end
end

View File

@ -0,0 +1,43 @@
# Copyright (c) 2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: cairo-curve-to.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $
=begin
= cairo/Curve To
This demo shows how to use GDK and cairo to draw curve.
From http://cairographics.org/samples/curve_to.html.
=end
require 'common'
module Demo
class CairoCurveTo < CairoWindow
X = 0.1
Y = 0.5
X1 = 0.4
Y1 = 0.9
X2 = 0.6
Y2 = 0.1
X3 = 0.9
Y3 = 0.5
def initialize
super('cairo curve to')
end
def draw(cr)
cr.move_to(X, Y)
cr.curve_to(X1, Y1, X2, Y2, X3, Y3)
cr.stroke
cr.set_source_rgba(1, 0.2, 0.2, 0.6)
cr.set_line_width(0.03)
cr.move_to(X, Y)
cr.line_to(X1, Y1)
cr.move_to(X2, Y2)
cr.line_to(X3, Y3)
cr.stroke
end
end
end

View File

@ -0,0 +1,39 @@
# Copyright (c) 2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: cairo-dash.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $
=begin
= cairo/Dash
This demo shows how to use GDK and cairo to show dash.
From http://cairographics.org/samples/xxx_dash.html.
=end
require 'common'
module Demo
class CairoDash < CairoWindow
def initialize
super('cairo dash')
end
def draw(cr)
dashes = [
0.20, # in
0.05, # skip
0.05, # ink
0.05, # skip
]
offset = -0.2
cr.set_dash(dashes, offset)
cr.move_to(0.5, 0.1)
cr.line_to(0.9, 0.9)
cr.rel_line_to(-0.4, 0.0)
cr.curve_to(0.2, 0.9, 0.2, 0.5, 0.5, 0.5)
cr.stroke
end
end
end

View File

@ -0,0 +1,32 @@
# Copyright (c) 2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: cairo-fill-and-stroke.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $
=begin
= cairo/Fill And Stroke
This demo shows how to use GDK and cairo to fill and stroke.
From http://cairographics.org/samples/fill_and_stroke.html.
=end
require 'common'
module Demo
class CairoFillAndStroke < CairoWindow
def initialize
super('cairo fill and stroke')
end
def draw(cr)
cr.move_to(0.5, 0.1)
cr.line_to(0.9, 0.9)
cr.rel_line_to(-0.4, 0.0)
cr.curve_to(0.2, 0.9, 0.2, 0.5, 0.5, 0.5)
cr.close_path
cr.set_source_rgba(0, 0, 1)
cr.fill_preserve
cr.set_source_rgba(0, 0, 0)
cr.stroke
end
end
end

View File

@ -0,0 +1,38 @@
# Copyright (c) 2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: cairo-fill-and-stroke2.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $
=begin
= cairo/Fill And Stroke2
This demo shows how to use GDK and cairo to fill and stroke.
From http://cairographics.org/samples/fill_and_stroke2.html.
=end
require 'common'
module Demo
class CairoFillAndStroke2 < CairoWindow
def initialize
super('cairo fill and stroke2')
end
def draw(cr)
cr.move_to(0.5, 0.1)
cr.line_to(0.9, 0.9)
cr.rel_line_to(-0.4, 0.0)
cr.curve_to(0.2, 0.9, 0.2, 0.5, 0.5, 0.5)
cr.close_path
cr.move_to(0.25, 0.1)
cr.rel_line_to(0.2, 0.2)
cr.rel_line_to(-0.2, 0.2)
cr.rel_line_to(-0.2, -0.2)
cr.close_path
cr.set_source_rgba(0, 0, 1)
cr.fill_preserve
cr.set_source_rgba(0, 0, 0)
cr.stroke
end
end
end

View File

@ -0,0 +1,35 @@
# Copyright (c) 2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: cairo-gradient.rb,v 1.2 2005/10/12 15:23:49 ktou Exp $
=begin
= cairo/Gradient
This demo shows how to use GDK and cairo to gradient.
From http://cairographics.org/samples/gradient.html.
=end
require 'common'
module Demo
class CairoGradient < CairoWindow
def initialize
super('cairo gradient')
end
def draw(cr)
pat = Cairo::LinearPattern.new(0.0, 0.0, 0.0, 1.0)
pat.add_color_stop_rgb(1, 0, 0, 0)
pat.add_color_stop_rgb(0, 1, 0, 0)
cr.rectangle(0, 0, 1, 1)
cr.set_source(pat)
cr.fill
pat = Cairo::RadialPattern.new(0.45, 0.4, 0.1, 0.4, 0.4, 0.5)
pat.add_color_stop_rgba(0, 1, 1, 1, 0.8)
pat.add_color_stop_rgba(1, 0, 0, 0)
cr.set_source(pat)
cr.arc(0.5, 0.5, 0.3, 0, 2 * Math::PI)
cr.fill
end
end
end

View File

@ -0,0 +1,39 @@
# Copyright (c) 2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: cairo-image-pattern.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $
=begin
= cairo/Image Pattern
This demo shows how to use GDK and cairo to use image pattern.
From http://cairographics.org/samples/imagepattern.html.
=end
require 'common'
module Demo
class CairoImagePattern < CairoWindow
def initialize
super('cairo image pattern')
end
def draw(cr)
image = Cairo::ImageSurface.from_png("ruby-gnome2-logo.png")
pattern = Cairo::SurfacePattern.new(image)
pattern.set_extend(Cairo::EXTEND_REPEAT)
cr.translate(0.5, 0.5)
cr.rotate(Math::PI / 4)
cr.scale(1 / Math.sqrt(2), 1 / Math.sqrt(2))
cr.translate(-0.5, -0.5)
matrix = Cairo::Matrix.scale(image.width * 5, image.height * 5)
pattern.set_matrix(matrix)
cr.set_source(pattern)
cr.rectangle(0, 0, 1.0, 1.0)
cr.fill
end
end
end

View File

@ -0,0 +1,49 @@
# Copyright (c) 2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: cairo-image.rb,v 1.2 2005/10/16 12:07:32 mutoh Exp $
=begin
= cairo/Image
This demo shows how to use GDK and cairo to show image.
From http://cairographics.org/samples/image.html.
=end
require 'common'
module Demo
class CairoImage < CairoWindow
def initialize
super('cairo gradient')
end
def draw(cr)
cr.save do
loader = Gdk::PixbufLoader.new
File.open("background.jpg", "rb") do |f|
loader.last_write(f.read)
end
pixbuf = loader.pixbuf
cr.translate(0.5, 0.5)
cr.rotate(45 * Math::PI / 180)
cr.scale(1.0 / pixbuf.width, 1.0 / pixbuf.height)
cr.translate(-0.5 * pixbuf.width, -0.5 * pixbuf.height)
cr.set_source_pixbuf(pixbuf, 0, 0)
cr.paint
end
cr.save do
image = Cairo::ImageSurface.from_png("ruby-gnome2-logo.png")
cr.translate(0.5, 0.5)
cr.rotate(60 * Math::PI / 180)
cr.scale(0.8 / image.width, 0.8 / image.height)
cr.translate(-0.5 * image.width, -0.5 * image.height)
cr.set_source(image, 0, 0)
cr.paint
end
end
end
end

View File

@ -0,0 +1,53 @@
# Copyright (c) 2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: cairo-line-cap.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $
=begin
= cairo/Line Cap
This demo shows how to use GDK and cairo to set line cap.
From http://cairographics.org/samples/set_line_cap.html.
=end
require 'common'
module Demo
class CairoLineCap < CairoWindow
def initialize
super('cairo line cap')
end
def draw(cr)
cr.set_line_width(0.12)
cr.set_line_cap(Cairo::LINE_CAP_BUTT) # default
cr.move_to(0.25, 0.2)
cr.line_to(0.25, 0.8)
cr.stroke
cr.set_line_cap(Cairo::LINE_CAP_ROUND)
cr.move_to(0.5, 0.2)
cr.line_to(0.5, 0.8)
cr.stroke
cr.set_line_cap(Cairo::LINE_CAP_SQUARE)
cr.move_to(0.75, 0.2)
cr.line_to(0.75, 0.8)
cr.stroke
# draw helping lines
cr.set_source_rgba(1, 0.2, 0.2)
cr.set_line_width(0.01)
cr.move_to(0.25, 0.2)
cr.line_to(0.25, 0.8)
cr.move_to(0.5, 0.2)
cr.line_to(0.5, 0.8)
cr.move_to(0.75, 0.2)
cr.line_to(0.75, 0.8)
cr.stroke
end
end
end

View File

@ -0,0 +1,41 @@
# Copyright (c) 2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: cairo-line-join.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $
=begin
= cairo/Line Join
This demo shows how to use GDK and cairo to set line join.
From http://cairographics.org/samples/set_line_join.html.
=end
require 'common'
module Demo
class CairoLineJoin < CairoWindow
def initialize
super('cairo line join')
end
def draw(cr)
cr.set_line_width(0.16)
cr.move_to(0.3, 0.33)
cr.rel_line_to(0.2, -0.2)
cr.rel_line_to(0.2, 0.2)
cr.set_line_join(Cairo::LINE_JOIN_MITER) # default
cr.stroke
cr.move_to(0.3, 0.63)
cr.rel_line_to(0.2, -0.2)
cr.rel_line_to(0.2, 0.2)
cr.set_line_join(Cairo::LINE_JOIN_BEVEL)
cr.stroke
cr.move_to(0.3, 0.93)
cr.rel_line_to(0.2, -0.2)
cr.rel_line_to(0.2, 0.2)
cr.set_line_join(Cairo::LINE_JOIN_ROUND)
cr.stroke
end
end
end

View File

@ -0,0 +1,41 @@
# Copyright (c) 2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: cairo-long-lines.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $
=begin
= cairo/Long Lines
This demo shows how to use GDK and cairo to show long lines.
From http://cairographics.org/samples/xxx_long_liens.html.
=end
require 'common'
module Demo
class CairoLongLines < CairoWindow
def initialize
super('cairo long lines')
end
def draw(cr)
cr.move_to(0.1, -50)
cr.line_to(0.1, 50)
cr.set_source_rgba(1, 0, 0)
cr.stroke
cr.move_to(0.2, -60)
cr.line_to(0.2, 60)
cr.set_source_rgba(1, 1, 0)
cr.stroke
cr.move_to(0.3, -70)
cr.line_to(0.3, 70)
cr.set_source_rgba(0, 1, 0)
cr.stroke
cr.move_to(0.4, -80)
cr.line_to(0.4, 80)
cr.set_source_rgba(0, 0, 1)
cr.stroke
end
end
end

View File

@ -0,0 +1,83 @@
# Copyright (c) 2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: cairo-operator.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $
=begin
= cairo/Operator
This demo shows how to use GDK and cairo to use Cairo::OPERATOR_*
From http://cairographics.org/samples/operator_add.html,
http://cairographics.org/samples/operator_atop.html,
http://cairographics.org/samples/operator_atop_reverse.html,
http://cairographics.org/samples/operator_in.html,
http://cairographics.org/samples/operator_in_reverse.html,
http://cairographics.org/samples/operator_out.html,
http://cairographics.org/samples/operator_out_reverse.html,
http://cairographics.org/samples/operator_over.html,
http://cairographics.org/samples/operator_over_reverse.html,
http://cairographics.org/samples/operator_saturate.html and
http://cairographics.org/samples/operator_xor.html
=end
require 'common'
module Demo
class CairoOperator < CairoWindow
def initialize
super('cairo operator')
@operator = Cairo::OPERATOR_ADD
set_default_size(400, 400)
@drawing_area = child
remove(@drawing_area)
vbox = Gtk::VBox.new
vbox.pack_start(@drawing_area, true, true)
vbox.pack_start(operator_selector, false, false)
add(vbox)
end
def draw(cr)
cr.save do
image = Cairo::ImageSurface.from_png("ruby-gnome2-logo.png")
cr.translate(0.5, 0.5)
cr.rotate(-45 * Math::PI / 180)
cr.scale(0.8 / image.width, 0.8 / image.height)
cr.translate(-0.5 * image.width, -0.5 * image.height)
cr.set_source(image, 0.0, 0.0)
cr.paint
end
cr.set_operator(@operator)
cr.set_source_rgba(1, 0, 0, 0.5)
cr.rectangle(0.2, 0.2, 0.5, 0.5)
cr.fill
cr.set_source_rgba(0, 1, 0)
cr.rectangle(0.4, 0.4, 0.4, 0.4)
cr.fill
cr.set_source_rgba(0, 0, 1)
cr.rectangle(0.6, 0.6, 0.3, 0.3)
cr.fill
end
def operator_selector
combo = Gtk::ComboBox.new
operators = []
Cairo.constants.each do |name|
operators << name if /^OPERATOR_/ =~ name
end
operators.sort.each_with_index do |name, i|
combo.append_text(name.to_s)
combo.set_active(i) if Cairo.const_get(name) == @operator
end
combo.signal_connect("changed") do |widget|
text = widget.active_text
@operator = Cairo.const_get(text) if text
@drawing_area.queue_draw
end
combo
end
end
end

View File

@ -0,0 +1,28 @@
# Copyright (c) 2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: cairo-path.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $
=begin
= cairo/Path
This demo shows how to use GDK and cairo to draw path.
From http://cairographics.org/samples/path.html.
=end
require 'common'
module Demo
class CairoPath < CairoWindow
def initialize
super('cairo path')
end
def draw(cr)
cr.move_to(0.5, 0.1)
cr.line_to(0.9, 0.9)
cr.rel_line_to(-0.4, 0.0)
cr.curve_to(0.2, 0.9, 0.2, 0.5, 0.5, 0.5)
cr.stroke
end
end
end

View File

@ -0,0 +1,88 @@
# Copyright (c) 2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: cairo-pattern-fill.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $
=begin
= cairo/Pattern Fill
This demo shows how to use GDK and cairo to fill by pattern.
From http://cairographics.org/samples/pattern_fill.html.
=end
require 'common'
module Demo
class CairoPatternFill < CairoWindow
X_FUZZ = 0.08
Y_FUZZ = 0.08
X_INNER_RADIUS = 0.3
Y_INNER_RADIUS = 0.2
X_OUTER_RADIUS = 0.45
Y_OUTER_RADIUS = 0.35
SPIKES = 10
TEXT = "Ruby!"
def initialize
super('cairo pattern fill')
end
def draw(cr)
srand(45)
cr.set_line_width(0.01)
x = y = nil
0.step(SPIKES * 2 - 1, 2) do |i|
x = x_position(i, X_INNER_RADIUS)
y = y_position(i, Y_INNER_RADIUS)
if (i == 0)
cr.move_to(x, y)
else
cr.line_to(x, y)
end
i += 1
x = x_position(i, X_OUTER_RADIUS)
y = y_position(i, Y_OUTER_RADIUS)
cr.line_to(x, y)
end
cr.close_path
cr.stroke
cr.select_font_face("Sans",
Cairo::FONT_SLANT_NORMAL,
Cairo::FONT_WEIGHT_BOLD)
cr.move_to(x - 0.5, y)
cr.set_font_size(0.1)
cr.text_path(TEXT)
cr.set_source_rgba(1, 0, 0.5)
cr.fill
cr.set_font_size(0.2)
extents = cr.text_extents(TEXT)
x = 0.5 - (extents.width / 2 + extents.x_bearing)
y = 0.5 - (extents.height / 2 + extents.y_bearing)
cr.move_to(x, y)
cr.text_path(TEXT)
cr.set_source_rgba(1, 0, 0)
cr.stroke
end
def x_position(i, radius)
0.5 + Math.cos(Math::PI * i / SPIKES) * radius + rand * X_FUZZ
end
def y_position(i, radius)
0.5 + Math.sin(Math::PI * i / SPIKES) * radius + rand * Y_FUZZ
end
end
end

View File

@ -0,0 +1,32 @@
# Copyright (c) 2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: cairo-self-intersect.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $
=begin
= cairo/Self Intersect
This demo shows how to use GDK and cairo to show cross.
From http://cairographics.org/samples/xxx_self_intersect.html.
=end
require 'common'
module Demo
class CairoSelfIntersect < CairoWindow
def initialize
super('cairo self intersect')
end
def draw(cr)
cr.move_to(0.3, 0.3)
cr.line_to(0.7, 0.3)
cr.line_to(0.5, 0.3)
cr.line_to(0.5, 0.7)
cr.set_line_width(0.22)
cr.set_line_cap(Cairo::LINE_CAP_ROUND)
cr.set_line_join(Cairo::LINE_JOIN_ROUND)
cr.stroke
end
end
end

View File

@ -0,0 +1,45 @@
# Copyright (c) 2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: cairo-text-align-center.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $
=begin
= cairo/Text Align Center
This demo shows how to use GDK and cairo to show text in center.
From http://cairographics.org/samples/text_align_center.html.
=end
require 'common'
module Demo
class CairoTextAlignCenter < CairoWindow
TEXT = "Ruby"
def initialize
super('cairo text align center')
end
def draw(cr)
cr.select_font_face("Sans",
Cairo::FONT_SLANT_NORMAL,
Cairo::FONT_WEIGHT_NORMAL)
cr.set_font_size(0.2)
extents = cr.text_extents(TEXT)
x = 0.5 - (extents.width / 2 + extents.x_bearing)
y = 0.5 - (extents.height / 2 + extents.y_bearing)
cr.move_to(x, y)
cr.show_text(TEXT)
# draw helping lines
cr.set_source_rgba(1, 0.2, 0.2, 0.6)
cr.arc(x, y, 0.05, 0, 2 * Math::PI)
cr.fill
cr.move_to(0.5, 0)
cr.rel_line_to(0, 1)
cr.move_to(0, 0.5)
cr.rel_line_to(1, 0)
cr.stroke
end
end
end

View File

@ -0,0 +1,46 @@
# Copyright (c) 2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: cairo-text-extents.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $
=begin
= cairo/Text Extents
This demo shows how to use GDK and cairo to show text extents.
From http://cairographics.org/samples/text.html.
=end
require 'common'
module Demo
class CairoTextExtents < CairoWindow
TEXT = "Ruby"
def initialize
super('cairo text')
end
def draw(cr)
cr.select_font_face("Sans",
Cairo::FONT_SLANT_NORMAL,
Cairo::FONT_WEIGHT_NORMAL)
cr.set_font_size(0.3)
extents = cr.text_extents(TEXT)
x = 0.1
y = 0.6
cr.move_to(x, y)
cr.show_text(TEXT)
# draw helping lines
cr.set_source_rgba(1, 0.2, 0.2, 0.6)
cr.arc(x, y, 0.05, 0, 2 * Math::PI)
cr.fill
cr.move_to(x, y)
cr.rel_line_to(0, -extents.height)
cr.rel_line_to(extents.width, 0)
cr.rel_line_to(extents.x_bearing, -extents.y_bearing)
cr.stroke
end
end
end

View File

@ -0,0 +1,43 @@
# Copyright (c) 2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: cairo-text.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $
=begin
= cairo/Text
This demo shows how to use GDK and cairo to show text.
From http://cairographics.org/samples/text.html.
=end
require 'common'
module Demo
class CairoText < CairoWindow
def initialize
super('cairo text')
end
def draw(cr)
cr.select_font_face("Sans",
Cairo::FONT_SLANT_NORMAL,
Cairo::FONT_WEIGHT_BOLD)
cr.set_font_size(0.35)
cr.move_to(0.04, 0.53)
cr.show_text("Hello")
cr.move_to(0.27, 0.65)
cr.text_path("void")
cr.set_source_rgba(0.5, 0.5, 1)
cr.fill_preserve
cr.set_source_rgba(0, 0, 0)
cr.set_line_width(0.01)
cr.stroke
# draw helping lines
cr.set_source_rgba(1,0.2,0.2, 0.6)
cr.arc(0.04, 0.53, 0.02, 0, 2 * Math::PI)
cr.arc(0.27, 0.65, 0.02, 0, 2 * Math::PI)
cr.fill
end
end
end

View File

@ -0,0 +1,408 @@
# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: changedisplay.rb,v 1.6 2005/07/30 11:22:15 mutoh Exp $
=begin
= Change Display
Demonstrates migrating a window between different displays and
screens. A display is a mouse and keyboard with some number of
associated monitors. A screen is a set of monitors grouped
into a single physical work area. The neat thing about having
multiple displays is that they can be on a completely separate
computers, as long as there is a network connection to the
computer where the application is running.
Only some of the windowing systems where GTK+ runs have the
concept of multiple displays and screens. (The X Window System
is the main example.) Other windowing systems can only
handle one keyboard and mouse, and combine all monitors into
a single screen.
This is a moderately complex example, and demonstrates:
- Tracking the currently open displays and screens
- Changing the screen for a window
- Letting the user choose a window by clicking on it
- Using Gtk::ListStore and Gtk::TreeView
- Using Gtk::Dialog
=end
require 'common'
module Demo
class ChangeDisplay < Gtk::Dialog
# These enumerations provide symbolic names for the columns
# in the two GtkListStore models.
DISPLAY_COLUMN_NAME, DISPLAY_COLUMN_DISPLAY = 0, 1
SCREEN_COLUMN_NUMBER, SCREEN_COLUMN_SCREEN = 0, 1
# Main entry point. If the dialog for this demo doesn't yet exist, creates
# it. Otherwise, destroys it.
def initialize
@size_group = nil
@display_model = nil
@screen_model = nil
@screen_selection = nil
@current_display = nil
@current_screen = nil
super('Change Screen or display',
nil, # parent
Gtk::Dialog::NO_SEPARATOR,
[Gtk::Stock::CLOSE, Gtk::Dialog::RESPONSE_CLOSE],
['Change', Gtk::Dialog::RESPONSE_OK])
set_default_size(300, 400)
signal_connect('response') do |dialog, response_id|
if response_id == Gtk::Dialog::RESPONSE_OK
if Gtk.check_version?(2, 2, 0)
query_change_display
else
puts "This sample requires GTK+ 2.2.0 or later"
end
else
destroy # Gtk.main_quit?
end
end
signal_connect('destroy') do
end
unless Gtk.check_version?(2, 2, 0)
vbox.add(Gtk::Label.new("This sample requires GTK+ 2.2.0 or later"))
return
end
vbox = Gtk::VBox.new(false, 5)
vbox.set_border_width(8)
self.vbox.pack_start(vbox, true, true)
@size_group = Gtk::SizeGroup.new(Gtk::SizeGroup::HORIZONTAL)
frame = create_display_frame
vbox.pack_start(frame, true, true)
frame = create_screen_frame
vbox.pack_start(frame, true, true)
initialize_displays
end
# Adds all currently open displays to our list of displays,
# and set up a signal connection so that we'll be notified
# when displays are opened in the future as well.
def initialize_displays
manager = Gdk::DisplayManager.get
manager.displays.each do |display|
add_display(display)
end
handler_id = manager.signal_connect('display_opened') do |display|
add_display(display)
end
signal_connect('destroy') do
manager.signal_handler_disconnect(handler_id)
end
end
# Fills in the screen list based on the current display
def fill_screens
@screen_model.clear
if @current_display
n_screens = @current_display.n_screens
n_screens.times do |i|
iter = @screen_model.append
iter.set_value(SCREEN_COLUMN_NUMBER, i)
iter.set_value(SCREEN_COLUMN_SCREEN, @current_display.get_screen(i))
if i == 0
@screen_selection.select_iter(iter)
end
end
end
end
# Creates the 'Display' frame in the main window.
def create_display_frame
frame, tree_view, button_vbox = create_frame('Display')
button = left_align_button_new('_Open...')
button.signal_connect('clicked') do
open_display_cb
end
button_vbox.pack_start(button, false, false, 0)
button = left_align_button_new('_Close')
button.signal_connect('clicked') do
if @current_display
@current_display.close
end
end
button_vbox.pack_start(button, false, false, 0)
@display_model = Gtk::ListStore.new(String, Gdk::Display)
tree_view.model = @display_model
column = Gtk::TreeViewColumn.new('Name',
Gtk::CellRendererText.new,
{'text' => DISPLAY_COLUMN_NAME})
tree_view.append_column(column)
selection = tree_view.selection
selection.signal_connect('changed') do
display_changed_cb(selection)
end
return frame
end
# Creates the 'Screen' frame in the main window.
def create_screen_frame
frame, tree_view, button_vbox = create_frame('Screen')
@screen_model = Gtk::ListStore.new(Integer, Gdk::Screen)
tree_view.model = @screen_model
column = Gtk::TreeViewColumn.new('Number',
Gtk::CellRendererText.new,
{'text' => SCREEN_COLUMN_NUMBER})
tree_view.append_column(column)
@screen_selection = tree_view.selection
@screen_selection.signal_connect('changed') do |selection|
@current_screen = if iter = selection.selected
iter.get_value(SCREEN_COLUMN_SCREEN)
else
nil
end
end
return frame
end
# This function is used both for creating the 'Display' and
# 'Screen' frames, since they have a similar structure. The
# caller hooks up the right context for the value returned
# in tree_view, and packs any relevant buttons into button_vbox.
def create_frame(title)
frame = Gtk::Frame.new(title)
hbox = Gtk::HBox.new(false, 8)
hbox.set_border_width(8)
frame.add(hbox)
scrollwin = Gtk::ScrolledWindow.new
scrollwin.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC)
scrollwin.shadow_type = Gtk::SHADOW_IN
hbox.pack_start(scrollwin, true, true)
tree_view = Gtk::TreeView.new
tree_view.headers_visible = false
scrollwin.add(tree_view)
selection = tree_view.selection
selection.mode = Gtk::SELECTION_BROWSE
button_vbox = Gtk::VBox.new(false, 5)
hbox.pack_start(button_vbox, false, false)
@size_group.add_widget(button_vbox)
return frame, tree_view, button_vbox
end
# If we have a stack of buttons, it often looks better if their contents
# are left-aligned, rather than centered. This function creates a button
# and left-aligns it contents.
def left_align_button_new(label)
button = Gtk::Button.new(label, true)
button.child.set_alignment(0.0, 0.5)
return button
end
# Prompts the user for a toplevel window to move, and then moves
# that window to the currently selected display
def query_change_display
screen = self.window.screen
toplevel = query_for_toplevel(screen,
"Please select the toplevel\n"+
"to move to the new screen")
if toplevel
toplevel.screen = @current_screen
else
screen.display.beep
end
end
# Asks the user to click on a window, then waits for them click
# the mouse. When the mouse is released, returns the toplevel
# window under the pointer, or nil, if there is none.
def query_for_toplevel(screen, prompt)
toplevel = nil
display = screen.display
popup = Gtk::Window.new(Gtk::Window::POPUP)
popup.screen = screen
popup.modal = true
popup.window_position = Gtk::Window::POS_CENTER
frame = Gtk::Frame.new
frame.set_shadow_type(Gtk::SHADOW_OUT)
popup.add(frame)
label = Gtk::Label.new(prompt)
label.set_padding(10, 10)
frame.add(label)
popup.show_all
# TODO: Gdk::Cursor.new(screen.display, Gdk::Cursor::CROSSHAIR)
cursor = Gdk::Cursor.new(Gdk::Cursor::CROSSHAIR)
if Gdk::pointer_grab(popup.window, false,
Gdk::Event::BUTTON_RELEASE_MASK,
nil,
cursor,
Gdk::Event::CURRENT_TIME) == Gdk::GRAB_SUCCESS
clicked = false
popup.signal_connect('button-release-event') do
clicked = true
end
# Process events until clicked is set by button_release_event_cb.
# We pass in may_block = true since we want to wait if there
# are no events currently.
until clicked
Gtk.main_iteration # TODO: GLib::main_context_iteration(nil, true)
toplevel = find_toplevel_at_pointer(screen.display)
if toplevel == popup
toplevel = nil
end
end
popup.destroy
Gdk.flush # Really release the grab
return toplevel
end
end
# Finds the toplevel window under the mouse pointer, if any.
def find_toplevel_at_pointer(display)
pointer_window, x, y = display.window_at_pointer
# The user data field of a GdkWindow is used to store a pointer
# to the widget that created it.
if pointer_window
widget = pointer_window.user_data
end
return (if widget
widget.toplevel
else
nil
end)
end
# Called when the user clicks on 'Open...' in the display
# frame. Prompts for a new display, and then opens a connection
# to that display.
def open_display_cb
dialog = Gtk::Dialog.new('Open Display',
self,
Gtk::Dialog::MODAL,
[Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL],
[Gtk::Stock::OK, Gtk::Dialog::RESPONSE_OK])
dialog.default_response = Gtk::Dialog::RESPONSE_OK
display_entry = Gtk::Entry.new
display_entry.activates_default = true
dialog_label =
Gtk::Label.new("Please enter the name of\nthe new display\n")
dialog.vbox.add(dialog_label)
dialog.vbox.add(display_entry)
display_entry.grab_focus
dialog.vbox.show_all
result = nil
until result
response_id = dialog.run
break if response_id != Gtk::Dialog::RESPONSE_OK
new_screen_name = display_entry.text
unless new_screen_name.empty?
begin
result = Gdk::Dispaly.open(new_screen_name)
rescue
dialog_label.text = "Can't open display :\n\t%s\nplease try another one\n" % [new_screen_name]
end
end
end
dialog.destroy
end
# Called when the selected row in the display list changes.
# Updates info.current_display, then refills the list of
# screens.
def display_changed_cb(selection)
@current_display =
if iter = selection.selected
iter.get_value(DISPLAY_COLUMN_DISPLAY)
else
nil
end
fill_screens
end
# Adds a new display to our list of displays, and connects
# to the 'closed' signal so that we can remove it from the
# list of displays again.
def add_display(display)
iter = @display_model.append
iter.set_value(DISPLAY_COLUMN_NAME, display.name)
iter.set_value(DISPLAY_COLUMN_DISPLAY, display)
handler_id = display.signal_connect('closed') do
display_closed_cb(display)
end
signal_connect('destroy') do
display.signal_handler_disconnect(handler_id)
end
end
# Called when one of the currently open displays is closed.
# Remove it from our list of displays.
def display_closed_cb(display)
@display_model.each do |model, path, iter|
tmp_display = iter.get_value( DISPLAY_COLUMN_DISPLAY)
if tmp_display == display
@display_model.remove(iter)
break
end
end
end
end
end

View File

@ -0,0 +1,72 @@
# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
# $Id: clipboard.rb,v 1.3 2005/07/28 14:30:38 mutoh Exp $
=begin
= Clipboard
GtkClipboard is used for clipboard handling. This demo shows how to
copy and paste text to and from the clipboard.
=end
require 'common'
module Demo
class Clipboard < Demo::BasicWindow
def initialize
super('Clipboard')
unless Gtk.check_version?(2, 2, 0)
add(Gtk::Label.new("This sample requires GTK+ 2.2.0 or later"))
return
end
vbox = Gtk::VBox.new(false, 0)
vbox.border_width = 8
add(vbox)
label = Gtk::Label.new(%Q["Copy" will copy the text\nin the entry to the clipboard])
vbox.pack_start(label, false, false, 0)
hbox = Gtk::HBox.new(false, 0)
hbox.border_width = 8
vbox.pack_start(hbox, false, false, 0)
# Create the first entry
entry = Gtk::Entry.new
hbox.pack_start(entry, true, true, 0)
# Create the button
button = Gtk::Button.new(Gtk::Stock::COPY)
hbox.pack_start(button, false, false, 0)
button.signal_connect('clicked', entry) do |w, e|
clipboard = e.get_clipboard(Gdk::Selection::CLIPBOARD)
clipboard.text = e.text
end
label = Gtk::Label.new(%Q["Paste" will paste the text from the clipboard to the entry])
vbox.pack_start(label, false, false, 0)
hbox = Gtk::HBox.new(false, 4)
hbox.border_width = 8
vbox.pack_start(hbox, false, false, 0)
# Create the second entry
entry = Gtk::Entry.new
hbox.pack_start(entry, true, true, 0)
# Create the button
button = Gtk::Button.new(Gtk::Stock::PASTE)
hbox.pack_start(button, false, false, 0)
button.signal_connect('clicked', entry) do |w, e|
clipboard = e.get_clipboard(Gdk::Selection::CLIPBOARD)
clipboard.request_text do |board, text, data|
e.text = text
end
end
end
end
end

View File

@ -0,0 +1,84 @@
# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: colorsel.rb,v 1.4 2005/02/12 23:02:43 kzys Exp $
=begin
= Color Selector
Gtk::ColorSelection lets the user choose a color. Gtk::ColorSelectionDialog
is a prebuilt dialog containing a Gtk::ColorSelection.
=end
require 'common'
module Demo
class ColorSel < BasicWindow
def initialize
super('Color Selection')
@color = Gdk::Color.new(0, 0, 65535)
set_border_width(8)
vbox = Gtk::VBox.new(false, 0)
vbox.set_border_width(8)
add(vbox)
## Create the color swatch area
@frame = Gtk::Frame.new
@frame.set_shadow_type(Gtk::SHADOW_IN)
vbox.pack_start(@frame, true, true, 0)
@da = Gtk::DrawingArea.new
@da.signal_connect('expose_event') do |widget, event|
if widget.window
style = widget.style
widget.window.draw_rectangle(style.bg_gc(Gtk::STATE_NORMAL),
true,
event.area.x, event.area.y,
event.area.width, event.area.height)
end
end
# set a minimum size
@da.set_size_request(200, 200)
# set the color
@da.modify_bg(Gtk::STATE_NORMAL, @color)
@frame.add(@da)
alignment = Gtk::Alignment.new(1.0, 0.5, 0.0, 0.0)
button = Gtk::Button.new('_Change the above color', true)
alignment.add(button)
vbox.pack_start(alignment, false, false, 0)
button.signal_connect('clicked') do
change_color_callback
end
end
def change_color_callback
dialog = Gtk::ColorSelectionDialog.new('Changing color')
dialog.set_transient_for(self)
colorsel = dialog.colorsel
colorsel.set_previous_color(@color)
colorsel.set_current_color(@color)
colorsel.set_has_palette(true)
response = dialog.run
if response == Gtk::Dialog::RESPONSE_OK
@color = colorsel.current_color
@da.modify_bg(Gtk::STATE_NORMAL, @color)
end
dialog.destroy
end
end
end

View File

@ -0,0 +1,88 @@
=begin
common.rb - Common class for gtk-demo.
Copyright (c) 2003-2005 Ruby-GNOME2 Project Team
This program is licenced under the same licence as Ruby-GNOME2.
$Id: common.rb,v 1.9 2005/10/15 03:41:36 mutoh Exp $
=end
require 'gtk2'
module Demo
def self.find_file(basename)
%w(. /usr/share/gtk-2.0/demo /usr/local/share/gtk-2.0/demo/).each do |dirname|
path = File.join(dirname, basename)
if File.exist?(path)
return path
end
end
raise "#{basename}: No such file or directory"
end
class BasicWindow < Gtk::Window
def initialize(title = nil)
super(Gtk::Window::TOPLEVEL)
if title
set_title("#{title} in Ruby/GTK")
end
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
signal_connect("delete_event") do |widget, event|
quit
end
end
def quit
destroy
true
end
end
class CairoWindow < BasicWindow
def initialize(title=nil)
super
unless Gdk.cairo_available?
add_cairo_require_label
return
end
drawing_area = Gtk::DrawingArea.new
add(drawing_area)
drawing_area.signal_connect("expose_event") do |widget, event|
cr = widget.window.create_cairo_context
cr.scale(*widget.window.size)
cr.set_line_width(0.04)
cr.save do
cr.set_source_color(Gdk::Color.new(65535, 65535, 65535))
cr.gdk_rectangle(Gdk::Rectangle.new(0, 0, 1, 1))
cr.fill
end
draw(cr)
end
end
def add_cairo_require_label
message = "This sample requires GTK+ 2.8.0 or later and cairo support"
add(Gtk::Label.new(message))
end
def draw(cr)
raise "not implemented"
end
end
end

View File

@ -0,0 +1,258 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<interface>
<object class="GtkListStore" id="liststore1">
<columns>
<column type="gchararray"/>
<column type="gchararray"/>
<column type="gint"/>
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0">John</col>
<col id="1">Doe</col>
<col id="2">25</col>
<col id="3">This is the John Doe row</col>
</row>
<row>
<col id="0">Mary</col>
<col id="1">Dole</col>
<col id="2">50</col>
<col id="3">This is the Mary Dole row</col>
</row>
</data>
</object>
<object class="GtkUIManager" id="uimanager">
<child>
<object class="GtkActionGroup" id="DefaultActions">
<child>
<object class="GtkAction" id="Copy">
<property name="name">Copy</property>
<property name="tooltip" translatable="yes">Copy selected object into the clipboard</property>
<property name="stock_id">gtk-copy</property>
</object>
</child>
<child>
<object class="GtkAction" id="Cut">
<property name="name">Cut</property>
<property name="tooltip" translatable="yes">Cut selected object into the clipboard</property>
<property name="stock_id">gtk-cut</property>
</object>
</child>
<child>
<object class="GtkAction" id="EditMenu">
<property name="name">EditMenu</property>
<property name="label" translatable="yes">_Edit</property>
</object>
</child>
<child>
<object class="GtkAction" id="FileMenu">
<property name="name">FileMenu</property>
<property name="label" translatable="yes">_File</property>
</object>
</child>
<child>
<object class="GtkAction" id="New">
<property name="name">New</property>
<property name="tooltip" translatable="yes">Create a new file</property>
<property name="stock_id">gtk-new</property>
</object>
</child>
<child>
<object class="GtkAction" id="Open">
<property name="name">Open</property>
<property name="tooltip" translatable="yes">Open a file</property>
<property name="stock_id">gtk-open</property>
</object>
</child>
<child>
<object class="GtkAction" id="Paste">
<property name="name">Paste</property>
<property name="tooltip" translatable="yes">Paste object from the Clipboard</property>
<property name="stock_id">gtk-paste</property>
</object>
</child>
<child>
<object class="GtkAction" id="Quit">
<property name="name">Quit</property>
<property name="tooltip" translatable="yes">Quit the program</property>
<property name="stock_id">gtk-quit</property>
<signal handler="quit_activate" name="activate"/>
</object>
</child>
<child>
<object class="GtkAction" id="Save">
<property name="name">Save</property>
<property name="is_important">True</property>
<property name="tooltip" translatable="yes">Save a file</property>
<property name="stock_id">gtk-save</property>
</object>
</child>
<child>
<object class="GtkAction" id="SaveAs">
<property name="name">SaveAs</property>
<property name="tooltip" translatable="yes">Save with a different name</property>
<property name="stock_id">gtk-save-as</property>
</object>
</child>
<child>
<object class="GtkAction" id="HelpMenu">
<property name="name">HelpMenu</property>
<property name="label" translatable="yes">_Help</property>
</object>
</child>
<child>
<object class="GtkAction" id="About">
<property name="name">About</property>
<property name="stock_id">gtk-about</property>
<signal handler="about_activate" name="activate"/>
</object>
<accelerator key="F1"/>
</child>
</object>
</child>
<ui>
<menubar name="menubar1">
<menu action="FileMenu" name="FileMenu">
<menuitem action="New" name="New"/>
<menuitem action="Open" name="Open"/>
<menuitem action="Save" name="Save"/>
<menuitem action="SaveAs" name="SaveAs"/>
<separator/>
<menuitem action="Quit" name="Quit"/>
</menu>
<menu action="EditMenu">
<menuitem action="Copy" name="Copy"/>
<menuitem action="Cut" name="Cut"/>
<menuitem action="Paste" name="Paste"/>
</menu>
<menu action="HelpMenu" name="HelpMenu">
<menuitem action="About" name="About"/>
</menu>
</menubar>
<toolbar name="toolbar1">
<toolitem action="New" name="New"/>
<toolitem action="Open" name="Open"/>
<toolitem action="Save" name="Save"/>
<separator/>
<toolitem action="Copy" name="Copy"/>
<toolitem action="Cut" name="Cut"/>
<toolitem action="Paste" name="Paste"/>
</toolbar>
</ui>
</object>
<object class="GtkAboutDialog" id="aboutdialog1">
<property name="program-name" translatable="yes">GtkBuilder demo</property>
<accessibility>
<relation target="window1" type="subwindow-of"/>
</accessibility>
</object>
<object class="GtkWindow" id="window1">
<property name="default_height">250</property>
<property name="default_width">440</property>
<property name="title">GtkBuilder demo</property>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<child>
<object constructor="uimanager" class="GtkMenuBar" id="menubar1">
<property name="visible">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="a11y-menubar">
<property name="AtkObject::accessible-name">The menubar</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
</packing>
</child>
<child>
<object constructor="uimanager" class="GtkToolbar" id="toolbar1">
<property name="visible">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="a11y-toolbar">
<property name="AtkObject::accessible-name">The toolbar</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="hscrollbar_policy">automatic</property>
<property name="shadow_type">in</property>
<property name="visible">True</property>
<property name="vscrollbar_policy">automatic</property>
<child>
<object class="GtkTreeView" id="treeview1">
<property name="visible">True</property>
<property name="model">liststore1</property>
<property name="tooltip-column">3</property>
<child internal-child="accessible">
<object class="AtkObject" id="a11y-treeview">
<property name="AtkObject::accessible-name">Name list</property>
<property name="AtkObject::accessible-description">
A list of person with name, surname and age columns
</property>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="column1">
<property name="title">Name</property>
<child>
<object class="GtkCellRendererText" id="renderer1"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="column2">
<property name="title">Surname</property>
<child>
<object class="GtkCellRendererText" id="renderer2"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="column3">
<property name="title">Age</property>
<child>
<object class="GtkCellRendererText" id="renderer3"/>
<attributes>
<attribute name="text">2</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
<accessibility>
<action action_name="move-cursor" description="Move the cursor to select another person."/>
</accessibility>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkStatusbar" id="statusbar1">
<property name="visible">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">3</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

View File

@ -0,0 +1,137 @@
# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: dialog.rb,v 1.5 2005/02/12 23:02:43 kzys Exp $
=begin
= Dialog and Message Boxes
Dialog widgets are used to pop up a transient window for user feedback.
=end
require 'common'
module Demo
class Dialog < Demo::BasicWindow
def initialize
@count = 1
super('Dialogs')
set_border_width(8)
frame = Gtk::Frame.new('Dialogs')
add(frame)
vbox = Gtk::VBox.new(false, 8)
vbox.set_border_width(8)
frame.add(vbox)
# Standard message dialog
hbox = Gtk::HBox.new(false, 0)
vbox.pack_start(hbox, false, false, 0)
button = Gtk::Button.new('_Message Dialog', true)
button.signal_connect('clicked') do
message_dialog_clicked
end
hbox.pack_start(button, false, false, 0)
vbox.pack_start(Gtk::HSeparator.new, false, false, 0)
# Interactive dialog
hbox = Gtk::HBox.new(false, 8)
vbox.pack_start(hbox, false, false, 0)
vbox2 = Gtk::VBox.new(false, 0)
button = Gtk::Button.new('_Interactive Dialog')
button.signal_connect('clicked') do
interactive_dialog_clicked
end
hbox.pack_start(vbox2, false, false, 0)
vbox2.pack_start(button, false, false, 0)
table = Gtk::Table.new(2, 2, false)
table.set_row_spacings(4)
table.set_column_spacings(4)
hbox.pack_start(table, false, false, 0)
label = Gtk::Label.new('_Entry 1', true)
table.attach_defaults(label, 0, 1, 0, 1)
@entry1 = Gtk::Entry.new
table.attach_defaults(@entry1, 1, 2, 0, 1)
label.set_mnemonic_widget(@entry1)
label = Gtk::Label.new('E_ntry 2', true)
table.attach_defaults(label, 0, 1, 1, 2)
@entry2 = Gtk::Entry.new
table.attach_defaults(@entry2, 1, 2, 1, 2)
label.set_mnemonic_widget(@entry2)
end
def message_dialog_clicked
dialog = Gtk::MessageDialog.new(self,
Gtk::Dialog::MODAL |
Gtk::Dialog::DESTROY_WITH_PARENT,
Gtk::MessageDialog::INFO,
Gtk::MessageDialog::BUTTONS_OK,
<<EOS)
This message box has been popped up the following
number of times:
#{@count}
EOS
dialog.run
dialog.destroy
@count += 1
end
def interactive_dialog_clicked
dialog = Gtk::Dialog.new('Interactive Dialog',
self,
Gtk::Dialog::MODAL |
Gtk::Dialog::DESTROY_WITH_PARENT,
[Gtk::Stock::OK, Gtk::Dialog::RESPONSE_OK],
["_Non-stock Button", Gtk::Dialog::RESPONSE_CANCEL]
)
hbox = Gtk::HBox.new(false, 0)
hbox.set_border_width(8)
dialog.vbox.pack_start(hbox, false, false, 0)
stock = Gtk::Image.new(Gtk::Stock::DIALOG_QUESTION, Gtk::IconSize::DIALOG)
hbox.pack_start(stock, false, false, 0)
table = Gtk::Table.new(2, 2, false)
table.set_row_spacings(4)
table.set_column_spacings(4)
hbox.pack_start(table, true, true, 0)
label = Gtk::Label.new('_Entry 1', true)
table.attach_defaults(label,
0, 1, 0, 1)
local_entry1 = Gtk::Entry.new
local_entry1.text = @entry1.text
table.attach_defaults(local_entry1, 1, 2, 0, 1)
label.set_mnemonic_widget(local_entry1)
label = Gtk::Label.new('E_ntry 2', true)
table.attach_defaults(label,
0, 1, 1, 2)
local_entry2 = Gtk::Entry.new
local_entry2.text = @entry2.text
table.attach_defaults(local_entry2, 1, 2, 1, 2)
label.set_mnemonic_widget(local_entry2)
hbox.show_all
response = dialog.run
if response == Gtk::Dialog::RESPONSE_OK
@entry1.text = local_entry1.text
@entry2.text = local_entry2.text
end
dialog.destroy
end
end
end

View File

@ -0,0 +1,226 @@
# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: drawingarea.rb,v 1.5 2005/02/12 23:02:43 kzys Exp $
=begin
= Drawing Area
Gtk::DrawingArea is a blank area where you can draw custom displays
of various kinds.
This demo has two drawing areas. The checkerboard area shows
how you can just draw something; all you have to do is write
a signal handler for expose_event, as shown here.
The 'scribble' area is a bit more advanced, and shows how to handle
events such as button presses and mouse motion. Click the mouse
and drag in the scribble area to draw squiggles. Resize the window
to clear the area.
=end
require 'common'
module Demo
class DrawingArea < BasicWindow
def initialize
# Pixmap for scribble area, to store current scribbles
@pixmap = nil
super('Drawing Area')
self.border_width = 8
vbox = Gtk::VBox.new(false, 8)
vbox.border_width = 8
add(vbox)
## Create the checkerboard area
label = Gtk::Label.new
label.set_markup('<u>Checkerboard pattern</u>')
vbox.pack_start(label, false, false, 0)
frame = Gtk::Frame.new
frame.shadow_type = Gtk::SHADOW_IN
vbox.pack_start(frame, true, true, 0)
da = Gtk::DrawingArea.new
# set a minimum size
da.set_size_request(100, 100)
frame.add(da)
da.signal_connect('expose_event') do |widget, event|
checkerboard_expose(widget)
end
## Create the scribble area
label = Gtk::Label.new
label.set_markup('<u>Scribble area</u>')
vbox.pack_start(label, false, false, 0)
frame = Gtk::Frame.new
frame.shadow_type = Gtk::SHADOW_IN
vbox.pack_start(frame, true, true, 0)
da = Gtk::DrawingArea.new
# set a minimum size
da.set_size_request(100, 100)
frame.add(da)
# Signals used to handle backing pixmap
da.signal_connect('expose_event') do |*args|
scribble_expose_event(*args)
end
da.signal_connect('configure_event') do |widget, event|
scribble_configure_event(widget)
end
# Event signals
da.signal_connect('motion_notify_event') do |*args|
scribble_motion_notify_event(*args)
end
da.signal_connect('button_press_event') do |*args|
scribble_button_press_event(*args)
end
# Ask to receive events the drawing area doesn't normally
# subscribe to
da.events |= (Gdk::Event::LEAVE_NOTIFY_MASK |
Gdk::Event::BUTTON_PRESS_MASK |
Gdk::Event::POINTER_MOTION_MASK |
Gdk::Event::POINTER_MOTION_HINT_MASK)
end
# Create a new pixmap of the appropriate size to store our scribbles
def scribble_configure_event(widget)
@pixmap = Gdk::Pixmap.new(self.window,
widget.allocation.width,
widget.allocation.height,
-1)
# Initialize the pixmap to white
@pixmap.draw_rectangle(widget.style.white_gc,
true,
0, 0,
widget.allocation.width,
widget.allocation.height)
# We've handled the configure event, no need for further processing.
return true
end
CHECK_SIZE = 10
SPACING = 2
def checkerboard_expose(da)
# At the start of an expose handler, a clip region of event.area
# is set on the window, and event.area has been cleared to the
# widget's background color. The docs for
# gdk_window_begin_paint_region give more details on how this
# works.
# It would be a bit more efficient to keep these
# GC's around instead of recreating on each expose, but
# this is the lazy/slow way.
gc1 = Gdk::GC.new(da.window)
gc1.rgb_fg_color = Gdk::Color.new(30000, 0, 30000)
gc2 = Gdk::GC.new(da.window)
gc2.rgb_fg_color = Gdk::Color.new(65535, 65535, 65535)
xcount = 0
SPACING.step(da.allocation.width, CHECK_SIZE + SPACING) do |i|
ycount = xcount % 2; # start with even/odd depending on row
SPACING.step(da.allocation.height, CHECK_SIZE + SPACING) do |j|
gc = if ycount % 2 == 1
gc1
else
gc2
end
# If we're outside event.area, this will do nothing.
# It might be mildly more efficient if we handled
# the clipping ourselves, but again we're feeling lazy.
da.window.draw_rectangle(gc, true, i, j, CHECK_SIZE, CHECK_SIZE)
ycount += 1
end
xcount += 1
end
# return true because we've handled this event, so no
# further processing is required.
#
return true
end
# Redraw the screen from the pixmap
def scribble_expose_event(widget, event)
# We use the 'foreground GC' for the widget since it already exists,
# but honestly any GC would work. The only thing to worry about
# is whether the GC has an inappropriate clip region set.
widget.window.draw_drawable(widget.style.fg_gc(widget.state),
@pixmap,
# Only copy the area that was exposed.
event.area.x, event.area.y,
event.area.x, event.area.y,
event.area.width, event.area.height)
return false
end
def draw_brush(widget, x, y)
update_rect = Gdk::Rectangle.new(x - 3, y - 3, 6, 6)
# Paint to the pixmap, where we store our state
@pixmap.draw_rectangle(widget.style.black_gc,
true,
update_rect.x, update_rect.y,
update_rect.width, update_rect.height)
# Now invalidate the affected region of the drawing area.
widget.window.invalidate(update_rect, false)
end
def scribble_button_press_event(widget, event)
unless @pixmap
# paranoia check, in case we haven't gotten a configure event
return false
end
if event.button == 1
draw_brush(widget, event.x, event.y)
end
# We've handled the event, stop processing
return true
end
def scribble_motion_notify_event(widget, event)
unless @pixmap
# paranoia check, in case we haven't gotten a configure event
return false
end
# This call is very important; it requests the next motion event.
# If you don't call Gdk::Window#pointer you'll only get
# a single motion event. The reason is that we specified
# Gdk::POINTER_MOTION_HINT_MASK to Gtk::Widget#set_events.
# If we hadn't specified that, we could just use event.x, event.y
# as the pointer location. But we'd also get deluged in events.
# By requesting the next event as we handle the current one,
# we avoid getting a huge number of events faster than we
# can cope.
win, x, y, state = event.window.pointer
if (state & Gdk::Window::BUTTON1_MASK) != 0
draw_brush(widget, x, y)
end
# We've handled it, stop processing
return true
end
end
end

View File

@ -0,0 +1,172 @@
# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: editable_cells.rb,v 1.7 2005/02/06 18:25:13 kzys Exp $
=begin
= Tree View/Editable Cells
This demo demonstrates the use of editable cells in a Gtk::TreeView. If
you're new to the Gtk::TreeView widgets and associates, look into
the Gtk::ListStore example first.
=end
require 'common'
module Demo
class EditableCells < BasicWindow
Item = Struct.new('Item', :number, :product, :editable)
COLUMN_NUMBER, COLUMN_PRODUCT, COLUMN_EDITABLE, NUM_COLUMNS = *(0..4).to_a
def initialize
super('Shopping list')
self.border_width = 5
vbox = Gtk::VBox.new(false, 5)
add(vbox)
vbox.pack_start(Gtk::Label.new('Shopping list (you can edit the cells!)'),
false, false, 0)
sw = Gtk::ScrolledWindow.new
sw.shadow_type = Gtk::SHADOW_ETCHED_IN
sw.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
vbox.pack_start(sw, true, true, 0)
# create model
model = create_model
# create tree view
treeview = Gtk::TreeView.new(model)
treeview.rules_hint = true
treeview.selection.mode = Gtk::SELECTION_SINGLE
add_columns(treeview)
sw.add(treeview)
# some buttons
hbox = Gtk::HBox.new(true, 4)
vbox.pack_start(hbox, false, false, 0)
button = Gtk::Button.new('Add item')
button.signal_connect('clicked') do
add_item(model)
end
hbox.pack_start(button, true, true, 0)
button = Gtk::Button.new('Remove item')
button.signal_connect('clicked') do
remove_item(treeview)
end
hbox.pack_start(button, true, true, 0)
set_default_size(320, 200)
end
def create_model
# create array
@articles = []
add_items
# create list store
model = Gtk::ListStore.new(Integer, String, TrueClass)
# add items
@articles.each do |article|
iter = model.append
article.each_with_index do |value, index|
iter.set_value(index, value)
end
end
return model
end
def add_items
item = Item.new(3, 'bottles of coke', true)
@articles.push(item)
item = Item.new(5, 'packages of noodles', true)
@articles.push(item)
item = Item.new(2, 'packages of chocolate chip cookies', true)
@articles.push(item)
item = Item.new(1, 'can vanilla ice cream', true)
@articles.push(item)
item = Item.new(6, 'eggs', true)
@articles.push(item)
end
def add_columns(treeview)
model = treeview.model
# number column
renderer = Gtk::CellRendererText.new
renderer.signal_connect('edited') do |*args|
cell_edited(*args.push(model))
end
treeview.insert_column(-1, 'Number', renderer,
{
:text => COLUMN_NUMBER,
:editable => COLUMN_EDITABLE,
})
def renderer.column
COLUMN_NUMBER
end
# product column
renderer = Gtk::CellRendererText.new
renderer.signal_connect('edited') do |*args|
cell_edited(*args.push(model))
end
def renderer.column
COLUMN_PRODUCT
end
treeview.insert_column(-1, 'Product', renderer,
{
:text => COLUMN_PRODUCT,
:editable => COLUMN_EDITABLE,
})
end
def cell_edited(cell, path_string, new_text, model)
path = Gtk::TreePath.new(path_string)
column = cell.column
iter = model.get_iter(path)
case column
when COLUMN_NUMBER
i = iter.path.indices[0]
@articles[i].number = new_text.to_i
iter.set_value(column, @articles[i].number)
when COLUMN_PRODUCT
i = iter.path.indices[0]
@articles[i].product = new_text
iter.set_value(column, @articles[i].product)
end
end
def add_item(model)
foo = Item.new(0, 'Description here', true)
@articles.concat([foo])
iter = model.append
foo.each_with_index do |value, index|
iter.set_value(index, value)
end
end
def remove_item(treeview)
model = treeview.model
selection = treeview.selection
if iter = selection.selected
@articles.delete_at(iter.path.indices[0])
model.remove(iter)
end
end
end
end

View File

@ -0,0 +1,63 @@
# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
# $Id: entry_completion.rb,v 1.3 2005/02/25 17:09:24 kzys Exp $
=begin
= Entry Completion (EntryCompletion)
GtkEntryCompletion provides a mechanism for adding support for
completion in GtkEntry.
=end
require 'common'
module Demo
class EntryCompletion < Gtk::Dialog
def initialize
super('GtkEntryCompletion',
nil, # parent
0,
[Gtk::Stock::CLOSE, Gtk::Dialog::RESPONSE_NONE])
self.resizable = false
signal_connect('response') do
self.destroy
end
vbox = Gtk::VBox.new(false, 5)
self.vbox.pack_start(vbox, true, true)
vbox.border_width = 5
label = Gtk::Label.new
label.markup = 'Completion demo, try writing <b>total</b> or <b>gnome</b> for example'
vbox.pack_start(label, false, false)
# Create our entry
entry = Gtk::Entry.new
vbox.pack_start(entry, false, false)
# Create the completion object
completion = Gtk::EntryCompletion.new
# Assign the completion to the entry
entry.completion = completion
# Create a tree model and use it as the completion model
completion.model = create_completion_model
# Use model column 0 as the text column
completion.text_column = 0
end
def create_completion_model
store = Gtk::ListStore.new(String)
%w(GNOME total totally).each do |word|
iter = store.append
iter[0] = word
end
store
end
end
end

View File

@ -0,0 +1,40 @@
# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
# $Id: expander.rb,v 1.2 2005/02/25 17:09:25 kzys Exp $
=begin
= Expander (Expander)
GtkExpander allows to provide additional content that is initially hidden.
This is also known as "disclosure triangle".
=end
require 'common'
module Demo
class Expander < Gtk::Dialog
def initialize
super('GtkExpander',
nil, # parent
0,
[Gtk::Stock::CLOSE, Gtk::Dialog::RESPONSE_NONE])
self.resizable = false
signal_connect('response') do
self.destroy
end
vbox = Gtk::VBox.new(false, 5)
self.vbox.pack_start(vbox, true, true)
vbox.border_width = 5
label = Gtk::Label.new('Expander demo. CLick on the triangle for details.')
vbox.pack_start(label, false, false)
# Create the expander
expander = Gtk::Expander.new('Details')
vbox.pack_start(expander, false, false)
expander.add(Gtk::Label.new('Details can be shown or hidden.'))
end
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@ -0,0 +1,211 @@
# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: hypertext.rb,v 1.2 2005/12/01 09:27:01 ktou Exp $
=begin
= Text Widget/Hypertext
Usually, tags modify the appearance of text in the view, e.g. making it
bold or colored or underlined. But tags are not restricted to appearance.
They can also affect the behavior of mouse and key presses, as this demo
shows.
=end
require 'common'
module Demo
class Hypertext < BasicWindow
def initialize
super('Hypertext')
@hand_cursor = Gdk::Cursor.new(Gdk::Cursor::HAND2)
@regular_cursor = Gdk::Cursor.new(Gdk::Cursor::XTERM)
@hovering = false
set_default_size(450, 450)
self.border_width = 0
view = Gtk::TextView.new
view.wrap_mode = Gtk::TextTag::WRAP_WORD
view.signal_connect('key-press-event') do |*args|
key_press_event(*args)
end
view.signal_connect('event-after') do |*args|
event_after(*args)
end
view.signal_connect('motion-notify-event') do |*args|
motion_notify_event(*args)
end
view.signal_connect('visibility-notify-event') do |*args|
visibility_notify_event(*args)
end
buffer = view.buffer
sw = Gtk::ScrolledWindow.new
sw.set_policy(Gtk::POLICY_AUTOMATIC,
Gtk::POLICY_AUTOMATIC)
add(sw)
sw.add(view)
show_page(buffer, 1)
end
# Inserts a piece of text into the buffer, giving it the usual
# appearance of a hyperlink in a web browser: blue and underlined.
# Additionally, attaches some data on the tag, to make it recognizable
# as a link.
def insert_link(buffer, iter, text, page)
tag = buffer.create_tag(nil,
{
'foreground' => 'blue',
'underline' => Pango::AttrUnderline::SINGLE,
})
tag.page = page
buffer.insert(iter, text, tag)
print("Insert #{tag}:#{page}\n")
end
# Fills the buffer with text and interspersed links. In any real
# hypertext app, this method would parse a file to identify the links.
def show_page(buffer, page)
puts
buffer.text = ''
iter = buffer.get_iter_at_offset(0)
case page
when 1
buffer.insert(iter, 'Some text ot show that simple ')
insert_link(buffer, iter, 'hypertext', 3)
buffer.insert(iter, ' can easily be realized with ')
insert_link(buffer, iter, 'tags', 2)
buffer.insert(iter, '.')
when 2
buffer.insert(iter,
%Q[A tag is an attribute that can be applied to some range of text. For example, a tag might be called "bold" and make the text insid the tag bold. However, the tag concept is more general than that; tags don't have to affect appearance. They can instead affect the behavior of mouse and key presses, "lock" a range of text so the user can't edit it, or countless other things.])
buffer.insert(iter, "\n")
insert_link(buffer, iter, 'Go back', 1)
when 3
tag = buffer.create_tag(nil,
{
'weight' =>
Pango::FontDescription::WEIGHT_BOLD
})
buffer.insert(iter, "hypertext:\n", tag);
buffer.insert(iter, %Q[machine-readable text that is not sequential but is organized so that related items of information are connected.\n])
insert_link(buffer, iter, 'Go back', 1)
end
end
# Looks at all tags covering the position of iter in the text view,
# and if one of them is a link, follow it by showing the page identified
# by the data attached to it.
def follow_if_link(text_view, iter)
tags = iter.tags
tags.each do |tag|
print("Follow #{tag}:#{tag.page}\n")
if tag.page
show_page(text_view.buffer, tag.page)
break
end
end
end
# Links can be activated by pressing Enter.
def key_press_event(text_view, event)
case event.keyval
when Gdk::Keyval::GDK_Return, Gdk::Keyval::GDK_KP_Enter
buffer = text_view.buffer
iter = buffer.get_iter_at_mark(buffer.get_mark("insert"))
follow_if_link(text_view, iter)
end
false
end
# Links can also be activated by clicking.
def event_after(text_view, event)
unless event.kind_of?(Gdk::EventButton) and event.button == 1
return false
end
buffer = text_view.buffer
# we shouldn't follow a link if the user has selected something
range = buffer.selection_bounds
if range and range[0].offset != range[1].offset
return false
end
x, y = text_view.window_to_buffer_coords(Gtk::TextView::WINDOW_WIDGET,
event.x, event.y)
iter = text_view.get_iter_at_location(x, y)
follow_if_link(text_view, iter)
end
# Looks at all tags covering the position (x, y) in the text view,
# and if one of them is a link, change the cursor to the "hands" cursor
# typically used by web browsers.
def set_cursor_if_appropriate(text_view, x, y)
buffer = text_view.buffer
iter = text_view.get_iter_at_location(x, y)
hovering = false
tags = iter.tags
tags.each do |t|
if t.page
hovering = true
break
end
end
if hovering != @hovering
@hovering = hovering
window = text_view.get_window(Gtk::TextView::WINDOW_TEXT)
window.cursor = if @hovering
@hand_cursor
else
@regular_cursor
end
end
end
# Update the cursor image if the pointer moved.
def motion_notify_event(text_view, event)
x, y = text_view.window_to_buffer_coords(Gtk::TextView::WINDOW_WIDGET,
event.x, event.y)
set_cursor_if_appropriate(text_view, x, y)
text_view.window.pointer
false
end
# Also update the cursor image if the window becomes visible
# (e.g. when a window covering it got iconified).
def visibility_notify_event (text_view, event)
window, wx, wy = text_view.window.pointer
bx, by = text_view.window_to_buffer_coords(Gtk::TextView::WINDOW_WIDGET,
wx, wy)
set_cursor_if_appropriate(text_view, bx, by)
false
end
end
end
module Gtk
class TextTag
attr_accessor :page
end
end

View File

@ -0,0 +1,109 @@
# Copyright (c) 2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: iconview.rb,v 1.7 2007/08/05 15:41:31 mutoh Exp $
=begin
= Icon View (IconView)
The Gtk::IconView widget is used to display and manipulate icons.
It uses a Gtk::TreeModel for data storage, so the list store example
might be helpful.
=end
$KCODE="u"
require 'common'
module Demo
class IconView < Demo::BasicWindow
COL_PATH, COL_DISPLAY_NAME, COL_IS_DIR, COL_PIXBUF = (0..3).to_a
def fill_store
@store.clear
Dir.glob(File.join(@parent, "*")).each do |path|
is_dir = FileTest.directory?(path)
iter = @store.append
# set COL_DISPLAY_NAME first because changing an iter will trigger the
# sort function; if we set something else first, the value of
# COL_DISPLAY_NAME for this row will be "nil" and the sort function will fail
puts path
#puts GLib.convert(GLib.filename_to_utf8(path), "Shift_JIS", "UTF-8")
#puts File.basename(GLib.convert(GLib.filename_to_utf8(path), "Shift_JIS", "UTF-8"))
# iter[COL_DISPLAY_NAME] = File.basename(GLib.filename_to_utf8(path))
iter[COL_DISPLAY_NAME] = GLib.filename_to_utf8(path)
iter[COL_PATH] = path
iter[COL_IS_DIR] = is_dir
iter[COL_PIXBUF] = is_dir ? @folder_pixbuf : @file_pixbuf
end
end
def initialize
super('Gtk::IconView demo')
@file_pixbuf = Gdk::Pixbuf.new(Demo.find_file("gnome-fs-regular.png"))
@folder_pixbuf = Gdk::Pixbuf.new(Demo.find_file("gnome-fs-directory.png"))
@store = Gtk::ListStore.new(String, String, TrueClass, Gdk::Pixbuf)
@parent = "/"
@store.set_default_sort_func do |a, b|
if !a[COL_IS_DIR] and b[COL_IS_DIR]
1
elsif a[COL_IS_DIR] and !b[COL_IS_DIR]
-1
else
a[COL_DISPLAY_NAME] <=> b[COL_DISPLAY_NAME]
end
end
@store.set_sort_column_id(Gtk::TreeSortable::DEFAULT_SORT_COLUMN_ID,
Gtk::SORT_ASCENDING)
fill_store
set_default_size(650, 400)
set_border_width(8)
vbox = Gtk::VBox.new(false, 0)
add(vbox)
toolbar = Gtk::Toolbar.new
vbox.pack_start(toolbar, false, false, 0)
up_button = Gtk::ToolButton.new(Gtk::Stock::GO_UP)
up_button.important = true
up_button.sensitive = false
toolbar.insert(-1, up_button)
up_button.signal_connect("clicked") do
@parent = File.dirname(@parent)
fill_store
up_button.sensitive = @parent != "/"
end
home_button = Gtk::ToolButton.new(Gtk::Stock::HOME)
home_button.important = true
toolbar.insert(-1, home_button)
home_button.signal_connect("clicked") do
@parent = GLib.home_dir
fill_store
up_button.sensitive = true
end
sw = Gtk::ScrolledWindow.new
sw.shadow_type = Gtk::SHADOW_ETCHED_IN
sw.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
vbox.pack_start(sw, true, true, 0)
iconview = Gtk::IconView.new(@store)
iconview.selection_mode = Gtk::SELECTION_MULTIPLE
iconview.text_column = COL_DISPLAY_NAME
iconview.pixbuf_column = COL_PIXBUF
iconview.signal_connect("item_activated") do |iview, path|
iter = @store.get_iter(path)
if iter[COL_DISPLAY_NAME]
@parent = iter[COL_PATH]
fill_store
up_button.sensitive = true
end
end
sw.add(iconview)
iconview.grab_focus
end
end
end

View File

@ -0,0 +1,197 @@
# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: images.rb,v 1.5 2006/04/08 12:30:03 mutoh Exp $
=begin
= Images
Gtk::Image is used to display an image; the image can be in a number of formats.
Typically, you load an image into a Gdk::Pixbuf, then display the pixbuf.
This demo code shows some of the more obscure cases, in the simple
case a call to Gtk::Image.new is all you need.
If you want to put image data in your program as a String variable,
use the make-inline-pixbuf program that comes with GTK+.
This way you won't need to depend on loading external files, your
application binary can be self-contained.
=end
require 'common'
module Demo
class Images < BasicWindow
def initialize
@pixbuf_loader = nil
@load_timeout = 0
@image_stream = nil
super('Images')
signal_connect('destroy') do
cleanup_callback
end
self.border_width = 8
vbox = Gtk::VBox.new(false, 8)
vbox.border_width = 8
add(vbox)
label = Gtk::Label.new
label.set_markup('<u>Image loaded from a file</u>')
vbox.pack_start(label, false, false, 0)
frame = Gtk::Frame.new
frame.shadow_type = Gtk::SHADOW_IN
# The alignment keeps the frame from growing when users resize
# the window
align = Gtk::Alignment.new(0.5, 0.5, 0, 0)
align.add(frame)
vbox.pack_start(align, false, false, 0)
# demo_find_file looks in the the current directory first,
# so you can run gtk-demo without installing GTK, then looks
# in the location where the file is installed.
pixbuf = nil
begin
filename = Demo.find_file('gtk-logo-rgb.gif')
pixbuf = Gdk::Pixbuf.new(filename)
rescue
# This code shows off error handling. You can just use
# Gtk::Image.new instead if you don't want to report
# errors to the user. If the file doesn't load when using
# Gtk::Image.new, a 'missing image' icon will
# be displayed instead.
dialog = Gtk::MessageDialog.new(self,
Gtk::Dialog::DESTROY_WITH_PARENT,
Gtk::MessageDialog::ERROR,
Gtk::MessageDialog::BUTTONS_CLOSE,
"Unable to open image file 'gtk-logo-rgb.gif': #{$1}")
dialog.signal_connect('response') do |widget, data|
widget.destroy
end
dialog.show
end
image = Gtk::Image.new(pixbuf)
frame.add(image)
# Animation
label = Gtk::Label.new
label.set_markup('<u>Animation loaded from a file</u>')
vbox.pack_start(label, false, false, 0)
frame = Gtk::Frame.new
frame.shadow_type = Gtk::SHADOW_IN
# The alignment keeps the frame from growing when users resize
# the window
align = Gtk::Alignment.new(0.5, 0.5, 0, 0)
align.add(frame)
vbox.pack_start(align, false, false, 0)
filename = Demo.find_file('floppybuddy.gif')
image = Gtk::Image.new(filename)
frame.add(image)
# Progressive
label = Gtk::Label.new
label.set_markup('<u>Progressive image loading</u>')
vbox.pack_start(label, false, false, 0)
frame = Gtk::Frame.new(nil)
frame.shadow_type = Gtk::SHADOW_IN
# The alignment keeps the frame from growing when users resize
# the window
align = Gtk::Alignment.new(0.5, 0.5, 0, 0)
align.add(frame)
vbox.pack_start(align, false, false, 0)
# Create an empty image for now; the progressive loader
# will create the pixbuf and fill it in.
image = Gtk::Image.new
frame.add(image)
start_progressive_loading(image)
# Sensitivity control
button = Gtk::ToggleButton.new('_Insensitive', true)
vbox.pack_start(button, false, false, 0)
button.signal_connect('toggled') do |widget|
vbox.children.each do |widget|
if widget != button
widget.sensitive = ! button.active?
end
end
end
end
def start_progressive_loading(image)
@load_timeout = Gtk.timeout_add(150) do
progressive_timeout(image)
end
end
def progressive_timeout(image)
if @image_stream
buf = @image_stream.read(256)
@pixbuf_loader.write(buf)
if @image_stream.eof?
@image_stream.close
@image_stream = nil
@pixbuf_loader.close
@pixbuf_loader = nil
end
else
filename = Demo.find_file('alphatest.png')
@image_stream = File.open(filename, 'rb')
if @pixbuf_loader != nil
@pixbuf_loader.close
@pixbuf_loader = nil
end
@pixbuf_loader = Gdk::PixbufLoader.new
@pixbuf_loader.signal_connect('area_prepared') do |loader|
pixbuf = loader.pixbuf
# Avoid displaying random memory contents, since the pixbuf
# isn't filled in yet.
pixbuf.fill!(0xaaaaaaff)
image.pixbuf = pixbuf
end
@pixbuf_loader.signal_connect('area_updated') do
# We know the pixbuf inside the Gtk::Image has changed, but the image
# itself doesn't know this; so queue a redraw. If we wanted to be
# really efficient, we could use a drawing area or something
# instead of a Gtk::Image, so we could control the exact position of
# the pixbuf on the display, then we could queue a draw for only
# the updated area of the image.
image.queue_draw
end
end
# leave timeout installed
return true
end
def cleanup_callback
@pixbuf_loader.close if @pixbuf_loader
@pixbuf_loader = nil
if @load_timeout != 0
Gtk.timeout_remove(@load_timeout)
end
end
end
end

View File

@ -0,0 +1,94 @@
# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: item_factory.rb,v 1.4 2005/02/12 23:02:43 kzys Exp $
=begin
= Item Factory
The Gtk::ItemFactory object allows the easy creation of menus
from an array of descriptions of menu items.
=end
require 'common'
module Demo
class ItemFactory < BasicWindow
def initialize
super('Item Factory')
accel_group = Gtk::AccelGroup.new
item_factory = Gtk::ItemFactory.new(Gtk::ItemFactory::TYPE_MENU_BAR,
'<main>', accel_group)
add_accel_group(accel_group)
set_border_width(0)
ifactory_cb = proc do |data, widget|
puts "ItemFactory: activated \"#{Gtk::ItemFactory.path_from_widget(widget)}\""
end
menu_items = [
['/_File'],
['/File/tearoff1',
'<Tearoff>', nil, nil, ifactory_cb],
['/File/_New',
'<Item>', '<control>N', nil, ifactory_cb],
['/File/_Open',
'<Item>', '<control>O', nil, ifactory_cb],
['/File/_Save',
'<Item>', '<control>S', nil, ifactory_cb],
['/File/Save _As...',
'<Item>', nil, nil, ifactory_cb],
['/File/sep1', '<Separator>'],
['/File/_Quit',
'<Item>', '<control>Q', nil, ifactory_cb],
['/_Preferences'],
['/_Preferences/_Color'],
[ '/_Preferences/Color/_Red',
'<RadioItem>', nil, nil, ifactory_cb],
['/_Preferences/Color/_Green',
'/Preferences/Color/Red', nil, nil, ifactory_cb],
['/_Preferences/Color/_Blue',
'/Preferences/Color/Red', nil, nil, ifactory_cb],
['/_Preferences/_Shape'],
['/_Preferences/Shape/_Square',
'<RadioItem>', nil, nil, ifactory_cb],
[ '/_Preferences/Shape/_Rectangle',
'/Preferences/Shape/Square', nil, nil, ifactory_cb],
[ '/_Preferences/Shape/_Oval',
'/Preferences/Shape/Rectangle', nil, nil, ifactory_cb],
[ '/_Help', '<LastBranch>'],
[ '/Help/_About', '<Item>', nil, nil, ifactory_cb],
]
item_factory.create_items(menu_items)
item_factory.get_item('/Preferences/Shape/Oval').set_active(true)
box1 = Gtk::VBox.new(false, 0)
add(box1)
box1.pack_start(item_factory.get_widget('<main>'), false, false, 0)
label = Gtk::Label.new("Type\n<alt>\nto start")
label.set_size_request(200, 200)
label.set_alignment(0.5, 0.5)
box1.pack_start(label, true, true, 0)
separator = Gtk::HSeparator.new
box1.pack_start(separator)
box2 = Gtk::VBox.new(false, 10)
box2.set_border_width(10)
box1.pack_start(box2, false, true, 0)
button = Gtk::Button.new('close')
# TODO: Need signal_connect_swapped?
button.signal_connect('clicked') do
quit
end
box2.pack_start(button, true, true, 0)
button.set_flags(Gtk::Widget::CAN_DEFAULT)
button.grab_default
end
end
end

View File

@ -0,0 +1,138 @@
# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: list_store.rb,v 1.5 2005/02/06 18:25:13 kzys Exp $
=begin
= Tree View/List Store
The Gtk::ListStore is used to store data in list form, to be used
later on by a Gtk::TreeView to display it. This demo builds a
simple Gtk::ListStore and displays it. See the Stock Browser
demo for a more advanced example.
=end
require 'common'
module Demo
class ListStore < BasicWindow
Bug = Struct.new('Bug', :fixed, :number, :severity, :description)
COLUMN_FIXED, COLUMN_NUMBER, COLUMN_SEVERITY, COLUMN_DESCRIPTION,
NUM_COLUMNS = *(0..5).to_a
DATA = [
[ false, 60482, 'Normal', 'scrollable notebooks and hidden tabs' ],
[ false, 60620, 'Critical', 'gdk_window_clear_area (gdkwindow-win32.c) is not thread-safe' ],
[ false, 50214, 'Major', 'Xft support does not clean up correctly' ],
[ true, 52877, 'Major', 'GtkFileSelection needs a refresh method. ' ],
[ false, 56070, 'Normal', "Can't click button after setting in sensitive" ],
[ true, 56355, 'Normal', 'GtkLabel - Not all changes propagate correctly' ],
[ false, 50055, 'Normal', 'Rework width/height computations for TreeView' ],
[ false, 58278, 'Normal', "gtk_dialog_set_response_sensitive doesn't work" ],
[ false, 55767, 'Normal', 'Getters for all setters' ],
[ false, 56925, 'Normal', 'Gtkcalender size' ],
[ false, 56221, 'Normal', 'Selectable label needs right-click copy menu' ],
[ true, 50939, 'Normal', 'Add shift clicking to GtkTextView' ],
[ false, 6112, 'Enhancement','netscape-like collapsable toolbars' ],
[ false, 1, 'Normal', 'First bug :=)' ],
].collect do |ary|
Bug.new(*ary)
end
def initialize
super('GtkListStore demo')
self.border_width = 8
vbox = Gtk::VBox.new(false, 8)
add(vbox)
label = Gtk::Label.new('This is the bug list (note: not based on real data, it would be nice to have a nice ODBC interface to bugzilla or so, though).')
vbox.pack_start(label, false, false, 0)
sw = Gtk::ScrolledWindow.new(nil, nil)
sw.shadow_type = Gtk::SHADOW_ETCHED_IN
sw.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC)
vbox.pack_start(sw, true, true, 0)
# create tree model
model = create_model
# create tree view
treeview = Gtk::TreeView.new(model)
treeview.rules_hint = true
treeview.search_column = COLUMN_DESCRIPTION
sw.add(treeview)
# add columns to the tree view
add_columns(treeview)
set_default_size(280, 250)
end
def create_model
# create list store
store = Gtk::ListStore.new(TrueClass, Integer, String, String)
# add data to the list store
DATA.each do |bug|
iter = store.append
bug.each_with_index do |value, index|
iter[index] = value
end
end
return store
end
def add_columns(treeview)
# column for fixed toggles
renderer = Gtk::CellRendererToggle.new
renderer.signal_connect('toggled') do |cell, path|
fixed_toggled(treeview.model, path)
end
column = Gtk::TreeViewColumn.new('Fixed?',
renderer,
'active' => COLUMN_FIXED)
# set this column to a fixed sizing (of 50 pixels)
column.sizing = Gtk::TreeViewColumn::FIXED
column.fixed_width = 50
treeview.append_column(column)
# column for bug numbers
renderer = Gtk::CellRendererText.new
column = Gtk::TreeViewColumn.new('Bug number',
renderer,
'text' => COLUMN_NUMBER)
column.set_sort_column_id(COLUMN_NUMBER)
treeview.append_column(column)
# column for severities
renderer = Gtk::CellRendererText.new
column = Gtk::TreeViewColumn.new('Severity',
renderer,
'text' => COLUMN_SEVERITY)
column.set_sort_column_id(COLUMN_SEVERITY)
treeview.append_column(column)
# column for description
renderer = Gtk::CellRendererText.new
column = Gtk::TreeViewColumn.new('Description',
renderer,
'text' => COLUMN_DESCRIPTION)
column.set_sort_column_id(COLUMN_DESCRIPTION)
treeview.append_column(column)
end
def fixed_toggled(model, path_str)
path = Gtk::TreePath.new(path_str)
# get toggled iter
iter = model.get_iter(path)
fixed =iter[COLUMN_FIXED]
# do something with the value
fixed ^= 1
# set new value
iter[COLUMN_FIXED] = fixed
end
end
end

View File

@ -0,0 +1,382 @@
#! /usr/bin/env ruby
=begin
main.rb - Main class of gtk-demo.
Copyright (c) 2003-2006 Ruby-GNOME2 Project Team
This program is licenced under the same licence as Ruby-GNOME2.
$Id: main.rb,v 1.20 2007/07/09 13:21:54 ggc Exp $
=end
require 'gtk2'
$:.unshift(File.dirname(__FILE__))
module Demo
class Main < Gtk::Window
TITLE_COLUMN, FILENAME_COLUMN, CLASS_COLUMN, ITALIC_COLUMN = 0, 1, 2, 3
def initialize
super()
@current_file = nil
@info_buffer = Gtk::TextBuffer.new
@source_buffer = Gtk::TextBuffer.new
set_title('Ruby/GTK+ Code Demos')
signal_connect('destroy') do
Gtk.main_quit
end
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
hbox = Gtk::HBox.new
add(hbox)
tree = create_tree
scrolled_window = Gtk::ScrolledWindow.new
scrolled_window.add(tree)
hbox.pack_start(scrolled_window, false, false, 0)
notebook = Gtk::Notebook.new
hbox.pack_start(notebook, true, true, 0)
notebook.append_page(create_text(@info_buffer, false),
Gtk::Label.new('_Info', true))
notebook.append_page(create_text(@source_buffer, true),
Gtk::Label.new('_Source', true))
@info_buffer.create_tag('title',
{'font' => 'Sans 18'})
@source_buffer.create_tag('comment',
{'foreground' => 'red'})
@source_buffer.create_tag('const',
{'foreground' => 'ForestGreen'})
@source_buffer.create_tag('string',
{
'foreground' => 'RosyBrown',
'weight' => Pango::FontDescription::WEIGHT_BOLD
})
@source_buffer.create_tag('reserved',
{'foreground' => 'purple'})
end
def script_info(path)
title = nil
klass = nil
depend = nil
file = File.open(path)
file.each do |ln|
if not title and ln =~ /^=\s+(.*)$/
title = $1
if title =~ /^(.*)\((.+?)\)$/
title = $1
depend = $2
end
elsif not klass and ln =~ /\s*class\s+([A-Z][A-Za-z0-9_]*)/
klass = $1
end
if title and klass
break
end
end
if not klass
raise "File not found: #{path}. This script should be run from its directory."
end
return title, klass.intern, depend
end
def generate_index
# Target scripts
scripts = Dir.glob('*.rb') - %w(common.rb main.rb)
# Generate index tree
children = {}
index = []
scripts.each do |fn|
title, klass, depend = script_info(fn)
if depend and not Gtk.const_defined?(depend)
next
end
if title =~ %r{^(.+?)/(.+)$}
parent = $1
child = $2
unless children[parent]
children[parent] = []
index += [[parent, nil, nil, []]]
end
children[parent] += [[child, fn, klass]]
else
index += [[title, fn, klass]]
end
end
# Sort children
children.each_key do |parent|
children[parent].sort! do |a, b|
a[0] <=> b[0]
end
end
# Expand children
index.collect! do |row|
if row[3]
row[3] = children[row[0]]
end
row
end
index.sort! do |a, b|
a[0] <=> b[0]
end
index
end
def create_tree
model = Gtk::TreeStore.new(String, String, String, TrueClass)
tree_view = Gtk::TreeView.new
tree_view.set_model(model)
selection = tree_view.selection
selection.set_mode(Gtk::SELECTION_BROWSE)
tree_view.set_size_request(200, -1)
append_children(model, generate_index)
cell = Gtk::CellRendererText.new
cell.style = Pango::FontDescription::STYLE_ITALIC
column = Gtk::TreeViewColumn.new("Widget (double click for demo)", cell,
{
'text' => TITLE_COLUMN,
'style_set' => ITALIC_COLUMN,
})
tree_view.append_column(column)
selection.signal_connect('changed') do |selection|
iter = selection.selected
load_file(iter.get_value(FILENAME_COLUMN)) if iter
end
tree_view.signal_connect('row_activated') do |tree_view, path, column|
row_activated_cb(tree_view.model, path)
end
tree_view.expand_all
return tree_view
end
def append_children(model, source, parent = nil)
source.each do |title, filename, klass, children|
iter = model.append(parent)
[title, filename, klass].each_with_index do |value, i|
if value
iter.set_value(i, value)
end
end
iter.set_value(ITALIC_COLUMN, false)
if children
append_children(model, children, iter)
end
end
end
def row_activated_cb(model, path)
iter = model.get_iter(path)
iter.set_value(ITALIC_COLUMN, true)
lib = iter.get_value(FILENAME_COLUMN)
if lib
require(lib)
klass = Demo.const_get(iter.get_value(CLASS_COLUMN))
window = klass.new
window.signal_connect('destroy') do
iter.set_value(ITALIC_COLUMN, false)
end
window.show_all
@window = window
end
end
def create_text(buffer, is_source)
scrolled_window = Gtk::ScrolledWindow.new
scrolled_window.set_policy(Gtk::POLICY_AUTOMATIC,
Gtk::POLICY_AUTOMATIC)
scrolled_window.set_shadow_type(Gtk::SHADOW_IN)
text_view = Gtk::TextView.new
text_view.set_buffer(buffer)
text_view.set_editable(false)
text_view.set_cursor_visible(false)
scrolled_window.add(text_view)
if is_source
font_desc = Pango::FontDescription.new('Monospace 12')
text_view.modify_font(font_desc)
text_view.set_wrap_mode(Gtk::TextTag::WRAP_NONE)
else
text_view.set_wrap_mode(Gtk::TextTag::WRAP_WORD)
text_view.set_pixels_above_lines(2)
text_view.set_pixels_below_lines(2)
end
return scrolled_window
end
def fontify(start_iter = @source_buffer.start_iter,
end_iter = @source_buffer.end_iter)
str = @source_buffer.get_text(start_iter, end_iter, true)
tokenizer = RubyTokonizer.new
tokenizer.tokenize(str, start_iter.offset) do |tag, start, last|
@source_buffer.apply_tag(tag.to_s,
@source_buffer.get_iter_at_offset(start),
@source_buffer.get_iter_at_offset(last))
end
end
def load_file(filename)
if filename == @current_file
return
end
@info_buffer.delete(*@info_buffer.bounds)
@source_buffer.delete(*@source_buffer.bounds)
file = begin
File.open(filename)
rescue
$stderr.puts "Cannot open: #{$!}" if $DEBUG
return
end
start = @info_buffer.get_iter_at_offset(0)
state = :before_header
file.each do |line|
case state
when :before_header
if line =~ /^=begin$/
state = :in_header
end
when :in_header
if line =~ /^=end$/
state = :body
start = @source_buffer.get_iter_at_offset(0)
elsif line =~ /^=\s+(.*)$/
title = $1
title.gsub!(/\s*\(.*\)$/, '') # Delete depend field
last = start
@info_buffer.insert(last, title)
start = last.clone
start.backward_chars(title.length)
@info_buffer.apply_tag('title', start, last)
start = last
else
@info_buffer.insert(start, line)
end
when :body # Reading program body
@source_buffer.insert(start, line)
end
end
fontify
@current_file = filename
end
end
class RubyTokonizer
RESERVED_WORDS = %w(begin end module class def if then else while unless do case when require yield)
RESERVED_WORDS_PATTERN = Regexp.compile(/(^|\s+)(#{RESERVED_WORDS.collect do |pat| Regexp.quote(pat) end.join('|')})(\s+|$)/)
def tokenize(str, index = 0)
until str.empty?
tag = nil
case str
when /".+?"/, /'.+?'/
tag = :string
when /#.*$/
tag = :comment
when RESERVED_WORDS_PATTERN
tag = :reserved
when /[A-Z][A-Za-z0-9_]+/
tag = :const
end
if tag
tokenize($~.pre_match, index) do |*args|
yield(*args)
end
yield(tag, index + $~.begin(0), index + $~.end(0))
index += (str.length - $~.post_match.length)
str = $~.post_match
else
index += str.length
str = ''
end
end
end
end
end
target = ARGV.shift
if target
Demo::INDEX.each do |title, filename, klass_symbol, children|
if target == filename or target == klass_symbol.id2name
require filename
window = Demo.const_get(klass_symbol).new
window.show_all
class << window
def quit
Gtk.main_quit
end
end
break
end
end
else
main = Demo::Main.new
main.set_default_size(600, 400)
main.show_all
end
Gtk.main

View File

@ -0,0 +1,172 @@
# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: menus.rb,v 1.4 2005/02/12 23:02:43 kzys Exp $
=begin
= Menus
There are several widgets involved in displaying menus. The
Gtk::MenuBar widget is a horizontal menu bar, which normally appears
at the top of an application. The Gtk::Menu widget is the actual menu
that pops up. Both Gtk::MenuBar and Gtk::Menu are subclasses of
Gtk::MenuShell; a Gtk::MenuShell contains menu items
(Gtk::MenuItem). Each menu item contains text and/or images and can
be selected by the user.
There are several kinds of menu item, including plain Gtk::MenuItem,
Gtk::CheckMenuItem which can be checked/unchecked, Gtk::RadioMenuItem
which is a check menu item that's in a mutually exclusive group,
Gtk::SeparatorMenuItem which is a separator bar, Gtk::TearoffMenuItem
which allows a Gtk::Menu to be torn off, and Gtk::ImageMenuItem which
can place a Gtk::Image or other widget next to the menu text.
A Gtk::MenuItem can have a submenu, which is simply a Gtk::Menu to pop
up when the menu item is selected. Typically, all menu items in a menu bar
have submenus.
The Gtk::OptionMenu widget is a button that pops up a Gtk::Menu when clicked.
It's used inside dialogs and such.
Gtk::ItemFactory provides a higher-level interface for creating menu bars
and menus; while you can construct menus manually, most people don't
do that. There's a separate demo for Gtk::ItemFactory.
=end
require 'common'
module Demo
class Menus < BasicWindow
def initialize
super('menus')
self.border_width = 0
accel_group = Gtk::AccelGroup.new
add_accel_group(accel_group)
box1 = Gtk::VBox.new(false, 0)
add(box1)
menubar = Gtk::MenuBar.new
box1.pack_start(menubar, false, true, 0)
menu = create_menu(2, true)
menuitem = Gtk::MenuItem.new("test\nline2")
menuitem.submenu = menu
menubar.append(menuitem)
menuitem.show
menuitem = Gtk::MenuItem.new('foo')
menuitem.submenu = create_menu(3, true)
menubar.append(menuitem)
menuitem.show
menuitem = Gtk::MenuItem.new('bar')
menuitem.submenu = create_menu(4, true)
menuitem.right_justified = true
menubar.append(menuitem)
menuitem.show
box2 = Gtk::VBox.new(false, 10)
box2.border_width = 10
box1.pack_start(box2, true, true, 0)
box2.show
menu = create_menu(1, false)
# menu.accel_group = accel_group
menuitem = Gtk::SeparatorMenuItem.new
menu.append(menuitem)
menuitem.show
menuitem = Gtk::CheckMenuItem.new('Accelerate Me')
menu.append(menuitem)
menuitem.show
menuitem.add_accelerator('activate',
accel_group,
Gdk::Keyval::GDK_F1,
0,
Gtk::ACCEL_VISIBLE)
menuitem = Gtk::CheckMenuItem.new('Accelerator Locked')
menu.append(menuitem)
menuitem.show
menuitem.add_accelerator('activate',
accel_group,
Gdk::Keyval::GDK_F2,
0,
Gtk::ACCEL_VISIBLE | Gtk::ACCEL_LOCKED)
menuitem = Gtk::CheckMenuItem.new('Accelerators Frozen')
menu.append(menuitem)
menuitem.show
menuitem.add_accelerator('activate',
accel_group,
Gdk::Keyval::GDK_F2,
0,
Gtk::ACCEL_VISIBLE)
menuitem.add_accelerator('activate',
accel_group,
Gdk::Keyval::GDK_F3,
0,
Gtk::ACCEL_VISIBLE)
optionmenu = Gtk::OptionMenu.new
optionmenu.menu = menu
optionmenu.history = 3
box2.pack_start(optionmenu, true, true, 0)
optionmenu.show
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)
box2.show
button = Gtk::Button.new('close')
button.signal_connect('clicked') do
quit
end
box2.pack_start(button, true, true, 0)
button.flags = Gtk::Widget::CAN_DEFAULT
button.grab_default
button.show
end
def create_menu (depth, tearoff)
if depth < 1
return nil
end
menu = Gtk::Menu.new
group = nil
if tearoff
menuitem = Gtk::TearoffMenuItem.new
menu.append(menuitem)
menuitem.show
end
5.times do |i|
buf = sprintf('item %2d - %d', depth, i + 1)
menuitem = Gtk::RadioMenuItem.new(buf)
group = menuitem.group
menu.append(menuitem)
menuitem.show
if i == 3
menuitem.sensitive = false
end
if submenu = create_menu(depth - 1, true)
menuitem.submenu = submenu
end
end
menu.show
return menu
end
end
end

View File

@ -0,0 +1,156 @@
# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: panes.rb,v 1.5 2005/02/12 23:06:07 kzys Exp $
=begin
= Paned Widgets
The Gtk::HPaned and Gtk::VPaned Widgets divide their content
area into two panes with a divider in between that the
user can adjust. A separate child is placed into each
pane.
There are a number of options that can be set for each pane.
This test contains both a horizontal (HPaned) and a vertical
(VPaned) widget, and allows you to adjust the options for
each side of each widget.
=end
require 'common'
module Demo
class Panes < BasicWindow
def initialize
super('Panes')
self.border_width = 0
vbox = Gtk::VBox.new(false, 0)
add(vbox)
vpaned = Gtk::VPaned.new
vbox.pack_start(vpaned, true, true, 0)
vpaned.border_width = 5
hpaned = Gtk::HPaned.new
vpaned.add1(hpaned)
frame = Gtk::Frame.new
frame.shadow_type = Gtk::SHADOW_IN
frame.set_size_request(60, 60)
hpaned.add1(frame)
button = Gtk::Button.new('_Hi there', true)
frame.add(button)
frame = Gtk::Frame.new
frame.shadow_type = Gtk::SHADOW_IN
frame.set_size_request(80, 60)
hpaned.add2(frame)
frame = Gtk::Frame.new
frame.shadow_type = Gtk::SHADOW_IN
frame.set_size_request(60, 80)
vpaned.add2(frame)
# Now create toggle buttons to control sizing
vbox.pack_start(create_pane_options(hpaned,
'Horizontal', 'Left', 'Right'),
false, false, 0)
vbox.pack_start(create_pane_options(vpaned,
'Vertical', 'Top', 'Bottom'),
false, false, 0)
end
def create_pane_options(paned, frame_label, label1, label2)
frame = Gtk::Frame.new(frame_label)
frame.border_width = 4
table = Gtk::Table.new(3, 2, true)
frame.add(table)
label = Gtk::Label.new(label1)
table.attach_defaults(label, 0, 1, 0, 1)
check_button = Gtk::CheckButton.new('_Resize', true)
table.attach_defaults(check_button, 0, 1, 1, 2)
check_button.signal_connect('toggled') do
toggle_resize(paned.child1)
end
check_button = Gtk::CheckButton.new('_Shrink', true)
table.attach_defaults(check_button, 0, 1, 2, 3)
check_button.active = true
check_button.signal_connect('toggled') do
toggle_shrink(paned.child1)
end
label = Gtk::Label.new(label2)
table.attach_defaults(label, 1, 2, 0, 1)
check_button = Gtk::CheckButton.new('_Resize')
table.attach_defaults(check_button, 1, 2, 1, 2)
check_button.active = true
check_button.signal_connect('toggled') do
toggle_resize(paned.child2)
end
check_button = Gtk::CheckButton.new('_Shrink')
table.attach_defaults(check_button, 1, 2, 2, 3)
check_button.active = true
check_button.signal_connect('toggled') do
toggle_shrink(paned.child2)
end
return frame
end
def toggle_resize(child)
paned = child.parent
is_child1 = (child == paned.child1)
resize = if is_child1
paned.child1_resize?
else
paned.child2_resize?
end
shrink = if is_child1
paned.child1_shrink?
else
paned.child2_shrink?
end
child.parent.remove(child)
if is_child1
paned.pack1(child, !resize, shrink)
else
paned.pack2(child, !resize, shrink)
end
end
def toggle_shrink(child)
paned = child.parent
is_child1 = (child == paned.child1)
resize = if is_child1
paned.child1_resize?
else
paned.child2_resize?
end
shrink = if is_child1
paned.child1_shrink?
else
paned.child2_shrink?
end
child.parent.remove(child)
if is_child1
paned.pack1(child, resize, !shrink)
else
paned.pack2(child, resize, !shrink)
end
end
end
end

View File

@ -0,0 +1,176 @@
# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: pixbufs.rb,v 1.5 2005/02/12 23:02:43 kzys Exp $
=begin
= Pixbufs
A Gdk::Pixbuf represents an image, normally in RGB or RGBA format.
Pixbufs are normally used to load files from disk and perform
image scaling.
This demo is not all that educational, but looks cool. It was written
by Extreme Pixbuf Hacker Federico Mena Quintero. It also shows
off how to use Gtk::DrawingArea to do a simple animation.
Look at the Image demo for additional pixbuf usage examples.
=end
require 'common'
module Demo
class Pixbufs < BasicWindow
FRAME_DELAY = 50
BACKGROUND_NAME = 'background.jpg'
IMAGE_NAMES = [
'apple-red.png',
'gnome-applets.png',
'gnome-calendar.png',
'gnome-foot.png',
'gnome-gmush.png',
'gnome-gimp.png',
'gnome-gsame.png',
'gnu-keys.png',
'ruby-gnome2-logo.png'
]
CYCLE_LEN = 60
def initialize
super('Pixbufs')
set_resizable(false)
@background = nil
@frame = nil
@frame_num = 0
@images = []
begin
load_pixbufs
set_size_request(@background.width, @background.height)
@frame = Gdk::Pixbuf.new(Gdk::Pixbuf::COLORSPACE_RGB,
false, 8,
@background.width, @background.height)
@da = Gtk::DrawingArea.new
@da.signal_connect('expose_event') do |w, e|
expose_cb(w, e)
end
add(@da)
timeout_id = Gtk.timeout_add(FRAME_DELAY) do
timeout
end
signal_connect('destroy') do
Gtk.timeout_remove(timeout_id)
end
rescue
dialog = Gtk::MessageDialog.new(self,
Gtk::Dialog::DESTROY_WITH_PARENT,
Gtk::MessageDialog::ERROR,
Gtk::MessageDialog::BUTTONS_CLOSE,
"Failed to load an image: #{$!.message}")
dialog.signal_connect('response') do
dialog.destroy
end
dialog.show
end
end
def load_pixbufs
# Loads the images for the demo
if @background
return # already loaded earlier
end
# demo_find_file() looks in the the current directory first,
# so you can run gtk-demo without installing GTK, then looks
# in the location where the file is installed.
#
filename = Demo.find_file(BACKGROUND_NAME)
@background = Gdk::Pixbuf.new(filename)
IMAGE_NAMES.each_with_index do |basename, i|
filename = Demo.find_file(basename)
@images[i] = Gdk::Pixbuf.new(filename)
end
end
def expose_cb(widget, event)
rowstride = @frame.rowstride
pixels = @frame.pixels
pixels[0, rowstride * event.area.y + event.area.x * 3] = ''
Gdk::RGB.draw_rgb_image(widget.window,
widget.style.black_gc,
event.area.x, event.area.y,
event.area.width, event.area.height,
Gdk::RGB::Dither::NORMAL,
pixels, rowstride,
event.area.x, event.area.y)
true
end
# Timeout handler to regenerate the frame
def timeout
@background.copy_area(0, 0, @background.width, @background.height,
@frame, 0, 0)
f = Float(@frame_num % CYCLE_LEN) / CYCLE_LEN;
xmid = @background.width / 2.0
ymid = @background.height / 2.0
radius = [xmid, ymid].min / 2.0
@images.each_with_index do |image, i|
ang = 2.0 * Math::PI * Float(i) / IMAGE_NAMES.length - f * 2.0 * Math::PI
r = radius + (radius / 3.0) * Math.sin(f * 2.0 * Math::PI)
xpos = (xmid + r * Math.cos(ang) - image.width / 2.0 + 0.5).floor
ypos = (ymid + r * Math.sin(ang) - image.height / 2.0 + 0.5).floor
k = if (i & 1) == 1
Math.sin(f * 2.0 * Math::PI)
else
Math.cos(f * 2.0 * Math::PI)
end
k = [0.25, 2.0 * k * k].max
r1 = Gdk::Rectangle.new(xpos, ypos, image.width * k, image.height * k)
r2 = Gdk::Rectangle.new(0, 0, @background.width, @background.height)
dest = r1.intersect(r2)
if dest
@frame.composite!(image, dest.x, dest.y, dest.width, dest.height,
xpos, ypos, k, k, Gdk::Pixbuf::INTERP_NEAREST,
if (i & 1) == 1
[
127,
(255 * Math.sin(f * 2.0 * Math::PI)).abs
].max
else
[
127,
(255 * Math.cos(f * 2.0 * Math::PI)).abs
].max
end)
end
end
@da.queue_draw
@frame_num += 1
true
end
end
end

View File

@ -0,0 +1,128 @@
# Copyright (c) 2008 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
=begin
= Printing
Gtk::PrintOperation offers a simple API to support printing
in a cross-platform way.
=end
require 'common'
module Demo
class Printing < BasicWindow
Data = Struct.new(:font_size, :lines_per_page, :lines, :n_pages)
HEADER_HEIGHT = 10 * 72 / 25.4
HEADER_GAP = 3 * 72 / 25.4
def initialize
super('Printing')
button = Gtk::Button.new("Print...")
button.signal_connect("clicked") do
begin
run_print_operation
rescue
dialog = Gtk::MessageDialog.new(self, :destroy_with_parent, :error,
:close, $!.message)
dialog.signal_connect("response") do
dialog.destroy
true
end
dialog.show
end
true
end
add(button)
end
private
def run_print_operation
operation = Gtk::PrintOperation.new
data = Data.new
data.font_size = 12.0
operation.signal_connect("begin-print") do |_operation, context|
on_begin_print(_operation, context, data)
end
operation.signal_connect("draw-page") do |_operation, context, page_number|
on_draw_page(_operation, context, page_number, data)
end
operation.signal_connect("end-print") do |_operation, context|
on_end_print(_operation, context, data)
end
operation.use_full_page = false
operation.unit = :points
operation.run(:print_dialog, self)
end
def on_begin_print(operation, context, data)
height = context.height - HEADER_HEIGHT - HEADER_GAP
data.lines_per_page = (height / data.font_size).floor
data.lines = File.readlines(__FILE__)
data.n_pages = (data.lines.size - 1) / data.lines_per_page + 1
operation.set_n_pages(data.n_pages)
end
def on_draw_page(operation, context, page_number, data)
cr = context.cairo_context
draw_header(cr, operation, context, page_number, data)
draw_body(cr, operation, context, page_number, data)
end
def draw_header(cr, operation, context, page_number, data)
width = context.width
cr.rectangle(0, 0, width, HEADER_HEIGHT)
cr.set_source_rgb(0.8, 0.8, 0.8)
cr.fill_preserve
cr.set_source_rgb(0, 0, 0)
cr.line_width = 1
cr.stroke
layout = context.create_pango_layout
layout.font_description = "sans 14"
layout.text = File.basename(__FILE__)
text_width, text_height = layout.pixel_size
if (text_width > width)
layout.width = width
layout.ellipsize = :start
text_width, text_height = layout.pixel_size
end
y = (HEADER_HEIGHT - text_height) / 2
cr.move_to((width - text_width) / 2, y)
cr.show_pango_layout(layout)
layout.text = "#{page_number + 1}/#{data.n_pages}"
layout.width = -1
text_width, text_height = layout.pixel_size
cr.move_to(width - text_width - 4, y)
cr.show_pango_layout(layout)
end
def draw_body(cr, operation, context, page_number, data)
layout = context.create_pango_layout
description = Pango::FontDescription.new("monosapce")
description.size = data.font_size * Pango::SCALE
layout.font_description = description
cr.move_to(0, HEADER_HEIGHT + HEADER_GAP)
start_line = page_number * data.lines_per_page
data.lines[start_line, data.lines_per_page].each do |line|
layout.text = line
cr.show_pango_layout(layout)
cr.rel_move_to(0, data.font_size)
end
end
def on_end_print(operation, context, data)
end
end
end

View File

@ -0,0 +1,84 @@
# Copyright (c) 2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: rotated_text.rb,v 1.2 2005/03/05 15:01:16 mutoh Exp $
=begin
= Rotated Text
This demo shows how to use GDK and Pango to draw rotated and transformed text.
The use of Gdk::PangoRenderer in this example is a somewhat advanced technique; most applications can simply use Gdk::Drawable#draw_layout.
We use it here mostly because that allows us to work in user coordinates - that is, coordinates prior to the application of the transformation matrix, rather than device coordinates.
As of GTK+-2.6, the ability to draw transformed and anti-aliased graphics as shown in this example is only present for text.
With GTK+-2.8, a new graphics system called "Cairo" will be introduced that provides these capabilities and many more for all types of graphics.
=end
require 'common'
module Demo
class RotatedText < BasicWindow
RADIUS = 150
N_WORDS = 10
FONT = "Sans Bold 27"
def initialize
super('Rotated Text')
unless Gtk.check_version?(2, 6, 0)
add(Gtk::Label.new("This sample requires GTK+ 2.6.0 or later"))
return
end
drawing_area = Gtk::DrawingArea.new
add(drawing_area)
drawing_area.modify_bg(Gtk::STATE_NORMAL, Gdk::Color.new(65535, 65535, 65535))
drawing_area.signal_connect("expose_event") do
matrix = Pango::Matrix.new
# Get the default renderer for the screen, and set it up for drawing
renderer = Gdk::PangoRenderer.get_default(drawing_area.screen)
renderer.drawable = drawing_area.window
renderer.gc = style.black_gc
width = drawing_area.allocation.width
height = drawing_area.allocation.height
# Set up a transformation matrix so that the user space coordinates for
# the centered square where we draw are [-RADIUS, RADIUS], [-RADIUS, RADIUS]
# We first center, then change the scale
device_radius = [width, height].min / 2.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)
# Create a PangoLayout, set the font and text
context = Gdk::Pango.context
layout = Pango::Layout.new(context)
layout.text = "Text"
layout.font_description = Pango::FontDescription.new(FONT)
# Draw the layout N_WORDS times in a circle
(0...N_WORDS).each do |i|
rotated_matrix = matrix.dup
angle = 360 * i / N_WORDS.to_f
# Gradient from red at angle == 60 to blue at angle == 300
red = 65535 * (1 + Math.cos((angle - 60) * Math::PI / 180.0)) / 2
color = Gdk::Color.new(red, 0, 65535 - red)
renderer.set_override_color(Pango::Renderer::PART_FOREGROUND, color)
rotated_matrix.rotate!(angle)
context.matrix = rotated_matrix
# Inform Pango to re-layout the text with the new transformation matrix
layout.context_changed
width, height = layout.size
renderer.draw_layout(layout, - width / 2, - RADIUS * Pango::SCALE)
end
# Clean up default renderer, since it is shared
renderer.set_override_color(Gdk::PangoRenderer::PART_FOREGROUND, nil)
renderer.drawable = nil
renderer.gc = nil
end
end
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

View File

@ -0,0 +1,118 @@
# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: sizegroup.rb,v 1.5 2005/02/12 23:02:43 kzys Exp $
=begin
= Size Groups
Gtk::SizeGroup provides a mechanism for grouping a number of
widgets together so they all request the same amount of space.
This is typically useful when you want a column of widgets to
have the same size, but you can't use a Gtk::Table widget.
Note that size groups only affect the amount of space requested,
not the size that the widgets finally receive. If you want the
widgets in a Gtk::SizeGroup to actually be the same size, you need
to pack them in such a way that they get the size they request
and not more. For example, if you are packing your widgets
into a table, you would not include the Gtk::FILL flag.
=end
require 'common'
module Demo
class SizeGroup < Gtk::Dialog
def initialize
super('GtkSizeGroup', nil, 0,
[Gtk::Stock::CLOSE, Gtk::Dialog::RESPONSE_NONE])
color_options = %w(Red Green Blue)
dash_options = %w(Solid Dashed Dotted)
end_options = %w(Square Round Arrow)
set_resizable(false)
signal_connect('response') do
destroy
end
vbox = Gtk::VBox.new(false, 5)
self.vbox.pack_start(vbox, true, true, 0)
vbox.set_border_width(5)
size_group = Gtk::SizeGroup.new(Gtk::SizeGroup::HORIZONTAL)
## Create one frame holding color options
frame = Gtk::Frame.new('Color Options')
vbox.pack_start(frame, true, true, 0)
table = Gtk::Table.new(2, 2, false)
table.set_border_width(5)
table.set_row_spacings(5)
table.set_column_spacings(10)
frame.add(table)
add_row(table, 0, size_group, '_Foreground', color_options)
add_row(table, 1, size_group, '_Background', color_options)
## And another frame holding line style options
frame = Gtk::Frame.new('Line Options')
vbox.pack_start(frame, false, false, 0)
table = Gtk::Table.new(2, 2, false)
table.set_border_width(5)
table.set_row_spacings(5)
table.set_column_spacings(10)
frame.add(table)
add_row(table, 0, size_group, '_Dashing', dash_options)
add_row(table, 1, size_group, '_Line ends', end_options)
# And a check button to turn grouping on and off
check_button = Gtk::CheckButton.new('_Enable grouping', true)
vbox.pack_start(check_button, false, false, 0)
check_button.set_active(true)
check_button.signal_connect('toggled', size_group) do |check_button, size_group|
new_mode = if check_button.active?
Gtk::SizeGroup::HORIZONTAL
else
Gtk::SizeGroup::VERTICAL
end
size_group.set_mode(new_mode)
end
end
def add_row(table, row, size_group, label_text, options)
label = Gtk::Label.new(label_text, true)
label.set_alignment(0, 1)
table.attach(label,
0, 1, row, row + 1,
Gtk::EXPAND | Gtk::FILL, 0,
0, 0)
option_menu = create_option_menu(options)
label.set_mnemonic_widget(option_menu)
size_group.add_widget(option_menu)
table.attach(option_menu,
1, 2, row, row + 1,
0, 0,
0, 0)
end
def create_option_menu(strings)
menu = Gtk::Menu.new
strings.each do |str|
menu_item = Gtk::MenuItem.new(str)
menu_item.show
menu.append(menu_item)
end
option_menu = Gtk::OptionMenu.new
option_menu.set_menu(menu)
return option_menu
end
end
end

View File

@ -0,0 +1,235 @@
# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: stock_browser.rb,v 1.5 2005/02/12 23:02:43 kzys Exp $
=begin
= Stock Item and Icon Browser
This source code for this demo doesn't demonstrate anything
particularly useful in applications. The purpose of the 'demo' is
just to provide a handy place to browse the available stock icons
and stock items.
=end
require 'common'
module Demo
class StockBrowser < BasicWindow
Item =
Struct.new('Item',
:stock_id, :label, :modifier, :keyval, :translation_domain)
ItemInfo =
Struct.new('ItemInfo', :id, :item, :small_icon, :const, :accel_str)
ItemDisplay =
Struct.new('ItemDisplay',
:type_label, :const_label, :id_label, :label_accel_label,
:icon_image)
def initialize
super('Stock Icons and Items')
set_default_size(-1, 500)
self.border_width = 8
hbox = Gtk::HBox.new(false, 8)
add(hbox)
sw = Gtk::ScrolledWindow.new
sw.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC)
hbox.pack_start(sw, false, false, 0)
model = create_model
treeview = Gtk::TreeView.new(model)
sw.add(treeview)
column = Gtk::TreeViewColumn.new
column.title = 'Const'
cell_renderer = Gtk::CellRendererPixbuf.new
column.pack_start(cell_renderer, false)
column.set_attributes(cell_renderer, "stock_id" => 1)
cell_renderer = Gtk::CellRendererText.new
column.pack_start(cell_renderer, true)
column.set_cell_data_func(cell_renderer) do |column, cell, model, iter|
cell.text = iter[0].const
end
treeview.append_column(column)
cell_renderer = Gtk::CellRendererText.new
treeview.insert_column(-1, 'Label', cell_renderer) do |col, cell, model, iter|
info = iter[0]
cell.text = info.item.label if info
end
cell_renderer = Gtk::CellRendererText.new
treeview.insert_column(-1, 'Accel', cell_renderer) do |col, cell, model, iter|
info = iter[0]
cell.text = info.accel_str if info
end
cell_renderer = Gtk::CellRendererText.new
treeview.insert_column(-1, 'ID', cell_renderer) do |col, cell, model, iter|
info = iter[0]
cell.text = info.id if info
end
align = Gtk::Alignment.new(0.5, 0.0, 0.0, 0.0)
hbox.pack_end(align, false, false, 0)
frame = Gtk::Frame.new('Selected Item')
align.add(frame)
vbox = Gtk::VBox.new(false, 8)
vbox.border_width = 4
frame.add(vbox)
display = ItemDisplay.new
class << treeview
@display = nil
attr_accessor :display
end
treeview.display = display
display.type_label = Gtk::Label.new
display.const_label = Gtk::Label.new
display.id_label = Gtk::Label.new
display.label_accel_label = Gtk::Label.new
display.icon_image = Gtk::Image.new # empty image
vbox.pack_start(display.type_label, false, false, 0)
vbox.pack_start(display.icon_image, false, false, 0)
vbox.pack_start(display.label_accel_label, false, false, 0)
vbox.pack_start(display.const_label, false, false, 0)
vbox.pack_start(display.id_label, false, false, 0)
selection = treeview.selection
selection.mode = Gtk::SELECTION_SINGLE
selection.signal_connect('changed') do |s|
selection_changed(s)
end
end
def create_model
store = Gtk::ListStore.new(ItemInfo, String, String, String)
list_ids = Gtk::Stock.ids
list_ids.sort! do |a, b|
a.to_s <=> b.to_s
end
list_ids.each do |stock_id|
info = ItemInfo.new
info.id = stock_id
begin
info.item = Item.new(*Gtk::Stock.lookup(stock_id))
rescue ArgumentError
info.item = Item.new
end
# only show icons for stock IDs that have default icons
icon_set = Gtk::IconFactory.lookup_default(info.id.to_s)
if icon_set
# See what sizes this stock icon really exists at
sizes = icon_set.sizes
# Use menu size if it exists, otherwise first size found
size = sizes.find do |s| s == Gtk::IconSize::MENU end || sizes.first
info.small_icon = render_icon(info.id, size, '')
unless size == Gtk::IconSize::MENU
# Make the result the proper size for our thumbnail
w, h = Gtk::IconSize.lookup(size)
scaled = info.small_icon.scale(w, h, Gdk::Pixbuf::INTERP_BILINEAR)
info.small_icon = scaled
end
else
info.small_icon = nil
end
if info.item.keyval
info.accel_str = Gtk::Accelerator.to_name(info.item.keyval,
info.item.modifier)
else
info.accel_str = ''
end
info.const = id_to_const(info.id)
iter = store.append
iter[0] = info
iter[1] = info.id
end
return store
end
def selection_changed(selection)
treeview = selection.tree_view
display = treeview.display
iter = selection.selected
info = iter[0]
display.type_label.label = if info.small_icon and info.item.label
'Icon and Item'
elsif info.small_icon
'Icon Only'
elsif info.item.label
'Item Only'
else
'???????'
end
display.const_label.label = info.const
display.id_label.label = info.id
if info.item.label
str = "%s %s" % [info.item.label, info.accel_str]
display.label_accel_label.set_text(str, true)
else
display.label_accel_label.set_text('')
end
if info.small_icon
display.icon_image.set(info.id, get_largest_size(info.id))
else
display.icon_image.pixbuf = nil
end
end
def get_largest_size(symbol)
set = Gtk::IconFactory.lookup_default(symbol.id2name)
best_size = Gtk::IconSize::INVALID
best_pixels = 0
sizes = set.sizes
sizes.collect! do |i|
width, height = Gtk::IconSize.lookup(i)
[i, width * height]
end
return (sizes.max do |a, b| a[1] <=> b[1] end)[0]
end
def id_to_const(id)
const = ''
s = id.id2name
if s =~ /^gtk-/
const += 'Gtk::Stock::'
s[0,4] = ''
end
const += s.upcase.gsub(/-/, '_')
const
end
end
end

View File

@ -0,0 +1,436 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: textview.rb,v 1.8 2005/02/06 18:25:13 kzys Exp $
=begin
= Text Widget/Multiple Views
The Gtk::TextView widget displays a Gtk::TextBuffer.
One Gtk::TextBuffer can be displayed by multiple Gtk::TextViews.
This demo has two views displaying a single buffer,
and shows off the widget's text formatting features.
=end
require 'common'
module Demo
class TextView < BasicWindow
GRAY50_WIDTH = 2
GRAY50_HEIGHT = 2
GRAY50_BITS = [0x02, 0x01].pack("c")
@@nest_window = nil
def initialize
super("TextView Window")
set_default_size(450, 450)
set_title("TextView")
set_border_width(0)
vpaned = Gtk::VPaned.new
vpaned.set_border_width(5)
add(vpaned)
##
# For convenience, we just use the autocreated buffer from
# the first text view; you could also create the buffer
# by itself with Gtk::TextBuffer.new, then later create
# a view widget.
#
view1 = Gtk::TextView.new
buffer = view1.buffer
view2 = Gtk::TextView.new(buffer)
sw = Gtk::ScrolledWindow.new(nil, nil)
sw.set_policy(Gtk::POLICY_AUTOMATIC,
Gtk::POLICY_AUTOMATIC)
vpaned.add1(sw)
sw.add(view1)
sw = Gtk::ScrolledWindow.new(nil, nil)
sw.set_policy(Gtk::POLICY_AUTOMATIC,
Gtk::POLICY_AUTOMATIC)
vpaned.add2(sw)
sw.add(view2)
create_tags(buffer)
insert_text(buffer)
attach_widgets(view1)
attach_widgets(view2)
vpaned.show_all
self.show
end
def create_tags(buffer)
##
# Create a bunch of tags. Note that it's also possible to
# create tags with Gtk::TextTag.new then add them to the
# tag table for the buffer, Gtk::TextBuffer#create_tag is
# just a convenience function. Also note that you don't have
# to give tags a name; pass NULL for the name to create an
# anonymous tag.
#
# In any real app, another useful optimization would be to create
# a Gtk::TextTagTable in advance, and reuse the same tag table for
# all the buffers with the same tag set, instead of creating
# new copies of the same tags for every buffer.
#
# Tags are assigned default priorities in order of addition to the
# tag table. That is, tags created later that affect the same text
# property affected by an earlier tag will override the earlier
# tag. You can modify tag priorities with
# Gtk::TextTag#set_priority.
#
buffer.create_tag('heading',
'weight' => Pango::FontDescription::WEIGHT_BOLD,
'size' => 15 * Pango::SCALE)
buffer.create_tag("italic",
"style" => Pango::FontDescription::STYLE_ITALIC)
buffer.create_tag("bold",
"weight" => Pango::FontDescription::WEIGHT_BOLD)
buffer.create_tag("big",
# points times the PANGO_SCALE factor
"size" => 20 * Pango::SCALE)
buffer.create_tag("xx-small",
"scale" => Pango::AttrScale::XX_SMALL)
buffer.create_tag("x-large",
"scale" => Pango::AttrScale::X_LARGE)
buffer.create_tag("monospace", "family" => "monospace")
buffer.create_tag("blue_foreground", "foreground" => "blue")
buffer.create_tag("red_background", "background" => "red")
stipple = Gdk::Pixmap.create_from_data(nil, GRAY50_BITS, GRAY50_WIDTH,
GRAY50_HEIGHT)
buffer.create_tag("background_stipple",
"background_stipple" => stipple)
buffer.create_tag("foreground_stipple",
"foreground_stipple" => stipple)
buffer.create_tag("big_gap_before_line",
"pixels_above_lines" => 30)
buffer.create_tag("big_gap_after_line",
"pixels_below_lines" => 30)
buffer.create_tag("double_spaced_line",
"pixels_inside_wrap" => 10)
buffer.create_tag("not_editable",
"editable" => false)
buffer.create_tag("word_wrap",
"wrap_mode" => Gtk::TextTag::WRAP_WORD)
buffer.create_tag("char_wrap",
"wrap_mode" => Gtk::TextTag::WRAP_CHAR)
buffer.create_tag("no_wrap",
"wrap_mode" => Gtk::TextTag::WRAP_NONE)
buffer.create_tag("center",
"justification" => Gtk::JUSTIFY_CENTER)
buffer.create_tag("right_justify",
"justification" => Gtk::JUSTIFY_RIGHT)
buffer.create_tag("wide_margins",
"left_margin" => 50,
"right_margin" => 50)
buffer.create_tag("strikethrough",
"strikethrough" => true)
buffer.create_tag("underline",
"underline" => Pango::AttrUnderline::SINGLE)
buffer.create_tag("double_underline",
"underline" => Pango::AttrUnderline::DOUBLE)
buffer.create_tag("superscript",
"rise" => 10 * Pango::SCALE, # 10 pixels
"size" => 8 * Pango::SCALE) # 8 points
buffer.create_tag("subscript",
"rise" => -10 * Pango::SCALE, # 10 pixels
"size" => 8 * Pango::SCALE) # 8 points
buffer.create_tag("rtl_quote",
"wrap_mode" => Gtk::TextTag::WRAP_WORD,
"direction" => Gtk::Widget::TEXT_DIR_RTL,
"indent" => 30,
"left_margin" => 20,
"right_margin" => 20)
end
def insert_text(buffer)
##
# Demo.find_file looks in the the current directory first,
# so you can run gtk-demo without installing GTK, then looks
# in the location where the file is installed.
#
filename = Demo.find_file("gtk-logo-rgb.gif")
pixbuf = Gdk::Pixbuf.new(filename) if filename
unless pixbuf
$stderr.print "Failed to load image file gtk-logo-rgb.gif\n"
exit 1
end
scaled = pixbuf.scale(32, 32, Gdk::Pixbuf::INTERP_BILINEAR)
pixbuf = scaled
##
# get start of buffer; each insertion will revalidate the
# iterator to point to just after the inserted text.
#
iter = buffer.get_iter_at_offset(0)
buffer.insert(iter, "The text widget can display text with all kinds of nifty attributes. It also supports multiple views of the same buffer; this demo is showing the same buffer in two places.\n\n")
buffer.insert(iter, "Font styles. ", 'heading')
buffer.insert(iter, "For example, you can have ")
buffer.insert(iter, "italic", "italic")
buffer.insert(iter, ", ")
buffer.insert(iter, "bold", "bold")
buffer.insert(iter, ", or ")
buffer.insert(iter, "monospace(typewriter)", "monospace")
buffer.insert(iter, ", or ")
buffer.insert(iter, "big", "big")
buffer.insert(iter, " text. ")
buffer.insert(iter, "It's best not to hardcode specific text sizes; you can use relative sizes as with CSS, such as ")
buffer.insert(iter, "xx-small", "xx-small")
buffer.insert(iter, " or ")
buffer.insert(iter, "x-large", "x-large")
buffer.insert(iter, " to ensure that your program properly adapts if the user changes the default font size.\n\n")
buffer.insert(iter, "Colors. ", "heading")
buffer.insert(iter, "Colors such as ")
buffer.insert(iter, "a blue foreground", "blue_foreground")
buffer.insert(iter, " or ")
buffer.insert(iter, "a red background", "red_background")
buffer.insert(iter, " or even ")
buffer.insert(iter, "a stippled red background",
"red_background", "background_stipple")
buffer.insert(iter, " or ")
buffer.insert(iter, "a stippled blue foreground on solid red background",
"blue_foreground", "red_background", "foreground_stipple")
buffer.insert(iter, "(select that to read it) can be used.\n\n")
buffer.insert(iter, "Underline, strikethrough, and rise. ", "heading")
buffer.insert(iter, "Strikethrough", "strikethrough")
buffer.insert(iter, ", ")
buffer.insert(iter, "underline", "underline")
buffer.insert(iter, ", ")
buffer.insert(iter, "double underline", "double_underline")
buffer.insert(iter, ", ")
buffer.insert(iter, "superscript", "superscript")
buffer.insert(iter, ", and ")
buffer.insert(iter, "subscript", "subscript")
buffer.insert(iter, " are all supported.\n\n")
buffer.insert(iter, "Images. ", "heading")
buffer.insert(iter, "The buffer can have images in it: ")
buffer.insert(iter, pixbuf)
buffer.insert(iter, pixbuf)
buffer.insert(iter, pixbuf)
buffer.insert(iter, " for example.\n\n")
buffer.insert(iter, "Spacing. ", "heading")
buffer.insert(iter, "You can adjust the amount of space before each line.\n")
buffer.insert(iter, "This line has a whole lot of space before it.\n",
"big_gap_before_line", "wide_margins")
buffer.insert(iter, "You can also adjust the amount of space after each line; this line has a whole lot of space after it.\n",
"big_gap_after_line", "wide_margins")
buffer.insert(iter, "You can also adjust the amount of space between wrapped lines; this line has extra space between each wrapped line in the same paragraph. To show off wrapping, some filler text: the quick brown fox jumped over the lazy dog. Blah blah blah blah blah blah blah blah blah.\n",
"double_spaced_line", "wide_margins")
buffer.insert(iter, "Also note that those lines have extra-wide margins.\n\n")
buffer.insert(iter, "Editability. ", "heading")
buffer.insert(iter, "This line is 'locked down' and can't be edited by the user - just try it! You can't delete this line.\n\n",
"not_editable")
buffer.insert(iter, "Wrapping. ", "heading")
buffer.insert(iter, "This line(and most of the others in this buffer) is word-wrapped, using the proper Unicode algorithm. Word wrap should work in all scripts and languages that GTK+ supports. Let's make this a long paragraph to demonstrate: blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n\n")
buffer.insert(iter, "This line has character-based wrapping, and can wrap between any two character glyphs. Let's make this a long paragraph to demonstrate: blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n\n", "char_wrap")
buffer.insert(iter, "This line has all wrapping turned off, so it makes the horizontal scrollbar appear.\n\n\n", "no_wrap")
buffer.insert(iter, "Justification. ", "heading")
buffer.insert(iter, "\nThis line has center justification.\n", "center")
buffer.insert(iter, "This line has right justification.\n",
"right_justify")
buffer.insert(iter, "\nThis line has big wide margins. Text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text.\n", "wide_margins")
buffer.insert(iter, "Internationalization. ", "heading")
buffer.insert(iter, "You can put all sorts of Unicode text in the buffer.\n\nGerman(Deutsch Süd) Grüß Gott\nGreek(Ελληνικά) Γειά σας\nHebrew שלום\nJapanese(日本語)\n\nThe widget properly handles bidirectional text, word wrapping, DOS/UNIX/Unicode paragraph separators, grapheme boundaries, and so on using the Pango internationalization framework.\n")
buffer.insert(iter, "Here's a word-wrapped quote in a right-to-left language:\n")
buffer.insert(iter, "??? ??? ???? ?? ???? ???????? ????? ?? ???? ?????? ??????? ??????? ?? ???? ?????? ?? ????? ?? ??????? ????? ??????? ??? ?????? ????? ?????? ????? ???? ?? ?????? ?????? ?? ???????? ?????? ????? ?? ???? ???? ????????? ???????. ???? ???? ??? ???????? ????? ?? »????????« ?? ???????.\n\n", "rtl_quote")
buffer.insert(iter, "You can put widgets in the buffer: Here's a button: ")
anchor = buffer.create_child_anchor(iter)
buffer.insert(iter, " and a menu: ")
anchor = buffer.create_child_anchor(iter)
buffer.insert(iter, " and a scale: ")
anchor = buffer.create_child_anchor(iter)
buffer.insert(iter, " and an animation: ")
anchor = buffer.create_child_anchor(iter)
buffer.insert(iter, " finally a text entry: ")
anchor = buffer.create_child_anchor(iter)
buffer.insert(iter, ".\n")
buffer.insert(iter, "\n\nThis demo doesn't demonstrate all the Gtk::TextBuffer features; it leaves out, for example: invisible/hidden text(doesn't work in GTK 2, but planned), tab stops, application-drawn areas on the sides of the widget for displaying breakpoints and such...")
# Apply word_wrap tag to whole buffer
buf_start, buf_end = buffer.bounds
buffer.apply_tag("word_wrap", buf_start, buf_end)
end
def find_anchor(iter)
while iter.forward_char do
return true if iter.child_anchor
end
return false
end
def attach_widgets(text_view)
buffer = text_view.buffer;
iter = buffer.start_iter
i = 0;
while find_anchor(iter) do
anchor = iter.child_anchor
if i == 0
widget = Gtk::Button.new("Click Me")
widget.signal_connect('clicked') { |button|
if @@nest_window and ! @@nest_window.destroyed?
@@nest_window.present
break
end
buffer = Gtk::TextBuffer.new
iter = buffer.start_iter
buffer.insert(iter, "This buffer is shared by a set of nested text views.\n Nested view:\n")
anchor = buffer.create_child_anchor(iter)
buffer.insert(iter, "\nDon't do this in real applications, please.\n")
view = Gtk::TextView.new(buffer)
recursive_attach_view(0, view, anchor)
@@nest_window = Gtk::Window.new(Gtk::Window::TOPLEVEL)
sw = Gtk::ScrolledWindow.new(nil, nil)
sw.set_policy(Gtk::POLICY_AUTOMATIC,
Gtk::POLICY_AUTOMATIC)
@@nest_window.add(sw)
sw.add(view)
@@nest_window.set_default_size(300, 400)
@@nest_window.show_all
}
elsif i == 1
menu = Gtk::Menu.new
widget = Gtk::OptionMenu.new
menu_item = Gtk::MenuItem.new("Option 1")
menu.append(menu_item)
menu_item = Gtk::MenuItem.new("Option 2")
menu.append(menu_item)
menu_item = Gtk::MenuItem.new("Option 3")
menu.append(menu_item)
widget.menu = menu
elsif i == 2
widget = Gtk::HScale.new
widget.set_range(0, 100)
widget.set_size_request(70, -1)
elsif i == 3
filename = Demo.find_file("floppybuddy.gif")
widget = Gtk::Image.new(filename)
elsif i == 4
widget = Gtk::Entry.new
else
#widget = nil; avoids a compiler warning
#g_assert_not_reached ;
end
text_view.add_child_at_anchor(widget,
anchor)
widget.show_all
i += 1
end
end
def recursive_attach_view(depth, view, anchor)
return if depth > 4
child_view = Gtk::TextView.new(view.buffer)
# Event box is to add a black border around each child view
event_box = Gtk::EventBox.new
color = Gdk::Color.parse("black")
event_box.modify_bg(Gtk::STATE_NORMAL, color)
align = Gtk::Alignment.new(0.5, 0.5, 1.0, 1.0)
align.set_border_width(1)
event_box.add(align)
align.add(child_view)
view.add_child_at_anchor(event_box, anchor)
recursive_attach_view(depth + 1, child_view, anchor)
end
end
end

View File

@ -0,0 +1,270 @@
# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: tree_store.rb,v 1.7 2005/02/06 18:25:13 kzys Exp $
=begin
= Tree View/Tree Store
The Gtk::TreeStore is used to store data in tree form, to be
used later on by a Gtk::TreeView to display it. This demo builds
a simple Gtk::TreeStore and displays it. If you're new to the
GtkTreeView widgets and associates, look into the Gtk::ListStore
example first.
=end
require 'common'
module Demo
class TreeStore < BasicWindow
# TreeItem structure
TreeItem = Struct.new('TreeItem',
:label,
:alex, :havoc, :tim, :owen, :dave,
:world_holiday) # shared by the European hackers
# columns
(
HOLIDAY_NAME_COLUMN,
ALEX_COLUMN,
HAVOC_COLUMN,
TIM_COLUMN,
OWEN_COLUMN,
DAVE_COLUMN,
VISIBLE_COLUMN,
WORLD_COLUMN,
NUM_COLUMNS,
) = *(0..9).to_a
# tree data
TOPLEVEL = [
['January',
[
["New Years Day", true, true, true, true, false, true],
["Presidential Inauguration", false, true, false, true, false, false],
["Martin Luther King Jr. day", false, true, false, true, false, false],
]
],
['February',
[
["Presidents' Day", false, true, false, true, false, false],
["Groundhog Day", false, false, false, false, false, false],
["Valentine's Day", false, false, false, false, true, true],
]
],
['March',
[
["National Tree Planting Day", false, false, false, false, false, false],
[ "St Patrick's Day", false, false, false, false, false, true],
]
],
['April',
[
[ "April Fools' Day", false, false, false, false, false, true ],
[ "Army Day", false, false, false, false, false, false ],
[ "Earth Day", false, false, false, false, false, true ],
[ "Administrative Professionals' Day", false, false, false, false, false, false ],
]],
['May',
[
[ "Nurses' Day", false, false, false, false, false, false ],
[ "National Day of Prayer", false, false, false, false, false, false ],
[ "Mothers' Day", false, false, false, false, false, true ],
[ "Armed Forces Day", false, false, false, false, false, false ],
[ "Memorial Day", true, true, true, true, false, true ],
]
],
['June',
[
[ "June Fathers' Day", false, false, false, false, false, true ],
[ "Juneteenth (Liberation of Slaves)", false, false, false, false, false, false ],
[ "Flag Day", false, true, false, true, false, false ],
]
],
['July',
[
[ "Parents' Day", false, false, false, false, false, true ],
[ "Independence Day", false, true, false, true, false, false ],
]
],
['August',
[
[ "Air Force Day", false, false, false, false, false, false ],
[ "Coast Guard Day", false, false, false, false, false, false ],
[ "Friendship Day", false, false, false, false, false, false ],
]
],
['September',
[
[ "Grandparents' Day", false, false, false, false, false, true ],
[ "Citizenship Day or Constitution Day", false, false, false, false, false, false ],
[ "Labor Day", true, true, true, true, false, true ],
]
],
['October',
[
[ "National Children's Day", false, false, false, false, false, false ],
[ "Bosses' Day", false, false, false, false, false, false ],
[ "Sweetest Day", false, false, false, false, false, false ],
[ "Mother-in-Law's Day", false, false, false, false, false, false ],
[ "Navy Day", false, false, false, false, false, false ],
[ "Columbus Day", false, true, false, true, false, false ],
[ "Halloween", false, false, false, false, false, true ],
]
],
['November',
[
[ "Marine Corps Day", false, false, false, false, false, false ],
[ "Veterans' Day", true, true, true, true, false, true ],
[ "Thanksgiving", false, true, false, true, false, false ],
]
],
['December',
[
[ 'Pearl Harbor Remembrance Day', false, false, false, false, false, false ],
[ 'Christmas', true, true, true, true, false, true ],
[ 'Kwanzaa', false, false, false, false, false, false ],
]
],
].collect do |month_name, holidays|
[
month_name,
holidays.collect do |args| TreeItem.new(args) end,
]
end
def initialize
# create window, etc
super('Card planning sheet')
vbox = Gtk::VBox.new(false, 8)
vbox.border_width = 8
add(vbox)
vbox.pack_start(Gtk::Label.new("Jonathan's Holiday Card Planning Sheet"),
false, false, 0)
sw = Gtk::ScrolledWindow.new(nil, nil)
sw.shadow_type = Gtk::SHADOW_ETCHED_IN
sw.set_policy(Gtk::POLICY_AUTOMATIC,
Gtk::POLICY_AUTOMATIC)
vbox.pack_start(sw, true, true, 0)
# create model
model = create_model
# create tree view
treeview = Gtk::TreeView.new(model)
treeview.rules_hint = true
treeview.selection.mode = Gtk::SELECTION_MULTIPLE
add_columns(treeview)
sw.add(treeview)
# expand all rows after the treeview widget has been realized
treeview.signal_connect('realize') do
treeview.expand_all
end
set_default_size(650, 400)
end
def create_model
# create tree store
model = Gtk::TreeStore.new(String,
TrueClass,
TrueClass,
TrueClass,
TrueClass,
TrueClass,
TrueClass,
TrueClass)
# add data to the tree store
TOPLEVEL.each do |month_name, holidays|
iter = model.append(nil)
iter[HOLIDAY_NAME_COLUMN] = month_name
(ALEX_COLUMN..DAVE_COLUMN).each do |index|
iter[index] = false
end
# add children
holidays.each do |holiday|
child_iter = model.append(iter)
child_iter[HOLIDAY_NAME_COLUMN] = holiday.label[0]
%w(alex havoc tim owen dave).each_with_index do |person, i|
child_iter[ALEX_COLUMN + i] = holiday[person]
end
child_iter[VISIBLE_COLUMN] = true
child_iter[WORLD_COLUMN] = holiday.world_holiday
end
end
return model
end
def add_columns(treeview)
model = treeview.model
# column for holiday names
renderer = Gtk::CellRendererText.new
renderer.xalign = 0.0
col_offset = treeview.insert_column(-1, 'Holiday',
renderer,
'text' => HOLIDAY_NAME_COLUMN)
column = treeview.get_column(col_offset - 1)
column.clickable = true
[
['Alex', true ],
['Havoc', false],
['Tim', true ],
['Owen', false],
['Dave', false],
].each_with_index do |args, i|
person, european = *args
renderer = Gtk::CellRendererToggle.new
renderer.xalign = 0.0
eval(%Q[def renderer.column; #{ALEX_COLUMN + i}; end])
renderer.signal_connect('toggled') do |cell, path|
item_toggled(cell, path, model)
end
attributes = {
'active' => (ALEX_COLUMN + i),
'visible' => VISIBLE_COLUMN,
}
if european
attributes['activatable'] = WORLD_COLUMN
end
col_offset = treeview.insert_column(-1, person, renderer, attributes)
column = treeview.get_column(col_offset - 1)
column.sizing = Gtk::TreeViewColumn::FIXED
column.fixed_width = 50
column.clickable = true
end
end
def item_toggled (cell, path_str, model)
path = Gtk::TreePath.new(path_str)
column = cell.column
# get toggled iter
iter = model.get_iter(path)
toggle_item = iter[column]
# do something with the value
toggle_item ^= 1
# set new value
iter[column] = toggle_item
end
end
end

View 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

View 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

View 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()

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View 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

View 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

Some files were not shown because too many files have changed in this diff Show More