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:
14
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/depend
Normal file
14
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/depend
Normal file
@@ -0,0 +1,14 @@
|
||||
install-so: install-headers
|
||||
install-headers:
|
||||
$(INSTALL_DATA) $(srcdir)/rbgdk.h $(RUBYARCHDIR)
|
||||
$(INSTALL_DATA) $(srcdir)/rbgdkconversions.h $(RUBYARCHDIR)
|
||||
$(INSTALL_DATA) $(srcdir)/rbgtk.h $(RUBYARCHDIR)
|
||||
$(INSTALL_DATA) $(srcdir)/rbgtkconversions.h $(RUBYARCHDIR)
|
||||
$(INSTALL_DATA) $(srcdir)/rbgtkmacros.h $(RUBYARCHDIR)
|
||||
|
||||
install: install-pc
|
||||
install-pc:
|
||||
if test -n "$(pkgconfigdir)"; then \
|
||||
$(MAKEDIRS) $(pkgconfigdir); \
|
||||
$(INSTALL_DATA) ruby-gtk2.pc $(pkgconfigdir); \
|
||||
fi
|
||||
139
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/extconf.rb
Normal file
139
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/extconf.rb
Normal file
@@ -0,0 +1,139 @@
|
||||
=begin
|
||||
extconf.rb for Ruby/GTK extention library
|
||||
=end
|
||||
|
||||
require 'pathname'
|
||||
|
||||
source_dir = Pathname(__FILE__).dirname
|
||||
base_dir = source_dir.parent.parent.expand_path
|
||||
top_dir = base_dir.parent.expand_path
|
||||
top_build_dir = Pathname(".").parent.parent.parent.expand_path
|
||||
|
||||
mkmf_gnome2_dir = top_dir + "glib2" + 'lib'
|
||||
version_suffix = ""
|
||||
unless mkmf_gnome2_dir.exist?
|
||||
if /(-\d+\.\d+\.\d+)(?:\.\d+)?\z/ =~ base_dir.basename.to_s
|
||||
version_suffix = $1
|
||||
mkmf_gnome2_dir = top_dir + "glib2#{version_suffix}" + 'lib'
|
||||
end
|
||||
end
|
||||
|
||||
$LOAD_PATH.unshift(mkmf_gnome2_dir.to_s)
|
||||
|
||||
module_name = "gtk2"
|
||||
package_id = "gtk+-2.0"
|
||||
|
||||
begin
|
||||
require 'mkmf-gnome2'
|
||||
rescue LoadError
|
||||
require 'rubygems'
|
||||
gem 'glib2'
|
||||
require 'mkmf-gnome2'
|
||||
end
|
||||
|
||||
have_func("rb_errinfo")
|
||||
|
||||
["glib2", "atk", "pango", "gdk_pixbuf2"].each do |package|
|
||||
directory = "#{package}#{version_suffix}"
|
||||
build_dir = "#{directory}/tmp/#{RUBY_PLATFORM}/#{package}/#{RUBY_VERSION}"
|
||||
add_depend_package(package, "#{directory}/ext/#{package}",
|
||||
top_dir.to_s,
|
||||
:top_build_dir => top_build_dir.to_s,
|
||||
:target_build_dir => build_dir)
|
||||
end
|
||||
|
||||
rcairo_options = {}
|
||||
rcairo_source_dir_names = ["rcairo"]
|
||||
if /mingw|cygwin|mswin/ =~ RUBY_PLATFORM
|
||||
rcairo_source_dir_names.unshift("rcairo.win32")
|
||||
end
|
||||
rcairo_source_dir_names.each do |rcairo_source_dir_name|
|
||||
rcairo_source_dir = top_dir.parent.expand_path + rcairo_source_dir_name
|
||||
if rcairo_source_dir.exist?
|
||||
rcairo_options[:rcairo_source_dir] = rcairo_source_dir.to_s
|
||||
break
|
||||
end
|
||||
end
|
||||
check_cairo(rcairo_options)
|
||||
|
||||
setup_win32(module_name, base_dir)
|
||||
|
||||
unless required_pkg_config_package(package_id,
|
||||
:debian => "libgtk2.0-dev",
|
||||
:redhat => "gtk2-devel",
|
||||
:homebrew => "gtk+",
|
||||
:macports => "gtk2")
|
||||
exit(false)
|
||||
end
|
||||
|
||||
have_header("st.h")
|
||||
have_header("ruby/st.h")
|
||||
|
||||
STDOUT.print("checking for target... ")
|
||||
STDOUT.flush
|
||||
target = PKGConfig.variable(package_id, "target")
|
||||
$defs << "-DRUBY_GTK2_TARGET=\\\"#{target}\\\""
|
||||
STDOUT.print(target, "\n")
|
||||
|
||||
gdk_include_path = nil
|
||||
include_paths = $CFLAGS.gsub(/-D\w+/, '').split(/-I/) + ['/usr/include']
|
||||
include_paths.each do |path|
|
||||
path.strip!
|
||||
|
||||
if FileTest.exist?("#{path}/gdk/gdkkeysyms.h")
|
||||
gdk_include_path = Pathname("#{path}/gdk")
|
||||
break
|
||||
end
|
||||
end
|
||||
raise "can't find gdkkeysyms.h" if gdk_include_path.nil?
|
||||
|
||||
gtk_header = "gtk/gtk.h"
|
||||
have_func('gtk_plug_get_type', gtk_header)
|
||||
have_func('gtk_socket_get_type', gtk_header)
|
||||
have_func('pango_render_part_get_type', gtk_header)
|
||||
have_header('gtk/gtkfilesystem.h') do |src|
|
||||
"#define GTK_FILE_SYSTEM_ENABLE_UNSUPPORTED\n#{src}"
|
||||
end
|
||||
|
||||
xlib_header = "X11/Xlib.h"
|
||||
if target == "x11" and have_header('X11/Xlib.h') and have_library("X11")
|
||||
have_func("XReadBitmapFileData", xlib_header)
|
||||
have_func("XGetErrorText", xlib_header)
|
||||
end
|
||||
|
||||
if target != "win32" and PKGConfig.have_package('gtk+-unix-print-2.0')
|
||||
$defs.push("-DHAVE_GTK_UNIX_PRINT")
|
||||
end
|
||||
|
||||
create_pkg_config_file("Ruby/GTK2", package_id, ruby_gnome2_version)
|
||||
|
||||
rbgdkkeysyms_h_path = Pathname("rbgdkkeysyms.h")
|
||||
gdkkeysyms_h_paths = []
|
||||
gdkkeysyms_h_paths << gdk_include_path + "gdkkeysyms.h"
|
||||
gdkkeysyms_h_paths << gdk_include_path + "gdkkeysyms-compat.h"
|
||||
rbgdkkeysyms_h_path.open("w") do |rbgdkkeysyms_h|
|
||||
gdkkeysyms_h_paths.each do |path|
|
||||
next unless path.exist?
|
||||
path.each_line do |line|
|
||||
if /^#define\s+(GDK_\w+)\s+\d+/ =~ line
|
||||
define_line = "rb_define_const(mGdkKeyval, \"#{$1}\", INT2FIX(#{$1}));"
|
||||
rbgdkkeysyms_h.puts(define_line)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
add_distcleanfile("rbgdkkeysyms.h")
|
||||
|
||||
ensure_objs
|
||||
|
||||
$defs << "-DRUBY_GTK2_COMPILATION"
|
||||
create_makefile(module_name)
|
||||
|
||||
pkg_config_dir = with_config("pkg-config-dir")
|
||||
if pkg_config_dir.is_a?(String)
|
||||
File.open("Makefile", "ab") do |makefile|
|
||||
makefile.puts
|
||||
makefile.puts("pkgconfigdir=#{pkg_config_dir}")
|
||||
end
|
||||
end
|
||||
302
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/global.h
Normal file
302
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/global.h
Normal file
@@ -0,0 +1,302 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef _RBGTK_GLOBAL_H
|
||||
#define _RBGTK_GLOBAL_H
|
||||
|
||||
#include "rbgtk.h"
|
||||
#ifdef HAVE_RUBY_ST_H
|
||||
# include <ruby/st.h>
|
||||
#else
|
||||
# include <st.h>
|
||||
#endif
|
||||
|
||||
#undef RG_DEF_METHOD
|
||||
#define RG_DEF_METHOD(method, argc) \
|
||||
rb_define_method(RG_TARGET_NAMESPACE, #method, rg_ ## method, argc)
|
||||
#undef RG_DEF_SMETHOD
|
||||
#define RG_DEF_SMETHOD(method, argc) \
|
||||
rb_define_singleton_method(RG_TARGET_NAMESPACE, #method, rg_s_ ## method, argc)
|
||||
|
||||
#ifndef HAVE_RB_ERRINFO
|
||||
# define rb_errinfo() (ruby_errinfo)
|
||||
#endif
|
||||
|
||||
#ifndef G_VALUE_INIT
|
||||
# define G_VALUE_INIT { 0, { { 0 } } }
|
||||
#endif
|
||||
|
||||
#if GTK_CHECK_VERSION(2,8,0) && defined(HAVE_RB_CAIRO_H)
|
||||
# define CAIRO_AVAILABLE 1
|
||||
#else
|
||||
# define CAIRO_AVAILABLE 0
|
||||
#endif
|
||||
|
||||
extern ID id_relative_callbacks;
|
||||
extern ID id_call;
|
||||
extern VALUE treeiter_set_value_table;
|
||||
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk(void);
|
||||
G_GNUC_INTERNAL void Init_gtk_gtk(void);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_atom(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_cairo(void);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_color(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_colormap(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_const(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_cursor(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_device(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_display(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_display_manager(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_dragcontext(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_event(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_geometry(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_image(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_input(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_keymap(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_keyval(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_pango(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_pangorenderer(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_pixbuf(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_pixmap(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_property(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_rectangle(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_region(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_rgb(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_screen(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_selection(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_threads(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_timecoord(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_visual(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_window(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_windowattr(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_x11(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_aboutdialog(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_accelerator(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_accel_group(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_accel_group_entry(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_accel_key(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_accel_label(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_accel_map(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_accessible(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_action(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_actiongroup(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_adjustment(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_alignment(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_allocation(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_arrow(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_aspect_frame(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_assistant(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_button_box(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_bin(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_bindings(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_border(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_box(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_buildable(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_builder(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_button(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_calendar(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_celleditable(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_celllayout(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_cellrenderer(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_cellrendereraccel(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_cellrenderercombo(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_cellrendererpixbuf(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_cellrendererprogress(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_cellrendererspin(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_cellrendererspinner(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_cellrenderertext(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_cellrenderertoggle(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_cellview(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_check_button(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_check_menu_item(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_clipboard(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_colorbutton(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_color_selection(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_color_selection_dialog(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_combo(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_combobox(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_comboboxentry(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_const(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_container(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_curve(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_dialog(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_drag(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_drawing_area(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_editable(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_entry(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_entry_completion(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_eventbox(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_expander(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_file_chooser(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_filesystemerror(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_filechooserbutton(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_file_chooser_dialog(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_file_chooser_widget(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_file_filter(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_file_selection(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_fixed(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_fontbutton(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_font_selection(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_font_selection_dialog(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_frame(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gamma_curve(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_draw(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_gdk_gc(VALUE mGdk);
|
||||
G_GNUC_INTERNAL void Init_gtk_handle_box(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_hbutton_box(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_hbox(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_hpaned(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_hruler(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_hscale(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_hscrollbar(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_hseparator(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_icon_factory(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_iconinfo(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_icon_set(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_icon_size(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_icon_source(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_icon_theme(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_iconview(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_image(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_image_menu_item(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_imcontext(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_imcontext_simple(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_im_multicontext(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_infobar(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_input_dialog(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_invisible(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_item(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_itemfactory(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_label(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_layout(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_link_button(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_list_store(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_menu(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_menu_bar(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_menu_item(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_menu_shell(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_menutoolbutton(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_message_dialog(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_misc(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_notebook(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_object(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_option_menu(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_page_setup(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_page_setup_unix_dialog(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_paned(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_paper_size(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_plug(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_print_context(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_printer(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_print_job(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_print_operation(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_print_operation_preview(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_print_settings(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_print_unix_dialog(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_progress(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_progress_bar(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_radio_action(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_radio_button(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_radio_menu_item(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_radiotoolbutton(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_range(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_rc(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_rcstyle(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_recentaction(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_recent_chooser(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_recent_chooser_dialog(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_recent_chooser_menu(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_recent_chooser_widget(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_recent_data(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_recent_filter(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_recent_filter_info(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_recent_info(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_recent_manager(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_ruler(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_scale(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_scalebutton(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_scrollbar(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_scrolled_window(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_selection(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_selectiondata(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_separator(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_separator_menu_item(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_separatortoolitem(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_settings(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_size_group(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_socket(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_spin_button(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_spinner(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_statusbar(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_status_icon(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_stock(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_style(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_table(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_target_list(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_tearoff_menu_item(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_text_appearance(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_text_attributes(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_textbuffer(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_textchild(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_textiter(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_textmark(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_texttag(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_text_tag_table(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_textview(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_toggle_action(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_toggle_button(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_toggletoolbutton(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_toolbar(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_toolbutton(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_toolitem(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_tooltip(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_tooltips(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_treedragdest(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_treedragsource(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_treeiter(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_treemodel(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_treemodelfilter(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_tmodelsort(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_treepath(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_treerowreference(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_treeselection(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_treesortable(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_tree_store(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_treeview(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_treeviewcolumn(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_uimanager(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_vbutton_box(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_vbox(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_viewport(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_volumebutton(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_vpaned(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_vruler(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_vscale(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_vscrollbar(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_vseparator(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_widget(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_window(VALUE mGtk);
|
||||
G_GNUC_INTERNAL void Init_gtk_windowgroup(VALUE mGtk);
|
||||
|
||||
#endif /* _RBGTK_GLOBAL_H */
|
||||
29
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/gtk2.def
Normal file
29
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/gtk2.def
Normal file
@@ -0,0 +1,29 @@
|
||||
EXPORTS
|
||||
Init_gtk2
|
||||
mGdk DATA
|
||||
rb_cGdkColor DATA
|
||||
mGtk DATA
|
||||
exec_callback
|
||||
rbgdk_rval2gdkpoints
|
||||
rbgdk_rval2gdkatoms
|
||||
rbgdk_rval2gdkpixbufglist
|
||||
gdk_atom_get_type
|
||||
gdk_geometry_get_type
|
||||
gdk_region_get_type
|
||||
gdk_windowattr_get_type
|
||||
get_gdkatom
|
||||
get_gdkevent
|
||||
gtk_accel_group_entry_get_type
|
||||
gtk_accel_key_get_type
|
||||
gtk_target_list_get_type
|
||||
gtk_bindingset_get_type
|
||||
make_gdkevent
|
||||
rbgtk_atom2selectiondata
|
||||
rbgtk_atom2selectiondata_free
|
||||
rbgtk_rval2gtktargetentries
|
||||
rbgtk_rval2gtktargetentries_accept_nil
|
||||
rbgtk_get_target_entry
|
||||
rbgtk_initialize_gtkobject
|
||||
rbgtk_register_treeiter_set_value_func
|
||||
gtk_text_appearance_get_type
|
||||
rbgtk_dialog_add_buttons_internal
|
||||
284
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/init.c
Normal file
284
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/init.c
Normal file
@@ -0,0 +1,284 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002-2006 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2001 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
#include "gmodule.h"
|
||||
|
||||
VALUE treeiter_set_value_table;
|
||||
|
||||
extern void Init_gtk2(void);
|
||||
|
||||
void
|
||||
Init_gtk2(void)
|
||||
{
|
||||
/*
|
||||
* For Gtk::TreeModel, Gtk::TreeIter.
|
||||
* They should be initialized on this timing.
|
||||
*/
|
||||
treeiter_set_value_table = rb_hash_new();
|
||||
rb_global_variable(&treeiter_set_value_table);
|
||||
|
||||
Init_gtk_gdk();
|
||||
Init_gtk_gtk();
|
||||
|
||||
Init_gtk_gdk_atom(mGdk);
|
||||
Init_gtk_gdk_cairo();
|
||||
Init_gtk_gdk_color(mGdk);
|
||||
Init_gtk_gdk_colormap(mGdk);
|
||||
Init_gtk_gdk_const(mGdk);
|
||||
Init_gtk_gdk_cursor(mGdk);
|
||||
Init_gtk_gdk_device(mGdk);
|
||||
Init_gtk_gdk_display(mGdk);
|
||||
Init_gtk_gdk_display_manager(mGdk);
|
||||
Init_gtk_gdk_dragcontext(mGdk);
|
||||
Init_gtk_gdk_event(mGdk);
|
||||
Init_gtk_gdk_geometry(mGdk);
|
||||
Init_gtk_gdk_image(mGdk);
|
||||
Init_gtk_gdk_input(mGdk);
|
||||
Init_gtk_gdk_keymap(mGdk);
|
||||
Init_gtk_gdk_keyval(mGdk);
|
||||
Init_gtk_gdk_pango(mGdk);
|
||||
Init_gtk_gdk_pangorenderer(mGdk);
|
||||
Init_gtk_gdk_pixbuf(mGdk);
|
||||
Init_gtk_gdk_pixmap(mGdk);
|
||||
Init_gtk_gdk_property(mGdk);
|
||||
Init_gtk_gdk_rectangle(mGdk);
|
||||
Init_gtk_gdk_region(mGdk);
|
||||
Init_gtk_gdk_rgb(mGdk);
|
||||
Init_gtk_gdk_screen(mGdk);
|
||||
Init_gtk_gdk_selection(mGdk);
|
||||
Init_gtk_gdk_threads(mGdk);
|
||||
Init_gtk_gdk_timecoord(mGdk);
|
||||
Init_gtk_gdk_visual(mGdk);
|
||||
Init_gtk_gdk_window(mGdk);
|
||||
Init_gtk_gdk_windowattr(mGdk);
|
||||
Init_gtk_gdk_x11(mGdk);
|
||||
Init_gtk_aboutdialog(mGtk);
|
||||
Init_gtk_accelerator(mGtk);
|
||||
Init_gtk_accel_group(mGtk);
|
||||
Init_gtk_accel_group_entry(mGtk);
|
||||
Init_gtk_accel_key(mGtk);
|
||||
Init_gtk_accel_label(mGtk);
|
||||
Init_gtk_accel_map(mGtk);
|
||||
Init_gtk_accessible(mGtk);
|
||||
Init_gtk_action(mGtk);
|
||||
Init_gtk_actiongroup(mGtk);
|
||||
Init_gtk_adjustment(mGtk);
|
||||
Init_gtk_alignment(mGtk);
|
||||
Init_gtk_allocation(mGtk);
|
||||
Init_gtk_arrow(mGtk);
|
||||
Init_gtk_aspect_frame(mGtk);
|
||||
Init_gtk_assistant(mGtk);
|
||||
Init_gtk_button_box(mGtk);
|
||||
Init_gtk_bin(mGtk);
|
||||
Init_gtk_bindings(mGtk);
|
||||
Init_gtk_border(mGtk);
|
||||
Init_gtk_box(mGtk);
|
||||
Init_gtk_buildable(mGtk);
|
||||
Init_gtk_builder(mGtk);
|
||||
Init_gtk_button(mGtk);
|
||||
Init_gtk_calendar(mGtk);
|
||||
Init_gtk_celleditable(mGtk);
|
||||
Init_gtk_celllayout(mGtk);
|
||||
Init_gtk_cellrenderer(mGtk);
|
||||
Init_gtk_cellrendereraccel(mGtk);
|
||||
Init_gtk_cellrenderercombo(mGtk);
|
||||
Init_gtk_cellrendererpixbuf(mGtk);
|
||||
Init_gtk_cellrendererprogress(mGtk);
|
||||
Init_gtk_cellrendererspin(mGtk);
|
||||
Init_gtk_cellrendererspinner(mGtk);
|
||||
Init_gtk_cellrenderertext(mGtk);
|
||||
Init_gtk_cellrenderertoggle(mGtk);
|
||||
Init_gtk_cellview(mGtk);
|
||||
Init_gtk_check_button(mGtk);
|
||||
Init_gtk_check_menu_item(mGtk);
|
||||
Init_gtk_clipboard(mGtk);
|
||||
Init_gtk_colorbutton(mGtk);
|
||||
Init_gtk_color_selection(mGtk);
|
||||
Init_gtk_color_selection_dialog(mGtk);
|
||||
Init_gtk_combo(mGtk);
|
||||
Init_gtk_combobox(mGtk);
|
||||
Init_gtk_comboboxentry(mGtk);
|
||||
Init_gtk_const(mGtk);
|
||||
Init_gtk_container(mGtk);
|
||||
Init_gtk_curve(mGtk);
|
||||
Init_gtk_dialog(mGtk);
|
||||
Init_gtk_drag(mGtk);
|
||||
Init_gtk_drawing_area(mGtk);
|
||||
Init_gtk_editable(mGtk);
|
||||
Init_gtk_entry(mGtk);
|
||||
Init_gtk_entry_completion(mGtk);
|
||||
Init_gtk_eventbox(mGtk);
|
||||
Init_gtk_expander(mGtk);
|
||||
Init_gtk_file_chooser(mGtk);
|
||||
Init_gtk_filesystemerror(mGtk);
|
||||
Init_gtk_filechooserbutton(mGtk);
|
||||
Init_gtk_file_chooser_dialog(mGtk);
|
||||
Init_gtk_file_chooser_widget(mGtk);
|
||||
Init_gtk_file_filter(mGtk);
|
||||
Init_gtk_file_selection(mGtk);
|
||||
Init_gtk_fixed(mGtk);
|
||||
Init_gtk_fontbutton(mGtk);
|
||||
Init_gtk_font_selection(mGtk);
|
||||
Init_gtk_font_selection_dialog(mGtk);
|
||||
Init_gtk_frame(mGtk);
|
||||
Init_gtk_gamma_curve(mGtk);
|
||||
Init_gtk_gdk_draw(mGdk);
|
||||
Init_gtk_gdk_gc(mGdk);
|
||||
Init_gtk_handle_box(mGtk);
|
||||
Init_gtk_hbutton_box(mGtk);
|
||||
Init_gtk_hbox(mGtk);
|
||||
Init_gtk_hpaned(mGtk);
|
||||
Init_gtk_hruler(mGtk);
|
||||
Init_gtk_hscale(mGtk);
|
||||
Init_gtk_hscrollbar(mGtk);
|
||||
Init_gtk_hseparator(mGtk);
|
||||
Init_gtk_icon_factory(mGtk);
|
||||
Init_gtk_iconinfo(mGtk);
|
||||
Init_gtk_icon_set(mGtk);
|
||||
Init_gtk_icon_size(mGtk);
|
||||
Init_gtk_icon_source(mGtk);
|
||||
Init_gtk_icon_theme(mGtk);
|
||||
Init_gtk_iconview(mGtk);
|
||||
Init_gtk_image(mGtk);
|
||||
Init_gtk_image_menu_item(mGtk);
|
||||
Init_gtk_imcontext(mGtk);
|
||||
Init_gtk_imcontext_simple(mGtk);
|
||||
Init_gtk_im_multicontext(mGtk);
|
||||
Init_gtk_infobar(mGtk);
|
||||
Init_gtk_input_dialog(mGtk);
|
||||
Init_gtk_invisible(mGtk);
|
||||
Init_gtk_item(mGtk);
|
||||
Init_gtk_itemfactory(mGtk);
|
||||
Init_gtk_label(mGtk);
|
||||
Init_gtk_layout(mGtk);
|
||||
Init_gtk_link_button(mGtk);
|
||||
Init_gtk_list_store(mGtk);
|
||||
Init_gtk_menu(mGtk);
|
||||
Init_gtk_menu_bar(mGtk);
|
||||
Init_gtk_menu_item(mGtk);
|
||||
Init_gtk_menu_shell(mGtk);
|
||||
Init_gtk_menutoolbutton(mGtk);
|
||||
Init_gtk_message_dialog(mGtk);
|
||||
Init_gtk_misc(mGtk);
|
||||
Init_gtk_notebook(mGtk);
|
||||
Init_gtk_object(mGtk);
|
||||
Init_gtk_option_menu(mGtk);
|
||||
Init_gtk_page_setup(mGtk);
|
||||
Init_gtk_page_setup_unix_dialog(mGtk);
|
||||
Init_gtk_paned(mGtk);
|
||||
Init_gtk_paper_size(mGtk);
|
||||
Init_gtk_plug(mGtk);
|
||||
Init_gtk_print_context(mGtk);
|
||||
Init_gtk_printer(mGtk);
|
||||
Init_gtk_print_job(mGtk);
|
||||
Init_gtk_print_operation(mGtk);
|
||||
Init_gtk_print_operation_preview(mGtk);
|
||||
Init_gtk_print_settings(mGtk);
|
||||
Init_gtk_print_unix_dialog(mGtk);
|
||||
Init_gtk_progress(mGtk);
|
||||
Init_gtk_progress_bar(mGtk);
|
||||
Init_gtk_radio_action(mGtk);
|
||||
Init_gtk_radio_button(mGtk);
|
||||
Init_gtk_radio_menu_item(mGtk);
|
||||
Init_gtk_radiotoolbutton(mGtk);
|
||||
Init_gtk_range(mGtk);
|
||||
Init_gtk_rc(mGtk);
|
||||
Init_gtk_rcstyle(mGtk);
|
||||
Init_gtk_recentaction(mGtk);
|
||||
Init_gtk_recent_chooser(mGtk);
|
||||
Init_gtk_recent_chooser_dialog(mGtk);
|
||||
Init_gtk_recent_chooser_menu(mGtk);
|
||||
Init_gtk_recent_chooser_widget(mGtk);
|
||||
Init_gtk_recent_data(mGtk);
|
||||
Init_gtk_recent_filter(mGtk);
|
||||
Init_gtk_recent_filter_info(mGtk);
|
||||
Init_gtk_recent_info(mGtk);
|
||||
Init_gtk_recent_manager(mGtk);
|
||||
Init_gtk_ruler(mGtk);
|
||||
Init_gtk_scale(mGtk);
|
||||
Init_gtk_scalebutton(mGtk);
|
||||
Init_gtk_scrollbar(mGtk);
|
||||
Init_gtk_scrolled_window(mGtk);
|
||||
Init_gtk_selection(mGtk);
|
||||
Init_gtk_selectiondata(mGtk);
|
||||
Init_gtk_separator(mGtk);
|
||||
Init_gtk_separator_menu_item(mGtk);
|
||||
Init_gtk_separatortoolitem(mGtk);
|
||||
Init_gtk_settings(mGtk);
|
||||
Init_gtk_size_group(mGtk);
|
||||
Init_gtk_socket(mGtk);
|
||||
Init_gtk_spin_button(mGtk);
|
||||
Init_gtk_spinner(mGtk);
|
||||
Init_gtk_statusbar(mGtk);
|
||||
Init_gtk_status_icon(mGtk);
|
||||
Init_gtk_stock(mGtk);
|
||||
Init_gtk_style(mGtk);
|
||||
Init_gtk_table(mGtk);
|
||||
Init_gtk_target_list(mGtk);
|
||||
Init_gtk_tearoff_menu_item(mGtk);
|
||||
Init_gtk_text_appearance(mGtk);
|
||||
Init_gtk_text_attributes(mGtk);
|
||||
Init_gtk_textbuffer(mGtk);
|
||||
Init_gtk_textchild(mGtk);
|
||||
Init_gtk_textiter(mGtk);
|
||||
Init_gtk_textmark(mGtk);
|
||||
Init_gtk_texttag(mGtk);
|
||||
Init_gtk_text_tag_table(mGtk);
|
||||
Init_gtk_textview(mGtk);
|
||||
Init_gtk_toggle_action(mGtk);
|
||||
Init_gtk_toggle_button(mGtk);
|
||||
Init_gtk_toggletoolbutton(mGtk);
|
||||
Init_gtk_toolbar(mGtk);
|
||||
Init_gtk_toolbutton(mGtk);
|
||||
Init_gtk_toolitem(mGtk);
|
||||
Init_gtk_tooltip(mGtk);
|
||||
Init_gtk_tooltips(mGtk);
|
||||
Init_gtk_treedragdest(mGtk);
|
||||
Init_gtk_treedragsource(mGtk);
|
||||
Init_gtk_treeiter(mGtk);
|
||||
Init_gtk_treemodel(mGtk);
|
||||
Init_gtk_treemodelfilter(mGtk);
|
||||
Init_gtk_tmodelsort(mGtk);
|
||||
Init_gtk_treepath(mGtk);
|
||||
Init_gtk_treerowreference(mGtk);
|
||||
Init_gtk_treeselection(mGtk);
|
||||
Init_gtk_treesortable(mGtk);
|
||||
Init_gtk_tree_store(mGtk);
|
||||
Init_gtk_treeview(mGtk);
|
||||
Init_gtk_treeviewcolumn(mGtk);
|
||||
Init_gtk_uimanager(mGtk);
|
||||
Init_gtk_vbutton_box(mGtk);
|
||||
Init_gtk_vbox(mGtk);
|
||||
Init_gtk_viewport(mGtk);
|
||||
Init_gtk_volumebutton(mGtk);
|
||||
Init_gtk_vpaned(mGtk);
|
||||
Init_gtk_vruler(mGtk);
|
||||
Init_gtk_vscale(mGtk);
|
||||
Init_gtk_vscrollbar(mGtk);
|
||||
Init_gtk_vseparator(mGtk);
|
||||
Init_gtk_widget(mGtk);
|
||||
Init_gtk_window(mGtk);
|
||||
Init_gtk_windowgroup(mGtk);
|
||||
}
|
||||
520
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdk.c
Normal file
520
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdk.c
Normal file
@@ -0,0 +1,520 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE mGdk
|
||||
|
||||
VALUE RG_TARGET_NAMESPACE;
|
||||
|
||||
/* We don't need them.
|
||||
void gdk_init (gint *argc,
|
||||
gchar ***argv);
|
||||
gboolean gdk_init_check (gint *argc,
|
||||
gchar ***argv);
|
||||
void gdk_parse_args (gint *argc,
|
||||
gchar ***argv);
|
||||
*/
|
||||
|
||||
struct rbgdk_rval2gdkpoints_args {
|
||||
VALUE ary;
|
||||
long n;
|
||||
GdkPoint *result;
|
||||
};
|
||||
|
||||
static VALUE
|
||||
rbgdk_rval2gdkpoints_body(VALUE value)
|
||||
{
|
||||
long i;
|
||||
struct rbgdk_rval2gdkpoints_args *args = (struct rbgdk_rval2gdkpoints_args *)value;
|
||||
|
||||
for (i = 0; i < args->n; i++) {
|
||||
VALUE points = rb_ary_to_ary(RARRAY_PTR(args->ary)[i]);
|
||||
|
||||
if (RARRAY_LEN(points) != 2)
|
||||
rb_raise(rb_eArgError, "point %ld should be array of size 2", i);
|
||||
|
||||
args->result[i].x = NUM2INT(RARRAY_PTR(points)[0]);
|
||||
args->result[i].y = NUM2INT(RARRAY_PTR(points)[1]);
|
||||
}
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static G_GNUC_NORETURN VALUE
|
||||
rbgdk_rval2gdkpoints_rescue(VALUE value)
|
||||
{
|
||||
g_free(((struct rbgdk_rval2gdkpoints_args *)value)->result);
|
||||
|
||||
rb_exc_raise(rb_errinfo());
|
||||
}
|
||||
|
||||
GdkPoint *
|
||||
rbgdk_rval2gdkpoints(VALUE value, long *n)
|
||||
{
|
||||
struct rbgdk_rval2gdkpoints_args args;
|
||||
|
||||
args.ary = rb_ary_to_ary(value);
|
||||
args.n = RARRAY_LEN(args.ary);
|
||||
args.result = g_new(GdkPoint, args.n + 1);
|
||||
|
||||
rb_rescue(rbgdk_rval2gdkpoints_body, (VALUE)&args,
|
||||
rbgdk_rval2gdkpoints_rescue, (VALUE)&args);
|
||||
|
||||
*n = args.n;
|
||||
|
||||
return args.result;
|
||||
}
|
||||
|
||||
struct rbgdk_rval2gdkatoms_args {
|
||||
VALUE ary;
|
||||
long n;
|
||||
GdkAtom *result;
|
||||
};
|
||||
|
||||
static VALUE
|
||||
rbgdk_rval2gdkatoms_body(VALUE value)
|
||||
{
|
||||
long i;
|
||||
struct rbgdk_rval2gdkatoms_args *args = (struct rbgdk_rval2gdkatoms_args *)value;
|
||||
|
||||
for (i = 0; i < args->n; i++)
|
||||
args->result[i] = RVAL2ATOM(RARRAY_PTR(args->ary)[i]);
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static G_GNUC_NORETURN VALUE
|
||||
rbgdk_rval2gdkatoms_rescue(VALUE value)
|
||||
{
|
||||
g_free(((struct rbgdk_rval2gdkatoms_args *)value)->result);
|
||||
|
||||
rb_exc_raise(rb_errinfo());
|
||||
}
|
||||
|
||||
GdkAtom *
|
||||
rbgdk_rval2gdkatoms(VALUE value, long *n)
|
||||
{
|
||||
struct rbgdk_rval2gdkatoms_args args;
|
||||
|
||||
args.ary = rb_ary_to_ary(value);
|
||||
args.n = RARRAY_LEN(args.ary);
|
||||
args.result = g_new(GdkAtom, args.n + 1);
|
||||
|
||||
rb_rescue(rbgdk_rval2gdkatoms_body, (VALUE)&args,
|
||||
rbgdk_rval2gdkatoms_rescue, (VALUE)&args);
|
||||
|
||||
*n = args.n;
|
||||
|
||||
return args.result;
|
||||
}
|
||||
|
||||
struct rval2gdkpixbufglist_args {
|
||||
VALUE ary;
|
||||
long n;
|
||||
GList *result;
|
||||
};
|
||||
|
||||
static VALUE
|
||||
rbgdk_rval2gdkpixbufglist_body(VALUE value)
|
||||
{
|
||||
long i;
|
||||
struct rval2gdkpixbufglist_args *args = (struct rval2gdkpixbufglist_args *)value;
|
||||
|
||||
for (i = 0; i < args->n; i++)
|
||||
args->result = g_list_append(args->result, GDK_PIXBUF(RVAL2GOBJ(RARRAY_PTR(args->ary)[i])));
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static G_GNUC_NORETURN VALUE
|
||||
rbgdk_rval2gdkpixbufglist_rescue(VALUE value)
|
||||
{
|
||||
g_list_free(((struct rval2gdkpixbufglist_args *)value)->result);
|
||||
|
||||
rb_exc_raise(rb_errinfo());
|
||||
}
|
||||
|
||||
GList *
|
||||
rbgdk_rval2gdkpixbufglist(VALUE value)
|
||||
{
|
||||
struct rval2gdkpixbufglist_args args;
|
||||
|
||||
args.ary = rb_ary_to_ary(value);
|
||||
args.n = RARRAY_LEN(args.ary);
|
||||
args.result = NULL;
|
||||
|
||||
rb_rescue(rbgdk_rval2gdkpixbufglist_body, (VALUE)&args,
|
||||
rbgdk_rval2gdkpixbufglist_rescue, (VALUE)&args);
|
||||
|
||||
return args.result;
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
static VALUE
|
||||
rg_m_display_arg_name(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return CSTR2RVAL(gdk_get_display_arg_name());
|
||||
}
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
rg_m_set_locale(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return CSTR2RVAL(gdk_set_locale());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_set_sm_client_id(VALUE self, VALUE id)
|
||||
{
|
||||
gdk_set_sm_client_id(NIL_P(id) ? NULL : RVAL2CSTR(id));
|
||||
return self;
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
static VALUE
|
||||
rg_m_notify_startup_complete(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE startup_id;
|
||||
|
||||
rb_scan_args(argc, argv, "01", &startup_id);
|
||||
|
||||
if (NIL_P(startup_id)) {
|
||||
gdk_notify_startup_complete();
|
||||
} else {
|
||||
#if GTK_CHECK_VERSION(2, 12, 0)
|
||||
gdk_notify_startup_complete_with_id(RVAL2CSTR(startup_id));
|
||||
#else
|
||||
rb_raise(rb_eNotImpError,
|
||||
"GTK+ >= 2.12 is required to use "
|
||||
"Gdk.notify_startup_complete with startup ID.");
|
||||
#endif
|
||||
}
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
rg_m_program_class(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return CSTR2RVAL(gdk_get_program_class());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_set_program_class(VALUE self, VALUE program_class)
|
||||
{
|
||||
gdk_set_program_class(RVAL2CSTR(program_class));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_display(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return CSTR2RVAL(gdk_get_display());
|
||||
}
|
||||
|
||||
#ifdef HAVE_X11_XLIB_H
|
||||
#ifdef HAVE_XGETERRORTEXT
|
||||
#include <X11/Xlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
static VALUE rb_x_error;
|
||||
static VALUE rb_x_io_error;
|
||||
|
||||
static int
|
||||
rbgdk_x_error(Display *display, XErrorEvent *error)
|
||||
{
|
||||
gchar buf[64];
|
||||
|
||||
XGetErrorText(display, error->error_code, buf, 63);
|
||||
|
||||
rb_funcall((VALUE)rb_x_error, id_call, 4, INT2NUM(error->serial),
|
||||
INT2NUM(error->error_code), INT2NUM(error->request_code),
|
||||
INT2NUM(error->minor_code));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
rbgdk_x_io_error(Display *display)
|
||||
{
|
||||
int errno_saved = errno;
|
||||
const gchar* disp;
|
||||
const gchar* error;
|
||||
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
disp = display ? DisplayString(display) : gdk_get_display_arg_name();
|
||||
#else
|
||||
disp = DisplayString(display);
|
||||
#endif
|
||||
if (! disp)
|
||||
disp = "(none)";
|
||||
|
||||
error = g_strerror(errno_saved);
|
||||
|
||||
rb_funcall((VALUE)rb_x_io_error, id_call, 3, CSTR2RVAL(disp),
|
||||
INT2NUM(errno), CSTR2RVAL(error));
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
rg_m_set_x_error_handler(VALUE self)
|
||||
{
|
||||
#ifdef HAVE_XGETERRORTEXT
|
||||
rb_x_error = rb_block_proc();
|
||||
G_RELATIVE(self, rb_x_error);
|
||||
XSetErrorHandler(rbgdk_x_error);
|
||||
#else
|
||||
rb_warn("Not supported on this environment.");
|
||||
#endif
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_set_x_io_error_handler(VALUE self)
|
||||
{
|
||||
#ifdef HAVE_XGETERRORTEXT
|
||||
rb_x_io_error = rb_block_proc();
|
||||
G_RELATIVE(self, rb_x_io_error);
|
||||
XSetIOErrorHandler(rbgdk_x_io_error);
|
||||
#else
|
||||
rb_warn("Not supported on this environment.");
|
||||
#endif
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_flush(VALUE self)
|
||||
{
|
||||
gdk_flush();
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_screen_width(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return INT2NUM(gdk_screen_width());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_screen_width_mm(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return INT2NUM(gdk_screen_width_mm());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_screen_height(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return INT2NUM(gdk_screen_height());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_screen_height_mm(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return INT2NUM(gdk_screen_height_mm());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_pointer_grab(G_GNUC_UNUSED VALUE self, VALUE win, VALUE owner_events, VALUE event_mask, VALUE confine_to, VALUE cursor, VALUE time)
|
||||
{
|
||||
return GENUM2RVAL(gdk_pointer_grab(GDK_WINDOW(RVAL2GOBJ(win)),
|
||||
RVAL2CBOOL(owner_events),
|
||||
RVAL2GFLAGS(event_mask, GDK_TYPE_EVENT_MASK),
|
||||
NIL_P(confine_to)?NULL:GDK_WINDOW(RVAL2GOBJ(confine_to)),
|
||||
NIL_P(cursor)?NULL:(GdkCursor*)RVAL2BOXED(cursor, GDK_TYPE_CURSOR),
|
||||
NUM2INT(time)), GDK_TYPE_GRAB_STATUS);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_pointer_ungrab(VALUE self, VALUE time)
|
||||
{
|
||||
gdk_pointer_ungrab(NUM2INT(time));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_keyboard_grab(G_GNUC_UNUSED VALUE self, VALUE win, VALUE owner_events, VALUE time)
|
||||
{
|
||||
return GENUM2RVAL(gdk_keyboard_grab(GDK_WINDOW(RVAL2GOBJ(win)),
|
||||
RVAL2CBOOL(owner_events), NUM2INT(time)),
|
||||
GDK_TYPE_GRAB_STATUS);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_keyboard_ungrab(VALUE self, VALUE time)
|
||||
{
|
||||
gdk_keyboard_ungrab(NUM2INT(time));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_pointer_is_grabbed_p(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return CBOOL2RVAL(gdk_pointer_is_grabbed());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_set_double_click_time(VALUE self, VALUE msec)
|
||||
{
|
||||
gdk_set_double_click_time(NUM2UINT(msec));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_beep(VALUE self)
|
||||
{
|
||||
gdk_beep();
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_error_trap_push(VALUE self)
|
||||
{
|
||||
gdk_error_trap_push();
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_error_trap_pop(VALUE self)
|
||||
{
|
||||
gdk_error_trap_pop();
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_windowing_x11_p(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
return Qtrue;
|
||||
#else
|
||||
return Qfalse;
|
||||
#endif
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_windowing_win32_p(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
#ifdef GDK_WINDOWING_WIN32
|
||||
return Qtrue;
|
||||
#else
|
||||
return Qfalse;
|
||||
#endif
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_windowing_fb_p(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
#ifdef GDK_WINDOWING_FB
|
||||
return Qtrue;
|
||||
#else
|
||||
return Qfalse;
|
||||
#endif
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_windowing_quartz_p(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
return Qtrue;
|
||||
#else
|
||||
return Qfalse;
|
||||
#endif
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_windowing_directfb_p(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
#ifdef GDK_WINDOWING_DIRECTFB
|
||||
return Qtrue;
|
||||
#else
|
||||
return Qfalse;
|
||||
#endif
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_target(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return CSTR2RVAL(RUBY_GTK2_TARGET);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_cairo_available_p(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
#if CAIRO_AVAILABLE
|
||||
return Qtrue;
|
||||
#else
|
||||
return Qfalse;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_gdk(void)
|
||||
{
|
||||
RG_TARGET_NAMESPACE = rb_define_module("Gdk");
|
||||
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
RG_DEF_MODFUNC(display_arg_name, 0);
|
||||
#endif
|
||||
RG_DEF_MODFUNC(set_locale, 0);
|
||||
RG_DEF_MODFUNC(set_sm_client_id, 1);
|
||||
#if GTK_CHECK_VERSION(2, 2, 0)
|
||||
RG_DEF_MODFUNC(notify_startup_complete, -1);
|
||||
#endif
|
||||
RG_DEF_MODFUNC(program_class, 0);
|
||||
RG_DEF_MODFUNC(set_program_class, 1);
|
||||
RG_DEF_MODFUNC(display, 0);
|
||||
|
||||
RG_DEF_MODFUNC(set_x_error_handler, 0);
|
||||
RG_DEF_MODFUNC(set_x_io_error_handler, 0);
|
||||
RG_DEF_MODFUNC(screen_width, 0);
|
||||
RG_DEF_MODFUNC(screen_width_mm, 0);
|
||||
RG_DEF_MODFUNC(screen_height, 0);
|
||||
RG_DEF_MODFUNC(screen_height_mm, 0);
|
||||
RG_DEF_MODFUNC(beep, 0);
|
||||
RG_DEF_MODFUNC(flush, 0);
|
||||
RG_DEF_MODFUNC(set_double_click_time, 1);
|
||||
RG_DEF_MODFUNC(pointer_grab, 6);
|
||||
RG_DEF_MODFUNC(pointer_ungrab, 1);
|
||||
RG_DEF_MODFUNC(keyboard_grab, 3);
|
||||
RG_DEF_MODFUNC(keyboard_ungrab, 1);
|
||||
RG_DEF_MODFUNC_P(pointer_is_grabbed, 0);
|
||||
RG_DEF_MODFUNC(error_trap_push, 0);
|
||||
RG_DEF_MODFUNC(error_trap_pop, 0);
|
||||
RG_DEF_MODFUNC_P(windowing_x11, 0);
|
||||
RG_DEF_MODFUNC_P(windowing_win32, 0);
|
||||
RG_DEF_MODFUNC_P(windowing_fb, 0);
|
||||
RG_DEF_MODFUNC_P(windowing_quartz, 0);
|
||||
RG_DEF_MODFUNC_P(windowing_directfb, 0);
|
||||
|
||||
RG_DEF_MODFUNC(target, 0);
|
||||
|
||||
RG_DEF_MODFUNC_P(cairo_available, 0);
|
||||
|
||||
/* GdkGrabStatus */
|
||||
G_DEF_CLASS(GDK_TYPE_GRAB_STATUS, "GrabStatus", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_GRAB_STATUS, "GDK_");
|
||||
|
||||
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
||||
}
|
||||
79
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdk.h
Normal file
79
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdk.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2008 Ruby-GNOME2 Project Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef __RB_GDK_H__
|
||||
#define __RB_GDK_H__
|
||||
|
||||
#include <rbgobject.h>
|
||||
#include <rbgtkmacros.h>
|
||||
#include <gdk/gdk.h>
|
||||
#include <rbgdkconversions.h>
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
# include <gdk/gdkx.h>
|
||||
#endif
|
||||
#ifdef GDK_WINDOWING_WIN32
|
||||
# include <gdk/gdkwin32.h>
|
||||
#endif
|
||||
|
||||
#define RVAL2GDKPOINTS(value, n) rbgdk_rval2gdkpoints(value, n)
|
||||
#define RVAL2GDKATOMS(value, n) rbgdk_rval2gdkatoms(value, n)
|
||||
|
||||
#define RVAL2GDKPIXBUFGLIST(value) rbgdk_rval2gdkpixbufglist(value)
|
||||
|
||||
#define GDK_BITMAP(b) ((GdkBitmap*)GDK_PIXMAP(b))
|
||||
|
||||
#define GEV2RVAL(ev) (make_gdkevent(ev))
|
||||
#define RVAL2GEV(ev) (get_gdkevent(ev))
|
||||
#define RVAL2ATOM(atom) (get_gdkatom(atom))
|
||||
#define RVAL2GDKNATIVEWINDOW(value) ((GdkNativeWindow)NUM2UINT(value))
|
||||
/* TODO: Will UINT2NUM work for pointers on 64-bit Windows? */
|
||||
#define GDKNATIVEWINDOW2RVAL(value) UINT2NUM((guint32)value)
|
||||
|
||||
#define GDK_TYPE_GEOMETRY (gdk_geometry_get_type())
|
||||
#define GDK_TYPE_REGION (gdk_region_get_type())
|
||||
#define GDK_TYPE_ATOM (gdk_atom_get_type())
|
||||
#define GDK_TYPE_WINDOW_ATTR (gdk_windowattr_get_type())
|
||||
#define GDK_TYPE_TIME_COORD (gdk_timecoord_get_type())
|
||||
|
||||
RUBY_GTK2_VAR VALUE mGdk;
|
||||
RUBY_GTK2_VAR VALUE rb_cGdkColor;
|
||||
|
||||
typedef struct {
|
||||
GdkAtom atom;
|
||||
} GdkAtomData;
|
||||
|
||||
GdkPoint *rbgdk_rval2gdkpoints(VALUE value, long *n);
|
||||
GdkAtom *rbgdk_rval2gdkatoms(VALUE value, long *n);
|
||||
|
||||
GList *rbgdk_rval2gdkpixbufglist(VALUE value);
|
||||
|
||||
extern GType gdk_windowattr_get_type(void);
|
||||
extern GType gdk_atom_get_type(void);
|
||||
extern GType gdk_geometry_get_type(void);
|
||||
extern GType gdk_region_get_type(void);
|
||||
extern GType gdk_timecoord_get_type(void);
|
||||
|
||||
extern GdkAtom get_gdkatom(VALUE atom);
|
||||
extern VALUE make_gdkevent(GdkEvent* event);
|
||||
extern GdkEvent* get_gdkevent(VALUE event);
|
||||
|
||||
#endif /* __RB_GDK_H__ */
|
||||
124
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkatom.c
Normal file
124
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkatom.c
Normal file
@@ -0,0 +1,124 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
#include "rbgdk.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cAtom
|
||||
#define _SELF(a) (((GdkAtomData*)RVAL2BOXED(a, GDK_TYPE_ATOM))->atom)
|
||||
|
||||
/*****************************************/
|
||||
static GdkAtomData *
|
||||
gdk_atom_copy(const GdkAtom atom)
|
||||
{
|
||||
GdkAtomData* data;
|
||||
data = g_new(GdkAtomData, 1);
|
||||
data->atom = atom;
|
||||
return data;
|
||||
}
|
||||
|
||||
GType
|
||||
gdk_atom_get_type(void)
|
||||
{
|
||||
static GType our_type = 0;
|
||||
if (our_type == 0)
|
||||
our_type = g_boxed_type_register_static ("GdkAtomData",
|
||||
(GBoxedCopyFunc)gdk_atom_copy,
|
||||
(GBoxedFreeFunc)g_free);
|
||||
return our_type;
|
||||
}
|
||||
|
||||
GdkAtom
|
||||
get_gdkatom(VALUE atom)
|
||||
{
|
||||
if (TYPE(atom) == T_STRING)
|
||||
return gdk_atom_intern(RVAL2CSTR(atom), FALSE);
|
||||
return ((GdkAtomData*)RVAL2BOXED(atom, GDK_TYPE_ATOM))->atom;
|
||||
}
|
||||
/*****************************************/
|
||||
|
||||
static VALUE
|
||||
rg_s_intern(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
VALUE name;
|
||||
VALUE exist;
|
||||
|
||||
rb_scan_args(argc, argv, "11", &name, &exist);
|
||||
|
||||
return BOXED2RVAL(gdk_atom_intern(RVAL2CSTR(name), RVAL2CBOOL(exist)),
|
||||
GDK_TYPE_ATOM);
|
||||
}
|
||||
|
||||
/* We don't need them.
|
||||
GdkAtom gdk_atom_intern_static_string(const gchar *atom_name);
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self, VALUE num)
|
||||
{
|
||||
guint atom = FIX2INT(num);
|
||||
if (atom == 0) {
|
||||
/* This is a trick for passing 0(NULL) */
|
||||
G_INITIALIZE(self, GUINT_TO_POINTER(1));
|
||||
_SELF(self) = GUINT_TO_POINTER(GDK_NONE);
|
||||
} else {
|
||||
G_INITIALIZE(self, GUINT_TO_POINTER(atom));
|
||||
}
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_name(VALUE self)
|
||||
{
|
||||
return CSTR2RVAL_FREE(gdk_atom_name(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_to_i(VALUE self)
|
||||
{
|
||||
return UINT2NUM(GPOINTER_TO_UINT(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_operator_equal(VALUE self, VALUE other)
|
||||
{
|
||||
return CBOOL2RVAL(_SELF(self) == _SELF(other));
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_gdk_atom(VALUE mGdk)
|
||||
{
|
||||
VALUE none;
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_ATOM, "Atom", mGdk);
|
||||
|
||||
RG_DEF_SMETHOD(intern, -1);
|
||||
|
||||
RG_DEF_METHOD(initialize, 1);
|
||||
RG_DEF_METHOD(name, 0);
|
||||
RG_DEF_METHOD(to_i, 0);
|
||||
RG_DEF_METHOD_OPERATOR("==", equal, 1);
|
||||
|
||||
/* This is a trick to define GDK_NONE as a BOXED object */
|
||||
none = BOXED2RVAL((gpointer)1, GDK_TYPE_ATOM);
|
||||
rb_define_const(RG_TARGET_NAMESPACE, "NONE", none);
|
||||
_SELF(none) = GDK_NONE;
|
||||
}
|
||||
97
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkcairo.c
Normal file
97
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkcairo.c
Normal file
@@ -0,0 +1,97 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2005 Kouhei Sutou
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#if CAIRO_AVAILABLE
|
||||
#include <gdk/gdkcairo.h>
|
||||
#include <rb_cairo.h>
|
||||
|
||||
#define RG_TARGET_NAMESPACE rb_cCairo_Context
|
||||
#define _SELF(self) RVAL2CRCONTEXT(self)
|
||||
|
||||
static VALUE
|
||||
rg_set_source_gdk_color(VALUE self, VALUE color)
|
||||
{
|
||||
gdk_cairo_set_source_color(_SELF(self), RVAL2GDKCOLOR(color));
|
||||
rb_cairo_check_status(cairo_status(_SELF(self)));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_source_pixbuf(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE pixbuf, pixbuf_x, pixbuf_y;
|
||||
|
||||
rb_scan_args(argc, argv, "12", &pixbuf, &pixbuf_x, &pixbuf_y);
|
||||
|
||||
gdk_cairo_set_source_pixbuf(_SELF(self),
|
||||
GDK_PIXBUF(RVAL2GOBJ(pixbuf)),
|
||||
NIL_P(pixbuf_x) ? 0 : NUM2DBL(pixbuf_x),
|
||||
NIL_P(pixbuf_y) ? 0 : NUM2DBL(pixbuf_y));
|
||||
rb_cairo_check_status(cairo_status(_SELF(self)));
|
||||
return self;
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,10,0)
|
||||
static VALUE
|
||||
rg_set_source_pixmap(VALUE self, VALUE pixmap, VALUE pixmap_x, VALUE pixmap_y)
|
||||
{
|
||||
gdk_cairo_set_source_pixmap(_SELF(self), GDK_PIXMAP(RVAL2GOBJ(pixmap)),
|
||||
NUM2DBL(pixmap_x), NUM2DBL(pixmap_y));
|
||||
rb_cairo_check_status(cairo_status(_SELF(self)));
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
rg_gdk_rectangle(VALUE self, VALUE rectangle)
|
||||
{
|
||||
gdk_cairo_rectangle(_SELF(self),
|
||||
(GdkRectangle*)RVAL2BOXED(rectangle, GDK_TYPE_RECTANGLE));
|
||||
rb_cairo_check_status(cairo_status(_SELF(self)));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_gdk_region(VALUE self, VALUE region)
|
||||
{
|
||||
gdk_cairo_region(_SELF(self), (GdkRegion*)RVAL2BOXED(region, GDK_TYPE_REGION));
|
||||
rb_cairo_check_status(cairo_status(_SELF(self)));
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_gdk_cairo(void)
|
||||
{
|
||||
#if CAIRO_AVAILABLE
|
||||
RG_DEF_METHOD(set_source_gdk_color, 1);
|
||||
RG_DEF_METHOD(set_source_pixbuf, -1);
|
||||
#if GTK_CHECK_VERSION(2,10,0)
|
||||
RG_DEF_METHOD(set_source_pixmap, 3);
|
||||
#endif
|
||||
RG_DEF_METHOD(gdk_rectangle, 1);
|
||||
RG_DEF_METHOD(gdk_region, 1);
|
||||
|
||||
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
||||
#endif
|
||||
}
|
||||
146
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkcolor.c
Normal file
146
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkcolor.c
Normal file
@@ -0,0 +1,146 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE rb_cGdkColor
|
||||
#define _SELF(c) (RVAL2GDKCOLOR(c))
|
||||
|
||||
VALUE RG_TARGET_NAMESPACE = Qnil;
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self, VALUE red, VALUE green, VALUE blue)
|
||||
{
|
||||
GdkColor color;
|
||||
|
||||
color.pixel = 0;
|
||||
color.red = NUM2INT(red);
|
||||
color.green = NUM2INT(green);
|
||||
color.blue = NUM2INT(blue);
|
||||
|
||||
G_INITIALIZE(self, g_boxed_copy(GDK_TYPE_COLOR, &color));
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_parse(G_GNUC_UNUSED VALUE self, VALUE name)
|
||||
{
|
||||
GdkColor c;
|
||||
if (! gdk_color_parse(RVAL2CSTR(name), &c)) {
|
||||
rb_raise(rb_eArgError, "can't parse color name `%s'", RVAL2CSTR(name));
|
||||
}
|
||||
return BOXED2RVAL(&c, GDK_TYPE_COLOR);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_pixel(VALUE self)
|
||||
{
|
||||
return INT2NUM(_SELF(self)->pixel);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_red(VALUE self)
|
||||
{
|
||||
|
||||
return INT2FIX(_SELF(self)->red);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_red(VALUE self, VALUE red)
|
||||
{
|
||||
_SELF(self)->red = NUM2INT(red);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_green(VALUE self)
|
||||
{
|
||||
return INT2FIX(_SELF(self)->green);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_green(VALUE self, VALUE green)
|
||||
{
|
||||
_SELF(self)->green = NUM2INT(green);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_blue(VALUE self)
|
||||
{
|
||||
return INT2FIX(_SELF(self)->blue);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_blue(VALUE self, VALUE blue)
|
||||
{
|
||||
_SELF(self)->blue = NUM2INT(blue);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_to_a(VALUE self)
|
||||
{
|
||||
GdkColor *c = _SELF(self);
|
||||
return rb_ary_new3(3, INT2FIX(c->red),
|
||||
INT2FIX(c->green), INT2FIX(c->blue));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_operator_gdkcolor_equal(VALUE self, VALUE other)
|
||||
{
|
||||
return CBOOL2RVAL(gdk_color_equal(_SELF(self), _SELF(other)));
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2, 12, 0)
|
||||
static VALUE
|
||||
rg_to_s(VALUE self)
|
||||
{
|
||||
return CSTR2RVAL_FREE(gdk_color_to_string(_SELF(self)));
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_gdk_color(VALUE mGdk)
|
||||
{
|
||||
RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_COLOR, "Color", mGdk);
|
||||
|
||||
RG_DEF_SMETHOD(parse, 1);
|
||||
RG_DEF_METHOD(initialize, 3);
|
||||
RG_DEF_METHOD(pixel, 0);
|
||||
RG_DEF_METHOD(red, 0);
|
||||
RG_DEF_METHOD(set_red, 1);
|
||||
RG_DEF_METHOD(green, 0);
|
||||
RG_DEF_METHOD(set_green, 1);
|
||||
RG_DEF_METHOD(blue, 0);
|
||||
RG_DEF_METHOD(set_blue, 1);
|
||||
RG_DEF_METHOD(to_a, 0);
|
||||
RG_DEF_METHOD_OPERATOR("==", gdkcolor_equal, 1);
|
||||
#if GTK_CHECK_VERSION(2, 12, 0)
|
||||
RG_DEF_METHOD(to_s, 0);
|
||||
#endif
|
||||
|
||||
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
||||
}
|
||||
139
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkcolormap.c
Normal file
139
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkcolormap.c
Normal file
@@ -0,0 +1,139 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Masao Mutoh
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cColormap
|
||||
#define _SELF(self) (GDK_COLORMAP(RVAL2GOBJ(self)))
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self, VALUE visual, VALUE allocate)
|
||||
{
|
||||
GdkColormap *cmap = gdk_colormap_new(GDK_VISUAL(RVAL2GOBJ(visual)),
|
||||
RVAL2CBOOL(allocate));
|
||||
G_INITIALIZE(self, cmap);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_system(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_colormap_get_system());
|
||||
}
|
||||
|
||||
/* Don't implement this. Because API is ugly
|
||||
(especially treating of "success").
|
||||
Use Gdk::Colormap#alloc_color instead.
|
||||
gint gdk_colormap_alloc_colors (GdkColormap *colormap,
|
||||
GdkColor *colors,
|
||||
gint ncolors,
|
||||
gboolean writeable,
|
||||
gboolean best_match,
|
||||
gboolean *success);
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
rg_alloc_color(VALUE self, VALUE color, VALUE writeable, VALUE best_match)
|
||||
{
|
||||
gboolean result;
|
||||
GdkColor *c = RVAL2GDKCOLOR(color);
|
||||
result = gdk_colormap_alloc_color(_SELF(self), c,
|
||||
RVAL2CBOOL(writeable), RVAL2CBOOL(best_match));
|
||||
return result ? INT2NUM(c->pixel) : Qnil;
|
||||
}
|
||||
|
||||
/* Don't implement Gdk::Colormap#free_colors.
|
||||
Because it should be pair with Gdk::Colormap#alloc_colors */
|
||||
static VALUE
|
||||
rg_free_color(VALUE self, VALUE color)
|
||||
{
|
||||
gdk_colormap_free_colors(_SELF(self), RVAL2GDKCOLOR(color), 1);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_query_color(VALUE self, VALUE pixel)
|
||||
{
|
||||
GdkColor color;
|
||||
gdk_colormap_query_color(_SELF(self), NUM2ULONG(pixel), &color);
|
||||
return GDKCOLOR2RVAL(&color);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_visual(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_colormap_get_visual(_SELF(self)));
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
static VALUE
|
||||
rg_screen(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_colormap_get_screen(_SELF(self)));
|
||||
}
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
rg_colors(VALUE self)
|
||||
{
|
||||
GdkColormap *cmap;
|
||||
GdkColor *colors;
|
||||
GdkVisual *visual;
|
||||
VALUE ary;
|
||||
int i;
|
||||
|
||||
cmap = _SELF(self);
|
||||
colors = cmap->colors;
|
||||
|
||||
visual = gdk_colormap_get_visual(cmap);
|
||||
|
||||
if (visual->type == GDK_VISUAL_GRAYSCALE ||
|
||||
visual->type == GDK_VISUAL_PSEUDO_COLOR) {
|
||||
ary = rb_ary_new2(cmap->size);
|
||||
for (i = 0; i < cmap->size; i++) {
|
||||
rb_ary_push(ary, BOXED2RVAL(colors, GDK_TYPE_COLOR));
|
||||
colors++;
|
||||
}
|
||||
return ary;
|
||||
} else {
|
||||
return Qnil;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_gdk_colormap(VALUE mGdk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_COLORMAP, "Colormap", mGdk);
|
||||
|
||||
RG_DEF_SMETHOD(system, 0);
|
||||
RG_DEF_METHOD(initialize, 2);
|
||||
RG_DEF_METHOD(alloc_color, 3);
|
||||
RG_DEF_METHOD(free_color, 1);
|
||||
RG_DEF_METHOD(query_color, 1);
|
||||
RG_DEF_METHOD(visual, 0);
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
RG_DEF_METHOD(screen, 0);
|
||||
#endif
|
||||
RG_DEF_METHOD(colors, 0);
|
||||
}
|
||||
39
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkconst.c
Normal file
39
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkconst.c
Normal file
@@ -0,0 +1,39 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
/*
|
||||
* Gdk module constants
|
||||
*/
|
||||
void
|
||||
Init_gtk_gdk_const(VALUE mGdk)
|
||||
{
|
||||
/* GdkStatus */
|
||||
G_DEF_CLASS(GDK_TYPE_STATUS, "Status", mGdk);
|
||||
G_DEF_CONSTANTS(mGdk, GDK_TYPE_STATUS, "GDK_");
|
||||
|
||||
}
|
||||
|
||||
|
||||
31
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkconversions.h
Normal file
31
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkconversions.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2008 Ruby-GNOME2 Project Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef __RB_GDK_CONVERSIONS_H__
|
||||
#define __RB_GDK_CONVERSIONS_H__
|
||||
|
||||
#include <rbgobject.h>
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
#define RVAL2GDKCOLOR(color) ((GdkColor *)RVAL2BOXED(color, GDK_TYPE_COLOR))
|
||||
#define GDKCOLOR2RVAL(color) (BOXED2RVAL(color, GDK_TYPE_COLOR))
|
||||
|
||||
#endif /* __RB_GDK_CONVERSIONS_H__ */
|
||||
120
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkcursor.c
Normal file
120
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkcursor.c
Normal file
@@ -0,0 +1,120 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2001-2004 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cCursor
|
||||
|
||||
static VALUE
|
||||
rg_initialize(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
GdkCursor* cursor = NULL;
|
||||
|
||||
if (argc == 1){
|
||||
VALUE type;
|
||||
rb_scan_args(argc, argv, "10", &type);
|
||||
cursor = gdk_cursor_new(RVAL2GENUM(type, GDK_TYPE_CURSOR_TYPE));
|
||||
} else if (argc == 2) {
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
VALUE display, type_or_name;
|
||||
rb_scan_args(argc, argv, "20", &display, &type_or_name);
|
||||
#if GTK_CHECK_VERSION(2,8,0)
|
||||
if (TYPE(type_or_name) == T_STRING)
|
||||
cursor = gdk_cursor_new_from_name(GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)),
|
||||
RVAL2CSTR(type_or_name));
|
||||
else
|
||||
#endif
|
||||
cursor = gdk_cursor_new_for_display(GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)),
|
||||
RVAL2GENUM(type_or_name, GDK_TYPE_CURSOR_TYPE));
|
||||
#else
|
||||
rb_raise(rb_eRuntimeError, "Gdk::Cursor.new(display, cursor_type) has been supported since GTK+-2.2.");
|
||||
#endif
|
||||
} else if (argc == 4) {
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
VALUE display, pixbuf, x, y;
|
||||
rb_scan_args(argc, argv, "40", &display, &pixbuf, &x, &y);
|
||||
cursor = gdk_cursor_new_from_pixbuf(GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)),
|
||||
GDK_PIXBUF(RVAL2GOBJ(pixbuf)),
|
||||
NUM2INT(x), NUM2INT(y));
|
||||
#else
|
||||
rb_raise(rb_eRuntimeError, "Gdk::Cursor.new(pixbuf) has been supported since GTK+-2.4.");
|
||||
#endif
|
||||
} else if (argc == 6) {
|
||||
VALUE pixmap, mask, fg, bg, x, y;
|
||||
rb_scan_args(argc, argv, "60", &pixmap, &mask, &fg, &bg, &x, &y);
|
||||
cursor = gdk_cursor_new_from_pixmap(GDK_PIXMAP(RVAL2GOBJ(pixmap)),
|
||||
NIL_P(mask)?NULL:GDK_PIXMAP(RVAL2GOBJ(mask)),
|
||||
RVAL2GDKCOLOR(fg),
|
||||
RVAL2GDKCOLOR(bg),
|
||||
NUM2INT(x), NUM2INT(y));
|
||||
}
|
||||
G_INITIALIZE(self, cursor);
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
static VALUE
|
||||
rg_display(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_cursor_get_display((GdkCursor*)RVAL2BOXED(self, GDK_TYPE_CURSOR)));
|
||||
}
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
rg_pixmap_p(VALUE self)
|
||||
{
|
||||
return CBOOL2RVAL(((GdkCursor*)RVAL2BOXED(self, GDK_TYPE_COLOR))->type ==
|
||||
GDK_CURSOR_IS_PIXMAP);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_cursor_type(VALUE self)
|
||||
{
|
||||
return GENUM2RVAL(((GdkCursor*)RVAL2BOXED(self, GDK_TYPE_CURSOR))->type, GDK_TYPE_CURSOR_TYPE);
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,8,0)
|
||||
static VALUE
|
||||
rg_image(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_cursor_get_image((GdkCursor*)RVAL2BOXED(self, GDK_TYPE_CURSOR)));
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_gdk_cursor(VALUE mGdk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_CURSOR, "Cursor", mGdk);
|
||||
|
||||
RG_DEF_METHOD(initialize, -1);
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
RG_DEF_METHOD(display, 0);
|
||||
#endif
|
||||
RG_DEF_METHOD_P(pixmap, 0);
|
||||
RG_DEF_METHOD(cursor_type, 0);
|
||||
#if GTK_CHECK_VERSION(2,8,0)
|
||||
RG_DEF_METHOD(image, 0);
|
||||
#endif
|
||||
|
||||
G_DEF_CLASS(GDK_TYPE_CURSOR_TYPE, "Type", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_CURSOR_TYPE, "GDK_");
|
||||
}
|
||||
229
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkdevice.c
Normal file
229
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkdevice.c
Normal file
@@ -0,0 +1,229 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2003-2006 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cDevice
|
||||
#define _SELF(self) (GDK_DEVICE(RVAL2GOBJ(self)))
|
||||
|
||||
/* Methods */
|
||||
static VALUE
|
||||
rg_s_list(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
/* Owned by GDK */
|
||||
return GLIST2ARY(gdk_devices_list());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_set_extension_events(G_GNUC_UNUSED VALUE self, VALUE window, VALUE mask, VALUE mode)
|
||||
{
|
||||
gdk_input_set_extension_events(GDK_WINDOW(RVAL2GOBJ(window)),
|
||||
NUM2INT(mask), FIX2INT(mode));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_source(VALUE self, VALUE source)
|
||||
{
|
||||
gdk_device_set_source(_SELF(self), RVAL2GENUM(source, GDK_TYPE_INPUT_SOURCE));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_mode(VALUE self, VALUE mode)
|
||||
{
|
||||
return CBOOL2RVAL(gdk_device_set_mode(_SELF(self), RVAL2GENUM(mode, GDK_TYPE_INPUT_MODE)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_key(VALUE self, VALUE index, VALUE keyval, VALUE modifiers)
|
||||
{
|
||||
gdk_device_set_key(_SELF(self), NUM2UINT(index), NUM2UINT(keyval),
|
||||
RVAL2GFLAGS(modifiers, GDK_TYPE_MODIFIER_TYPE));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_axis_use(VALUE self, VALUE index, VALUE use)
|
||||
{
|
||||
gdk_device_set_axis_use(_SELF(self), NUM2UINT(index),
|
||||
RVAL2GENUM(use, GDK_TYPE_AXIS_USE));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_core_pointer(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_device_get_core_pointer());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_get_state(VALUE self, VALUE window)
|
||||
{
|
||||
gdouble axes[2];
|
||||
GdkModifierType mask;
|
||||
|
||||
gdk_device_get_state(_SELF(self), GDK_WINDOW(RVAL2GOBJ(window)),
|
||||
axes, &mask);
|
||||
return rb_ary_new3(3, rb_float_new(axes[0]), rb_float_new(axes[1]),
|
||||
GFLAGS2RVAL(mask, GDK_TYPE_MODIFIER_TYPE));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_get_history(VALUE self, VALUE window, VALUE start, VALUE stop)
|
||||
{
|
||||
gboolean ret;
|
||||
GdkTimeCoord** events;
|
||||
gint i, n_events;
|
||||
VALUE ary = Qnil;
|
||||
ret = gdk_device_get_history(_SELF(self),
|
||||
GDK_WINDOW(RVAL2GOBJ(window)),
|
||||
NUM2UINT(start), NUM2UINT(stop),
|
||||
&events, &n_events);
|
||||
if (ret){
|
||||
ary = rb_ary_new();
|
||||
for (i = 0; i < n_events; i++){
|
||||
rb_ary_push(ary, BOXED2RVAL(events, GDK_TYPE_TIME_COORD));
|
||||
}
|
||||
gdk_device_free_history(events, n_events);
|
||||
}
|
||||
return ary;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_get_axis(VALUE self, VALUE rbaxes, VALUE rbuse)
|
||||
{
|
||||
GdkDevice *device = _SELF(self);
|
||||
GdkAxisUse use = RVAL2GENUM(rbuse, GDK_TYPE_AXIS_USE);
|
||||
long n;
|
||||
gdouble *axes = RVAL2GDOUBLES(rbaxes, n);
|
||||
gint device_n_axes = gdk_device_get_n_axes(device);
|
||||
gdouble value;
|
||||
gboolean found;
|
||||
|
||||
if (n != device_n_axes)
|
||||
rb_raise(rb_eArgError,
|
||||
"unexpected number of axes: %ld != %d",
|
||||
n, device_n_axes);
|
||||
|
||||
found = gdk_device_get_axis(device, axes, use, &value);
|
||||
|
||||
g_free(axes);
|
||||
|
||||
return found ? DBL2NUM(value) : Qnil;
|
||||
}
|
||||
|
||||
/* Accessor */
|
||||
static VALUE
|
||||
rg_name(VALUE self)
|
||||
{
|
||||
return CSTR2RVAL(_SELF(self)->name);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_source(VALUE self)
|
||||
{
|
||||
return GENUM2RVAL(_SELF(self)->source, GDK_TYPE_INPUT_SOURCE);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_mode(VALUE self)
|
||||
{
|
||||
return GENUM2RVAL(_SELF(self)->mode, GDK_TYPE_INPUT_MODE);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_has_cursor_p(VALUE self)
|
||||
{
|
||||
return CBOOL2RVAL(_SELF(self)->has_cursor);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_axes(VALUE self)
|
||||
{
|
||||
gint i;
|
||||
VALUE ary = rb_ary_new();
|
||||
GdkDeviceAxis* axes = _SELF(self)->axes;
|
||||
|
||||
for (i = 0; i < _SELF(self)->num_axes; i++){
|
||||
rb_ary_push(ary, rb_ary_new3(3, GENUM2RVAL(axes[i].use, GDK_TYPE_AXIS_USE),
|
||||
rb_float_new(axes[i].min), rb_float_new(axes[i].max)));
|
||||
}
|
||||
return ary;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_keys(VALUE self)
|
||||
{
|
||||
gint i;
|
||||
VALUE ary = rb_ary_new();
|
||||
GdkDeviceKey* keys = _SELF(self)->keys;
|
||||
|
||||
for (i = 0; i < _SELF(self)->num_keys; i++){
|
||||
rb_ary_push(ary, rb_ary_new3(2, UINT2NUM(keys[i].keyval),
|
||||
GFLAGS2RVAL(keys[i].modifiers, GDK_TYPE_MODIFIER_TYPE)));
|
||||
}
|
||||
return ary;
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_gdk_device(VALUE mGdk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_DEVICE, "Device", mGdk);
|
||||
|
||||
RG_DEF_SMETHOD(list, 0);
|
||||
RG_DEF_SMETHOD(core_pointer, 0);
|
||||
RG_DEF_SMETHOD(set_extension_events, 3);
|
||||
|
||||
RG_DEF_METHOD(set_source, 1);
|
||||
RG_DEF_METHOD(set_mode, 1);
|
||||
RG_DEF_METHOD(set_key, 3);
|
||||
RG_DEF_METHOD(set_axis_use, 2);
|
||||
RG_DEF_METHOD(get_state, 1);
|
||||
RG_DEF_METHOD(get_history, 3);
|
||||
RG_DEF_METHOD(get_axis, 2);
|
||||
|
||||
RG_DEF_METHOD(name, 0);
|
||||
RG_DEF_METHOD(source, 0);
|
||||
RG_DEF_METHOD(mode, 0);
|
||||
RG_DEF_METHOD_P(has_cursor, 0);
|
||||
RG_DEF_METHOD(axes, 0);
|
||||
RG_DEF_METHOD(keys, 0);
|
||||
|
||||
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
||||
|
||||
/* GdkInputSource */
|
||||
G_DEF_CLASS(GDK_TYPE_INPUT_SOURCE, "InputSource", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_INPUT_SOURCE, "GDK_");
|
||||
|
||||
/* GdkInputMode */
|
||||
G_DEF_CLASS(GDK_TYPE_INPUT_MODE, "InputMode", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_INPUT_MODE, "GDK_");
|
||||
|
||||
/* GdkAxisUse */
|
||||
G_DEF_CLASS(GDK_TYPE_AXIS_USE, "AxisUse", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_AXIS_USE, "GDK_");
|
||||
|
||||
/* GdkExtensionMode */
|
||||
G_DEF_CLASS(GDK_TYPE_EXTENSION_MODE, "ExtensionMode", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_EXTENSION_MODE, "GDK_");
|
||||
|
||||
}
|
||||
591
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkdisplay.c
Normal file
591
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkdisplay.c
Normal file
@@ -0,0 +1,591 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002-2005 Ruby-GNOME2 Project Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
|
||||
#define RG_TARGET_NAMESPACE cDisplay
|
||||
#define _SELF(i) GDK_DISPLAY_OBJECT(RVAL2GOBJ(i))
|
||||
|
||||
static VALUE
|
||||
rg_close(VALUE self)
|
||||
{
|
||||
gdk_display_close(_SELF(self));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_open(G_GNUC_UNUSED VALUE self, VALUE display_name)
|
||||
{
|
||||
GdkDisplay* gdisplay = gdk_display_open(RVAL2CSTR(display_name));
|
||||
if (! gdisplay) {
|
||||
rb_raise(rb_eRuntimeError, "The display `%s' could not be opened.",
|
||||
RVAL2CSTR(display_name));
|
||||
} else {
|
||||
VALUE display;
|
||||
g_object_ref(gdisplay);
|
||||
display = GOBJ2RVAL(gdisplay);
|
||||
|
||||
if (rb_block_given_p()) {
|
||||
rb_ensure(rb_yield, display, rg_close, display);
|
||||
return Qnil;
|
||||
} else {
|
||||
return display;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_default(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
GdkDisplay* gdisplay = gdk_display_get_default();
|
||||
if (! gdisplay)
|
||||
rb_raise(rb_eRuntimeError, "No default display is found.");
|
||||
|
||||
return GOBJ2RVAL(gdisplay);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_name(VALUE self)
|
||||
{
|
||||
return CSTR2RVAL(gdk_display_get_name(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_n_screens(VALUE self)
|
||||
{
|
||||
return INT2NUM(gdk_display_get_n_screens(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_get_screen(VALUE self, VALUE num)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_display_get_screen(_SELF(self), NUM2INT(num)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_default_screen(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_display_get_default_screen(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_pointer_ungrab(VALUE self, VALUE time)
|
||||
{
|
||||
gdk_display_pointer_ungrab(_SELF(self), NUM2ULONG(time));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_keyboard_ungrab(VALUE self, VALUE time)
|
||||
{
|
||||
gdk_display_keyboard_ungrab(_SELF(self), NUM2ULONG(time));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_pointer_grabbed_p(VALUE self)
|
||||
{
|
||||
return CBOOL2RVAL(gdk_display_pointer_is_grabbed(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_beep(VALUE self)
|
||||
{
|
||||
gdk_display_beep(_SELF(self));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_sync(VALUE self)
|
||||
{
|
||||
gdk_display_sync(_SELF(self));
|
||||
return self;
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
static VALUE
|
||||
rg_flush(VALUE self)
|
||||
{
|
||||
gdk_display_flush(_SELF(self));
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
rg_devices(VALUE self)
|
||||
{
|
||||
return rbgutil_glist2ary(gdk_display_list_devices(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_event(VALUE self)
|
||||
{
|
||||
return GEV2RVAL(gdk_display_get_event(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_peek_event(VALUE self)
|
||||
{
|
||||
return GEV2RVAL(gdk_display_peek_event(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_put_event(VALUE self, VALUE event)
|
||||
{
|
||||
gdk_display_put_event(_SELF(self), RVAL2GEV(event));
|
||||
return self;
|
||||
}
|
||||
|
||||
/* Don't implement this.
|
||||
static GdkFilterReturn
|
||||
filter_func(GdkXEvent xevent, GdkEvent event, gpointer func)
|
||||
{
|
||||
return GENUM2RVAL(rb_funcall((VALUE)func, id_call, 2,
|
||||
????, GEV2RVAL(event)),
|
||||
GDK_TYPE_FILTER_RETURN);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
gdkdisplay_add_client_message_filter(VALUE self, VALUE message_type)
|
||||
{
|
||||
VALUE func = RB_BLOCK_PROC();
|
||||
G_RELATIVE(self, func);
|
||||
gdk_display_add_client_message_filter(_SELF(self), RVAL2ATOM(message_type),
|
||||
filter_func, func);
|
||||
return self;
|
||||
}
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
rg_set_double_click_time(VALUE self, VALUE msec)
|
||||
{
|
||||
gdk_display_set_double_click_time(_SELF(self), NUM2UINT(msec));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_double_click_time(VALUE self)
|
||||
{
|
||||
return UINT2NUM(_SELF(self)->double_click_time);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_button_click_time(VALUE self)
|
||||
{
|
||||
return rb_ary_new3(2,
|
||||
UINT2NUM(_SELF(self)->button_click_time[0]),
|
||||
UINT2NUM(_SELF(self)->button_click_time[1]));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_button_window(VALUE self)
|
||||
{
|
||||
return rb_ary_new3(2,
|
||||
GOBJ2RVAL(_SELF(self)->button_window[0]),
|
||||
GOBJ2RVAL(_SELF(self)->button_window[1]));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_button_number(VALUE self)
|
||||
{
|
||||
return rb_ary_new3(2,
|
||||
INT2NUM(_SELF(self)->button_number[0]),
|
||||
INT2NUM(_SELF(self)->button_number[1]));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_closed_p(VALUE self)
|
||||
{
|
||||
return CBOOL2RVAL(_SELF(self)->closed);
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
static VALUE
|
||||
rg_button_x(VALUE self)
|
||||
{
|
||||
return rb_ary_new3(2,
|
||||
INT2NUM(_SELF(self)->button_x[0]),
|
||||
INT2NUM(_SELF(self)->button_x[1]));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_button_y(VALUE self)
|
||||
{
|
||||
return rb_ary_new3(2,
|
||||
INT2NUM(_SELF(self)->button_y[0]),
|
||||
INT2NUM(_SELF(self)->button_y[1]));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_double_click_distance(VALUE self, VALUE distance)
|
||||
{
|
||||
gdk_display_set_double_click_distance(_SELF(self), NUM2UINT(distance));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_double_click_distance(VALUE self)
|
||||
{
|
||||
return UINT2NUM(_SELF(self)->double_click_distance);
|
||||
}
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
rg_pointer(VALUE self)
|
||||
{
|
||||
GdkScreen *screen;
|
||||
int x,y;
|
||||
GdkModifierType mask;
|
||||
|
||||
gdk_display_get_pointer(_SELF(self), &screen, &x, &y, &mask);
|
||||
|
||||
return rb_ary_new3(4, GOBJ2RVAL(screen), INT2NUM(x), INT2NUM(y), INT2NUM(mask));
|
||||
}
|
||||
static VALUE
|
||||
rg_window_at_pointer(VALUE self)
|
||||
{
|
||||
GdkWindow *window;
|
||||
int x,y;
|
||||
|
||||
window = gdk_display_get_window_at_pointer(_SELF(self), &x, &y);
|
||||
|
||||
return rb_ary_new3(3, GOBJ2RVAL(window), INT2NUM(x), INT2NUM(y));
|
||||
}
|
||||
|
||||
/* Don't implement this.
|
||||
GdkDisplayPointerHooks* gdk_display_set_pointer_hooks
|
||||
(GdkDisplay *display,
|
||||
const GdkDisplayPointerHooks *new_hooks);
|
||||
*/
|
||||
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
static VALUE
|
||||
rg_supports_cursor_color_p(VALUE self)
|
||||
{
|
||||
return CBOOL2RVAL(gdk_display_supports_cursor_color(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_supports_cursor_alpha_p(VALUE self)
|
||||
{
|
||||
return CBOOL2RVAL(gdk_display_supports_cursor_alpha(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_default_cursor_size(VALUE self)
|
||||
{
|
||||
return UINT2NUM(gdk_display_get_default_cursor_size(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_maximal_cursor_size(VALUE self)
|
||||
{
|
||||
guint width, height;
|
||||
gdk_display_get_maximal_cursor_size(_SELF(self), &width, &height);
|
||||
return rb_assoc_new(UINT2NUM(width), UINT2NUM(height));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_default_group(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_display_get_default_group(_SELF(self)));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
static VALUE
|
||||
rg_supports_selection_notification_p(VALUE self)
|
||||
{
|
||||
return CBOOL2RVAL(gdk_display_supports_selection_notification(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_request_selection_notification_p(VALUE self, VALUE selection)
|
||||
{
|
||||
return CBOOL2RVAL(gdk_display_request_selection_notification(_SELF(self),
|
||||
RVAL2ATOM(selection)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_supports_clipboard_persistence_p(VALUE self)
|
||||
{
|
||||
return CBOOL2RVAL(gdk_display_supports_clipboard_persistence(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_store_clipboard(VALUE self, VALUE rbclipboard_window, VALUE rbtime_, VALUE rbtargets)
|
||||
{
|
||||
GdkDisplay *display = _SELF(self);
|
||||
GdkWindow *clipboard_window = GDK_WINDOW(RVAL2GOBJ(rbclipboard_window));
|
||||
guint32 time_ = NUM2UINT(rbtime_);
|
||||
long n;
|
||||
GdkAtom *targets = RVAL2GDKATOMS(rbtargets, &n);
|
||||
|
||||
gdk_display_store_clipboard(display, clipboard_window, time_, targets, n);
|
||||
|
||||
g_free(targets);
|
||||
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
rg_core_pointer(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_display_get_core_pointer(_SELF(self)));
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,8,0)
|
||||
static VALUE
|
||||
rg_warp_pointer(VALUE self, VALUE screen, VALUE x, VALUE y)
|
||||
{
|
||||
gdk_display_warp_pointer(_SELF(self), RVAL2GOBJ(screen), NUM2INT(x), NUM2INT(y));
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
static VALUE
|
||||
rg_grab(VALUE self)
|
||||
{
|
||||
gdk_x11_display_grab(_SELF(self));
|
||||
return self;
|
||||
}
|
||||
static VALUE
|
||||
rg_ungrab(VALUE self)
|
||||
{
|
||||
gdk_x11_display_ungrab(_SELF(self));
|
||||
return self;
|
||||
}
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
static VALUE
|
||||
rg_register_standard_event_type(VALUE self, VALUE event_base, VALUE n_events)
|
||||
{
|
||||
gdk_x11_register_standard_event_type(_SELF(self),
|
||||
NUM2INT(event_base), NUM2INT(n_events));
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
#if GTK_CHECK_VERSION(2,8,0)
|
||||
static VALUE
|
||||
rg_user_time(VALUE self)
|
||||
{
|
||||
return UINT2NUM(gdk_x11_display_get_user_time(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_cursor_theme(VALUE self, VALUE theme, VALUE size)
|
||||
{
|
||||
gdk_x11_display_set_cursor_theme(_SELF(self), RVAL2CSTR(theme), NUM2INT(size));
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
# if GTK_CHECK_VERSION(2, 12, 0)
|
||||
/*
|
||||
*** need gdk_x11_display_broadcast_startup_messagev() ***
|
||||
|
||||
typedef struct _StartupMessageParameterData {
|
||||
gchar **parameters;
|
||||
guint i;
|
||||
} StartupMessageParameterData;
|
||||
|
||||
static int
|
||||
collect_parameter(VALUE key, VALUE value, VALUE data)
|
||||
{
|
||||
StartupMessageParameterData *parameter_data;
|
||||
parameter_data = (StartupMessageParameterData *)data;
|
||||
|
||||
parameter_data->parameters[parameter_data->i] = RVAL2CSTR(key);
|
||||
parameter_data->i++;
|
||||
parameter_data->parameters[parameter_data->i] = RVAL2CSTR(value);
|
||||
parameter_data->i++;
|
||||
|
||||
return ST_CONTINUE;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_broadcast_startup_message(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE rb_message_type, rb_parameters;
|
||||
char *message_type;
|
||||
guint n_parameters;
|
||||
gchar **parameters;
|
||||
|
||||
rb_scan_args(argc, argv, "11", &rb_message_type, &rb_parameters);
|
||||
|
||||
message_type = RVAL2CSTR(rb_message_type);
|
||||
if (NIL_P(rb_parameters)) {
|
||||
n_parameters = 0;
|
||||
parameters = NULL;
|
||||
}
|
||||
else {
|
||||
StartupMessageParameterData data;
|
||||
|
||||
Check_Type(rb_parameters, T_HASH);
|
||||
n_parameters = NUM2UINT(rb_funcall(rb_parameters, rb_intern("size"), 0));
|
||||
parameters = ALLOCA_N(gchar *, n_parameters * 2);
|
||||
data.i = 0;
|
||||
data.parameters = parameters;
|
||||
rb_hash_foreach(rb_parameters, collect_parameter, (VALUE)&data);
|
||||
}
|
||||
|
||||
gdk_x11_display_broadcast_startup_messagev(_SELF(self),
|
||||
message_type,
|
||||
n_parameters,
|
||||
parameters);
|
||||
|
||||
return self;
|
||||
}
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
rg_startup_notification_id(VALUE self)
|
||||
{
|
||||
return CSTR2RVAL(gdk_x11_display_get_startup_notification_id(_SELF(self)));
|
||||
}
|
||||
# endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if GTK_CHECK_VERSION(2,10,0)
|
||||
static VALUE
|
||||
rg_supports_shapes_p(VALUE self)
|
||||
{
|
||||
return CBOOL2RVAL(gdk_display_supports_shapes(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_supports_input_shapes_p(VALUE self)
|
||||
{
|
||||
return CBOOL2RVAL(gdk_display_supports_input_shapes(_SELF(self)));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GTK_CHECK_VERSION(2, 12, 0)
|
||||
static VALUE
|
||||
rg_supports_composite_p(VALUE self)
|
||||
{
|
||||
return CBOOL2RVAL(gdk_display_supports_composite(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_trigger_tooltip_query(VALUE self)
|
||||
{
|
||||
gtk_tooltip_trigger_tooltip_query(_SELF(self));
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_gdk_display(VALUE mGdk)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_DISPLAY, "Display", mGdk);
|
||||
|
||||
RG_DEF_SMETHOD(open, 1);
|
||||
RG_DEF_SMETHOD(default, 0);
|
||||
RG_DEF_METHOD(name, 0);
|
||||
RG_DEF_METHOD(n_screens, 0);
|
||||
RG_DEF_METHOD(get_screen, 1);
|
||||
RG_DEF_ALIAS("[]", "get_screen");
|
||||
RG_DEF_METHOD(default_screen, 0);
|
||||
|
||||
RG_DEF_METHOD(pointer_ungrab, 1);
|
||||
RG_DEF_METHOD(keyboard_ungrab, 1);
|
||||
RG_DEF_METHOD_P(pointer_grabbed, 0);
|
||||
|
||||
RG_DEF_METHOD(beep, 0);
|
||||
RG_DEF_METHOD(sync, 0);
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
RG_DEF_METHOD(flush, 0);
|
||||
#endif
|
||||
RG_DEF_METHOD(close, 0);
|
||||
|
||||
RG_DEF_METHOD(devices, 0);
|
||||
RG_DEF_METHOD(event, 0);
|
||||
RG_DEF_METHOD(peek_event, 0);
|
||||
RG_DEF_METHOD(put_event, 1);
|
||||
RG_DEF_METHOD(set_double_click_time, 1);
|
||||
RG_DEF_METHOD(double_click_time, 0);
|
||||
RG_DEF_METHOD(button_click_time, 0);
|
||||
RG_DEF_METHOD(button_window, 0);
|
||||
RG_DEF_METHOD(button_number, 0);
|
||||
RG_DEF_METHOD_P(closed, 0);
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
RG_DEF_METHOD(button_x, 0);
|
||||
RG_DEF_METHOD(button_y, 0);
|
||||
RG_DEF_METHOD(set_double_click_distance, 1);
|
||||
RG_DEF_METHOD(double_click_distance, 0);
|
||||
#endif
|
||||
RG_DEF_METHOD(pointer, 0);
|
||||
RG_DEF_METHOD(window_at_pointer, 0);
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
RG_DEF_METHOD_P(supports_cursor_color, 0);
|
||||
RG_DEF_METHOD_P(supports_cursor_alpha, 0);
|
||||
RG_DEF_METHOD(default_cursor_size, 0);
|
||||
RG_DEF_METHOD(maximal_cursor_size, 0);
|
||||
RG_DEF_METHOD(default_group, 0);
|
||||
#endif
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
RG_DEF_METHOD_P(supports_selection_notification, 0);
|
||||
RG_DEF_METHOD_P(request_selection_notification, 1);
|
||||
RG_DEF_METHOD_P(supports_clipboard_persistence, 0);
|
||||
RG_DEF_METHOD(store_clipboard, 3);
|
||||
#endif
|
||||
RG_DEF_METHOD(core_pointer, 0);
|
||||
#if GTK_CHECK_VERSION(2,8,0)
|
||||
RG_DEF_METHOD(warp_pointer, 3);
|
||||
#endif
|
||||
|
||||
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
RG_DEF_METHOD(grab, 0);
|
||||
RG_DEF_METHOD(ungrab, 0);
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
RG_DEF_METHOD(register_standard_event_type, 2);
|
||||
#endif
|
||||
#if GTK_CHECK_VERSION(2,8,0)
|
||||
RG_DEF_METHOD(user_time, 0);
|
||||
RG_DEF_METHOD(set_cursor_theme, 2);
|
||||
#endif
|
||||
# if GTK_CHECK_VERSION(2, 12, 0)
|
||||
/*
|
||||
RG_DEF_METHOD(broadcast_startup_message, -1);
|
||||
*/
|
||||
RG_DEF_METHOD(startup_notification_id, 0);
|
||||
# endif
|
||||
G_DEF_CLASS3("GdkDisplayX11", "DisplayX11", mGdk);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if GTK_CHECK_VERSION(2,10,0)
|
||||
RG_DEF_METHOD_P(supports_shapes, 0);
|
||||
RG_DEF_METHOD_P(supports_input_shapes, 0);
|
||||
#endif
|
||||
#if GTK_CHECK_VERSION(2, 12, 0)
|
||||
RG_DEF_METHOD_P(supports_composite, 0);
|
||||
RG_DEF_METHOD(trigger_tooltip_query, 0);
|
||||
#endif
|
||||
}
|
||||
59
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkdisplaymanager.c
Normal file
59
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkdisplaymanager.c
Normal file
@@ -0,0 +1,59 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002-2006 Ruby-GNOME2 Project Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
|
||||
#define RG_TARGET_NAMESPACE cDisplayManager
|
||||
#define _SELF(obj) GDK_DISPLAY_MANAGER(RVAL2GOBJ(obj))
|
||||
|
||||
static VALUE
|
||||
rg_s_get(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_display_manager_get());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_displays(VALUE self)
|
||||
{
|
||||
return GSLIST2ARYF(gdk_display_manager_list_displays(_SELF(self)));
|
||||
}
|
||||
|
||||
/* Move to Gdk::Display.
|
||||
static VALUE
|
||||
gdkdisplaymanager_get_core_pointer(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_display_get_core_pointer(_SELF(self)));
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_gdk_display_manager(VALUE mGdk)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_DISPLAY_MANAGER, "DisplayManager", mGdk);
|
||||
|
||||
RG_DEF_SMETHOD(get, 0);
|
||||
RG_DEF_METHOD(displays, 0);
|
||||
#endif
|
||||
}
|
||||
304
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkdragcontext.c
Normal file
304
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkdragcontext.c
Normal file
@@ -0,0 +1,304 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cDragContext
|
||||
#define _SELF(self) (GDK_DRAG_CONTEXT(RVAL2GOBJ(self)))
|
||||
|
||||
static VALUE
|
||||
rg_protocol(VALUE self)
|
||||
{
|
||||
return GENUM2RVAL(_SELF(self)->protocol, GDK_TYPE_DRAG_PROTOCOL);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_source_p(VALUE self)
|
||||
{
|
||||
return CBOOL2RVAL(_SELF(self)->is_source);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_source_window(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(_SELF(self)->source_window);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_dest_window(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(_SELF(self)->dest_window);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_targets(VALUE self)
|
||||
{
|
||||
GList *list = _SELF(self)->targets, *cur;
|
||||
VALUE ary = rb_ary_new();
|
||||
|
||||
for (cur = list; cur != NULL; cur = cur->next) {
|
||||
rb_ary_push(ary, BOXED2RVAL((GdkAtom)cur->data, GDK_TYPE_ATOM));
|
||||
}
|
||||
return ary;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_actions(VALUE self)
|
||||
{
|
||||
return GFLAGS2RVAL(_SELF(self)->actions, GDK_TYPE_DRAG_ACTION);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_suggested_action(VALUE self)
|
||||
{
|
||||
return GFLAGS2RVAL(_SELF(self)->suggested_action, GDK_TYPE_DRAG_ACTION);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_action(VALUE self)
|
||||
{
|
||||
return GFLAGS2RVAL(_SELF(self)->action, GDK_TYPE_DRAG_ACTION);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_start_time(VALUE self)
|
||||
{
|
||||
return UINT2NUM(_SELF(self)->start_time);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self)
|
||||
{
|
||||
G_INITIALIZE(self, gdk_drag_context_new());
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_get_protocol(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
VALUE xid;
|
||||
GdkDragProtocol prot;
|
||||
GdkNativeWindow ret;
|
||||
|
||||
if (argc == 1) {
|
||||
rb_scan_args(argc, argv, "10", &xid);
|
||||
ret = gdk_drag_get_protocol(RVAL2GDKNATIVEWINDOW(xid), &prot);
|
||||
} else {
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
VALUE display;
|
||||
rb_scan_args(argc, argv, "20", &display, &xid);
|
||||
ret = gdk_drag_get_protocol_for_display(GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)),
|
||||
RVAL2GDKNATIVEWINDOW(xid), &prot);
|
||||
#else
|
||||
rb_warn("Not supported arguments for Gdk::Display in GTK+-2.0.x.");
|
||||
ret = gdk_drag_get_protocol(NUM2UINT(xid), &prot);
|
||||
#endif
|
||||
}
|
||||
|
||||
return rb_ary_new3(2, GENUM2RVAL(prot, GDK_TYPE_DRAG_PROTOCOL), GDKNATIVEWINDOW2RVAL(ret));
|
||||
}
|
||||
|
||||
/* Instance Methods */
|
||||
static VALUE
|
||||
rg_selection(VALUE self)
|
||||
{
|
||||
return BOXED2RVAL(gdk_drag_get_selection(_SELF(self)), GDK_TYPE_ATOM);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_drag_abort(VALUE self, VALUE time)
|
||||
{
|
||||
gdk_drag_abort(_SELF(self), NUM2UINT(time));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_drop_reply(VALUE self, VALUE ok, VALUE time)
|
||||
{
|
||||
gdk_drop_reply(_SELF(self), RVAL2CBOOL(ok), NUM2UINT(time));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_drag_drop(VALUE self, VALUE time)
|
||||
{
|
||||
gdk_drag_drop(_SELF(self), NUM2UINT(time));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_find_window(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE drag_window, x_root, y_root;
|
||||
GdkWindow *dest_window;
|
||||
GdkDragProtocol prot;
|
||||
|
||||
if (argc == 3) {
|
||||
rb_scan_args(argc, argv, "30", &drag_window, &x_root, &y_root);
|
||||
gdk_drag_find_window(_SELF(self),
|
||||
GDK_WINDOW(RVAL2GOBJ(drag_window)),
|
||||
NUM2INT(x_root), NUM2INT(y_root),
|
||||
&dest_window, &prot);
|
||||
} else {
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
VALUE screen;
|
||||
rb_scan_args(argc, argv, "40", &drag_window, &screen, &x_root, &y_root);
|
||||
gdk_drag_find_window_for_screen(_SELF(self),
|
||||
GDK_WINDOW(RVAL2GOBJ(drag_window)),
|
||||
GDK_SCREEN(RVAL2GOBJ(screen)),
|
||||
NUM2INT(x_root), NUM2INT(y_root),
|
||||
&dest_window, &prot);
|
||||
#else
|
||||
rb_raise(rb_eArgError, "Wrong number of arguments: %d", argc);
|
||||
#endif
|
||||
}
|
||||
|
||||
return rb_ary_new3(2, GOBJ2RVAL(dest_window),
|
||||
GENUM2RVAL(prot, GDK_TYPE_DRAG_PROTOCOL));
|
||||
}
|
||||
|
||||
struct rbgdk_rval2gdkatomglist_args {
|
||||
VALUE ary;
|
||||
long n;
|
||||
GList *result;
|
||||
};
|
||||
|
||||
static VALUE
|
||||
rbgdk_rval2gdkatomglist_body(VALUE value)
|
||||
{
|
||||
long i;
|
||||
struct rbgdk_rval2gdkatomglist_args *args = (struct rbgdk_rval2gdkatomglist_args *)value;
|
||||
|
||||
for (i = 0; i < args->n; i++)
|
||||
args->result = g_list_append(args->result, GINT_TO_POINTER(RVAL2ATOM(RARRAY_PTR(args->ary)[i])));
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static G_GNUC_NORETURN VALUE
|
||||
rbgdk_rval2gdkatomglist_rescue(VALUE value)
|
||||
{
|
||||
g_free(((struct rbgdk_rval2gdkatomglist_args *)value)->result);
|
||||
|
||||
rb_exc_raise(rb_errinfo());
|
||||
}
|
||||
|
||||
static GList *
|
||||
rbgdk_rval2gdkatomglist(VALUE value)
|
||||
{
|
||||
struct rbgdk_rval2gdkatomglist_args args;
|
||||
|
||||
args.ary = rb_ary_to_ary(value);
|
||||
args.n = RARRAY_LEN(args.ary);
|
||||
args.result = NULL;
|
||||
|
||||
rb_rescue(rbgdk_rval2gdkatomglist_body, (VALUE)&args,
|
||||
rbgdk_rval2gdkatomglist_rescue, (VALUE)&args);
|
||||
|
||||
return args.result;
|
||||
}
|
||||
|
||||
#define RVAL2GDKATOMGLIST(value) rbgdk_rval2gdkatomglist(value)
|
||||
|
||||
static VALUE
|
||||
rg_s_drag_begin(G_GNUC_UNUSED VALUE self, VALUE rbwindow, VALUE rbtargets)
|
||||
{
|
||||
GdkWindow *window = GDK_WINDOW(RVAL2GOBJ(rbwindow));
|
||||
GList *targets = RVAL2GDKATOMGLIST(rbtargets);
|
||||
GdkDragContext *result = gdk_drag_begin(window, targets);
|
||||
|
||||
g_list_free(targets);
|
||||
|
||||
return GOBJ2RVAL(result);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_drag_motion(VALUE self, VALUE dest_window, VALUE protocol, VALUE x_root, VALUE y_root, VALUE suggested_action, VALUE possible_actions, VALUE time)
|
||||
{
|
||||
gboolean ret = gdk_drag_motion(_SELF(self),
|
||||
GDK_WINDOW(RVAL2GOBJ(dest_window)),
|
||||
RVAL2GENUM(protocol, GDK_TYPE_DRAG_PROTOCOL),
|
||||
NUM2INT(x_root), NUM2INT(y_root),
|
||||
RVAL2GFLAGS(suggested_action, GDK_TYPE_DRAG_ACTION),
|
||||
RVAL2GFLAGS(possible_actions, GDK_TYPE_DRAG_ACTION),
|
||||
NUM2UINT(time));
|
||||
return CBOOL2RVAL(ret);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_drop_finish(VALUE self, VALUE success, VALUE time)
|
||||
{
|
||||
gdk_drop_finish(_SELF(self), RVAL2CBOOL(success), NUM2UINT(time));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_drag_status(VALUE self, VALUE action, VALUE time)
|
||||
{
|
||||
gdk_drag_status(_SELF(self),
|
||||
RVAL2GFLAGS(action, GDK_TYPE_DRAG_ACTION), NUM2UINT(time));
|
||||
return self;
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
static VALUE
|
||||
rg_drag_drop_succeeded_p(VALUE self)
|
||||
{
|
||||
return CBOOL2RVAL(gdk_drag_drop_succeeded(_SELF(self)));
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_gdk_dragcontext(VALUE mGdk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_DRAG_CONTEXT, "DragContext", mGdk);
|
||||
|
||||
RG_DEF_SMETHOD(get_protocol, -1);
|
||||
RG_DEF_SMETHOD(drag_begin, 1);
|
||||
|
||||
RG_DEF_METHOD(initialize, 0);
|
||||
RG_DEF_METHOD(protocol, 0);
|
||||
RG_DEF_METHOD_P(source, 0);
|
||||
RG_DEF_METHOD(source_window, 0);
|
||||
RG_DEF_METHOD(dest_window, 0);
|
||||
RG_DEF_METHOD(targets, 0);
|
||||
RG_DEF_METHOD(actions, 0);
|
||||
RG_DEF_METHOD(suggested_action, 0);
|
||||
RG_DEF_METHOD(action, 0);
|
||||
RG_DEF_METHOD(start_time, 0);
|
||||
|
||||
RG_DEF_METHOD(selection, 0);
|
||||
RG_DEF_METHOD(drag_abort, 1);
|
||||
RG_DEF_METHOD(drop_reply, 2);
|
||||
RG_DEF_METHOD(drag_drop, 1);
|
||||
RG_DEF_METHOD(find_window, 4);
|
||||
RG_DEF_METHOD(drag_motion, 7);
|
||||
RG_DEF_METHOD(drop_finish, 2);
|
||||
RG_DEF_METHOD(drag_status, 2);
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
RG_DEF_METHOD_P(drag_drop_succeeded, 0);
|
||||
#endif
|
||||
/* Constants */
|
||||
G_DEF_CLASS(GDK_TYPE_DRAG_PROTOCOL, "Protocol", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CLASS(GDK_TYPE_DRAG_ACTION, "Action", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_DRAG_PROTOCOL, "GDK_DRAG_");
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_DRAG_ACTION, "GDK_");
|
||||
}
|
||||
546
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkdraw.c
Normal file
546
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkdraw.c
Normal file
@@ -0,0 +1,546 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002-2005 Masao Mutoh
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
#include "rbpango.h"
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
#include <gdk/gdkx.h>
|
||||
#endif
|
||||
#ifdef HAVE_RB_CAIRO_H
|
||||
#include <rb_cairo.h>
|
||||
#endif
|
||||
|
||||
#define RG_TARGET_NAMESPACE cDrawable
|
||||
#define _SELF(s) GDK_DRAWABLE(RVAL2GOBJ(s))
|
||||
|
||||
static VALUE
|
||||
rg_visual(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(_SELF(self));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_colormap(VALUE self, VALUE colormap)
|
||||
{
|
||||
VALUE old_colormap;
|
||||
|
||||
old_colormap = GOBJ2RVAL(gdk_drawable_get_colormap(_SELF(self)));
|
||||
G_CHILD_REMOVE(self, old_colormap);
|
||||
|
||||
G_CHILD_ADD(self, colormap);
|
||||
gdk_drawable_set_colormap(_SELF(self), GDK_COLORMAP(RVAL2GOBJ(colormap)));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_colormap(VALUE self)
|
||||
{
|
||||
VALUE rb_colormap;
|
||||
|
||||
rb_colormap = GOBJ2RVAL(gdk_drawable_get_colormap(_SELF(self)));
|
||||
G_CHILD_ADD(self, rb_colormap);
|
||||
return rb_colormap;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_depth(VALUE self)
|
||||
{
|
||||
return INT2NUM(gdk_drawable_get_depth(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_size(VALUE self)
|
||||
{
|
||||
gint width, height;
|
||||
gdk_drawable_get_size(_SELF(self), &width, &height);
|
||||
return rb_ary_new3(2, INT2NUM(width), INT2NUM(height));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_clip_region(VALUE self)
|
||||
{
|
||||
return BOXED2RVAL(gdk_drawable_get_clip_region(_SELF(self)), GDK_TYPE_REGION);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_visible_region(VALUE self)
|
||||
{
|
||||
return BOXED2RVAL(gdk_drawable_get_visible_region(_SELF(self)), GDK_TYPE_REGION);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_draw_point(VALUE self, VALUE gc, VALUE x, VALUE y)
|
||||
{
|
||||
gdk_draw_point(_SELF(self), GDK_GC(RVAL2GOBJ(gc)),
|
||||
NUM2INT(x), NUM2INT(y));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_draw_points(VALUE self, VALUE rbgc, VALUE rbpoints)
|
||||
{
|
||||
GdkDrawable *drawable = _SELF(self);
|
||||
GdkGC *gc = GDK_GC(RVAL2GOBJ(rbgc));
|
||||
long n;
|
||||
GdkPoint *points = RVAL2GDKPOINTS(rbpoints, &n);
|
||||
|
||||
gdk_draw_points(drawable, gc, points, n);
|
||||
|
||||
g_free(points);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_draw_line(VALUE self, VALUE gc, VALUE x1, VALUE y1, VALUE x2, VALUE y2)
|
||||
{
|
||||
gdk_draw_line(_SELF(self), GDK_GC(RVAL2GOBJ(gc)),
|
||||
NUM2INT(x1), NUM2INT(y1),
|
||||
NUM2INT(x2), NUM2INT(y2));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_draw_lines(VALUE self, VALUE rbgc, VALUE rbpoints)
|
||||
{
|
||||
GdkDrawable *drawable = _SELF(self);
|
||||
GdkGC *gc = GDK_GC(RVAL2GOBJ(rbgc));
|
||||
long n;
|
||||
GdkPoint *points = RVAL2GDKPOINTS(rbpoints, &n);
|
||||
|
||||
gdk_draw_lines(drawable, gc, points, n);
|
||||
|
||||
g_free(points);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
static VALUE
|
||||
rg_draw_pixbuf(VALUE self, VALUE gc, VALUE pixbuf, VALUE src_x, VALUE src_y, VALUE dest_x, VALUE dest_y, VALUE width, VALUE height, VALUE dither, VALUE x_dither, VALUE y_dither)
|
||||
{
|
||||
gdk_draw_pixbuf(_SELF(self),
|
||||
GDK_GC(RVAL2GOBJ(gc)),
|
||||
GDK_PIXBUF(RVAL2GOBJ(pixbuf)),
|
||||
NUM2INT(src_x), NUM2INT(src_y),
|
||||
NUM2INT(dest_x), NUM2INT(dest_y),
|
||||
NUM2INT(width), NUM2INT(height),
|
||||
RVAL2GENUM(dither, GDK_TYPE_RGB_DITHER),
|
||||
NUM2INT(x_dither), NUM2INT(y_dither));
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
struct rbgdk_rval2gdksegments_args {
|
||||
VALUE ary;
|
||||
long n;
|
||||
GdkSegment *result;
|
||||
};
|
||||
|
||||
static VALUE
|
||||
rbgdk_rval2gdksegments_body(VALUE value)
|
||||
{
|
||||
long i;
|
||||
struct rbgdk_rval2gdksegments_args *args = (struct rbgdk_rval2gdksegments_args *)value;
|
||||
|
||||
for (i = 0; i < args->n; i++) {
|
||||
VALUE segments = rb_ary_to_ary(RARRAY_PTR(args->ary)[i]);
|
||||
|
||||
if (RARRAY_LEN(segments) != 2)
|
||||
rb_raise(rb_eArgError, "segment %ld should be array of size 4", i);
|
||||
|
||||
args->result[i].x1 = NUM2INT(RARRAY_PTR(segments)[0]);
|
||||
args->result[i].y1 = NUM2INT(RARRAY_PTR(segments)[1]);
|
||||
args->result[i].x2 = NUM2INT(RARRAY_PTR(segments)[2]);
|
||||
args->result[i].y2 = NUM2INT(RARRAY_PTR(segments)[3]);
|
||||
}
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static G_GNUC_NORETURN VALUE
|
||||
rbgdk_rval2gdksegments_rescue(VALUE value)
|
||||
{
|
||||
g_free(((struct rbgdk_rval2gdksegments_args *)value)->result);
|
||||
|
||||
rb_exc_raise(rb_errinfo());
|
||||
}
|
||||
|
||||
static GdkSegment *
|
||||
rbgdk_rval2gdksegments(VALUE value, long *n)
|
||||
{
|
||||
struct rbgdk_rval2gdksegments_args args;
|
||||
|
||||
args.ary = rb_ary_to_ary(value);
|
||||
args.n = RARRAY_LEN(args.ary);
|
||||
args.result = g_new(GdkSegment, args.n + 1);
|
||||
|
||||
rb_rescue(rbgdk_rval2gdksegments_body, (VALUE)&args,
|
||||
rbgdk_rval2gdksegments_rescue, (VALUE)&args);
|
||||
|
||||
if (n != NULL)
|
||||
*n = args.n;
|
||||
|
||||
return args.result;
|
||||
}
|
||||
|
||||
#define RVAL2GDKSEGMENTS(value, n) rbgdk_rval2gdksegments(value, n)
|
||||
|
||||
static VALUE
|
||||
rg_draw_segments(VALUE self, VALUE rbgc, VALUE rbsegments)
|
||||
{
|
||||
GdkDrawable *drawable = _SELF(self);
|
||||
GdkGC *gc = GDK_GC(RVAL2GOBJ(rbgc));
|
||||
long n;
|
||||
GdkSegment *segments = RVAL2GDKSEGMENTS(rbsegments, &n);
|
||||
|
||||
gdk_draw_segments(drawable, gc, segments, n);
|
||||
|
||||
g_free(segments);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_draw_rectangle(VALUE self, VALUE gc, VALUE filled, VALUE x, VALUE y, VALUE w, VALUE h)
|
||||
{
|
||||
gdk_draw_rectangle(_SELF(self), GDK_GC(RVAL2GOBJ(gc)),
|
||||
RVAL2CBOOL(filled),
|
||||
NUM2INT(x), NUM2INT(y),
|
||||
NUM2INT(w), NUM2INT(h));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_draw_arc(VALUE self, VALUE gc, VALUE filled, VALUE x, VALUE y, VALUE w, VALUE h, VALUE a1, VALUE a2)
|
||||
{
|
||||
gdk_draw_arc(_SELF(self), GDK_GC(RVAL2GOBJ(gc)),
|
||||
RVAL2CBOOL(filled),
|
||||
NUM2INT(x), NUM2INT(y),
|
||||
NUM2INT(w), NUM2INT(h),
|
||||
NUM2INT(a1), NUM2INT(a2));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_draw_polygon(VALUE self, VALUE rbgc, VALUE rbfilled, VALUE rbpoints)
|
||||
{
|
||||
GdkDrawable *drawable = _SELF(self);
|
||||
GdkGC *gc = GDK_GC(RVAL2GOBJ(rbgc));
|
||||
gboolean filled = RVAL2CBOOL(rbfilled);
|
||||
long n;
|
||||
GdkPoint *points = RVAL2GDKPOINTS(rbpoints, &n);
|
||||
|
||||
gdk_draw_polygon(drawable, gc, filled, points, n);
|
||||
|
||||
g_free(points);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
/*
|
||||
trapezoids = [[y1, x11, x21, y2, x12, x22], ...]
|
||||
*/
|
||||
struct rbgdk_rval2gdktrapezoids_args {
|
||||
VALUE ary;
|
||||
long n;
|
||||
GdkTrapezoid *result;
|
||||
};
|
||||
|
||||
static VALUE
|
||||
rbgdk_rval2gdktrapezoids_body(VALUE value)
|
||||
{
|
||||
long i;
|
||||
struct rbgdk_rval2gdktrapezoids_args *args = (struct rbgdk_rval2gdktrapezoids_args *)value;
|
||||
|
||||
for (i = 0; i < args->n; i++) {
|
||||
VALUE trapezoids = rb_ary_to_ary(RARRAY_PTR(args->ary)[i]);
|
||||
|
||||
if (RARRAY_LEN(trapezoids) != 6)
|
||||
rb_raise(rb_eArgError, "trapezoid %ld should be array of size 6", i);
|
||||
|
||||
args->result[i].y1 = NUM2DBL(RARRAY_PTR(trapezoids)[0]);
|
||||
args->result[i].x11 = NUM2DBL(RARRAY_PTR(trapezoids)[1]);
|
||||
args->result[i].x21 = NUM2DBL(RARRAY_PTR(trapezoids)[2]);
|
||||
args->result[i].y2 = NUM2DBL(RARRAY_PTR(trapezoids)[3]);
|
||||
args->result[i].x12 = NUM2DBL(RARRAY_PTR(trapezoids)[4]);
|
||||
args->result[i].x22 = NUM2DBL(RARRAY_PTR(trapezoids)[5]);
|
||||
}
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static G_GNUC_NORETURN VALUE
|
||||
rbgdk_rval2gdktrapezoids_rescue(VALUE value)
|
||||
{
|
||||
g_free(((struct rbgdk_rval2gdktrapezoids_args *)value)->result);
|
||||
|
||||
rb_exc_raise(rb_errinfo());
|
||||
}
|
||||
|
||||
static GdkTrapezoid *
|
||||
rbgdk_rval2gdktrapezoids(VALUE value, long *n)
|
||||
{
|
||||
struct rbgdk_rval2gdktrapezoids_args args;
|
||||
|
||||
args.ary = rb_ary_to_ary(value);
|
||||
args.n = RARRAY_LEN(args.ary);
|
||||
args.result = g_new(GdkTrapezoid, args.n + 1);
|
||||
|
||||
rb_rescue(rbgdk_rval2gdktrapezoids_body, (VALUE)&args,
|
||||
rbgdk_rval2gdktrapezoids_rescue, (VALUE)&args);
|
||||
|
||||
if (n != NULL)
|
||||
*n = args.n;
|
||||
|
||||
return args.result;
|
||||
}
|
||||
|
||||
#define RVAL2GDKTRAPEZOIDS(value, n) rbgdk_rval2gdktrapezoids(value, n)
|
||||
|
||||
static VALUE
|
||||
rg_draw_trapezoids(VALUE self, VALUE rbgc, VALUE rbtrapezoids)
|
||||
{
|
||||
GdkDrawable *drawable = _SELF(self);
|
||||
GdkGC *gc = GDK_GC(RVAL2GOBJ(rbgc));
|
||||
long n;
|
||||
GdkTrapezoid *trapezoids = RVAL2GDKTRAPEZOIDS(rbtrapezoids, &n);
|
||||
|
||||
gdk_draw_trapezoids(drawable, gc, trapezoids, n);
|
||||
|
||||
g_free(trapezoids);
|
||||
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
rg_draw_glyphs(VALUE self, VALUE gc, VALUE font, VALUE x, VALUE y, VALUE glyphs)
|
||||
{
|
||||
gdk_draw_glyphs(_SELF(self), GDK_GC(RVAL2GOBJ(gc)), PANGO_FONT(RVAL2GOBJ(font)),
|
||||
NUM2INT(x), NUM2INT(y),
|
||||
(PangoGlyphString*)(RVAL2BOXED(glyphs, PANGO_TYPE_GLYPH_STRING)));
|
||||
return self;
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
static VALUE
|
||||
rg_draw_glyphs_transformed(VALUE self, VALUE gc, VALUE matrix, VALUE font, VALUE x, VALUE y, VALUE glyphs)
|
||||
{
|
||||
gdk_draw_glyphs_transformed(_SELF(self), GDK_GC(RVAL2GOBJ(gc)),
|
||||
NIL_P(matrix) ? (PangoMatrix*)NULL : (PangoMatrix*)(RVAL2BOXED(matrix, PANGO_TYPE_MATRIX)),
|
||||
PANGO_FONT(RVAL2GOBJ(font)),
|
||||
NUM2INT(x), NUM2INT(y),
|
||||
(PangoGlyphString*)(RVAL2BOXED(glyphs, PANGO_TYPE_GLYPH_STRING)));
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
rg_draw_layout_line(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE gc, x, y, line, fg, bg;
|
||||
|
||||
rb_scan_args(argc, argv, "42", &gc, &x, &y, &line, &fg, &bg);
|
||||
|
||||
gdk_draw_layout_line_with_colors(_SELF(self), GDK_GC(RVAL2GOBJ(gc)),
|
||||
NUM2INT(x), NUM2INT(y),
|
||||
(PangoLayoutLine*)RVAL2BOXED(line, PANGO_TYPE_LAYOUT_LINE),
|
||||
RVAL2GDKCOLOR(fg),
|
||||
RVAL2GDKCOLOR(bg));
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_draw_layout(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE gc, x, y, layout, fg, bg;
|
||||
|
||||
rb_scan_args(argc, argv, "42", &gc, &x, &y, &layout, &fg, &bg);
|
||||
|
||||
gdk_draw_layout_with_colors(_SELF(self), GDK_GC(RVAL2GOBJ(gc)),
|
||||
NUM2INT(x), NUM2INT(y), PANGO_LAYOUT(RVAL2GOBJ(layout)),
|
||||
RVAL2GDKCOLOR(fg),
|
||||
RVAL2GDKCOLOR(bg));
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_draw_drawable(VALUE self, VALUE gc, VALUE src, VALUE xsrc, VALUE ysrc, VALUE xdst, VALUE ydst, VALUE w, VALUE h)
|
||||
{
|
||||
gdk_draw_drawable(_SELF(self), GDK_GC(RVAL2GOBJ(gc)), _SELF(src),
|
||||
NUM2INT(xsrc), NUM2INT(ysrc),
|
||||
NUM2INT(xdst), NUM2INT(ydst),
|
||||
NUM2INT(w), NUM2INT(h));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_draw_image(VALUE self, VALUE gc, VALUE image, VALUE xsrc, VALUE ysrc, VALUE xdst, VALUE ydst, VALUE w, VALUE h)
|
||||
{
|
||||
gdk_draw_image(_SELF(self), GDK_GC(RVAL2GOBJ(gc)),
|
||||
GDK_IMAGE(RVAL2GOBJ(image)),
|
||||
NUM2INT(xsrc), NUM2INT(ysrc),
|
||||
NUM2INT(xdst), NUM2INT(ydst),
|
||||
NUM2INT(w), NUM2INT(h));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_get_image(VALUE self, VALUE x, VALUE y, VALUE w, VALUE h)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_drawable_get_image(_SELF(self),
|
||||
NUM2INT(x), NUM2INT(y),
|
||||
NUM2INT(w), NUM2INT(h)));
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
static VALUE
|
||||
rg_copy_to_image(VALUE self, VALUE image, VALUE xsrc, VALUE ysrc, VALUE xdst, VALUE ydst, VALUE w, VALUE h)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_drawable_copy_to_image(_SELF(self),
|
||||
GDK_IMAGE(RVAL2GOBJ(image)),
|
||||
NUM2INT(xsrc), NUM2INT(ysrc),
|
||||
NUM2INT(xdst), NUM2INT(ydst),
|
||||
NUM2INT(w), NUM2INT(h)));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
static VALUE
|
||||
rg_xid(VALUE self)
|
||||
{
|
||||
return ULONG2NUM(GDK_DRAWABLE_XID(_SELF(self)));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef GDK_WINDOWING_WIN32
|
||||
static VALUE
|
||||
rg_handle(VALUE self)
|
||||
{
|
||||
HGDIOBJ handle;
|
||||
handle = gdk_win32_drawable_get_handle(_SELF(self));
|
||||
return ULONG2NUM(GPOINTER_TO_UINT(handle));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
static VALUE
|
||||
rg_display(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_drawable_get_display(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_screen(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_drawable_get_screen(_SELF(self)));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GTK_CHECK_VERSION(2,8,0)
|
||||
# ifdef HAVE_RB_CAIRO_H
|
||||
static VALUE
|
||||
rg_create_cairo_context(VALUE self)
|
||||
{
|
||||
VALUE rb_cr;
|
||||
cairo_t *cr;
|
||||
cr = gdk_cairo_create(_SELF(self));
|
||||
rb_cairo_check_status(cairo_status(cr));
|
||||
rb_cr = CRCONTEXT2RVAL(cr);
|
||||
cairo_destroy (cr);
|
||||
return rb_cr;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_gdk_draw(VALUE mGdk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_DRAWABLE, "Drawable", mGdk);
|
||||
|
||||
RG_DEF_METHOD(visual, 0);
|
||||
RG_DEF_METHOD(set_colormap, 1);
|
||||
RG_DEF_METHOD(colormap, 0);
|
||||
RG_DEF_METHOD(depth, 0);
|
||||
RG_DEF_METHOD(size, 0);
|
||||
RG_DEF_METHOD(clip_region, 0);
|
||||
RG_DEF_METHOD(visible_region, 0);
|
||||
RG_DEF_METHOD(draw_point, 3);
|
||||
RG_DEF_METHOD(draw_points, 2);
|
||||
RG_DEF_METHOD(draw_line, 5);
|
||||
RG_DEF_METHOD(draw_lines, 2);
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
RG_DEF_METHOD(draw_pixbuf, 11);
|
||||
#endif
|
||||
RG_DEF_METHOD(draw_segments, 2);
|
||||
RG_DEF_METHOD(draw_rectangle, 6);
|
||||
RG_DEF_METHOD(draw_arc, 8);
|
||||
RG_DEF_METHOD(draw_polygon, 3);
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
RG_DEF_METHOD(draw_trapezoids, 2);
|
||||
#endif
|
||||
RG_DEF_METHOD(draw_glyphs, 5);
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
RG_DEF_METHOD(draw_glyphs_transformed, 6);
|
||||
#endif
|
||||
RG_DEF_METHOD(draw_layout_line, -1);
|
||||
RG_DEF_METHOD(draw_layout, -1);
|
||||
RG_DEF_METHOD(draw_drawable, 8);
|
||||
RG_DEF_METHOD(draw_image, 8);
|
||||
RG_DEF_METHOD(get_image, 4);
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
RG_DEF_METHOD(copy_to_image, 7);
|
||||
#endif
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
RG_DEF_METHOD(xid, 0);
|
||||
#endif
|
||||
#ifdef GDK_WINDOWING_WIN32
|
||||
RG_DEF_METHOD(handle, 0);
|
||||
#endif
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
RG_DEF_METHOD(display, 0);
|
||||
RG_DEF_METHOD(screen, 0);
|
||||
#endif
|
||||
|
||||
#if GTK_CHECK_VERSION(2,8,0)
|
||||
# ifdef HAVE_RB_CAIRO_H
|
||||
RG_DEF_METHOD(create_cairo_context, 0);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
G_DEF_CLASS3("GdkDrawableImplX11", "DrawableImplX11", mGdk);
|
||||
#elif defined(GDK_WINDOWING_WIN32)
|
||||
G_DEF_CLASS3("GdkDrawableImplWin32", "DrawableImplWin32", mGdk);
|
||||
#elif defined(GDK_WINDOWING_FB)
|
||||
G_DEF_CLASS3("GdkDrawableFB", "DrawableFB", mGdk);
|
||||
#endif
|
||||
|
||||
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
||||
}
|
||||
981
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkevent.c
Normal file
981
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkevent.c
Normal file
@@ -0,0 +1,981 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002-2004 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#if GTK_CHECK_VERSION(2,8,0)
|
||||
static VALUE gdkevents[36];
|
||||
#elif GTK_CHECK_VERSION(2,6,0)
|
||||
static VALUE gdkevents[35];
|
||||
#else
|
||||
static VALUE gdkevents[34];
|
||||
#endif
|
||||
|
||||
/***********************************************/
|
||||
|
||||
VALUE
|
||||
make_gdkevent(GdkEvent *ev)
|
||||
{
|
||||
VALUE obj;
|
||||
if (ev == NULL) return Qnil;
|
||||
|
||||
obj = BOXED2RVAL(ev, GDK_TYPE_EVENT);
|
||||
RBASIC(obj)->klass = gdkevents[ev->type]; /* hack */
|
||||
return obj;
|
||||
}
|
||||
|
||||
GdkEvent*
|
||||
get_gdkevent(VALUE event)
|
||||
{
|
||||
return NIL_P(event) ? NULL : RVAL2BOXED(event, GDK_TYPE_EVENT);
|
||||
}
|
||||
|
||||
/***********************************************/
|
||||
#define ATTR_STR(type, name)\
|
||||
static VALUE \
|
||||
gdkevent ## type ## _ ## name (VALUE self)\
|
||||
{\
|
||||
return CSTR2RVAL(get_gdkevent(self)->type.name);\
|
||||
}\
|
||||
static VALUE \
|
||||
gdkevent ## type ## _set_ ## name (VALUE self, VALUE val)\
|
||||
{\
|
||||
get_gdkevent(self)->type.name = (gchar *)RVAL2CSTR(val);\
|
||||
return self;\
|
||||
}
|
||||
|
||||
#define ATTR_INT(type, name)\
|
||||
static VALUE \
|
||||
gdkevent ## type ## _ ## name (VALUE self)\
|
||||
{\
|
||||
return INT2NUM(get_gdkevent(self)->type.name);\
|
||||
}\
|
||||
static VALUE \
|
||||
gdkevent ## type ## _set_ ## name (VALUE self, VALUE val)\
|
||||
{\
|
||||
get_gdkevent(self)->type.name = NUM2INT(val);\
|
||||
return self;\
|
||||
}
|
||||
|
||||
#define ATTR_UINT(type, name)\
|
||||
static VALUE \
|
||||
gdkevent ## type ## _ ## name (VALUE self)\
|
||||
{\
|
||||
return UINT2NUM(get_gdkevent(self)->type.name);\
|
||||
}\
|
||||
static VALUE \
|
||||
gdkevent ## type ## _set_ ## name (VALUE self, VALUE val)\
|
||||
{\
|
||||
get_gdkevent(self)->type.name = NUM2UINT(val);\
|
||||
return self;\
|
||||
}
|
||||
|
||||
#define ATTR_GDKNATIVEWINDOW(type, name)\
|
||||
static VALUE \
|
||||
gdkevent ## type ## _ ## name (VALUE self)\
|
||||
{\
|
||||
return GDKNATIVEWINDOW2RVAL(get_gdkevent(self)->type.name);\
|
||||
}\
|
||||
static VALUE \
|
||||
gdkevent ## type ## _set_ ## name (VALUE self, VALUE val)\
|
||||
{\
|
||||
get_gdkevent(self)->type.name = RVAL2GDKNATIVEWINDOW(val);\
|
||||
return self;\
|
||||
}
|
||||
|
||||
#define ATTR_FLOAT(type, name)\
|
||||
static VALUE \
|
||||
gdkevent ## type ## _ ## name (VALUE self)\
|
||||
{\
|
||||
return rb_float_new(get_gdkevent(self)->type.name);\
|
||||
}\
|
||||
static VALUE \
|
||||
gdkevent ## type ## _set_ ## name (VALUE self, VALUE val)\
|
||||
{\
|
||||
get_gdkevent(self)->type.name = NUM2DBL(val);\
|
||||
return self;\
|
||||
}
|
||||
|
||||
#define ATTR_GOBJ(type, name)\
|
||||
static VALUE \
|
||||
gdkevent ## type ## _ ## name (VALUE self)\
|
||||
{\
|
||||
return GOBJ2RVAL(get_gdkevent(self)->type.name);\
|
||||
}\
|
||||
static VALUE \
|
||||
gdkevent ## type ## _set_ ## name (VALUE self, VALUE val)\
|
||||
{\
|
||||
GdkEvent *event;\
|
||||
event = get_gdkevent(self);\
|
||||
if (event->type.name)\
|
||||
g_object_unref(event->type.name);\
|
||||
event->type.name = RVAL2GOBJ(val);\
|
||||
if (event->type.name)\
|
||||
g_object_ref(event->type.name);\
|
||||
return self;\
|
||||
}
|
||||
|
||||
#define ATTR_BOOL(type, name)\
|
||||
static VALUE \
|
||||
gdkevent ## type ## _ ## name (VALUE self)\
|
||||
{\
|
||||
return CBOOL2RVAL(get_gdkevent(self)->type.name);\
|
||||
}\
|
||||
static VALUE \
|
||||
gdkevent ## type ## _set_ ## name (VALUE self, VALUE val)\
|
||||
{\
|
||||
get_gdkevent(self)->type.name = RVAL2CBOOL(val);\
|
||||
return self;\
|
||||
}
|
||||
|
||||
#define ATTR_ATOM(type, name)\
|
||||
static VALUE \
|
||||
gdkevent ## type ## _ ## name (VALUE self)\
|
||||
{\
|
||||
GdkAtom atom = get_gdkevent(self)->type.name;\
|
||||
return BOXED2RVAL(atom, GDK_TYPE_ATOM);\
|
||||
}\
|
||||
static VALUE \
|
||||
gdkevent ## type ## _set_ ## name (VALUE self, VALUE val)\
|
||||
{\
|
||||
get_gdkevent(self)->type.name = RVAL2ATOM(val);\
|
||||
return self;\
|
||||
}
|
||||
|
||||
#define ATTR_FLAGS(type, name, gtype)\
|
||||
static VALUE \
|
||||
gdkevent ## type ## _ ## name (VALUE self)\
|
||||
{\
|
||||
return GFLAGS2RVAL(get_gdkevent(self)->type.name, gtype);\
|
||||
}\
|
||||
static VALUE \
|
||||
gdkevent ## type ## _set_ ## name (VALUE self, VALUE val)\
|
||||
{\
|
||||
get_gdkevent(self)->type.name = RVAL2GFLAGS(val, gtype);\
|
||||
return self;\
|
||||
}
|
||||
|
||||
#define ATTR_ENUM(type, name, gtype)\
|
||||
static VALUE \
|
||||
gdkevent ## type ## _ ## name (VALUE self)\
|
||||
{\
|
||||
return GENUM2RVAL(get_gdkevent(self)->type.name, gtype);\
|
||||
}\
|
||||
static VALUE \
|
||||
gdkevent ## type ## _set_ ## name (VALUE self, VALUE val)\
|
||||
{\
|
||||
get_gdkevent(self)->type.name = RVAL2GENUM(val, gtype);\
|
||||
return self;\
|
||||
}
|
||||
|
||||
#define ATTR_AXES(type, gdkklass) \
|
||||
static VALUE \
|
||||
gdkevent ##type ## _axes(VALUE self)\
|
||||
{\
|
||||
gdkklass type = get_gdkevent(self)->type;\
|
||||
return type.axes ? rb_ary_new3(2, \
|
||||
rb_float_new(type.axes[0]),\
|
||||
rb_float_new(type.axes[1])) : Qnil;\
|
||||
} \
|
||||
static VALUE \
|
||||
gdkevent ## type ## _set_axes(VALUE self, VALUE x, VALUE y)\
|
||||
{\
|
||||
gdkklass val = get_gdkevent(self)->type;\
|
||||
val.axes[0] = NUM2DBL(x);\
|
||||
val.axes[1] = NUM2DBL(y);\
|
||||
return self;\
|
||||
}
|
||||
|
||||
#define DEFINE_ACCESSOR(event, type, name) \
|
||||
rb_define_method(event, G_STRINGIFY(name), gdkevent ## type ## _## name, 0);\
|
||||
rb_define_method(event, G_STRINGIFY(set_ ## name), gdkevent ## type ## _set_## name, 1);
|
||||
|
||||
|
||||
/* initialize */
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
#define GDKEVENT_INIT(type, default_gtype) \
|
||||
static VALUE \
|
||||
gdkevent ## type ## _initialize(int argc, VALUE *argv, VALUE self)\
|
||||
{\
|
||||
VALUE type;\
|
||||
GdkEventType gtype;\
|
||||
\
|
||||
rb_scan_args(argc, argv, "01", &type);\
|
||||
if (NIL_P(type)){\
|
||||
gtype = default_gtype;\
|
||||
} else {\
|
||||
gtype = RVAL2GENUM(type, GDK_TYPE_EVENT_TYPE);\
|
||||
}\
|
||||
\
|
||||
G_INITIALIZE(self, gdk_event_new(gtype));\
|
||||
return Qnil;\
|
||||
}
|
||||
#else
|
||||
#define GDKEVENT_INIT(type, default_gtype) \
|
||||
static VALUE \
|
||||
gdkevent ## type ## _initialize(int argc, VALUE *argv, VALUE self)\
|
||||
{\
|
||||
rb_raise(rb_eRuntimeError, "Gdk::Event.new is not supported in this environment.");\
|
||||
return Qnil;\
|
||||
}
|
||||
#endif
|
||||
|
||||
#define DEFINE_INIT(event, type) \
|
||||
rb_define_method(event, "initialize", gdkevent ## type ## _initialize, -1);
|
||||
|
||||
/***********************************************/
|
||||
|
||||
/* GdkEvent Singleton Methods */
|
||||
static VALUE
|
||||
gdkevent_s_events_pending(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return CBOOL2RVAL(gdk_events_pending());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
gdkevent_s_peek(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return make_gdkevent(gdk_event_peek());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
gdkevent_s_get(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return make_gdkevent(gdk_event_get());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
gdkevent_s_get_graphics_expose(G_GNUC_UNUSED VALUE self, VALUE window)
|
||||
{
|
||||
return make_gdkevent(gdk_event_get_graphics_expose(GDK_WINDOW(RVAL2GOBJ(window))));
|
||||
}
|
||||
|
||||
/* GdkEvent */
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
static VALUE
|
||||
gdkevent_initialize(VALUE self, VALUE type)
|
||||
{
|
||||
GdkEventType gtype = RVAL2GENUM(type, GDK_TYPE_EVENT_TYPE);
|
||||
if (RBASIC(self)->klass != gdkevents[gtype])
|
||||
rb_raise(rb_eArgError, "Wrong event type for this class.");
|
||||
|
||||
G_INITIALIZE(self, gdk_event_new(gtype));
|
||||
return Qnil;
|
||||
}
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
gdkevent_type(VALUE self)
|
||||
{
|
||||
return GENUM2RVAL(get_gdkevent(self)->type, GDK_TYPE_EVENT_TYPE);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
gdkevent_put(VALUE self)
|
||||
{
|
||||
gdk_event_put(get_gdkevent(self));
|
||||
return self;
|
||||
}
|
||||
|
||||
/* We don't need this.
|
||||
gdk_event_get_time();
|
||||
gboolean gdk_event_get_state (GdkEvent *event,
|
||||
GdkModifierType *state);
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
gdkevent_get_axis(VALUE self, VALUE axis_use)
|
||||
{
|
||||
gdouble value;
|
||||
gboolean ret = gdk_event_get_axis(get_gdkevent(self),
|
||||
RVAL2GENUM(axis_use, GDK_TYPE_AXIS_USE), &value);
|
||||
return ret ? rb_float_new(value) : Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
gdkevent_get_coords(VALUE self)
|
||||
{
|
||||
gdouble x_win, y_win;
|
||||
gboolean ret = gdk_event_get_coords(get_gdkevent(self), &x_win, &y_win);
|
||||
|
||||
return ret ? rb_ary_new3(2, rb_float_new(x_win), rb_float_new(y_win)) : Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
gdkevent_get_root_coords(VALUE self)
|
||||
{
|
||||
gdouble x_root, y_root;
|
||||
gboolean ret = gdk_event_get_root_coords(get_gdkevent(self), &x_root, &y_root);
|
||||
|
||||
return ret ? rb_ary_new3(2, rb_float_new(x_root), rb_float_new(y_root)) : Qnil;
|
||||
}
|
||||
|
||||
static void
|
||||
handler_func(GdkEvent *event, gpointer func)
|
||||
{
|
||||
rb_funcall((VALUE)func, id_call, 1, make_gdkevent(event));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
gdkevent_s_handler_set(VALUE self)
|
||||
{
|
||||
volatile VALUE func = rb_block_proc();
|
||||
G_RELATIVE(self, func);
|
||||
|
||||
gdk_event_handler_set((GdkEventFunc)handler_func, (gpointer)func, NULL);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
gdkevent_s_get_show_events(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return CBOOL2RVAL(gdk_get_show_events());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
gdkevent_s_set_show_events(VALUE self, VALUE show_events)
|
||||
{
|
||||
gdk_set_show_events(RVAL2CBOOL(show_events));
|
||||
return self;
|
||||
}
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
static VALUE
|
||||
gdkevent_set_screen(VALUE self, VALUE screen)
|
||||
{
|
||||
gdk_event_set_screen(get_gdkevent(self), GDK_SCREEN(RVAL2GOBJ(screen)));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
gdkevent_screen(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_event_get_screen(get_gdkevent(self)));
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
type: String, Integer, Gdk::Color.
|
||||
*/
|
||||
static VALUE
|
||||
gdkevent_s_setting_get(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
VALUE name, type;
|
||||
GType gtype;
|
||||
GValue val = G_VALUE_INIT;
|
||||
gboolean ret;
|
||||
VALUE value;
|
||||
|
||||
rb_scan_args(argc, argv, "11", &name, &type);
|
||||
if (NIL_P(type))
|
||||
gtype = G_TYPE_STRING;
|
||||
else
|
||||
gtype = CLASS2GTYPE(type);
|
||||
|
||||
g_value_init(&val, gtype);
|
||||
ret = gdk_setting_get(RVAL2CSTR(name), &val);
|
||||
|
||||
value = ret ? GVAL2RVAL(&val) : Qnil;
|
||||
g_value_unset(&val);
|
||||
return value;
|
||||
}
|
||||
|
||||
/* GdkEventAny */
|
||||
ATTR_GOBJ(any, window);
|
||||
ATTR_BOOL(any, send_event);
|
||||
|
||||
/* GdkEventKey */
|
||||
ATTR_UINT(key, time);
|
||||
ATTR_FLAGS(key, state, GDK_TYPE_MODIFIER_TYPE);
|
||||
ATTR_INT(key, keyval);
|
||||
ATTR_UINT(key, hardware_keycode);
|
||||
ATTR_UINT(key, group);
|
||||
|
||||
/* GdkEventButton */
|
||||
ATTR_UINT(button, time);
|
||||
ATTR_FLOAT(button, x);
|
||||
ATTR_FLOAT(button, y);
|
||||
ATTR_AXES(button, GdkEventButton);
|
||||
ATTR_INT(button, button);
|
||||
ATTR_FLAGS(button, state, GDK_TYPE_MODIFIER_TYPE);
|
||||
ATTR_GOBJ(button, device);
|
||||
ATTR_FLOAT(button, x_root);
|
||||
ATTR_FLOAT(button, y_root);
|
||||
|
||||
/* GdkEventScroll */
|
||||
ATTR_UINT(scroll, time);
|
||||
ATTR_FLOAT(scroll, x);
|
||||
ATTR_FLOAT(scroll, y);
|
||||
ATTR_FLAGS(scroll, state, GDK_TYPE_MODIFIER_TYPE);
|
||||
ATTR_ENUM(scroll, direction, GDK_TYPE_SCROLL_DIRECTION);
|
||||
ATTR_GOBJ(scroll, device);
|
||||
ATTR_FLOAT(scroll, x_root);
|
||||
ATTR_FLOAT(scroll, y_root);
|
||||
GDKEVENT_INIT(scroll, GDK_SCROLL);
|
||||
|
||||
/* GdkEventMotion */
|
||||
ATTR_UINT(motion, time);
|
||||
ATTR_FLOAT(motion, x);
|
||||
ATTR_FLOAT(motion, y);
|
||||
ATTR_AXES(motion, GdkEventMotion);
|
||||
ATTR_FLOAT(motion, x_root);
|
||||
ATTR_FLOAT(motion, y_root);
|
||||
ATTR_FLAGS(motion, state, GDK_TYPE_MODIFIER_TYPE);
|
||||
ATTR_BOOL(motion, is_hint);
|
||||
ATTR_GOBJ(motion, device);
|
||||
GDKEVENT_INIT(motion, GDK_MOTION_NOTIFY);
|
||||
|
||||
#if GTK_CHECK_VERSION(2, 12, 0)
|
||||
static VALUE
|
||||
gdkeventmotion_request_motions(VALUE self)
|
||||
{
|
||||
gdk_event_request_motions(&(get_gdkevent(self)->motion));
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* GdkEventExpose */
|
||||
static VALUE
|
||||
gdkeventexpose_area(VALUE self)
|
||||
{
|
||||
return BOXED2RVAL(&get_gdkevent(self)->expose.area, GDK_TYPE_RECTANGLE);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
gdkeventexpose_set_area(VALUE self, VALUE rect)
|
||||
{
|
||||
GdkRectangle* grect = (GdkRectangle*)RVAL2BOXED(rect, GDK_TYPE_RECTANGLE);
|
||||
GdkEventExpose event = get_gdkevent(self)->expose;
|
||||
event.area.x = grect->x;
|
||||
event.area.y = grect->y;
|
||||
event.area.width = grect->width;
|
||||
event.area.height = grect->height;
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
gdkeventexpose_region(VALUE self)
|
||||
{
|
||||
return BOXED2RVAL(get_gdkevent(self)->expose.region, GDK_TYPE_REGION);
|
||||
}
|
||||
static VALUE
|
||||
gdkeventexpose_set_region(VALUE self, VALUE region)
|
||||
{
|
||||
get_gdkevent(self)->expose.region = RVAL2BOXED(region, GDK_TYPE_REGION);
|
||||
return self;
|
||||
}
|
||||
|
||||
ATTR_INT(expose, count);
|
||||
GDKEVENT_INIT(expose, GDK_EXPOSE);
|
||||
|
||||
/* GdkEventVisibility */
|
||||
ATTR_ENUM(visibility, state, GDK_TYPE_VISIBILITY_STATE);
|
||||
GDKEVENT_INIT(visibility, GDK_VISIBILITY_NOTIFY);
|
||||
|
||||
/* GdkEventCrossing */
|
||||
ATTR_GOBJ(crossing, subwindow);
|
||||
ATTR_UINT(crossing, time);
|
||||
ATTR_INT(crossing, x);
|
||||
ATTR_INT(crossing, y);
|
||||
ATTR_FLOAT(crossing, x_root);
|
||||
ATTR_FLOAT(crossing, y_root);
|
||||
ATTR_ENUM(crossing, mode, GDK_TYPE_CROSSING_MODE);
|
||||
ATTR_ENUM(crossing, detail, GDK_TYPE_NOTIFY_TYPE);
|
||||
ATTR_BOOL(crossing, focus);
|
||||
ATTR_FLAGS(crossing, state, GDK_TYPE_MODIFIER_TYPE);
|
||||
|
||||
/* GdkEventFocus */
|
||||
ATTR_BOOL(focus_change, in);
|
||||
GDKEVENT_INIT(focus_change, GDK_FOCUS_CHANGE);
|
||||
|
||||
/* GdkEventConfigure */
|
||||
ATTR_INT(configure, x);
|
||||
ATTR_INT(configure, y);
|
||||
ATTR_INT(configure, width);
|
||||
ATTR_INT(configure, height);
|
||||
GDKEVENT_INIT(configure, GDK_CONFIGURE);
|
||||
|
||||
/* GdkEventProperty */
|
||||
ATTR_ATOM(property, atom);
|
||||
ATTR_UINT(property, time);
|
||||
ATTR_ENUM(property, state, GDK_TYPE_PROPERTY_STATE);
|
||||
GDKEVENT_INIT(property, GDK_PROPERTY_NOTIFY);
|
||||
|
||||
/* GdkEventSelection */
|
||||
ATTR_ATOM(selection, selection);
|
||||
ATTR_ATOM(selection, target);
|
||||
ATTR_ATOM(selection, property);
|
||||
ATTR_GDKNATIVEWINDOW(selection, requestor);
|
||||
ATTR_INT(selection, time);
|
||||
|
||||
/* GdkEventDND */
|
||||
ATTR_GOBJ(dnd, context);
|
||||
ATTR_UINT(dnd, time);
|
||||
ATTR_INT(dnd, x_root);
|
||||
ATTR_INT(dnd, y_root);
|
||||
|
||||
/* GdkEventProximity */
|
||||
ATTR_UINT(proximity, time);
|
||||
ATTR_GOBJ(proximity, device);
|
||||
|
||||
/* GdkEventClient */
|
||||
ATTR_ATOM(client, message_type);
|
||||
GDKEVENT_INIT(client, GDK_CLIENT_EVENT);
|
||||
|
||||
static VALUE
|
||||
gdkeventclient_data_format(VALUE self)
|
||||
{
|
||||
return INT2NUM(get_gdkevent(self)->client.data_format);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
gdkeventclient_data(VALUE self)
|
||||
{
|
||||
int i;
|
||||
VALUE ary = Qnil;
|
||||
gushort format = get_gdkevent(self)->client.data_format;
|
||||
|
||||
if (format == 8) {
|
||||
ary = rb_ary_new2(20);
|
||||
for (i = 0; i < 20; i++)
|
||||
rb_ary_push(ary, INT2FIX(get_gdkevent(self)->client.data.b[i]));
|
||||
} else if (format == 16) {
|
||||
ary = rb_ary_new2(10);
|
||||
for (i = 0; i<10; i++)
|
||||
rb_ary_push(ary, INT2FIX(get_gdkevent(self)->client.data.s[i]));
|
||||
} else if (format == 32){
|
||||
ary = rb_ary_new2(5);
|
||||
for (i = 0; i < 5; i++)
|
||||
rb_ary_push(ary, INT2NUM(get_gdkevent(self)->client.data.l[i]));
|
||||
} else {
|
||||
rb_warn("The format is not supported.");
|
||||
}
|
||||
return ary;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
gdkeventclient_send_client_message(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE xid, display;
|
||||
rb_scan_args(argc, argv, "11", &xid, &display);
|
||||
if (NIL_P(display)){
|
||||
return CBOOL2RVAL(gdk_event_send_client_message(
|
||||
get_gdkevent(self), RVAL2GDKNATIVEWINDOW(xid)));
|
||||
} else {
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
return CBOOL2RVAL(gdk_event_send_client_message_for_display(
|
||||
GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)),
|
||||
get_gdkevent(self),
|
||||
RVAL2GDKNATIVEWINDOW(xid)));
|
||||
#else
|
||||
rb_warn("this arguments number has been supported since 2.2");
|
||||
return Qfalse;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static VALUE
|
||||
gdkeventclient_send_clientmessage_toall(VALUE self)
|
||||
{
|
||||
gdk_event_send_clientmessage_toall(get_gdkevent(self));
|
||||
return self;
|
||||
}
|
||||
|
||||
static GdkFilterReturn
|
||||
filter_func(GdkXEvent *xevent, GdkEvent *event, gpointer func)
|
||||
{
|
||||
VALUE ret = rb_funcall((VALUE)func, id_call, 2, LONG2NUM((glong)xevent), make_gdkevent(event));
|
||||
return RVAL2GENUM(ret, GDK_TYPE_FILTER_RETURN);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
gdkevent_s_add_client_message_filter(VALUE self, VALUE message_type)
|
||||
{
|
||||
volatile VALUE func = rb_block_proc();
|
||||
G_RELATIVE(self, func);
|
||||
gdk_add_client_message_filter(RVAL2ATOM(message_type),
|
||||
(GdkFilterFunc)filter_func, (gpointer)func);
|
||||
return self;
|
||||
}
|
||||
|
||||
/* GdkEventNoExpose */
|
||||
GDKEVENT_INIT(noexpose, GDK_NO_EXPOSE);
|
||||
|
||||
/* GdkEventWindowState */
|
||||
ATTR_FLAGS(window_state, changed_mask, GDK_TYPE_WINDOW_STATE);
|
||||
ATTR_FLAGS(window_state, new_window_state, GDK_TYPE_WINDOW_STATE);
|
||||
GDKEVENT_INIT(window_state, GDK_WINDOW_STATE);
|
||||
|
||||
/* GdkEventSetting */
|
||||
ATTR_ENUM(setting, action, GDK_TYPE_SETTING_ACTION);
|
||||
ATTR_STR(setting, name);
|
||||
GDKEVENT_INIT(setting, GDK_SETTING);
|
||||
|
||||
/* GdkEventOwnerChange */
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
ATTR_GDKNATIVEWINDOW(owner_change, owner);
|
||||
ATTR_ENUM(owner_change, reason, GDK_TYPE_OWNER_CHANGE);
|
||||
ATTR_ATOM(owner_change, selection);
|
||||
ATTR_UINT(owner_change, time);
|
||||
ATTR_UINT(owner_change, selection_time);
|
||||
GDKEVENT_INIT(owner_change, GDK_OWNER_CHANGE);
|
||||
#endif
|
||||
|
||||
/* GdkEventGrabBroken */
|
||||
#if GTK_CHECK_VERSION(2,8,0)
|
||||
ATTR_BOOL(grab_broken, keyboard);
|
||||
ATTR_BOOL(grab_broken, implicit);
|
||||
ATTR_GOBJ(grab_broken, grab_window);
|
||||
GDKEVENT_INIT(grab_broken, GDK_GRAB_BROKEN);
|
||||
#endif
|
||||
|
||||
/* MISC */
|
||||
static VALUE
|
||||
gdkevent_g2r(const GValue *values)
|
||||
{
|
||||
return make_gdkevent(g_value_get_boxed(&values[0]));
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_gdk_event(VALUE mGdk)
|
||||
{
|
||||
VALUE ev;
|
||||
VALUE gdkEvent;
|
||||
VALUE gdkEventAny;
|
||||
|
||||
gdkEvent = G_DEF_CLASS(GDK_TYPE_EVENT, "Event", mGdk);
|
||||
gdkEventAny = rb_define_class_under(mGdk, "EventAny", gdkEvent);
|
||||
|
||||
gdkevents[GDK_DELETE] = gdkEventAny;
|
||||
gdkevents[GDK_DESTROY] = gdkEventAny;
|
||||
gdkevents[GDK_EXPOSE] = rb_define_class_under(mGdk, "EventExpose", gdkEventAny);
|
||||
gdkevents[GDK_MOTION_NOTIFY] = rb_define_class_under(mGdk, "EventMotion", gdkEventAny);
|
||||
gdkevents[GDK_BUTTON_PRESS] = rb_define_class_under(mGdk, "EventButton", gdkEventAny);
|
||||
gdkevents[GDK_2BUTTON_PRESS] = gdkevents[GDK_BUTTON_PRESS];
|
||||
gdkevents[GDK_3BUTTON_PRESS] = gdkevents[GDK_BUTTON_PRESS];
|
||||
gdkevents[GDK_BUTTON_RELEASE]= gdkevents[GDK_BUTTON_PRESS];
|
||||
gdkevents[GDK_KEY_PRESS] = rb_define_class_under(mGdk, "EventKey", gdkEventAny);
|
||||
gdkevents[GDK_KEY_RELEASE] = gdkevents[GDK_KEY_PRESS];
|
||||
gdkevents[GDK_ENTER_NOTIFY] = rb_define_class_under(mGdk, "EventCrossing", gdkEventAny);
|
||||
gdkevents[GDK_LEAVE_NOTIFY] = gdkevents[GDK_ENTER_NOTIFY];
|
||||
gdkevents[GDK_FOCUS_CHANGE] = rb_define_class_under(mGdk, "EventFocus", gdkEventAny);
|
||||
gdkevents[GDK_CONFIGURE] = rb_define_class_under(mGdk, "EventConfigure", gdkEventAny);
|
||||
gdkevents[GDK_MAP] = gdkEventAny;
|
||||
gdkevents[GDK_UNMAP] = gdkEventAny;
|
||||
gdkevents[GDK_PROPERTY_NOTIFY]= rb_define_class_under(mGdk, "EventProperty", gdkEventAny);
|
||||
gdkevents[GDK_SELECTION_CLEAR]= rb_define_class_under(mGdk, "EventSelection", gdkEventAny);
|
||||
gdkevents[GDK_SELECTION_REQUEST]= gdkevents[GDK_SELECTION_CLEAR];
|
||||
gdkevents[GDK_SELECTION_NOTIFY] = gdkevents[GDK_SELECTION_CLEAR];
|
||||
gdkevents[GDK_PROXIMITY_IN] = rb_define_class_under(mGdk, "EventProximity", gdkEventAny);
|
||||
gdkevents[GDK_PROXIMITY_OUT] = gdkevents[GDK_PROXIMITY_IN];
|
||||
gdkevents[GDK_DRAG_ENTER] = rb_define_class_under(mGdk, "EventDND", gdkEventAny);
|
||||
gdkevents[GDK_DRAG_LEAVE] = gdkevents[GDK_DRAG_ENTER];
|
||||
gdkevents[GDK_DRAG_MOTION] = gdkevents[GDK_DRAG_ENTER];
|
||||
gdkevents[GDK_DRAG_STATUS] = gdkevents[GDK_DRAG_ENTER];
|
||||
gdkevents[GDK_DROP_START] = gdkevents[GDK_DRAG_ENTER];
|
||||
gdkevents[GDK_DROP_FINISHED] = gdkevents[GDK_DRAG_ENTER];
|
||||
gdkevents[GDK_CLIENT_EVENT] = rb_define_class_under(mGdk, "EventClient", gdkEventAny);
|
||||
gdkevents[GDK_VISIBILITY_NOTIFY] = rb_define_class_under(mGdk, "EventVisibility", gdkEventAny);
|
||||
gdkevents[GDK_NO_EXPOSE] = rb_define_class_under(mGdk, "EventNoExpose", gdkEventAny);
|
||||
gdkevents[GDK_SCROLL] = rb_define_class_under(mGdk, "EventScroll", gdkEventAny);
|
||||
gdkevents[GDK_WINDOW_STATE] = rb_define_class_under(mGdk, "EventWindowState", gdkEventAny);
|
||||
gdkevents[GDK_SETTING] = rb_define_class_under(mGdk, "EventSetting", gdkEventAny);
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
gdkevents[GDK_OWNER_CHANGE] = rb_define_class_under(mGdk, "EventOwnerChange", gdkEventAny);
|
||||
#endif
|
||||
#if GTK_CHECK_VERSION(2,8,0)
|
||||
gdkevents[GDK_GRAB_BROKEN] = rb_define_class_under(mGdk, "EventGrabBroken", gdkEventAny);
|
||||
#endif
|
||||
|
||||
/* GdkEvent */
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
rb_define_method(gdkEvent, "initialize", gdkevent_initialize, 1);
|
||||
#endif
|
||||
rb_define_method(gdkEvent, "event_type", gdkevent_type, 0);
|
||||
|
||||
rb_define_singleton_method(gdkEvent, "events_pending?", gdkevent_s_events_pending, 0);
|
||||
rb_define_singleton_method(gdkEvent, "peek", gdkevent_s_peek, 0);
|
||||
rb_define_singleton_method(gdkEvent, "get", gdkevent_s_get, 0);
|
||||
rb_define_method(gdkEvent, "put", gdkevent_put, 0);
|
||||
rb_define_method(gdkEvent, "get_axis", gdkevent_get_axis, 1);
|
||||
rb_define_method(gdkEvent, "coords", gdkevent_get_coords, 0);
|
||||
rb_define_method(gdkEvent, "root_coords", gdkevent_get_root_coords, 0);
|
||||
|
||||
rb_define_singleton_method(gdkEvent, "handler_set", gdkevent_s_handler_set, 0);
|
||||
rb_define_singleton_method(gdkEvent, "show_events?", gdkevent_s_get_show_events, 0);
|
||||
rb_define_singleton_method(gdkEvent, "set_show_events", gdkevent_s_set_show_events, 1);
|
||||
rb_define_singleton_method(gdkEvent, "setting_get", gdkevent_s_setting_get, -1);
|
||||
rb_define_singleton_method(gdkEvent, "add_client_message_filter", gdkevent_s_add_client_message_filter, 1);
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
rb_define_method(gdkEvent, "screen", gdkevent_screen, 0);
|
||||
rb_define_method(gdkEvent, "set_screen", gdkevent_set_screen, 1);
|
||||
#endif
|
||||
G_DEF_SETTERS(gdkEvent);
|
||||
|
||||
/* GdkEventAny */
|
||||
DEFINE_ACCESSOR(gdkEventAny, any, window);
|
||||
rb_define_method(gdkEventAny, "send_event?", gdkeventany_send_event, 0);
|
||||
rb_define_method(gdkEventAny, "set_send_event", gdkeventany_set_send_event, 1);
|
||||
G_DEF_SETTERS(gdkEventAny);
|
||||
|
||||
/* GdkEventKey */
|
||||
ev = gdkevents[GDK_KEY_PRESS];
|
||||
DEFINE_ACCESSOR(ev, key, time);
|
||||
DEFINE_ACCESSOR(ev, key, state);
|
||||
DEFINE_ACCESSOR(ev, key, keyval);
|
||||
DEFINE_ACCESSOR(ev, key, hardware_keycode);
|
||||
DEFINE_ACCESSOR(ev, key, group);
|
||||
G_DEF_SETTERS(ev);
|
||||
|
||||
/* GdkEventButton */
|
||||
ev = gdkevents[GDK_BUTTON_PRESS];
|
||||
DEFINE_ACCESSOR(ev, button, time);
|
||||
DEFINE_ACCESSOR(ev, button, x);
|
||||
DEFINE_ACCESSOR(ev, button, y);
|
||||
rb_define_method(ev, "axes", gdkeventbutton_axes, 0);
|
||||
rb_define_method(ev, "set_axes", gdkeventbutton_set_axes, 2);
|
||||
DEFINE_ACCESSOR(ev, button, state);
|
||||
DEFINE_ACCESSOR(ev, button, button);
|
||||
DEFINE_ACCESSOR(ev, button, device);
|
||||
DEFINE_ACCESSOR(ev, button, x_root);
|
||||
DEFINE_ACCESSOR(ev, button, y_root);
|
||||
G_DEF_SETTERS(ev);
|
||||
|
||||
/* GdkEventScroll */
|
||||
ev = gdkevents[GDK_SCROLL];
|
||||
DEFINE_ACCESSOR(ev, scroll, time);
|
||||
DEFINE_ACCESSOR(ev, scroll, x);
|
||||
DEFINE_ACCESSOR(ev, scroll, y);
|
||||
DEFINE_ACCESSOR(ev, scroll, state);
|
||||
DEFINE_ACCESSOR(ev, scroll, direction);
|
||||
DEFINE_ACCESSOR(ev, scroll, device);
|
||||
DEFINE_ACCESSOR(ev, scroll, x_root);
|
||||
DEFINE_ACCESSOR(ev, scroll, y_root);
|
||||
DEFINE_INIT(ev, scroll);
|
||||
G_DEF_SETTERS(ev);
|
||||
|
||||
/* GdkScrollDirection */
|
||||
G_DEF_CLASS(GDK_TYPE_SCROLL_DIRECTION, "Direction", ev);
|
||||
G_DEF_CONSTANTS(ev, GDK_TYPE_SCROLL_DIRECTION, "GDK_SCROLL_");
|
||||
|
||||
/* GdkEventMotion */
|
||||
ev = gdkevents[GDK_MOTION_NOTIFY];
|
||||
DEFINE_ACCESSOR(ev, motion, time);
|
||||
DEFINE_ACCESSOR(ev, motion, x);
|
||||
DEFINE_ACCESSOR(ev, motion, y);
|
||||
rb_define_method(ev, "axes", gdkeventmotion_axes, 0);
|
||||
rb_define_method(ev, "set_axes", gdkeventmotion_set_axes, 1);
|
||||
DEFINE_ACCESSOR(ev, motion, state);
|
||||
rb_define_method(ev, "hint?", gdkeventmotion_is_hint, 0);
|
||||
rb_define_method(ev, "set_hint", gdkeventmotion_set_is_hint, 1);
|
||||
DEFINE_ACCESSOR(ev, motion, device);
|
||||
DEFINE_ACCESSOR(ev, motion, x_root);
|
||||
DEFINE_ACCESSOR(ev, motion, y_root);
|
||||
DEFINE_INIT(ev, motion);
|
||||
#if GTK_CHECK_VERSION(2, 12, 0)
|
||||
rb_define_method(ev, "request", gdkeventmotion_request_motions, 0);
|
||||
#endif
|
||||
G_DEF_SETTERS(ev);
|
||||
|
||||
/* GdkEventExpose */
|
||||
ev = gdkevents[GDK_EXPOSE];
|
||||
DEFINE_ACCESSOR(ev, expose, area);
|
||||
DEFINE_ACCESSOR(ev, expose, region);
|
||||
DEFINE_ACCESSOR(ev, expose, count);
|
||||
DEFINE_INIT(ev, expose);
|
||||
rb_define_singleton_method(ev, "get_graphics_expose",
|
||||
gdkevent_s_get_graphics_expose, 1);
|
||||
G_DEF_SETTERS(ev);
|
||||
|
||||
/* GdkEventVisibility */
|
||||
ev = gdkevents[GDK_VISIBILITY_NOTIFY];
|
||||
DEFINE_ACCESSOR(ev, visibility, state);
|
||||
DEFINE_INIT(ev, visibility);
|
||||
G_DEF_SETTERS(ev);
|
||||
|
||||
/* GdkVisibilityState */
|
||||
G_DEF_CLASS(GDK_TYPE_VISIBILITY_STATE, "State", ev);
|
||||
G_DEF_CONSTANTS(ev, GDK_TYPE_VISIBILITY_STATE, "GDK_VISIBILITY_");
|
||||
|
||||
/* GdkEventCrossing */
|
||||
ev = gdkevents[GDK_ENTER_NOTIFY];
|
||||
DEFINE_ACCESSOR(ev, crossing, subwindow);
|
||||
DEFINE_ACCESSOR(ev, crossing, time);
|
||||
DEFINE_ACCESSOR(ev, crossing, x);
|
||||
DEFINE_ACCESSOR(ev, crossing, y);
|
||||
DEFINE_ACCESSOR(ev, crossing, x_root);
|
||||
DEFINE_ACCESSOR(ev, crossing, y_root);
|
||||
DEFINE_ACCESSOR(ev, crossing, mode);
|
||||
DEFINE_ACCESSOR(ev, crossing, detail);
|
||||
rb_define_method(ev, "focus?", gdkeventcrossing_focus, 0);
|
||||
rb_define_method(ev, "set_focus", gdkeventcrossing_set_focus, 1);
|
||||
DEFINE_ACCESSOR(ev, crossing, state);
|
||||
G_DEF_SETTERS(ev);
|
||||
|
||||
/* GdkCrossingMode */
|
||||
G_DEF_CLASS(GDK_TYPE_CROSSING_MODE, "Mode", ev);
|
||||
G_DEF_CONSTANTS(ev, GDK_TYPE_CROSSING_MODE, "GDK_CROSSING_");
|
||||
/* GdkNotifyType */
|
||||
G_DEF_CLASS(GDK_TYPE_NOTIFY_TYPE, "NotifyType", ev);
|
||||
G_DEF_CONSTANTS(ev, GDK_TYPE_NOTIFY_TYPE, "GDK_");
|
||||
|
||||
/* GdkEventFocus */
|
||||
ev = gdkevents[GDK_FOCUS_CHANGE];
|
||||
rb_define_method(ev, "in?", gdkeventfocus_change_in, 0);
|
||||
rb_define_method(ev, "set_in", gdkeventfocus_change_set_in, 1);
|
||||
DEFINE_INIT(ev, focus_change);
|
||||
G_DEF_SETTERS(ev);
|
||||
|
||||
/* GdkEventConfigure */
|
||||
ev = gdkevents[GDK_CONFIGURE];
|
||||
DEFINE_ACCESSOR(ev, configure, x);
|
||||
DEFINE_ACCESSOR(ev, configure, y);
|
||||
DEFINE_ACCESSOR(ev, configure, width);
|
||||
DEFINE_ACCESSOR(ev, configure, height);
|
||||
DEFINE_INIT(ev, configure);
|
||||
G_DEF_SETTERS(ev);
|
||||
|
||||
/* GdkEventProperty */
|
||||
ev = gdkevents[GDK_PROPERTY_NOTIFY];
|
||||
DEFINE_ACCESSOR(ev, property, atom);
|
||||
DEFINE_ACCESSOR(ev, property, time);
|
||||
DEFINE_ACCESSOR(ev, property, state);
|
||||
DEFINE_INIT(ev, property);
|
||||
G_DEF_SETTERS(ev);
|
||||
|
||||
/* GdkPropertyState */
|
||||
G_DEF_CLASS(GDK_TYPE_PROPERTY_STATE, "State", ev);
|
||||
G_DEF_CONSTANTS(ev, GDK_TYPE_PROPERTY_STATE, "GDK_");
|
||||
|
||||
/* GdkEventSelection */
|
||||
ev = gdkevents[GDK_SELECTION_CLEAR];
|
||||
DEFINE_ACCESSOR(ev, selection, selection);
|
||||
DEFINE_ACCESSOR(ev, selection, target);
|
||||
DEFINE_ACCESSOR(ev, selection, property);
|
||||
DEFINE_ACCESSOR(ev, selection, requestor);
|
||||
DEFINE_ACCESSOR(ev, selection, time);
|
||||
G_DEF_SETTERS(ev);
|
||||
|
||||
/* GdkEventDND */
|
||||
ev = gdkevents[GDK_DRAG_ENTER];
|
||||
DEFINE_ACCESSOR(ev, dnd, context);
|
||||
DEFINE_ACCESSOR(ev, dnd, time);
|
||||
DEFINE_ACCESSOR(ev, dnd, x_root);
|
||||
DEFINE_ACCESSOR(ev, dnd, y_root);
|
||||
G_DEF_SETTERS(ev);
|
||||
|
||||
/* GdkEventProximity */
|
||||
ev = gdkevents[GDK_PROXIMITY_IN];
|
||||
DEFINE_ACCESSOR(ev, proximity, time);
|
||||
DEFINE_ACCESSOR(ev, proximity, device);
|
||||
G_DEF_SETTERS(ev);
|
||||
|
||||
/* GdkEventClient */
|
||||
ev = gdkevents[GDK_CLIENT_EVENT];
|
||||
DEFINE_ACCESSOR(ev, client, message_type);
|
||||
rb_define_method(ev, "data_format", gdkeventclient_data_format, 0);
|
||||
rb_define_method(ev, "data", gdkeventclient_data, 0);
|
||||
rb_define_method(ev, "send_client_message",
|
||||
gdkeventclient_send_client_message, -1);
|
||||
rb_define_method(ev, "send_clientmessage_toall",
|
||||
gdkeventclient_send_clientmessage_toall, 0);
|
||||
DEFINE_INIT(ev, client);
|
||||
G_DEF_SETTERS(ev);
|
||||
|
||||
/* GdkEventNoExpose */
|
||||
ev = gdkevents[GDK_NO_EXPOSE];
|
||||
DEFINE_INIT(ev, noexpose);
|
||||
|
||||
/* GdkEventWindowState */
|
||||
ev = gdkevents[GDK_WINDOW_STATE];
|
||||
DEFINE_ACCESSOR(ev, window_state, changed_mask);
|
||||
DEFINE_ACCESSOR(ev, window_state, new_window_state);
|
||||
DEFINE_INIT(ev, window_state);
|
||||
G_DEF_SETTERS(ev);
|
||||
|
||||
/* GdkWindowState */
|
||||
G_DEF_CLASS(GDK_TYPE_WINDOW_STATE, "WindowState", ev);
|
||||
G_DEF_CONSTANTS(ev, GDK_TYPE_WINDOW_STATE, "GDK_WINDOW_STATE_");
|
||||
|
||||
/* GdkEventSetting */
|
||||
ev = gdkevents[GDK_SETTING];
|
||||
DEFINE_ACCESSOR(ev, setting, action);
|
||||
DEFINE_ACCESSOR(ev, setting, name);
|
||||
DEFINE_INIT(ev, setting);
|
||||
G_DEF_SETTERS(ev);
|
||||
|
||||
/* GdkSettingAction */
|
||||
G_DEF_CLASS(GDK_TYPE_SETTING_ACTION, "Action", ev);
|
||||
G_DEF_CONSTANTS(ev, GDK_TYPE_SETTING_ACTION, "GDK_SETTING_");
|
||||
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
/* GdkEventOwnerChange */
|
||||
ev = gdkevents[GDK_OWNER_CHANGE];
|
||||
DEFINE_ACCESSOR(ev, owner_change, owner);
|
||||
DEFINE_ACCESSOR(ev, owner_change, reason);
|
||||
DEFINE_ACCESSOR(ev, owner_change, selection);
|
||||
DEFINE_ACCESSOR(ev, owner_change, time);
|
||||
DEFINE_ACCESSOR(ev, owner_change, selection_time);
|
||||
G_DEF_SETTERS(ev);
|
||||
DEFINE_INIT(ev, owner_change);
|
||||
|
||||
/* GdkOwnerChange */
|
||||
G_DEF_CLASS(GDK_TYPE_OWNER_CHANGE, "OwnerChange", ev);
|
||||
G_DEF_CONSTANTS(ev, GDK_TYPE_OWNER_CHANGE, "GDK_OWNER_CHANGE_");
|
||||
#endif
|
||||
|
||||
#if GTK_CHECK_VERSION(2,8,0)
|
||||
/* GdkEventGrabBroken */
|
||||
ev = gdkevents[GDK_GRAB_BROKEN];
|
||||
rb_define_method(ev, "keyboard?", gdkeventgrab_broken_keyboard, 0);
|
||||
rb_define_method(ev, "set_keyboard", gdkeventgrab_broken_set_keyboard, 1);
|
||||
rb_define_method(ev, "implicit?", gdkeventgrab_broken_implicit, 0);
|
||||
rb_define_method(ev, "set_implicit", gdkeventgrab_broken_set_implicit, 1);
|
||||
DEFINE_ACCESSOR(ev, grab_broken, grab_window);
|
||||
DEFINE_INIT(ev, grab_broken);
|
||||
G_DEF_SETTERS(ev);
|
||||
#endif
|
||||
|
||||
rbgobj_register_g2r_func(GDK_TYPE_EVENT, &gdkevent_g2r);
|
||||
|
||||
/*
|
||||
* GdkEvent's Constants
|
||||
*/
|
||||
rb_define_const(gdkEvent, "CURRENT_TIME", INT2FIX(GDK_CURRENT_TIME));
|
||||
rb_define_const(gdkEvent, "PRIORITY_EVENTS", INT2FIX(GDK_PRIORITY_EVENTS));
|
||||
rb_define_const(gdkEvent, "PRIORITY_REDRAW", INT2FIX(GDK_PRIORITY_REDRAW));
|
||||
|
||||
/* GdkEventType */
|
||||
/* XXX */
|
||||
G_RENAME_CONSTANT("2BUTTON_PRESS","BUTTON2_PRESS");
|
||||
G_RENAME_CONSTANT("3BUTTON_PRESS","BUTTON3_PRESS");
|
||||
G_DEF_CLASS(GDK_TYPE_EVENT_TYPE, "Type", gdkEvent);
|
||||
G_RENAME_CONSTANT("2BUTTON_PRESS","BUTTON2_PRESS");
|
||||
G_RENAME_CONSTANT("3BUTTON_PRESS","BUTTON3_PRESS");
|
||||
G_DEF_CONSTANTS(gdkEvent, GDK_TYPE_EVENT_TYPE, "GDK_");
|
||||
|
||||
/* GdkEventMask */
|
||||
G_DEF_CLASS(GDK_TYPE_EVENT_MASK, "Mask", gdkEvent);
|
||||
G_DEF_CONSTANTS(gdkEvent, GDK_TYPE_EVENT_MASK, "GDK_");
|
||||
|
||||
}
|
||||
428
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkgc.c
Normal file
428
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkgc.c
Normal file
@@ -0,0 +1,428 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002-2004 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Masao Mutoh
|
||||
* Copyright (C) 2001 Neil Conway
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cGC
|
||||
#define _SELF(s) (GDK_GC(RVAL2GOBJ(s)))
|
||||
|
||||
static VALUE RG_TARGET_NAMESPACE;
|
||||
static VALUE gdkDrawable;
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self, VALUE win)
|
||||
{
|
||||
G_INITIALIZE(self, gdk_gc_new(GDK_DRAWABLE(RVAL2GOBJ(win))));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
/* we don't need them.
|
||||
GdkGC* gdk_gc_new_with_values (GdkDrawable *drawable,
|
||||
GdkGCValues *values,
|
||||
GdkGCValuesMask values_mask);
|
||||
void gdk_gc_set_values (GdkGC *gc,
|
||||
GdkGCValues *values,
|
||||
GdkGCValuesMask values_mask);
|
||||
void gdk_gc_get_values (GdkGC *gc,
|
||||
GdkGCValues *values);
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
rg_set_foreground(VALUE self, VALUE color)
|
||||
{
|
||||
gdk_gc_set_foreground(_SELF(self), RVAL2GDKCOLOR(color));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_background(VALUE self, VALUE color)
|
||||
{
|
||||
gdk_gc_set_background(_SELF(self), RVAL2GDKCOLOR(color));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_rgb_fg_color(VALUE self, VALUE color)
|
||||
{
|
||||
gdk_gc_set_rgb_fg_color(_SELF(self), RVAL2GDKCOLOR(color));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_rgb_bg_color(VALUE self, VALUE color)
|
||||
{
|
||||
gdk_gc_set_rgb_bg_color(_SELF(self), RVAL2GDKCOLOR(color));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_function(VALUE self, VALUE func)
|
||||
{
|
||||
GdkFunction f;
|
||||
f = (GdkFunction)(RVAL2GENUM(func, GDK_TYPE_FUNCTION));
|
||||
if (f > GDK_SET)
|
||||
rb_raise(rb_eArgError, "function out of range");
|
||||
|
||||
gdk_gc_set_function(_SELF(self), f);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_fill(VALUE self, VALUE fill)
|
||||
{
|
||||
gdk_gc_set_fill(_SELF(self), RVAL2GENUM(fill, GDK_TYPE_FILL));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_tile(VALUE self, VALUE tile)
|
||||
{
|
||||
gdk_gc_set_tile(_SELF(self), GDK_PIXMAP(RVAL2GOBJ(tile)));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_stipple(VALUE self, VALUE stipple)
|
||||
{
|
||||
gdk_gc_set_stipple(_SELF(self), GDK_PIXMAP(RVAL2GOBJ(stipple)));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_ts_origin(VALUE self, VALUE x, VALUE y)
|
||||
{
|
||||
gdk_gc_set_ts_origin(_SELF(self), NUM2INT(x), NUM2INT(y));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_clip_origin(VALUE self, VALUE x, VALUE y)
|
||||
{
|
||||
gdk_gc_set_clip_origin(_SELF(self), NUM2INT(x), NUM2INT(y));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_clip_mask(VALUE self, VALUE mask)
|
||||
{
|
||||
gdk_gc_set_clip_mask(_SELF(self), GDK_BITMAP(RVAL2GOBJ(mask)));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_clip_rectangle(VALUE self, VALUE rectangle)
|
||||
{
|
||||
gdk_gc_set_clip_rectangle(_SELF(self),
|
||||
(GdkRectangle*)RVAL2BOXED(rectangle, GDK_TYPE_RECTANGLE));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_clip_region(VALUE self, VALUE region)
|
||||
{
|
||||
gdk_gc_set_clip_region(_SELF(self),
|
||||
(GdkRegion*)RVAL2BOXED(region, GDK_TYPE_REGION));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_subwindow_mode(VALUE self, VALUE mode)
|
||||
{
|
||||
gdk_gc_set_subwindow(_SELF(self), RVAL2GENUM(mode, GDK_TYPE_SUBWINDOW_MODE));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_exposures(VALUE self, VALUE exposures)
|
||||
{
|
||||
gdk_gc_set_exposures(_SELF(self), RVAL2CBOOL(exposures));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_line_attributes(VALUE self, VALUE line_width, VALUE line_style, VALUE cap_style, VALUE join_style)
|
||||
{
|
||||
gdk_gc_set_line_attributes(_SELF(self), NUM2INT(line_width),
|
||||
RVAL2GENUM(line_style, GDK_TYPE_LINE_STYLE),
|
||||
RVAL2GENUM(cap_style, GDK_TYPE_CAP_STYLE),
|
||||
RVAL2GENUM(join_style, GDK_TYPE_JOIN_STYLE));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_dashes(VALUE self, VALUE rbdash_offset, VALUE rbdash_list)
|
||||
{
|
||||
GdkGC *gc = _SELF(self);
|
||||
gint dash_offset = NUM2INT(rbdash_offset);
|
||||
long n;
|
||||
gint8 *dash_list = RVAL2GINT8S(rbdash_list, n);
|
||||
|
||||
gdk_gc_set_dashes(gc, dash_offset, dash_list, n);
|
||||
|
||||
g_free(dash_list);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_copy(VALUE self, VALUE dst)
|
||||
{
|
||||
if (RVAL2CBOOL(rb_obj_is_kind_of(dst, gdkDrawable))) {
|
||||
VALUE args[1];
|
||||
args[0] = dst;
|
||||
dst = rb_class_new_instance(1, args, RG_TARGET_NAMESPACE);
|
||||
}
|
||||
gdk_gc_copy(_SELF(dst), _SELF(self));
|
||||
return dst;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_colormap(VALUE self, VALUE colormap)
|
||||
{
|
||||
gdk_gc_set_colormap(_SELF(self), GDK_COLORMAP(RVAL2GOBJ(colormap)));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_foreground(VALUE self)
|
||||
{
|
||||
GdkGCValues val;
|
||||
gdk_gc_get_values(_SELF(self), &val);
|
||||
|
||||
return BOXED2RVAL(&val.foreground, GDK_TYPE_COLOR);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_background(VALUE self)
|
||||
{
|
||||
GdkGCValues val;
|
||||
gdk_gc_get_values(_SELF(self), &val);
|
||||
|
||||
return BOXED2RVAL(&val.background, GDK_TYPE_COLOR);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_function(VALUE self)
|
||||
{
|
||||
GdkGCValues val;
|
||||
gdk_gc_get_values(_SELF(self), &val);
|
||||
|
||||
return GENUM2RVAL(val.function, GDK_TYPE_FUNCTION);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_fill(VALUE self)
|
||||
{
|
||||
GdkGCValues val;
|
||||
gdk_gc_get_values(_SELF(self), &val);
|
||||
|
||||
return GENUM2RVAL(val.fill, GDK_TYPE_FILL);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_tile(VALUE self)
|
||||
{
|
||||
GdkGCValues val;
|
||||
gdk_gc_get_values(_SELF(self), &val);
|
||||
|
||||
return GOBJ2RVAL(val.tile);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_stipple(VALUE self)
|
||||
{
|
||||
GdkGCValues val;
|
||||
gdk_gc_get_values(_SELF(self), &val);
|
||||
|
||||
return GOBJ2RVAL(val.stipple);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_ts_origin(VALUE self)
|
||||
{
|
||||
GdkGCValues val;
|
||||
gdk_gc_get_values(_SELF(self), &val);
|
||||
|
||||
return rb_ary_new3(2, INT2NUM(val.ts_x_origin),
|
||||
INT2NUM(val.ts_y_origin));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_clip_origin(VALUE self)
|
||||
{
|
||||
GdkGCValues val;
|
||||
gdk_gc_get_values(_SELF(self), &val);
|
||||
|
||||
return rb_ary_new3(2, INT2NUM(val.clip_x_origin),
|
||||
INT2NUM(val.clip_y_origin));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_clip_mask(VALUE self)
|
||||
{
|
||||
GdkGCValues val;
|
||||
gdk_gc_get_values(_SELF(self), &val);
|
||||
|
||||
return GOBJ2RVAL(val.clip_mask);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_subwindow_mode(VALUE self)
|
||||
{
|
||||
GdkGCValues val;
|
||||
gdk_gc_get_values(_SELF(self), &val);
|
||||
|
||||
return GENUM2RVAL(val.subwindow_mode, GDK_TYPE_SUBWINDOW_MODE);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_exposures_p(VALUE self)
|
||||
{
|
||||
GdkGCValues val;
|
||||
gdk_gc_get_values(_SELF(self), &val);
|
||||
|
||||
return CBOOL2RVAL(val.graphics_exposures);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_line_attributes(VALUE self)
|
||||
{
|
||||
GdkGCValues val;
|
||||
gdk_gc_get_values(_SELF(self), &val);
|
||||
|
||||
return rb_ary_new3(4, INT2NUM(val.line_width),
|
||||
GENUM2RVAL(val.line_style, GDK_TYPE_LINE_STYLE),
|
||||
GENUM2RVAL(val.cap_style, GDK_TYPE_CAP_STYLE),
|
||||
GENUM2RVAL(val.join_style, GDK_TYPE_JOIN_STYLE));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_colormap(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_gc_get_colormap(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_offset(VALUE self, VALUE x, VALUE y)
|
||||
{
|
||||
gdk_gc_offset(_SELF(self), NUM2INT(x), NUM2INT(y));
|
||||
return self;
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
static VALUE
|
||||
rg_screen(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_gc_get_screen(_SELF(self)));
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_gdk_gc(VALUE mGdk)
|
||||
{
|
||||
RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_GC, "GC", mGdk);
|
||||
gdkDrawable = rb_const_get(mGdk, rb_intern("Drawable"));
|
||||
|
||||
rbgobj_add_abstract_but_create_instance_class(GDK_TYPE_GC);
|
||||
|
||||
RG_DEF_METHOD(initialize, 1);
|
||||
RG_DEF_METHOD(set_foreground, 1);
|
||||
RG_DEF_METHOD(set_background, 1);
|
||||
RG_DEF_METHOD(set_rgb_fg_color, 1);
|
||||
RG_DEF_METHOD(set_rgb_bg_color, 1);
|
||||
RG_DEF_METHOD(set_function, 1);
|
||||
RG_DEF_METHOD(set_fill, 1);
|
||||
RG_DEF_METHOD(set_tile, 1);
|
||||
RG_DEF_METHOD(set_stipple, 1);
|
||||
RG_DEF_METHOD(set_ts_origin, 2);
|
||||
RG_DEF_METHOD(set_clip_origin, 2);
|
||||
RG_DEF_METHOD(set_clip_mask, 1);
|
||||
RG_DEF_METHOD(set_clip_rectangle, 1);
|
||||
RG_DEF_METHOD(set_clip_region, 1);
|
||||
RG_DEF_METHOD(set_subwindow_mode, 1);
|
||||
RG_DEF_METHOD(set_exposures, 1);
|
||||
RG_DEF_METHOD(set_line_attributes, 4);
|
||||
RG_DEF_METHOD(set_dashes, 2);
|
||||
RG_DEF_METHOD(copy, 1);
|
||||
RG_DEF_METHOD(set_colormap, 1);
|
||||
|
||||
RG_DEF_METHOD(foreground, 0);
|
||||
RG_DEF_METHOD(background, 0);
|
||||
RG_DEF_METHOD(function, 0);
|
||||
RG_DEF_METHOD(fill, 0);
|
||||
RG_DEF_METHOD(tile, 0);
|
||||
RG_DEF_METHOD(stipple, 0);
|
||||
RG_DEF_METHOD(ts_origin, 0);
|
||||
RG_DEF_METHOD(clip_origin, 0);
|
||||
RG_DEF_METHOD(clip_mask, 0);
|
||||
RG_DEF_METHOD(subwindow_mode, 0);
|
||||
RG_DEF_METHOD_P(exposures, 0);
|
||||
RG_DEF_METHOD(line_attributes, 0);
|
||||
|
||||
RG_DEF_METHOD(colormap, 0);
|
||||
RG_DEF_METHOD(offset, 2);
|
||||
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
RG_DEF_METHOD(screen, 0);
|
||||
#endif
|
||||
|
||||
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
||||
|
||||
/* GdkGCValuesMask */
|
||||
/* Don't need them.
|
||||
G_DEF_CLASS(GDK_TYPE_GC_VALUES_MASK, "ValuesMask", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_GC_VALUES_MASK, "GDK_GC_");
|
||||
*/
|
||||
|
||||
/* GdkFunction */
|
||||
G_DEF_CLASS(GDK_TYPE_FUNCTION, "Function", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_FUNCTION, "GDK_");
|
||||
|
||||
/* GdkFill */
|
||||
G_DEF_CLASS(GDK_TYPE_FILL, "Fill", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_FILL, "GDK_");
|
||||
|
||||
/* GdkSubwindowMode */
|
||||
G_DEF_CLASS(GDK_TYPE_SUBWINDOW_MODE, "SubWindowMode", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_SUBWINDOW_MODE, "GDK_");
|
||||
|
||||
/* GdkLineStyle */
|
||||
G_DEF_CLASS(GDK_TYPE_LINE_STYLE, "LineStyle", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_LINE_STYLE, "GDK_");
|
||||
|
||||
/* GdkCapStyle */
|
||||
G_DEF_CLASS(GDK_TYPE_CAP_STYLE, "CapStyle", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_CAP_STYLE, "GDK_");
|
||||
|
||||
/* GdkJoinStyle */
|
||||
G_DEF_CLASS(GDK_TYPE_JOIN_STYLE, "JoinStyle", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_JOIN_STYLE, "GDK_");
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
G_DEF_CLASS3("GdkGCX11", "GCX11", mGdk);
|
||||
#elif defined(GDK_WINDOWING_WIN32)
|
||||
G_DEF_CLASS3("GdkGCWin32", "GCWin32", mGdk);
|
||||
#elif defined(GDK_WINDOWING_FB)
|
||||
G_DEF_CLASS3("GdkGCFB", "GCFB", mGdk);
|
||||
#endif
|
||||
}
|
||||
256
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkgeometry.c
Normal file
256
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkgeometry.c
Normal file
@@ -0,0 +1,256 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Masao Mutoh
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
/*****************************************/
|
||||
static GdkGeometry*
|
||||
geo_copy(const GdkGeometry* geo)
|
||||
{
|
||||
GdkGeometry* new_geo;
|
||||
g_return_val_if_fail (geo != NULL, NULL);
|
||||
new_geo = g_new(GdkGeometry, 1);
|
||||
*new_geo = *geo;
|
||||
return new_geo;
|
||||
}
|
||||
|
||||
GType
|
||||
gdk_geometry_get_type(void)
|
||||
{
|
||||
static GType our_type = 0;
|
||||
if (our_type == 0)
|
||||
our_type = g_boxed_type_register_static ("GdkGeometry",
|
||||
(GBoxedCopyFunc)geo_copy,
|
||||
(GBoxedFreeFunc)g_free);
|
||||
return our_type;
|
||||
}
|
||||
/*****************************************/
|
||||
|
||||
#define RG_TARGET_NAMESPACE cGeometry
|
||||
#define _SELF(g) ((GdkGeometry*)RVAL2BOXED(g, GDK_TYPE_GEOMETRY))
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self)
|
||||
{
|
||||
GdkGeometry geometry;
|
||||
memset(&geometry, 0, sizeof(GdkGeometry));
|
||||
G_INITIALIZE(self, g_boxed_copy(GDK_TYPE_GEOMETRY, &geometry));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set(VALUE self, VALUE min_width, VALUE min_height, VALUE max_width, VALUE max_height, VALUE base_width, VALUE base_height, VALUE width_inc, VALUE height_inc, VALUE min_aspect, VALUE max_aspect, VALUE gravity)
|
||||
{
|
||||
GdkGeometry *geo = _SELF(self);
|
||||
geo->min_width = NUM2INT(min_width);
|
||||
geo->min_height = NUM2INT(min_height);
|
||||
geo->max_width = NUM2INT(max_width);
|
||||
geo->max_height = NUM2INT(max_height);
|
||||
geo->base_width = NUM2INT(base_width);
|
||||
geo->base_height = NUM2INT(base_height);
|
||||
geo->width_inc = NUM2INT(width_inc);
|
||||
geo->height_inc = NUM2INT(height_inc);
|
||||
geo->min_aspect = NUM2DBL(min_aspect);
|
||||
geo->max_aspect = NUM2DBL(max_aspect);
|
||||
geo->win_gravity = RVAL2GENUM(gravity, GDK_TYPE_GRAVITY);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_min_width(VALUE self)
|
||||
{
|
||||
return INT2NUM(_SELF(self)->min_width);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_min_height(VALUE self)
|
||||
{
|
||||
return INT2NUM(_SELF(self)->min_height);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_max_width(VALUE self)
|
||||
{
|
||||
return INT2NUM(_SELF(self)->max_width);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_max_height(VALUE self)
|
||||
{
|
||||
return INT2NUM(_SELF(self)->max_height);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_base_width(VALUE self)
|
||||
{
|
||||
return INT2NUM(_SELF(self)->base_width);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_base_height(VALUE self)
|
||||
{
|
||||
return INT2NUM(_SELF(self)->base_height);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_width_inc(VALUE self)
|
||||
{
|
||||
return INT2NUM(_SELF(self)->width_inc);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_height_inc(VALUE self)
|
||||
{
|
||||
return INT2NUM(_SELF(self)->height_inc);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_min_aspect(VALUE self)
|
||||
{
|
||||
return rb_float_new(_SELF(self)->min_aspect);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_max_aspect(VALUE self)
|
||||
{
|
||||
return rb_float_new(_SELF(self)->max_aspect);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_win_gravity(VALUE self)
|
||||
{
|
||||
return GENUM2RVAL(_SELF(self)->win_gravity, GDK_TYPE_GRAVITY);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_min_width(VALUE self, VALUE min_width)
|
||||
{
|
||||
_SELF(self)->min_width = NUM2INT(min_width);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_min_height(VALUE self, VALUE min_height)
|
||||
{
|
||||
_SELF(self)->min_height = NUM2INT(min_height);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_max_width(VALUE self, VALUE max_width)
|
||||
{
|
||||
_SELF(self)->max_width = NUM2INT(max_width);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_max_height(VALUE self, VALUE max_height)
|
||||
{
|
||||
_SELF(self)->max_height = NUM2INT(max_height);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_base_width(VALUE self, VALUE base_width)
|
||||
{
|
||||
_SELF(self)->base_width = NUM2INT(base_width);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_base_height(VALUE self, VALUE base_height)
|
||||
{
|
||||
_SELF(self)->base_height = NUM2INT(base_height);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_width_inc(VALUE self, VALUE width_inc)
|
||||
{
|
||||
_SELF(self)->width_inc = NUM2INT(width_inc);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_height_inc(VALUE self, VALUE height_inc)
|
||||
{
|
||||
_SELF(self)->height_inc = NUM2INT(height_inc);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_min_aspect(VALUE self, VALUE min_aspect)
|
||||
{
|
||||
_SELF(self)->min_aspect = NUM2DBL(min_aspect);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_max_aspect(VALUE self, VALUE max_aspect)
|
||||
{
|
||||
_SELF(self)->max_aspect = NUM2DBL(max_aspect);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_win_gravity(VALUE self, VALUE gravity)
|
||||
{
|
||||
_SELF(self)->win_gravity = RVAL2GENUM(gravity, GDK_TYPE_GRAVITY);
|
||||
return self;
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_gdk_geometry(VALUE mGdk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_GEOMETRY, "Geometry", mGdk);
|
||||
|
||||
RG_DEF_METHOD(initialize, 0);
|
||||
RG_DEF_METHOD(min_width, 0);
|
||||
RG_DEF_METHOD(min_height, 0);
|
||||
RG_DEF_METHOD(max_width, 0);
|
||||
RG_DEF_METHOD(max_height, 0);
|
||||
RG_DEF_METHOD(base_width, 0);
|
||||
RG_DEF_METHOD(base_height, 0);
|
||||
RG_DEF_METHOD(width_inc, 0);
|
||||
RG_DEF_METHOD(height_inc, 0);
|
||||
RG_DEF_METHOD(min_aspect, 0);
|
||||
RG_DEF_METHOD(max_aspect, 0);
|
||||
RG_DEF_METHOD(win_gravity, 0);
|
||||
RG_DEF_METHOD(set, 11);
|
||||
RG_DEF_METHOD(set_min_width, 1);
|
||||
RG_DEF_METHOD(set_min_height, 1);
|
||||
RG_DEF_METHOD(set_max_width, 1);
|
||||
RG_DEF_METHOD(set_max_height, 1);
|
||||
RG_DEF_METHOD(set_base_width, 1);
|
||||
RG_DEF_METHOD(set_base_height, 1);
|
||||
RG_DEF_METHOD(set_width_inc, 1);
|
||||
RG_DEF_METHOD(set_height_inc, 1);
|
||||
RG_DEF_METHOD(set_min_aspect, 1);
|
||||
RG_DEF_METHOD(set_max_aspect, 1);
|
||||
RG_DEF_METHOD(set_win_gravity, 1);
|
||||
|
||||
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
||||
|
||||
}
|
||||
152
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkimage.c
Normal file
152
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkimage.c
Normal file
@@ -0,0 +1,152 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cImage
|
||||
#define _SELF(i) GDK_IMAGE(RVAL2GOBJ(i))
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self, VALUE type, VALUE visual, VALUE w, VALUE h)
|
||||
{
|
||||
GdkImage* image = gdk_image_new((GdkImageType)RVAL2GENUM(type, GDK_TYPE_IMAGE_TYPE),
|
||||
GDK_VISUAL(RVAL2GOBJ(visual)),
|
||||
NUM2INT(w), NUM2INT(h));
|
||||
|
||||
if (image)
|
||||
G_INITIALIZE(self, image);
|
||||
else
|
||||
rb_raise(rb_eArgError, "The image could not be created.");
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_colormap(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_image_get_colormap(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_colormap(VALUE self, VALUE colormap)
|
||||
{
|
||||
gdk_image_set_colormap(_SELF(self), RVAL2GOBJ(colormap));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_put_pixel(VALUE self, VALUE x, VALUE y, VALUE pix)
|
||||
{
|
||||
gdk_image_put_pixel(_SELF(self),
|
||||
NUM2INT(x), NUM2INT(y), NUM2INT(pix));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_get_pixel(VALUE self, VALUE x, VALUE y)
|
||||
{
|
||||
return INT2NUM(gdk_image_get_pixel(_SELF(self),
|
||||
NUM2INT(x), NUM2INT(y)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_image_type(VALUE self)
|
||||
{
|
||||
return GENUM2RVAL((_SELF(self))->type, GDK_TYPE_IMAGE_TYPE);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_visual(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL((_SELF(self))->visual);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_byte_order(VALUE self)
|
||||
{
|
||||
return GENUM2RVAL((_SELF(self))->byte_order, GDK_TYPE_BYTE_ORDER);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_bits_per_pixel(VALUE self)
|
||||
{
|
||||
return INT2NUM((_SELF(self))->bits_per_pixel);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_width(VALUE self)
|
||||
{
|
||||
return INT2NUM((_SELF(self))->width);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_height(VALUE self)
|
||||
{
|
||||
return INT2NUM((_SELF(self))->height);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_depth(VALUE self)
|
||||
{
|
||||
return INT2NUM((_SELF(self))->depth);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_bpp(VALUE self)
|
||||
{
|
||||
return INT2NUM((_SELF(self))->bpp);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_bpl(VALUE self)
|
||||
{
|
||||
return INT2NUM((_SELF(self))->bpl);
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_gdk_image(VALUE mGdk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_IMAGE, "Image", mGdk);
|
||||
|
||||
RG_DEF_METHOD(initialize, 4);
|
||||
RG_DEF_METHOD(colormap, 0);
|
||||
RG_DEF_METHOD(set_colormap, 1);
|
||||
RG_DEF_METHOD(put_pixel, 3);
|
||||
RG_DEF_METHOD(get_pixel, 2);
|
||||
RG_DEF_METHOD(image_type, 0);
|
||||
RG_DEF_METHOD(visual, 0);
|
||||
RG_DEF_METHOD(byte_order, 0);
|
||||
RG_DEF_METHOD(bits_per_pixel, 0);
|
||||
RG_DEF_METHOD(width, 0);
|
||||
RG_DEF_METHOD(height, 0);
|
||||
RG_DEF_METHOD(depth, 0);
|
||||
RG_DEF_METHOD(bpp, 0);
|
||||
RG_DEF_METHOD(bpl, 0);
|
||||
|
||||
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
||||
|
||||
/* GdkImageType */
|
||||
G_DEF_CLASS(GDK_TYPE_IMAGE_TYPE, "Type", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_IMAGE_TYPE, "GDK_IMAGE_");
|
||||
}
|
||||
72
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkinput.c
Normal file
72
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkinput.c
Normal file
@@ -0,0 +1,72 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Masao Mutoh
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE mInput
|
||||
|
||||
static void
|
||||
exec_input(gpointer data, G_GNUC_UNUSED gint source, GdkInputCondition condition)
|
||||
{
|
||||
rb_funcall((VALUE)data, id_call, 1,
|
||||
GFLAGS2RVAL(condition, GDK_TYPE_INPUT_CONDITION));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_add(VALUE self, VALUE filedescriptor, VALUE gdk_input_condition)
|
||||
{
|
||||
VALUE id;
|
||||
VALUE func;
|
||||
|
||||
func = rb_block_proc();
|
||||
id = INT2FIX(gdk_input_add(NUM2INT(rb_funcall(filedescriptor,
|
||||
rb_intern("to_i"), 0)),
|
||||
RVAL2GFLAGS(gdk_input_condition, GDK_TYPE_INPUT_CONDITION),
|
||||
(GdkInputFunction)exec_input,
|
||||
(gpointer)func));
|
||||
G_RELATIVE2(self, func, id_relative_callbacks, id);
|
||||
return id;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_remove(VALUE self, VALUE id)
|
||||
{
|
||||
gdk_input_remove(NUM2INT(id));
|
||||
G_REMOVE_RELATIVE(self, id_relative_callbacks, id);
|
||||
return id;
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_gdk_input(VALUE mGdk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGdk, "Input");
|
||||
|
||||
RG_DEF_MODFUNC(add, 2);
|
||||
RG_DEF_MODFUNC(remove, 1);
|
||||
|
||||
/* GdkInputCondition */
|
||||
G_DEF_CLASS(GDK_TYPE_INPUT_CONDITION, "Condition", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_INPUT_CONDITION, "GDK_INPUT_");
|
||||
|
||||
}
|
||||
157
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkkeymap.c
Normal file
157
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkkeymap.c
Normal file
@@ -0,0 +1,157 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2003,2004 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cKeymap
|
||||
#define _SELF(s) GDK_KEYMAP(RVAL2GOBJ(s))
|
||||
|
||||
static VALUE
|
||||
rg_s_default(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_keymap_get_default());
|
||||
}
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
static VALUE
|
||||
rg_s_for_display(G_GNUC_UNUSED VALUE self, VALUE display)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_keymap_get_for_display(GDK_DISPLAY_OBJECT(RVAL2GOBJ(display))));
|
||||
}
|
||||
#endif
|
||||
static VALUE
|
||||
rg_lookup_key(VALUE self, VALUE keycode, VALUE group, VALUE level)
|
||||
{
|
||||
GdkKeymapKey key;
|
||||
|
||||
key.keycode = NUM2UINT(keycode);
|
||||
key.group = NUM2INT(group);
|
||||
key.level = NUM2INT(level);
|
||||
|
||||
return INT2NUM(gdk_keymap_lookup_key(_SELF(self), &key));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_translate_keyboard_state(VALUE self, VALUE hardware_keycode, VALUE state, VALUE group)
|
||||
{
|
||||
guint keyval;
|
||||
gint effective_group, level;
|
||||
GdkModifierType consumed_modifiers;
|
||||
gboolean ret;
|
||||
|
||||
ret = gdk_keymap_translate_keyboard_state(_SELF(self),
|
||||
NUM2UINT(hardware_keycode),
|
||||
RVAL2GFLAGS(state, GDK_TYPE_MODIFIER_TYPE),
|
||||
NUM2INT(group),
|
||||
&keyval, &effective_group,
|
||||
&level, &consumed_modifiers);
|
||||
return ret ? rb_ary_new3(4, UINT2NUM(keyval), INT2NUM(effective_group),
|
||||
INT2NUM(level),
|
||||
GFLAGS2RVAL(consumed_modifiers, GDK_TYPE_MODIFIER_TYPE)) : Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_get_entries_for_keyval(VALUE self, VALUE keyval)
|
||||
{
|
||||
GdkKeymapKey* keys;
|
||||
gint n_keys;
|
||||
gboolean ret;
|
||||
ret = gdk_keymap_get_entries_for_keyval(_SELF(self),
|
||||
NUM2UINT(keyval), &keys, &n_keys);
|
||||
|
||||
if (ret){
|
||||
VALUE key;
|
||||
VALUE ary = rb_ary_new();
|
||||
gint i;
|
||||
for (i = 0; i < n_keys; i++){
|
||||
key = rb_ary_new3(3, UINT2NUM(keys[i].keycode), INT2NUM(keys[i].group),
|
||||
INT2NUM(keys[i].level));
|
||||
rb_ary_push(ary, key);
|
||||
}
|
||||
g_free(keys);
|
||||
return ary;
|
||||
} else {
|
||||
return Qnil;
|
||||
}
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_get_entries_for_keycode(VALUE self, VALUE hardware_keycode)
|
||||
{
|
||||
GdkKeymapKey* keys;
|
||||
guint* keyvals;
|
||||
gint n_entries;
|
||||
gboolean ret = gdk_keymap_get_entries_for_keycode(_SELF(self),
|
||||
NUM2UINT(hardware_keycode),
|
||||
&keys, &keyvals, &n_entries);
|
||||
if (ret){
|
||||
VALUE key;
|
||||
VALUE ary = rb_ary_new();
|
||||
gint i;
|
||||
for (i = 0; i < n_entries; i++){
|
||||
key = rb_ary_new3(4, UINT2NUM(keys[i].keycode), INT2NUM(keys[i].group),
|
||||
INT2NUM(keys[i].level), UINT2NUM(keyvals[i]));
|
||||
rb_ary_push(ary, key);
|
||||
}
|
||||
g_free(keys);
|
||||
g_free(keyvals);
|
||||
return ary;
|
||||
} else {
|
||||
return Qnil;
|
||||
}
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_direction(VALUE self)
|
||||
{
|
||||
return GENUM2RVAL(gdk_keymap_get_direction(_SELF(self)), PANGO_TYPE_DIRECTION);
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2, 12, 0)
|
||||
static VALUE
|
||||
rg_have_bidi_layouts_p(VALUE self)
|
||||
{
|
||||
return CBOOL2RVAL(gdk_keymap_have_bidi_layouts(_SELF(self)));
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_gdk_keymap(VALUE mGdk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_KEYMAP, "Keymap", mGdk);
|
||||
|
||||
RG_DEF_SMETHOD(default, 0);
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
RG_DEF_SMETHOD(for_display, 0);
|
||||
#endif
|
||||
RG_DEF_METHOD(lookup_key, 3);
|
||||
RG_DEF_METHOD(translate_keyboard_state, 3);
|
||||
RG_DEF_METHOD(get_entries_for_keyval, 1);
|
||||
RG_DEF_METHOD(get_entries_for_keycode, 1);
|
||||
RG_DEF_METHOD(direction, 0);
|
||||
#if GTK_CHECK_VERSION(2, 12, 0)
|
||||
RG_DEF_METHOD_P(have_bidi_layouts, 0);
|
||||
#endif
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
G_DEF_CLASS3("GdkKeymapX11", "KeymapX11", mGdk);
|
||||
#endif
|
||||
|
||||
}
|
||||
108
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkkeyval.c
Normal file
108
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkkeyval.c
Normal file
@@ -0,0 +1,108 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
|
||||
#define RG_TARGET_NAMESPACE mGdkKeyval
|
||||
|
||||
static VALUE
|
||||
rg_m_to_name(G_GNUC_UNUSED VALUE self, VALUE keyval)
|
||||
{
|
||||
gchar* name = gdk_keyval_name(NUM2UINT(keyval));
|
||||
return name ? CSTR2RVAL(name) : Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_from_name(G_GNUC_UNUSED VALUE self, VALUE keyval_name)
|
||||
{
|
||||
return UINT2NUM(gdk_keyval_from_name(RVAL2CSTR(keyval_name)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_upper_p(G_GNUC_UNUSED VALUE self, VALUE keyval)
|
||||
{
|
||||
return CBOOL2RVAL(gdk_keyval_is_upper(NUM2UINT(keyval)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_lower_p(G_GNUC_UNUSED VALUE self, VALUE keyval)
|
||||
{
|
||||
return CBOOL2RVAL(gdk_keyval_is_lower(NUM2UINT(keyval)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_convert_case(G_GNUC_UNUSED VALUE self, VALUE symbol)
|
||||
{
|
||||
guint upper, lower;
|
||||
gdk_keyval_convert_case(NUM2UINT(symbol), &lower, &upper);
|
||||
return rb_ary_new3(2, UINT2NUM(lower), UINT2NUM(upper));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_to_upper(G_GNUC_UNUSED VALUE self, VALUE keyval)
|
||||
{
|
||||
return INT2NUM(gdk_keyval_to_upper(NUM2UINT(keyval)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_to_lower(G_GNUC_UNUSED VALUE self, VALUE keyval)
|
||||
{
|
||||
return INT2NUM(gdk_keyval_to_lower(NUM2UINT(keyval)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_to_unicode(G_GNUC_UNUSED VALUE self, VALUE keyval)
|
||||
{
|
||||
return UINT2NUM(gdk_keyval_to_unicode(NUM2UINT(keyval)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_from_unicode(G_GNUC_UNUSED VALUE self, VALUE wc)
|
||||
{
|
||||
VALUE unicode;
|
||||
if (TYPE(wc) == T_STRING) {
|
||||
unicode = NUM2UINT(rb_funcall(wc, rb_intern("[]"), 1, INT2FIX(0)));
|
||||
} else {
|
||||
unicode = NUM2UINT(wc);
|
||||
}
|
||||
return UINT2NUM(gdk_unicode_to_keyval(unicode));
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_gdk_keyval(VALUE mGdk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGdk, "Keyval");
|
||||
RG_DEF_MODFUNC(to_name, 1);
|
||||
RG_DEF_MODFUNC(from_name, 1);
|
||||
RG_DEF_MODFUNC_P(upper, 1);
|
||||
RG_DEF_MODFUNC_P(lower, 1);
|
||||
RG_DEF_MODFUNC(convert_case, 1);
|
||||
RG_DEF_MODFUNC(to_upper, 1);
|
||||
RG_DEF_MODFUNC(to_lower, 1);
|
||||
RG_DEF_MODFUNC(to_unicode, 1);
|
||||
RG_DEF_MODFUNC(from_unicode, 1);
|
||||
|
||||
#include "rbgdkkeysyms.h"
|
||||
}
|
||||
188
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkpango.c
Normal file
188
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkpango.c
Normal file
@@ -0,0 +1,188 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2003,2004 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
#include "rbpango.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE mPango
|
||||
|
||||
static VALUE
|
||||
rg_m_context(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
VALUE screen, ret;
|
||||
rb_scan_args(argc, argv, "01", &screen);
|
||||
if (NIL_P(screen)){
|
||||
ret = GOBJ2RVAL(gdk_pango_context_get());
|
||||
} else {
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
ret = GOBJ2RVAL(gdk_pango_context_get_for_screen(GDK_SCREEN(RVAL2GOBJ(screen))));
|
||||
#else
|
||||
rb_warn("Gdk::Pango.context_get: Not supported arguments in GTK+-2.0.x.");
|
||||
ret = GOBJ2RVAL(gdk_pango_context_get());
|
||||
#endif
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
gdkpango_context_set_colormap(VALUE self, VALUE colormap)
|
||||
{
|
||||
gdk_pango_context_set_colormap(PANGO_CONTEXT(RVAL2GOBJ(self)),
|
||||
GDK_COLORMAP(RVAL2GOBJ(colormap)));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
gdkpango_attr_embossed_initialize(VALUE self, VALUE embossed)
|
||||
{
|
||||
DATA_PTR(self) = gdk_pango_attr_embossed_new(RVAL2CBOOL(embossed));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
gdkpango_attr_embossed_value(VALUE self)
|
||||
{
|
||||
return CBOOL2RVAL(((GdkPangoAttrEmbossed*)RVAL2ATTR(self))->embossed);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
gdkpango_attr_stipple_initialize(VALUE self, VALUE stipple)
|
||||
{
|
||||
DATA_PTR(self) = gdk_pango_attr_stipple_new(GDK_BITMAP(RVAL2GOBJ(stipple)));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
gdkpango_attr_stipple_value(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(((GdkPangoAttrStipple*)RVAL2ATTR(self))->stipple);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
gdkpango_layout_get_clip_region(VALUE self, VALUE rbx_origin, VALUE rby_origin, VALUE rbindex_ranges)
|
||||
{
|
||||
PangoLayout *layout = PANGO_LAYOUT(RVAL2GOBJ(self));
|
||||
gint x_origin = NUM2INT(rbx_origin);
|
||||
gint y_origin = NUM2INT(rby_origin);
|
||||
long n;
|
||||
gint *index_ranges = RVAL2GINTS(rbindex_ranges, n);
|
||||
GdkRegion *result;
|
||||
|
||||
if (n % 2 != 0) {
|
||||
g_free(index_ranges);
|
||||
|
||||
rb_raise(rb_eArgError,
|
||||
"an even number of byte indexes must be given");
|
||||
}
|
||||
|
||||
result = gdk_pango_layout_get_clip_region(layout, x_origin, y_origin, index_ranges, n / 2);
|
||||
|
||||
g_free(index_ranges);
|
||||
|
||||
return BOXED2RVAL(result, GDK_TYPE_REGION);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
gdkpango_layout_line_get_clip_region(VALUE self, VALUE rbx_origin, VALUE rby_origin, VALUE rbindex_ranges)
|
||||
{
|
||||
PangoLayoutLine *line = (PangoLayoutLine *)RVAL2BOXED(self, PANGO_TYPE_LAYOUT_LINE);
|
||||
gint x_origin = NUM2INT(rbx_origin);
|
||||
gint y_origin = NUM2INT(rby_origin);
|
||||
long n;
|
||||
gint *index_ranges = RVAL2GINTS(rbindex_ranges, n);
|
||||
GdkRegion *result;
|
||||
|
||||
if (n % 2 != 0) {
|
||||
g_free(index_ranges);
|
||||
|
||||
rb_raise(rb_eArgError,
|
||||
"an even number of byte indexes must be given");
|
||||
}
|
||||
|
||||
result = gdk_pango_layout_line_get_clip_region(line, x_origin, y_origin, index_ranges, n / 2);
|
||||
|
||||
g_free(index_ranges);
|
||||
|
||||
return BOXED2RVAL(result, GDK_TYPE_REGION);
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2, 12, 0)
|
||||
static VALUE
|
||||
gdkpango_attr_emboss_color_initialize(VALUE self, VALUE color)
|
||||
{
|
||||
DATA_PTR(self) = gdk_pango_attr_emboss_color_new(RVAL2GDKCOLOR(color));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
gdkpango_attr_emboss_color_value(VALUE self)
|
||||
{
|
||||
return BOXED2RVAL(&(((GdkPangoAttrEmbossColor *)RVAL2ATTR(self))->color),
|
||||
PANGO_TYPE_COLOR);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_gdk_pango(VALUE mGdk)
|
||||
{
|
||||
VALUE klass;
|
||||
PangoAttribute* tmpattr;
|
||||
GdkColor color;
|
||||
|
||||
VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGdk, "Pango");
|
||||
VALUE context = GTYPE2CLASS(PANGO_TYPE_CONTEXT);
|
||||
VALUE layout = GTYPE2CLASS(PANGO_TYPE_LAYOUT);
|
||||
VALUE layoutline = GTYPE2CLASS(PANGO_TYPE_LAYOUT_LINE);
|
||||
VALUE pattr = ATTRTYPE2CLASS(CSTR2RVAL("Attribute"));
|
||||
VALUE pattrbool = ATTRTYPE2CLASS(CSTR2RVAL("AttrBool"));
|
||||
VALUE pattr_color = ATTRTYPE2CLASS(CSTR2RVAL("AttrColor"));
|
||||
|
||||
RG_DEF_MODFUNC(context, -1);
|
||||
|
||||
rb_define_method(context, "set_colormap", gdkpango_context_set_colormap, 1);
|
||||
G_DEF_SETTER(context, "colormap");
|
||||
rb_define_method(layout, "get_clip_region", gdkpango_layout_get_clip_region, 3);
|
||||
rb_define_method(layoutline, "get_clip_region", gdkpango_layout_line_get_clip_region, 3);
|
||||
|
||||
klass = rb_define_class_under(mGdk, "PangoAttrEmbossed", pattrbool);
|
||||
rb_define_method(klass, "initialize", gdkpango_attr_embossed_initialize, 1);
|
||||
tmpattr = gdk_pango_attr_embossed_new(TRUE);
|
||||
rb_define_method(klass, "value", gdkpango_attr_embossed_value, 0);
|
||||
RBPANGO_ADD_ATTRIBUTE(tmpattr->klass->type, klass);
|
||||
pango_attribute_destroy(tmpattr);
|
||||
|
||||
klass = rb_define_class_under(mGdk, "PangoAttrStipple", pattr);
|
||||
rb_define_method(klass, "initialize", gdkpango_attr_stipple_initialize, 1);
|
||||
rb_define_method(klass, "value", gdkpango_attr_stipple_value, 0);
|
||||
tmpattr = gdk_pango_attr_stipple_new(NULL);
|
||||
RBPANGO_ADD_ATTRIBUTE(tmpattr->klass->type, klass);
|
||||
pango_attribute_destroy(tmpattr);
|
||||
|
||||
#if GTK_CHECK_VERSION(2, 12, 0)
|
||||
klass = rb_define_class_under(mGdk, "PangoAttrEmbossColor", pattr_color);
|
||||
rb_define_method(klass, "initialize",
|
||||
gdkpango_attr_emboss_color_initialize, 1);
|
||||
rb_define_method(klass, "value", gdkpango_attr_emboss_color_value, 0);
|
||||
tmpattr = gdk_pango_attr_emboss_color_new(&color);
|
||||
RBPANGO_ADD_ATTRIBUTE(tmpattr->klass->type, klass);
|
||||
pango_attribute_destroy(tmpattr);
|
||||
#endif
|
||||
}
|
||||
149
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkpangorenderer.c
Normal file
149
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkpangorenderer.c
Normal file
@@ -0,0 +1,149 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011-2012 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2005 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
|
||||
#define RG_TARGET_NAMESPACE cPangoRenderer
|
||||
#define _SELF(s) (GDK_PANGO_RENDERER(RVAL2GOBJ(s)))
|
||||
|
||||
static VALUE
|
||||
rg_initialize(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE screen;
|
||||
GdkScreen* gscreen;
|
||||
|
||||
rb_scan_args(argc, argv, "01", &screen);
|
||||
|
||||
if (NIL_P(screen)){
|
||||
gscreen = gdk_screen_get_default();
|
||||
} else {
|
||||
gscreen = GDK_SCREEN(RVAL2GOBJ(screen));
|
||||
}
|
||||
|
||||
G_INITIALIZE(self, gdk_pango_renderer_new(gscreen));
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_get_default(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
VALUE screen;
|
||||
GdkScreen* gscreen;
|
||||
|
||||
rb_scan_args(argc, argv, "01", &screen);
|
||||
|
||||
if (NIL_P(screen)){
|
||||
gscreen = gdk_screen_get_default();
|
||||
} else {
|
||||
gscreen = GDK_SCREEN(RVAL2GOBJ(screen));
|
||||
}
|
||||
return GOBJ2RVAL(gdk_pango_renderer_get_default(gscreen));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_default(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
GdkScreen* gscreen = gdk_screen_get_default();
|
||||
return GOBJ2RVAL(gdk_pango_renderer_get_default(gscreen));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_drawable(VALUE self, VALUE drawable)
|
||||
{
|
||||
gdk_pango_renderer_set_drawable(_SELF(self),
|
||||
GDK_DRAWABLE(RVAL2GOBJ(drawable)));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_gc(VALUE self, VALUE gc)
|
||||
{
|
||||
gdk_pango_renderer_set_gc(_SELF(self),
|
||||
NIL_P(gc) ? NULL : GDK_GC(RVAL2GOBJ(gc)));
|
||||
return self;
|
||||
}
|
||||
|
||||
#ifdef HAVE_PANGO_RENDER_PART_GET_TYPE
|
||||
static VALUE
|
||||
rg_set_stipple(VALUE self, VALUE part, VALUE stipple)
|
||||
{
|
||||
gdk_pango_renderer_set_stipple(_SELF(self), RVAL2GENUM(part, PANGO_TYPE_RENDER_PART),
|
||||
NIL_P(stipple) ? NULL : GDK_BITMAP(RVAL2GOBJ(stipple)));
|
||||
|
||||
return self;
|
||||
}
|
||||
#else
|
||||
static VALUE
|
||||
rg_set_stipple(G_GNUC_UNUSED VALUE self,
|
||||
G_GNUC_UNUSED VALUE part,
|
||||
G_GNUC_UNUSED VALUE stipple)
|
||||
{
|
||||
rb_warning("Gdk::PangoRender#set_tipple is not supported (Require pango-1.8.1 or later");
|
||||
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PANGO_RENDER_PART_GET_TYPE
|
||||
static VALUE
|
||||
rg_set_override_color(VALUE self, VALUE part, VALUE color)
|
||||
{
|
||||
gdk_pango_renderer_set_override_color(_SELF(self),
|
||||
RVAL2GENUM(part, PANGO_TYPE_RENDER_PART),
|
||||
RVAL2GDKCOLOR(color));
|
||||
|
||||
return self;
|
||||
}
|
||||
#else
|
||||
static VALUE
|
||||
rg_set_override_color(G_GNUC_UNUSED VALUE self,
|
||||
G_GNUC_UNUSED VALUE part,
|
||||
G_GNUC_UNUSED VALUE color)
|
||||
{
|
||||
rb_warning("Gdk::PangoRender#set_override_color is not supported (Require pango-1.8.1 or later");
|
||||
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_gdk_pangorenderer(VALUE mGdk)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_PANGO_RENDERER, "PangoRenderer", mGdk);
|
||||
|
||||
RG_DEF_METHOD(initialize, -1);
|
||||
RG_DEF_METHOD(set_drawable, 1);
|
||||
RG_DEF_METHOD(set_gc, 1);
|
||||
RG_DEF_METHOD(set_stipple, 2);
|
||||
RG_DEF_METHOD(set_override_color, 2);
|
||||
|
||||
RG_DEF_SMETHOD(get_default, -1);
|
||||
RG_DEF_SMETHOD(default, 0);
|
||||
|
||||
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
||||
#endif
|
||||
}
|
||||
174
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkpixbuf.c
Normal file
174
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkpixbuf.c
Normal file
@@ -0,0 +1,174 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cPixbuf
|
||||
#define _SELF(s) GDK_PIXBUF(RVAL2GOBJ(s))
|
||||
|
||||
static VALUE
|
||||
rg_render_threshold_alpha(VALUE self, VALUE bitmap, VALUE src_x, VALUE src_y, VALUE dest_x, VALUE dest_y, VALUE width, VALUE height, VALUE alpha_threshold)
|
||||
{
|
||||
gdk_pixbuf_render_threshold_alpha(_SELF(self), GDK_BITMAP(RVAL2GOBJ(bitmap)),
|
||||
NUM2INT(src_x), NUM2INT(src_y),
|
||||
NUM2INT(dest_x), NUM2INT(dest_y),
|
||||
NUM2INT(width), NUM2INT(height),
|
||||
NUM2INT(alpha_threshold));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_render_to_drawable(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE gc, src_x, src_y, dest_x, dest_y, width, height,
|
||||
dither, x_dither, y_dither;
|
||||
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
rb_warn("Gdk::Pixbuf#render_to_drawable is obsolete. Use Gdk::Drawable#draw_pixbuf instead.");
|
||||
#endif
|
||||
|
||||
rb_scan_args(argc, argv, "73", &gc, &src_x, &src_y, &dest_x, &dest_y,
|
||||
&width, &height, &dither, &x_dither, &y_dither);
|
||||
|
||||
if (NIL_P(gc))
|
||||
rb_raise(rb_eArgError, "arguments 1 must be non nil");
|
||||
if (NIL_P(src_x))
|
||||
rb_raise(rb_eArgError, "arguments 2 must be non nil");
|
||||
if (NIL_P(src_y))
|
||||
rb_raise(rb_eArgError, "arguments 3 must be non nil");
|
||||
if (NIL_P(dest_x))
|
||||
rb_raise(rb_eArgError, "arguments 4 must be non nil");
|
||||
if (NIL_P(dest_y))
|
||||
rb_raise(rb_eArgError, "arguments 5 must be non nil");
|
||||
if (NIL_P(width))
|
||||
rb_raise(rb_eArgError, "arguments 6 must be non nil");
|
||||
if (NIL_P(height))
|
||||
rb_raise(rb_eArgError, "arguments 7 must be non nil");
|
||||
|
||||
gdk_pixbuf_render_to_drawable(_SELF(self),
|
||||
GDK_DRAWABLE(RVAL2GOBJ(self)),
|
||||
GDK_GC(RVAL2GOBJ(gc)),
|
||||
NUM2INT(src_x), NUM2INT(src_y),
|
||||
NUM2INT(dest_x), NUM2INT(dest_y),
|
||||
NUM2INT(width), NUM2INT(height),
|
||||
NIL_P(dither) ? GDK_RGB_DITHER_NONE : RVAL2GENUM(dither, GDK_TYPE_RGB_DITHER),
|
||||
NIL_P(x_dither) ? 0 : NUM2INT(x_dither),
|
||||
NIL_P(y_dither) ? 0 : NUM2INT(y_dither));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_render_pixmap_and_mask(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE colormap_or_alpha, alpha;
|
||||
GdkPixmap *pixmap;
|
||||
GdkBitmap *mask;
|
||||
|
||||
rb_scan_args(argc, argv, "11", &colormap_or_alpha, &alpha);
|
||||
|
||||
if (rb_obj_is_kind_of(colormap_or_alpha, GTYPE2CLASS(GDK_TYPE_COLORMAP))){
|
||||
gdk_pixbuf_render_pixmap_and_mask_for_colormap(_SELF(self),
|
||||
RVAL2GOBJ(colormap_or_alpha),
|
||||
&pixmap,
|
||||
&mask,
|
||||
NIL_P(alpha)?0:NUM2INT(alpha));
|
||||
} else {
|
||||
gdk_pixbuf_render_pixmap_and_mask(_SELF(self),
|
||||
&pixmap,
|
||||
&mask,
|
||||
NIL_P(colormap_or_alpha)?
|
||||
0:NUM2INT(colormap_or_alpha));
|
||||
}
|
||||
|
||||
return rb_ary_new3(2,
|
||||
pixmap ? GOBJ2RVAL(pixmap) : Qnil,
|
||||
mask ? GOBJ2RVAL(mask) : Qnil);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_from_drawable(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
VALUE cmap, src, src_x, src_y, width, height, dest, dest_x, dest_y;
|
||||
GdkPixbuf* buf;
|
||||
|
||||
rb_scan_args(argc, argv, "63", &cmap, &src, &src_x, &src_y, &width, &height,
|
||||
&dest, &dest_x, &dest_y);
|
||||
|
||||
buf = gdk_pixbuf_get_from_drawable(GDK_PIXBUF(RVAL2GOBJ(dest)),
|
||||
GDK_DRAWABLE(RVAL2GOBJ(src)),
|
||||
GDK_COLORMAP(RVAL2GOBJ(cmap)),
|
||||
NUM2INT(src_x), NUM2INT(src_y),
|
||||
NIL_P(dest_x) ? 0 : NUM2INT(dest_x),
|
||||
NIL_P(dest_y) ? 0 : NUM2INT(dest_y),
|
||||
NUM2INT(width), NUM2INT(height));
|
||||
if (NIL_P(dest)) {
|
||||
if (buf) {
|
||||
return GOBJ2RVALU(buf);
|
||||
} else {
|
||||
return Qnil;
|
||||
}
|
||||
} else {
|
||||
return dest;
|
||||
}
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_from_image(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
VALUE cmap, src, src_x, src_y, width, height, dest, dest_x, dest_y;
|
||||
GdkPixbuf* buf;
|
||||
|
||||
rb_scan_args(argc, argv, "63", &cmap, &src, &src_x, &src_y, &width, &height,
|
||||
&dest, &dest_x, &dest_y);
|
||||
|
||||
buf = gdk_pixbuf_get_from_image(GDK_PIXBUF(RVAL2GOBJ(dest)),
|
||||
GDK_IMAGE(RVAL2GOBJ(src)),
|
||||
GDK_COLORMAP(RVAL2GOBJ(cmap)),
|
||||
NUM2INT(src_x), NUM2INT(src_y),
|
||||
NIL_P(dest_x) ? 0 : NUM2INT(dest_x),
|
||||
NIL_P(dest_y) ? 0 : NUM2INT(dest_y),
|
||||
NUM2INT(width), NUM2INT(height));
|
||||
if (NIL_P(dest)) {
|
||||
if (buf) {
|
||||
return GOBJ2RVAL(buf);
|
||||
} else {
|
||||
return Qnil;
|
||||
}
|
||||
} else {
|
||||
return dest;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_gdk_pixbuf(VALUE mGdk)
|
||||
{
|
||||
/*
|
||||
* This defines Gdk::Pixbuf methods of GDK side.
|
||||
*/
|
||||
VALUE RG_TARGET_NAMESPACE = GTYPE2CLASS(GDK_TYPE_PIXBUF);
|
||||
|
||||
RG_DEF_METHOD(render_threshold_alpha, 8);
|
||||
RG_DEF_METHOD(render_to_drawable, -1);
|
||||
RG_DEF_METHOD(render_pixmap_and_mask, -1);
|
||||
|
||||
RG_DEF_SMETHOD(from_drawable, -1);
|
||||
RG_DEF_SMETHOD(from_image, -1);
|
||||
}
|
||||
251
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkpixmap.c
Normal file
251
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkpixmap.c
Normal file
@@ -0,0 +1,251 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002-2004 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
#ifdef HAVE_XREADBITMAPFILEDATA
|
||||
#include <X11/Xlib.h>
|
||||
#endif /* HAVE_XREADBITMAPFILEDATA */
|
||||
|
||||
#define RG_TARGET_NAMESPACE cPixmap
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self, VALUE win, VALUE w, VALUE h, VALUE depth)
|
||||
{
|
||||
G_INITIALIZE(self, gdk_pixmap_new(GDK_WINDOW(RVAL2GOBJ(win)),
|
||||
NUM2INT(w), NUM2INT(h),
|
||||
NUM2INT(depth)));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_create_from_data(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
VALUE win, data, w, h, depth, fg, bg, ret;
|
||||
|
||||
rb_scan_args(argc, argv, "43", &win, &data, &w, &h, &depth, &fg, &bg);
|
||||
|
||||
StringValue(data);
|
||||
if (NIL_P(depth)){
|
||||
ret = GOBJ2RVAL(gdk_bitmap_create_from_data(NIL_P(win) ? NULL : GDK_WINDOW(RVAL2GOBJ(win)),
|
||||
RVAL2CSTR(data), NUM2INT(w), NUM2INT(h)));
|
||||
} else {
|
||||
ret = GOBJ2RVAL(gdk_pixmap_create_from_data(NIL_P(win) ? NULL : GDK_WINDOW(RVAL2GOBJ(win)),
|
||||
RVAL2CSTR(data), NUM2INT(w), NUM2INT(h),
|
||||
NUM2INT(depth),
|
||||
RVAL2GDKCOLOR(fg),
|
||||
RVAL2GDKCOLOR(bg)));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_create_from_xpm(G_GNUC_UNUSED VALUE self, VALUE win, VALUE color, VALUE fname)
|
||||
{
|
||||
GdkPixmap *result;
|
||||
GdkBitmap *mask;
|
||||
|
||||
result = gdk_pixmap_create_from_xpm(GDK_WINDOW(RVAL2GOBJ(win)),
|
||||
&mask,
|
||||
RVAL2GDKCOLOR(color),
|
||||
RVAL2CSTR(fname));
|
||||
if (result == NULL)
|
||||
rb_raise(rb_eArgError, "Pixmap not created from %s", RVAL2CSTR(fname));
|
||||
|
||||
return rb_assoc_new(GOBJ2RVAL(result), GOBJ2RVAL(mask));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_create_from_xpm_d(G_GNUC_UNUSED VALUE self, VALUE win, VALUE tcolor, VALUE data)
|
||||
{
|
||||
GdkPixmap *result;
|
||||
GdkBitmap *mask;
|
||||
const gchar **buf = RVAL2STRV(data);
|
||||
|
||||
result = gdk_pixmap_create_from_xpm_d(GDK_WINDOW(RVAL2GOBJ(win)),
|
||||
&mask,
|
||||
RVAL2GDKCOLOR(tcolor),
|
||||
(gchar **)buf);
|
||||
|
||||
g_free(buf);
|
||||
|
||||
return rb_assoc_new(GOBJ2RVAL(result), GOBJ2RVAL(mask));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_colormap_create_from_xpm(G_GNUC_UNUSED VALUE self, VALUE win, VALUE colormap, VALUE tcolor, VALUE fname)
|
||||
{
|
||||
GdkPixmap *result;
|
||||
GdkBitmap *mask;
|
||||
|
||||
result = gdk_pixmap_colormap_create_from_xpm(NIL_P(win) ? NULL : GDK_WINDOW(RVAL2GOBJ(win)),
|
||||
GDK_COLORMAP(RVAL2GOBJ(colormap)),
|
||||
&mask,
|
||||
RVAL2GDKCOLOR(tcolor),
|
||||
RVAL2CSTR(fname));
|
||||
if (result == NULL)
|
||||
rb_raise(rb_eArgError, "Pixmap not created from %s", RVAL2CSTR(fname));
|
||||
|
||||
return rb_assoc_new(GOBJ2RVAL(result), GOBJ2RVAL(mask));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_colormap_create_from_xpm_d(G_GNUC_UNUSED VALUE self, VALUE win, VALUE colormap, VALUE tcolor, VALUE data)
|
||||
{
|
||||
GdkPixmap *result;
|
||||
GdkBitmap *mask;
|
||||
const gchar **buf = RVAL2STRV(data);
|
||||
|
||||
result = gdk_pixmap_colormap_create_from_xpm_d(NIL_P(win) ? NULL : GDK_WINDOW(RVAL2GOBJ(win)),
|
||||
GDK_COLORMAP(RVAL2GOBJ(colormap)),
|
||||
&mask,
|
||||
RVAL2GDKCOLOR(tcolor),
|
||||
(gchar **)buf);
|
||||
|
||||
return rb_assoc_new(GOBJ2RVAL(result), GOBJ2RVAL(mask));
|
||||
}
|
||||
|
||||
#ifdef HAVE_XREADBITMAPFILEDATA
|
||||
static VALUE
|
||||
rg_s_create_from_xbm(VALUE self, VALUE win, VALUE fname)
|
||||
{
|
||||
GdkBitmap *new;
|
||||
unsigned char *data;
|
||||
unsigned int width, height;
|
||||
int x, y;
|
||||
|
||||
StringValue(fname);
|
||||
if (XReadBitmapFileData(RVAL2CSTR(fname), &width, &height, &data, &x, &y))
|
||||
rb_raise(rb_eArgError, "Bitmap not created from %s", RVAL2CSTR(fname));
|
||||
|
||||
new = gdk_bitmap_create_from_data(GDK_WINDOW(RVAL2GOBJ(win)),
|
||||
(const gchar*)data, width, height);
|
||||
XFree(data);
|
||||
return GOBJ2RVAL(new);
|
||||
}
|
||||
#endif /* HAVE_XREADBITMAPFILEDATA */
|
||||
|
||||
/* From X Window System Interaction */
|
||||
/*
|
||||
Gdk::Window.foreign_new(anid)
|
||||
Gdk::Window.foreign_new(display, anid) # Since GTK+-2.2
|
||||
Gdk::Window.foreign_new(screen, anid, width, height, depth) # Since GTK+-2.10
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
rg_s_foreign_new(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
VALUE arg[5];
|
||||
GdkPixmap* win = NULL;
|
||||
|
||||
rb_scan_args(argc, argv, "14", &arg[0], &arg[1], &arg[2], &arg[3], &arg[4]);
|
||||
|
||||
switch(argc)
|
||||
{
|
||||
case 1:
|
||||
win = gdk_pixmap_foreign_new(RVAL2GDKNATIVEWINDOW(arg[0]));
|
||||
break;
|
||||
case 2:
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
win = gdk_pixmap_foreign_new_for_display(GDK_DISPLAY_OBJECT(RVAL2GOBJ(arg[0])),
|
||||
RVAL2GDKNATIVEWINDOW(arg[1]));
|
||||
#else
|
||||
win = gdk_pixmap_foreign_new(RVAL2GDKNATIVEWINDOW(arg[1]));
|
||||
rb_warn("Not supported. Use GTK+-2.2.0 or later.");
|
||||
#endif
|
||||
break;
|
||||
case 5:
|
||||
#if GTK_CHECK_VERSION(2,10,0)
|
||||
win = gdk_pixmap_foreign_new_for_screen(GDK_SCREEN(RVAL2GOBJ(arg[0])),
|
||||
RVAL2GDKNATIVEWINDOW(arg[1]), /* anid */
|
||||
NUM2INT(arg[2]), /* width */
|
||||
NUM2INT(arg[3]), /* height */
|
||||
NUM2INT(arg[4])); /* depth */
|
||||
#else
|
||||
win = gdk_pixmap_foreign_new(NUM2UINT(arg[1]));
|
||||
rb_warn("Not supported. GTK+-2.10.0 or later.");
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return win ? GOBJ2RVAL(win) : Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_lookup(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
VALUE arg[2];
|
||||
GdkPixmap* win = NULL;
|
||||
|
||||
rb_scan_args(argc, argv, "11", &arg[0], &arg[1]);
|
||||
|
||||
switch(argc)
|
||||
{
|
||||
case 1:
|
||||
win = gdk_pixmap_lookup(RVAL2GDKNATIVEWINDOW(arg[0]));
|
||||
break;
|
||||
case 2:
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
win = gdk_pixmap_lookup_for_display(RVAL2GOBJ(arg[0]), RVAL2GDKNATIVEWINDOW(arg[1]));
|
||||
#else
|
||||
win = gdk_pixmap_lookup(RVAL2GDKNATIVEWINDOW(arg[1]));
|
||||
rb_warn("Not supported in GTK+-2.0.x.");
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (win == NULL)
|
||||
return Qnil;
|
||||
else {
|
||||
return GOBJ2RVAL(win);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_gdk_pixmap(VALUE mGdk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_PIXMAP, "Pixmap", mGdk);
|
||||
|
||||
RG_DEF_METHOD(initialize, 4);
|
||||
RG_DEF_SMETHOD(create_from_data, -1);
|
||||
RG_DEF_SMETHOD(create_from_xpm, 3);
|
||||
RG_DEF_SMETHOD(create_from_xpm_d, 3);
|
||||
RG_DEF_SMETHOD(colormap_create_from_xpm, 4);
|
||||
RG_DEF_SMETHOD(colormap_create_from_xpm_d, 4);
|
||||
#ifdef HAVE_XREADBITMAPFILEDATA
|
||||
RG_DEF_SMETHOD(create_from_xbm, 2);
|
||||
#endif /* HAVE_XREADBITMAPFILEDATA */
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
G_DEF_CLASS3("GdkPixmapImplX11", "PixmapImplX11", mGdk);
|
||||
#elif defined(GDK_WINDOWING_WIN32)
|
||||
G_DEF_CLASS3("GdkPixmapImplWin32", "PixmapImplWin32", mGdk);
|
||||
#elif defined(GDK_WINDOWING_FB)
|
||||
G_DEF_CLASS3("GdkPixmapFB", "PixmapFB", mGdk);
|
||||
#endif
|
||||
|
||||
RG_DEF_SMETHOD(foreign_new, -1);
|
||||
RG_DEF_SMETHOD(lookup, -1);
|
||||
|
||||
}
|
||||
329
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkproperty.c
Normal file
329
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkproperty.c
Normal file
@@ -0,0 +1,329 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002-2004 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE mProperty
|
||||
|
||||
static VALUE
|
||||
rg_m_text_property_to_text_list(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
gint num, i;
|
||||
gchar** list;
|
||||
VALUE ret = Qnil;
|
||||
|
||||
if (argc == 3) {
|
||||
VALUE encoding, format, text;
|
||||
rb_scan_args(argc, argv, "30", &encoding, &format, &text);
|
||||
StringValue(text);
|
||||
|
||||
num = gdk_text_property_to_text_list(RVAL2ATOM(encoding),
|
||||
NUM2INT(format),
|
||||
(const guchar*)RVAL2CSTR(text),
|
||||
RSTRING_LEN(text), &list);
|
||||
} else {
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
VALUE display, encoding, format, text;
|
||||
rb_scan_args(argc, argv, "40", &display, &encoding, &format, &text);
|
||||
StringValue(text);
|
||||
|
||||
num = gdk_text_property_to_text_list_for_display(GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)),
|
||||
RVAL2ATOM(encoding),
|
||||
NUM2INT(format),
|
||||
(const guchar*)RVAL2CSTR(text),
|
||||
RSTRING_LEN(text),
|
||||
&list);
|
||||
#else
|
||||
VALUE encoding, format, text;
|
||||
rb_scan_args(argc, argv, "30", &encoding, &format, &text);
|
||||
rb_warn("Gdk::Property.text_property_to_text_list: Not supported arguments in GTK+-2.0.x.");
|
||||
num = gdk_text_property_to_text_list(RVAL2ATOM(encoding),
|
||||
NUM2INT(format),
|
||||
(const guchar*)RVAL2CSTR(text),
|
||||
RSTRING_LEN(text), &list);
|
||||
#endif
|
||||
}
|
||||
|
||||
ret = rb_ary_new2(num);
|
||||
for (i =0; i < num; i++){
|
||||
rb_ary_push(ret, CSTR2RVAL(list[i]));
|
||||
}
|
||||
gdk_free_text_list(list);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_text_property_to_utf8_list(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
gint num, i;
|
||||
gchar** list;
|
||||
VALUE ret = Qnil;
|
||||
|
||||
if (argc == 3) {
|
||||
VALUE encoding, format, text;
|
||||
rb_scan_args(argc, argv, "30", &encoding, &format, &text);
|
||||
StringValue(text);
|
||||
|
||||
num = gdk_text_property_to_utf8_list(RVAL2ATOM(encoding),
|
||||
NUM2INT(format),
|
||||
(const guchar*)RVAL2CSTR(text),
|
||||
RSTRING_LEN(text), &list);
|
||||
} else {
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
VALUE display, encoding, format, text;
|
||||
rb_scan_args(argc, argv, "40", &display, &encoding, &format, &text);
|
||||
StringValue(text);
|
||||
|
||||
num = gdk_text_property_to_utf8_list_for_display(GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)),
|
||||
RVAL2ATOM(encoding),
|
||||
NUM2INT(format),
|
||||
(const guchar*)RVAL2CSTR(text),
|
||||
RSTRING_LEN(text),
|
||||
&list);
|
||||
#else
|
||||
VALUE encoding, format, text;
|
||||
rb_scan_args(argc, argv, "30", &encoding, &format, &text);
|
||||
StringValue(text);
|
||||
|
||||
rb_warn("Gdk::Property.text_property_to_utf8_list: Not supported arguments in GTK+-2.0.x.");
|
||||
num = gdk_text_property_to_utf8_list(RVAL2ATOM(encoding),
|
||||
NUM2INT(format),
|
||||
(const guchar*)RVAL2CSTR(text),
|
||||
RSTRING_LEN(text), &list);
|
||||
#endif
|
||||
}
|
||||
|
||||
ret = rb_ary_new2(num);
|
||||
for (i =0; i < num; i++){
|
||||
rb_ary_push(ret, CSTR2RVAL(list[i]));
|
||||
}
|
||||
g_strfreev(list);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_string_to_compound_text(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
gint num;
|
||||
GdkAtom encoding;
|
||||
gint format;
|
||||
guchar *ctext;
|
||||
gint length;
|
||||
|
||||
if (argc == 1) {
|
||||
VALUE str;
|
||||
rb_scan_args(argc, argv, "10", &str);
|
||||
num = gdk_string_to_compound_text(RVAL2CSTR(str),
|
||||
&encoding, &format,
|
||||
&ctext, &length);
|
||||
} else {
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
VALUE display, str;
|
||||
|
||||
rb_scan_args(argc, argv, "20", &display, &str);
|
||||
num = gdk_string_to_compound_text_for_display(GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)),
|
||||
RVAL2CSTR(str),
|
||||
&encoding, &format,
|
||||
&ctext, &length);
|
||||
#else
|
||||
VALUE str;
|
||||
rb_scan_args(argc, argv, "10", &str);
|
||||
rb_warn("Gdk::Property.string_to_compound_text: Not supported arguments in GTK+-2.0.x.");
|
||||
num = gdk_string_to_compound_text(RVAL2CSTR(str),
|
||||
&encoding, &format,
|
||||
&ctext, &length);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (num == 0){
|
||||
VALUE ret = CSTR2RVAL((const char*)ctext);
|
||||
gdk_free_compound_text(ctext);
|
||||
return rb_ary_new3(3, BOXED2RVAL(encoding, GDK_TYPE_ATOM),
|
||||
INT2NUM(format), ret);
|
||||
} else {
|
||||
rb_raise(rb_eRuntimeError, "failed to converts a string %d\n", num);
|
||||
}
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_utf8_to_string_target(G_GNUC_UNUSED VALUE self, VALUE str)
|
||||
{
|
||||
return CSTR2RVAL((const char*)gdk_utf8_to_string_target(RVAL2CSTR(str)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_utf8_to_compound_text(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
GdkAtom encoding;
|
||||
gint format;
|
||||
guchar *ctext;
|
||||
gint length;
|
||||
gint ret;
|
||||
|
||||
if (argc == 1) {
|
||||
VALUE str;
|
||||
rb_scan_args(argc, argv, "10", &str);
|
||||
|
||||
ret = gdk_utf8_to_compound_text(RVAL2CSTR(str),
|
||||
&encoding, &format,
|
||||
&ctext, &length);
|
||||
} else {
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
VALUE display, str;
|
||||
|
||||
rb_scan_args(argc, argv, "20", &display, &str);
|
||||
ret = gdk_utf8_to_compound_text_for_display(GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)),
|
||||
RVAL2CSTR(str),
|
||||
&encoding, &format,
|
||||
&ctext, &length);
|
||||
#else
|
||||
VALUE str;
|
||||
rb_scan_args(argc, argv, "10", &str);
|
||||
|
||||
rb_warn("Gdk::Property.utf8_to_compound_text: Not supported arguments in GTK+-2.0.x.");
|
||||
ret = gdk_utf8_to_compound_text(RVAL2CSTR(str),
|
||||
&encoding, &format,
|
||||
&ctext, &length);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (ret){
|
||||
VALUE val = CSTR2RVAL((const char*)ctext);
|
||||
gdk_free_compound_text(ctext);
|
||||
return rb_ary_new3(3, BOXED2RVAL(encoding, GDK_TYPE_ATOM),
|
||||
INT2NUM(format), val);
|
||||
} else {
|
||||
rb_raise(rb_eRuntimeError, "failed to converts a string %d\n", ret);
|
||||
}
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_change(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
int fmt, len;
|
||||
void* dat;
|
||||
GdkAtom ntype;
|
||||
VALUE win, property, type, size= Qnil, mode, src;
|
||||
|
||||
if(6 == argc)
|
||||
rb_scan_args(argc, argv, "60", &win, &property, &type, &size, &mode, &src);
|
||||
else
|
||||
rb_scan_args(argc, argv, "50", &win, &property, &type, &mode, &src);
|
||||
|
||||
rbgtk_atom2selectiondata(type, size, src, &ntype, &dat, &fmt, &len);
|
||||
|
||||
gdk_property_change(GDK_WINDOW(RVAL2GOBJ(win)), RVAL2ATOM(property),
|
||||
ntype, fmt, RVAL2GENUM(mode, GDK_TYPE_PROP_MODE), dat, len);
|
||||
|
||||
rbgtk_atom2selectiondata_free(ntype, dat);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_get(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
/* for argument processing */
|
||||
GdkAtom rtype;
|
||||
gint rfmt, rlen;
|
||||
guchar* rdat;
|
||||
VALUE win, property, type, offset=INT2FIX(0), length=INT2FIX(9999), delete;
|
||||
|
||||
/* for inner processing */
|
||||
gint i;
|
||||
size_t j;
|
||||
VALUE ret = 0;
|
||||
|
||||
if(6 == argc)
|
||||
rb_scan_args(argc, argv, "60", &win, &property, &type, &offset, &length, &delete);
|
||||
else
|
||||
rb_scan_args(argc, argv, "40", &win, &property, &type, &delete);
|
||||
|
||||
if(gdk_property_get(GDK_WINDOW(RVAL2GOBJ(win)), RVAL2ATOM(property), RVAL2ATOM(type),
|
||||
NUM2INT(offset), NUM2INT(length),
|
||||
RVAL2CBOOL(delete), &rtype, &rfmt, &rlen, &rdat) == FALSE){
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
switch(rfmt){
|
||||
case 8:
|
||||
default:
|
||||
ret = RBG_STRING_SET_UTF8_ENCODING(rb_str_new((const char*)rdat, rlen));
|
||||
break;
|
||||
|
||||
case 16:
|
||||
ret = rb_ary_new();
|
||||
|
||||
for( i = 0; i < rlen; i++){
|
||||
rb_ary_push(ret, rb_Integer(((unsigned short*)rdat)[i]));
|
||||
}
|
||||
break;
|
||||
|
||||
case 32:
|
||||
ret = rb_ary_new();
|
||||
|
||||
if(rtype != GDK_SELECTION_TYPE_ATOM){
|
||||
for(j = 0; j < (rlen/sizeof(unsigned long)); j++){
|
||||
rb_ary_push(ret, INT2FIX(((unsigned long*)rdat)[j]));
|
||||
}
|
||||
} else {
|
||||
for(j = 0; j < (rlen/sizeof(unsigned long)); j++){
|
||||
rb_ary_push(ret, BOXED2RVAL((GdkAtom)((unsigned long*)rdat)[j], GDK_TYPE_ATOM));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return rb_ary_new3(3, BOXED2RVAL(rtype, GDK_TYPE_ATOM),
|
||||
ret, INT2NUM(rlen));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_delete(VALUE self, VALUE win, VALUE property)
|
||||
{
|
||||
gdk_property_delete(GDK_WINDOW(RVAL2GOBJ(win)), RVAL2ATOM(property));
|
||||
return self;
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_gdk_property(VALUE mGdk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGdk, "Property");
|
||||
|
||||
RG_DEF_MODFUNC(text_property_to_text_list, -1);
|
||||
RG_DEF_MODFUNC(text_property_to_utf8_list, -1);
|
||||
RG_DEF_MODFUNC(string_to_compound_text, -1);
|
||||
RG_DEF_MODFUNC(utf8_to_string_target, 1);
|
||||
RG_DEF_MODFUNC(utf8_to_compound_text, -1);
|
||||
RG_DEF_MODFUNC(change, -1);
|
||||
RG_DEF_MODFUNC(get, -1);
|
||||
RG_DEF_MODFUNC(delete, 2);
|
||||
|
||||
/* GdkPropMode from GdkProperties */
|
||||
G_DEF_CLASS(GDK_TYPE_PROP_MODE, "PropMode", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_PROP_MODE, "GDK_PROP_");
|
||||
|
||||
}
|
||||
142
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkrectangle.c
Normal file
142
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkrectangle.c
Normal file
@@ -0,0 +1,142 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Masao Mutoh
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cRectangle
|
||||
#define _SELF(r) ((GdkRectangle*)RVAL2BOXED(r, GDK_TYPE_RECTANGLE))
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self, VALUE x, VALUE y, VALUE width, VALUE height)
|
||||
{
|
||||
GdkRectangle rectangle;
|
||||
|
||||
rectangle.x = NUM2INT(x);
|
||||
rectangle.y = NUM2INT(y);
|
||||
rectangle.width = NUM2INT(width);
|
||||
rectangle.height = NUM2INT(height);
|
||||
|
||||
G_INITIALIZE(self, g_boxed_copy(GDK_TYPE_RECTANGLE, &rectangle));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_intersect(VALUE self, VALUE other)
|
||||
{
|
||||
GdkRectangle dest;
|
||||
gboolean ret = gdk_rectangle_intersect(_SELF(self), _SELF(other), &dest);
|
||||
return ret ? BOXED2RVAL(&dest, GDK_TYPE_RECTANGLE) : Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_union(VALUE self, VALUE other)
|
||||
{
|
||||
GdkRectangle dest;
|
||||
gdk_rectangle_union(_SELF(self), _SELF(other), &dest);
|
||||
return BOXED2RVAL(&dest, GDK_TYPE_RECTANGLE);
|
||||
}
|
||||
|
||||
/* Struct accessors */
|
||||
static VALUE
|
||||
rg_x(VALUE self)
|
||||
{
|
||||
return INT2NUM(_SELF(self)->x);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_y(VALUE self)
|
||||
{
|
||||
return INT2NUM(_SELF(self)->y);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_width(VALUE self)
|
||||
{
|
||||
return INT2NUM(_SELF(self)->width);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_height(VALUE self)
|
||||
{
|
||||
return INT2NUM(_SELF(self)->height);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_x(VALUE self, VALUE x)
|
||||
{
|
||||
_SELF(self)->x = NUM2INT(x);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_y(VALUE self, VALUE y)
|
||||
{
|
||||
_SELF(self)->y = NUM2INT(y);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_width(VALUE self, VALUE width)
|
||||
{
|
||||
_SELF(self)->width = NUM2INT(width);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_height(VALUE self, VALUE height)
|
||||
{
|
||||
_SELF(self)->height = NUM2INT(height);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_to_a(VALUE self)
|
||||
{
|
||||
GdkRectangle* a = _SELF(self);
|
||||
return rb_ary_new3(4, INT2FIX(a->x), INT2FIX(a->y),
|
||||
INT2FIX(a->width), INT2FIX(a->height));
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_gdk_rectangle(VALUE mGdk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_RECTANGLE, "Rectangle", mGdk);
|
||||
|
||||
RG_DEF_METHOD(initialize, 4);
|
||||
RG_DEF_METHOD(intersect, 1);
|
||||
RG_DEF_ALIAS("&", "intersect");
|
||||
RG_DEF_METHOD(union, 1);
|
||||
RG_DEF_ALIAS("|", "union");
|
||||
RG_DEF_METHOD(x, 0);
|
||||
RG_DEF_METHOD(y, 0);
|
||||
RG_DEF_METHOD(width, 0);
|
||||
RG_DEF_METHOD(height, 0);
|
||||
RG_DEF_METHOD(set_x, 1);
|
||||
RG_DEF_METHOD(set_y, 1);
|
||||
RG_DEF_METHOD(set_width, 1);
|
||||
RG_DEF_METHOD(set_height, 1);
|
||||
RG_DEF_METHOD(to_a, 0);
|
||||
|
||||
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
||||
}
|
||||
289
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkregion.c
Normal file
289
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkregion.c
Normal file
@@ -0,0 +1,289 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Masao Mutoh
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cRegion
|
||||
#define _SELF(r) ((GdkRegion*)RVAL2BOXED(r, GDK_TYPE_REGION))
|
||||
|
||||
/**********************************/
|
||||
GType
|
||||
gdk_region_get_type(void)
|
||||
{
|
||||
static GType our_type = 0;
|
||||
|
||||
if (our_type == 0)
|
||||
our_type = g_boxed_type_register_static ("GdkRegion",
|
||||
(GBoxedCopyFunc)gdk_region_copy,
|
||||
(GBoxedFreeFunc)gdk_region_destroy);
|
||||
return our_type;
|
||||
}
|
||||
/**********************************/
|
||||
static VALUE
|
||||
rg_initialize(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE points_or_rectangle, rbfill_rule;
|
||||
GdkRegion *region;
|
||||
|
||||
rb_scan_args(argc, argv, "02", &points_or_rectangle, &rbfill_rule);
|
||||
if (NIL_P(points_or_rectangle)) {
|
||||
region = gdk_region_new();
|
||||
} else if (TYPE(points_or_rectangle) == T_ARRAY) {
|
||||
GdkFillRule fill_rule = RVAL2GENUM(rbfill_rule, GDK_TYPE_FILL_RULE);
|
||||
long n;
|
||||
GdkPoint *points = RVAL2GDKPOINTS(points_or_rectangle, &n);
|
||||
|
||||
region = gdk_region_polygon(points, n, fill_rule);
|
||||
|
||||
g_free(points);
|
||||
} else if (RVAL2GTYPE(points_or_rectangle) == GDK_TYPE_RECTANGLE) {
|
||||
region = gdk_region_rectangle((GdkRectangle*)RVAL2BOXED(points_or_rectangle,
|
||||
GDK_TYPE_RECTANGLE));
|
||||
} else {
|
||||
rb_raise(rb_eArgError,
|
||||
"invalid argument %s (expect array of Gdk::Point or Gdk::Rectangle, nil)",
|
||||
rb_class2name(CLASS_OF(points_or_rectangle)));
|
||||
}
|
||||
|
||||
G_INITIALIZE(self, region);
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_rectangles(VALUE self)
|
||||
{
|
||||
GdkRectangle* rectangles;
|
||||
gint n_rect, i;
|
||||
VALUE ary;
|
||||
|
||||
gdk_region_get_rectangles(_SELF(self), &rectangles, &n_rect);
|
||||
ary = rb_ary_new2(n_rect);
|
||||
for (i = 0; i < n_rect; i++) {
|
||||
rb_ary_push(ary, BOXED2RVAL(&rectangles[i], GDK_TYPE_RECTANGLE));
|
||||
}
|
||||
g_free(rectangles);
|
||||
return ary;
|
||||
}
|
||||
|
||||
static void
|
||||
gdkregion_span_func(GdkSpan *span, gpointer func)
|
||||
{
|
||||
rb_funcall((VALUE)func, id_call, 3,
|
||||
INT2NUM(span->x), INT2NUM(span->y), INT2NUM(span->width));
|
||||
}
|
||||
|
||||
struct rbgdk_rval2gdkspans_args {
|
||||
VALUE ary;
|
||||
long n;
|
||||
GdkSpan *result;
|
||||
};
|
||||
|
||||
static VALUE
|
||||
rbgdk_rval2gdkspans_body(VALUE value)
|
||||
{
|
||||
long i;
|
||||
struct rbgdk_rval2gdkspans_args *args = (struct rbgdk_rval2gdkspans_args *)value;
|
||||
|
||||
for (i = 0; i < args->n; i++) {
|
||||
VALUE points = rb_ary_to_ary(RARRAY_PTR(args->ary)[i]);
|
||||
|
||||
if (RARRAY_LEN(points) != 2)
|
||||
rb_raise(rb_eArgError, "point %ld should be array of size 3", i);
|
||||
|
||||
args->result[i].x = NUM2INT(RARRAY_PTR(points)[0]);
|
||||
args->result[i].y = NUM2INT(RARRAY_PTR(points)[1]);
|
||||
args->result[i].width = NUM2INT(RARRAY_PTR(points)[1]);
|
||||
}
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static G_GNUC_NORETURN VALUE
|
||||
rbgdk_rval2gdkspans_rescue(VALUE value)
|
||||
{
|
||||
g_free(((struct rbgdk_rval2gdkspans_args *)value)->result);
|
||||
|
||||
rb_exc_raise(rb_errinfo());
|
||||
}
|
||||
|
||||
static GdkSpan *
|
||||
rbgdk_rval2gdkspans(VALUE value, long *n)
|
||||
{
|
||||
struct rbgdk_rval2gdkspans_args args;
|
||||
|
||||
args.ary = rb_ary_to_ary(value);
|
||||
args.n = RARRAY_LEN(args.ary);
|
||||
args.result = g_new(GdkSpan, args.n + 1);
|
||||
|
||||
rb_rescue(rbgdk_rval2gdkspans_body, (VALUE)&args,
|
||||
rbgdk_rval2gdkspans_rescue, (VALUE)&args);
|
||||
|
||||
if (n != NULL)
|
||||
*n = args.n;
|
||||
|
||||
return args.result;
|
||||
}
|
||||
|
||||
#define RVAL2GDKSPANS(value, n) rbgdk_rval2gdkspans(value, n)
|
||||
|
||||
static VALUE
|
||||
rg_spans_intersect_each(VALUE self, VALUE rbspans, VALUE rbsorted)
|
||||
{
|
||||
GdkRegion *region = _SELF(self);
|
||||
gboolean sorted = RVAL2CBOOL(rbsorted);
|
||||
VALUE func = rb_block_proc();
|
||||
long n;
|
||||
GdkSpan *spans;
|
||||
|
||||
G_RELATIVE(self, func);
|
||||
|
||||
spans = RVAL2GDKSPANS(rbspans, &n);
|
||||
|
||||
gdk_region_spans_intersect_foreach(region,
|
||||
spans,
|
||||
n,
|
||||
sorted,
|
||||
(GdkSpanFunc)gdkregion_span_func,
|
||||
(gpointer)func);
|
||||
|
||||
g_free(spans);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_clipbox(VALUE self)
|
||||
{
|
||||
GdkRectangle rect;
|
||||
gdk_region_get_clipbox(_SELF(self), &rect);
|
||||
return BOXED2RVAL(&rect, GDK_TYPE_RECTANGLE);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_empty_p(VALUE self)
|
||||
{
|
||||
return CBOOL2RVAL(gdk_region_empty(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_operator_equal(VALUE self, VALUE obj)
|
||||
{
|
||||
if (!rb_obj_is_instance_of(obj, GTYPE2CLASS(GDK_TYPE_REGION))) {
|
||||
return Qnil;
|
||||
}
|
||||
return CBOOL2RVAL(gdk_region_equal(_SELF(self), _SELF(obj)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_point_in_p(VALUE self, VALUE x, VALUE y)
|
||||
{
|
||||
return CBOOL2RVAL(gdk_region_point_in(_SELF(self), NUM2INT(x),
|
||||
NUM2INT(y)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_rect_in(VALUE self, VALUE rect)
|
||||
{
|
||||
return GENUM2RVAL(gdk_region_rect_in(
|
||||
_SELF(self),
|
||||
(GdkRectangle*)RVAL2BOXED(rect, GDK_TYPE_RECTANGLE)),
|
||||
GDK_TYPE_OVERLAP_TYPE);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_offset(VALUE self, VALUE dx, VALUE dy)
|
||||
{
|
||||
gdk_region_offset(_SELF(self), NUM2INT(dx), NUM2INT(dy));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_shrink(VALUE self, VALUE dx, VALUE dy)
|
||||
{
|
||||
gdk_region_shrink(_SELF(self), NUM2INT(dx), NUM2INT(dy));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_intersect(VALUE self, VALUE region)
|
||||
{
|
||||
gdk_region_intersect(_SELF(self), _SELF(region));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_union(VALUE self, VALUE other)
|
||||
{
|
||||
if (RVAL2GTYPE(other) == GDK_TYPE_RECTANGLE){
|
||||
gdk_region_union_with_rect(_SELF(self),
|
||||
(GdkRectangle*)RVAL2BOXED(other, GDK_TYPE_RECTANGLE));
|
||||
} else {
|
||||
gdk_region_union(_SELF(self), _SELF(other));
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_subtract(VALUE self, VALUE region)
|
||||
{
|
||||
gdk_region_subtract(_SELF(self), _SELF(region));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_xor(VALUE self, VALUE region)
|
||||
{
|
||||
gdk_region_xor(_SELF(self), _SELF(region));
|
||||
return self;
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_gdk_region(VALUE mGdk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_REGION, "Region", mGdk);
|
||||
|
||||
RG_DEF_METHOD(initialize, -1);
|
||||
RG_DEF_METHOD(rectangles, 0);
|
||||
RG_DEF_METHOD(spans_intersect_each, 2);
|
||||
RG_DEF_METHOD(clipbox, 0);
|
||||
RG_DEF_METHOD_P(empty, 0);
|
||||
RG_DEF_METHOD_OPERATOR("==", equal, 1);
|
||||
RG_DEF_METHOD_P(point_in, 2);
|
||||
RG_DEF_METHOD(rect_in, 1);
|
||||
RG_DEF_METHOD(offset, 2);
|
||||
RG_DEF_METHOD(shrink, 2);
|
||||
RG_DEF_METHOD(intersect, 1);
|
||||
RG_DEF_METHOD(union, 1);
|
||||
RG_DEF_METHOD(subtract, 1);
|
||||
RG_DEF_METHOD(xor, 1);
|
||||
|
||||
/* GdkOverlapType */
|
||||
G_DEF_CLASS(GDK_TYPE_OVERLAP_TYPE, "OverlapType", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_OVERLAP_TYPE, "GDK_");
|
||||
|
||||
/* GdkFillRule */
|
||||
G_DEF_CLASS(GDK_TYPE_FILL_RULE, "FillRule", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_FILL_RULE, "GDK_");
|
||||
}
|
||||
198
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkrgb.c
Normal file
198
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkrgb.c
Normal file
@@ -0,0 +1,198 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE mRGB
|
||||
#define RVAL2DRAW(s) GDK_DRAWABLE(RVAL2GOBJ(s))
|
||||
|
||||
static VALUE
|
||||
rg_m_draw_rgb_image(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE win, gc, x, y, w, h, dither, buf, rowstride, xdith, ydith;
|
||||
|
||||
rb_scan_args(argc, argv, "92", &win, &gc, &x, &y, &w, &h, &dither,
|
||||
&buf, &rowstride, &xdith, &ydith);
|
||||
|
||||
if (argc == 9){
|
||||
gdk_draw_rgb_image(RVAL2DRAW(win), GDK_GC(RVAL2GOBJ(gc)),
|
||||
NUM2INT(x), NUM2INT(y),
|
||||
NUM2INT(w), NUM2INT(h),
|
||||
RVAL2GENUM(dither, GDK_TYPE_RGB_DITHER),
|
||||
(guchar*)RVAL2CSTR(buf),
|
||||
NUM2INT(rowstride));
|
||||
} else {
|
||||
gdk_draw_rgb_image_dithalign(RVAL2DRAW(win), GDK_GC(RVAL2GOBJ(gc)),
|
||||
NUM2INT(x), NUM2INT(y),
|
||||
NUM2INT(w), NUM2INT(h),
|
||||
RVAL2GENUM(dither, GDK_TYPE_RGB_DITHER),
|
||||
(guchar*)RVAL2CSTR(buf),
|
||||
NUM2INT(rowstride),
|
||||
NUM2INT(xdith), NUM2INT(ydith));
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_draw_indexed_image(VALUE self, VALUE win, VALUE rbgc, VALUE rbx, VALUE rby,
|
||||
VALUE rbwidth, VALUE rbheight, VALUE rbdither,
|
||||
VALUE rbbuf, VALUE rbrowstride, VALUE rbcolors)
|
||||
{
|
||||
GdkDrawable *drawable = RVAL2DRAW(win);
|
||||
GdkGC *gc = GDK_GC(RVAL2GOBJ(rbgc));
|
||||
gint x = NUM2INT(rbx);
|
||||
gint y = NUM2INT(rby);
|
||||
gint width = NUM2INT(rbwidth);
|
||||
gint height = NUM2INT(rbheight);
|
||||
GdkRgbDither dither = RVAL2GENUM(rbdither, GDK_TYPE_RGB_DITHER);
|
||||
const guchar *buf = (const guchar *)RVAL2CSTR(rbbuf);
|
||||
gint rowstride = NUM2INT(rbrowstride);
|
||||
long n;
|
||||
guint32 *colors = RVAL2GUINT32S(rbcolors, n);
|
||||
GdkRgbCmap *cmap;
|
||||
|
||||
if (n < 0 || n > 255) {
|
||||
g_free(colors);
|
||||
|
||||
rb_raise(rb_eArgError, "colors: out of range (0 - 255)");
|
||||
}
|
||||
|
||||
cmap = gdk_rgb_cmap_new(colors, n);
|
||||
|
||||
g_free(colors);
|
||||
|
||||
gdk_draw_indexed_image(drawable, gc, x, y, width, height, dither, buf, rowstride, cmap);
|
||||
|
||||
gdk_rgb_cmap_free(cmap);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_draw_gray_image(VALUE self, VALUE win, VALUE gc, VALUE x, VALUE y, VALUE w, VALUE h, VALUE dither, VALUE buf, VALUE rowstride)
|
||||
{
|
||||
gdk_draw_gray_image(RVAL2DRAW(win), GDK_GC(RVAL2GOBJ(gc)),
|
||||
NUM2INT(x), NUM2INT(y),
|
||||
NUM2INT(w), NUM2INT(h),
|
||||
RVAL2GENUM(dither, GDK_TYPE_RGB_DITHER),
|
||||
(guchar*)RVAL2CSTR(buf),
|
||||
NUM2INT(rowstride));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_draw_rgb_32_image(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE win, gc, x, y, w, h, dither, buf, rowstride, xdith, ydith;
|
||||
|
||||
rb_scan_args(argc, argv, "92", &win, &gc, &x, &y, &w, &h, &dither,
|
||||
&buf, &rowstride, &xdith, &ydith);
|
||||
|
||||
if (argc == 9){
|
||||
gdk_draw_rgb_32_image(RVAL2DRAW(win), GDK_GC(RVAL2GOBJ(gc)),
|
||||
NUM2INT(x), NUM2INT(y),
|
||||
NUM2INT(w), NUM2INT(h),
|
||||
RVAL2GENUM(dither, GDK_TYPE_RGB_DITHER),
|
||||
(guchar*)RVAL2CSTR(buf),
|
||||
NUM2INT(rowstride));
|
||||
} else {
|
||||
gdk_draw_rgb_32_image_dithalign(RVAL2DRAW(win), GDK_GC(RVAL2GOBJ(gc)),
|
||||
NUM2INT(x), NUM2INT(y),
|
||||
NUM2INT(w), NUM2INT(h),
|
||||
RVAL2GENUM(dither, GDK_TYPE_RGB_DITHER),
|
||||
(guchar*)RVAL2CSTR(buf),
|
||||
NUM2INT(rowstride), NUM2INT(xdith), NUM2INT(ydith));
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_find_color(VALUE self, VALUE colormap, VALUE color)
|
||||
{
|
||||
gdk_rgb_find_color(GDK_COLORMAP(RVAL2GOBJ(colormap)),
|
||||
RVAL2GDKCOLOR(color));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_set_install(VALUE self, VALUE install)
|
||||
{
|
||||
gdk_rgb_set_install(RVAL2CBOOL(install));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_set_min_colors(VALUE self, VALUE min_colors)
|
||||
{
|
||||
gdk_rgb_set_min_colors(NUM2INT(min_colors));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_visual(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_rgb_get_visual());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_colormap(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_rgb_get_colormap());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_ditherable_p(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return CBOOL2RVAL(gdk_rgb_ditherable());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_set_verbose(VALUE self, VALUE verbose)
|
||||
{
|
||||
gdk_rgb_set_verbose(RVAL2CBOOL(verbose));
|
||||
return self;
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_gdk_rgb(VALUE mGdk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGdk, "RGB");
|
||||
|
||||
RG_DEF_MODFUNC(draw_rgb_image, -1);
|
||||
RG_DEF_MODFUNC(draw_indexed_image, 10);
|
||||
RG_DEF_MODFUNC(draw_gray_image, 9);
|
||||
RG_DEF_MODFUNC(draw_rgb_32_image, -1);
|
||||
RG_DEF_MODFUNC(find_color, 2);
|
||||
RG_DEF_MODFUNC(set_install, 1);
|
||||
RG_DEF_MODFUNC(set_min_colors, 0);
|
||||
RG_DEF_MODFUNC(visual, 0);
|
||||
RG_DEF_MODFUNC(colormap, 0);
|
||||
RG_DEF_MODFUNC_P(ditherable, 0);
|
||||
RG_DEF_MODFUNC(set_verbose, 1);
|
||||
|
||||
/* GdkRgbDither */
|
||||
G_DEF_CLASS(GDK_TYPE_RGB_DITHER, "Dither", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_RGB_DITHER, "GDK_RGB_");
|
||||
}
|
||||
444
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkscreen.c
Normal file
444
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkscreen.c
Normal file
@@ -0,0 +1,444 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2003-2006 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2003 Geoff Youngs
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
#ifdef HAVE_RB_CAIRO_H
|
||||
#include <rb_cairo.h>
|
||||
#endif
|
||||
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
|
||||
#define RG_TARGET_NAMESPACE cScreen
|
||||
#define _SELF(i) GDK_SCREEN(RVAL2GOBJ(i))
|
||||
|
||||
static ID id_new;
|
||||
|
||||
static VALUE
|
||||
rg_s_default(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_screen_get_default());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_default_colormap(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_screen_get_default_colormap(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_default_colormap(VALUE self, VALUE colormap)
|
||||
{
|
||||
gdk_screen_set_default_colormap(_SELF(self),
|
||||
GDK_COLORMAP(RVAL2GOBJ(colormap)));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_system_colormap(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_screen_get_system_colormap(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_system_visual(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_screen_get_system_visual(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_rgb_colormap(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_screen_get_rgb_colormap(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_rgb_visual(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_screen_get_rgb_visual(_SELF(self)));
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,8,0)
|
||||
static VALUE
|
||||
rg_rgba_colormap(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_screen_get_rgba_colormap(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_rgba_visual(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_screen_get_rgba_visual(_SELF(self)));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GTK_CHECK_VERSION(2,10,0)
|
||||
static VALUE
|
||||
rg_composited_p(VALUE self)
|
||||
{
|
||||
return CBOOL2RVAL(gdk_screen_is_composited(_SELF(self)));
|
||||
}
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
rg_root_window(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_screen_get_root_window(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_display(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_screen_get_display(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_number(VALUE self)
|
||||
{
|
||||
return INT2NUM(gdk_screen_get_number(_SELF(self)));
|
||||
}
|
||||
static VALUE
|
||||
rg_width(VALUE self)
|
||||
{
|
||||
return INT2NUM(gdk_screen_get_width(_SELF(self)));
|
||||
}
|
||||
static VALUE
|
||||
rg_height(VALUE self)
|
||||
{
|
||||
return INT2NUM(gdk_screen_get_height(_SELF(self)));
|
||||
}
|
||||
static VALUE
|
||||
rg_width_mm(VALUE self)
|
||||
{
|
||||
return INT2NUM(gdk_screen_get_width_mm(_SELF(self)));
|
||||
}
|
||||
static VALUE
|
||||
rg_height_mm(VALUE self)
|
||||
{
|
||||
return INT2NUM(gdk_screen_get_height_mm(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_visuals(VALUE self)
|
||||
{
|
||||
return GLIST2ARYF(gdk_screen_list_visuals(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_toplevel_windows(VALUE self)
|
||||
{
|
||||
return GLIST2ARYF(gdk_screen_get_toplevel_windows(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_display_name(VALUE self)
|
||||
{
|
||||
gchar* name = gdk_screen_make_display_name(_SELF(self));
|
||||
VALUE ret = CSTR2RVAL(name);
|
||||
g_free(name);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_n_monitors(VALUE self)
|
||||
{
|
||||
return INT2NUM(gdk_screen_get_n_monitors(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_monitor_geometry(VALUE self, VALUE num)
|
||||
{
|
||||
GdkRectangle rect;
|
||||
gdk_screen_get_monitor_geometry(_SELF(self), NUM2INT(num), &rect);
|
||||
return BOXED2RVAL(&rect, GDK_TYPE_RECTANGLE);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_get_monitor(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE arg1, arg2;
|
||||
VALUE ret;
|
||||
|
||||
rb_scan_args(argc, argv, "11", &arg1, &arg2);
|
||||
if (argc == 2){
|
||||
ret = INT2NUM(gdk_screen_get_monitor_at_point(_SELF(self),
|
||||
NUM2INT(arg1), NUM2INT(arg2)));
|
||||
} else if (argc == 1){
|
||||
ret = INT2NUM(gdk_screen_get_monitor_at_window(_SELF(self),
|
||||
GDK_WINDOW(RVAL2GOBJ(arg1))));
|
||||
} else {
|
||||
rb_raise(rb_eArgError, "Wrong number of arguments: %d", argc);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_broadcast_client_message(VALUE self, VALUE event)
|
||||
{
|
||||
gdk_screen_broadcast_client_message(_SELF(self), RVAL2GEV(event));
|
||||
return self;
|
||||
}
|
||||
|
||||
/*
|
||||
type: String, Integer, Gdk::Color.
|
||||
*/
|
||||
static VALUE
|
||||
rg_get_setting(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE name, type;
|
||||
GType gtype;
|
||||
GValue val = G_VALUE_INIT;
|
||||
gboolean ret;
|
||||
VALUE value;
|
||||
|
||||
rb_scan_args(argc, argv, "11", &name, &type);
|
||||
if (NIL_P(type))
|
||||
gtype = G_TYPE_STRING;
|
||||
else
|
||||
gtype = CLASS2GTYPE(type);
|
||||
|
||||
g_value_init(&val, gtype);
|
||||
ret = gdk_screen_get_setting(_SELF(self), RVAL2CSTR(name), &val);
|
||||
value = ret ? GVAL2RVAL(&val) : Qnil;
|
||||
g_value_unset(&val);
|
||||
return value;
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,10,0)
|
||||
#ifdef HAVE_RB_CAIRO_H
|
||||
static VALUE
|
||||
gdkscreen_get_font_options(VALUE self)
|
||||
{
|
||||
return CRFONTOPTIONS2RVAL((cairo_font_options_t *)gdk_screen_get_font_options(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
gdkscreen_set_font_options(VALUE self, VALUE options)
|
||||
{
|
||||
gdk_screen_set_font_options(_SELF(self),
|
||||
(const cairo_font_options_t *)RVAL2CRFONTOPTIONS(options));
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
rg_active_window(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_screen_get_active_window(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_window_stack(VALUE self)
|
||||
{
|
||||
GList* list = gdk_screen_get_window_stack(_SELF(self));
|
||||
VALUE ary = rb_ary_new();
|
||||
while (list) {
|
||||
rb_ary_push(ary, GOBJ2RVAL(list->data));
|
||||
g_object_unref(list->data);
|
||||
list = list->next;
|
||||
}
|
||||
g_list_free(list);
|
||||
return ary;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
static void
|
||||
child_setup(gpointer func)
|
||||
{
|
||||
if (! NIL_P(func)){
|
||||
rb_funcall((VALUE)func, id_call, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_spawn_on_screen(VALUE self, VALUE working_directory, VALUE argv, VALUE envp, VALUE flags)
|
||||
{
|
||||
GError *err = NULL;
|
||||
gboolean ret;
|
||||
gint child_pid;
|
||||
VALUE func = Qnil;
|
||||
gchar **gargv;
|
||||
gchar **genvp;
|
||||
|
||||
if (rb_block_given_p()) {
|
||||
func = rb_block_proc();
|
||||
G_RELATIVE(self, func);
|
||||
}
|
||||
|
||||
gargv = (gchar **)RVAL2STRV(argv);
|
||||
genvp = (gchar **)RVAL2STRV_ACCEPT_NIL(envp);
|
||||
ret = gdk_spawn_on_screen(_SELF(self),
|
||||
NIL_P(working_directory) ? NULL : RVAL2CSTR(working_directory),
|
||||
gargv, genvp, NUM2INT(flags),
|
||||
(GSpawnChildSetupFunc)child_setup, (gpointer)func,
|
||||
&child_pid, &err);
|
||||
g_free(gargv);
|
||||
g_free(genvp);
|
||||
if (!ret)
|
||||
RAISE_GERROR(err);
|
||||
|
||||
return INT2NUM(child_pid);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_spawn_on_screen_with_pipes(VALUE self, VALUE working_directory, VALUE argv, VALUE envp, VALUE flags)
|
||||
{
|
||||
GError *err = NULL;
|
||||
gboolean ret;
|
||||
gint child_pid;
|
||||
VALUE func = Qnil;
|
||||
gchar **gargv;
|
||||
gchar **genvp;
|
||||
gint standard_input, standard_output, standard_error;
|
||||
|
||||
if (rb_block_given_p()) {
|
||||
func = rb_block_proc();
|
||||
G_RELATIVE(self, func);
|
||||
}
|
||||
|
||||
gargv = (gchar **)RVAL2STRV(argv);
|
||||
genvp = (gchar **)RVAL2STRV_ACCEPT_NIL(envp);
|
||||
ret = gdk_spawn_on_screen_with_pipes(_SELF(self),
|
||||
NIL_P(working_directory) ? NULL : RVAL2CSTR(working_directory),
|
||||
gargv, genvp, NUM2INT(flags),
|
||||
(GSpawnChildSetupFunc)child_setup, (gpointer)func,
|
||||
&child_pid,
|
||||
&standard_input, &standard_output,
|
||||
&standard_error, &err);
|
||||
g_free(gargv);
|
||||
g_free(genvp);
|
||||
if (!ret)
|
||||
RAISE_GERROR(err);
|
||||
|
||||
return rb_ary_new3(4, INT2NUM(child_pid),
|
||||
rb_funcall(rb_cIO, id_new, 1, INT2NUM(standard_input)),
|
||||
rb_funcall(rb_cIO, id_new, 1, INT2NUM(standard_output)),
|
||||
rb_funcall(rb_cIO, id_new, 1, INT2NUM(standard_error)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_spawn_command_line_on_screen(G_GNUC_UNUSED VALUE self, VALUE command_line)
|
||||
{
|
||||
GError *err = NULL;
|
||||
VALUE ret;
|
||||
|
||||
ret = CBOOL2RVAL(g_spawn_command_line_async(RVAL2CSTR(command_line), &err));
|
||||
if (!ret) RAISE_GERROR(err);
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* From X Window System Interaction */
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
#include <gdk/gdkx.h>
|
||||
static VALUE
|
||||
rg_xnumber(VALUE self)
|
||||
{
|
||||
return INT2NUM(GDK_SCREEN_XNUMBER(_SELF(self)));
|
||||
}
|
||||
static VALUE
|
||||
rg_supports_net_wm_hint_p(VALUE self, VALUE property)
|
||||
{
|
||||
return CBOOL2RVAL(gdk_x11_screen_supports_net_wm_hint(_SELF(self),
|
||||
RVAL2ATOM(property)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_window_manager_name(VALUE self)
|
||||
{
|
||||
return CSTR2RVAL(gdk_x11_screen_get_window_manager_name(_SELF(self)));
|
||||
}
|
||||
static VALUE
|
||||
rg_screen_number(VALUE self)
|
||||
{
|
||||
return INT2NUM(gdk_x11_screen_get_screen_number(_SELF(self)));
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_gdk_screen(VALUE mGdk)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_SCREEN, "Screen", mGdk);
|
||||
|
||||
id_new = rb_intern("new");
|
||||
|
||||
RG_DEF_SMETHOD(default, 0);
|
||||
RG_DEF_METHOD(default_colormap, 0);
|
||||
RG_DEF_METHOD(set_default_colormap, 1);
|
||||
G_DEF_SETTER(RG_TARGET_NAMESPACE, "default_colormap");
|
||||
RG_DEF_METHOD(system_colormap, 0);
|
||||
RG_DEF_METHOD(system_visual, 0);
|
||||
RG_DEF_METHOD(rgb_colormap, 0);
|
||||
RG_DEF_METHOD(rgb_visual, 0);
|
||||
#if GTK_CHECK_VERSION(2,8,0)
|
||||
RG_DEF_METHOD(rgba_colormap, 0);
|
||||
RG_DEF_METHOD(rgba_visual, 0);
|
||||
#endif
|
||||
#if GTK_CHECK_VERSION(2,10,0)
|
||||
RG_DEF_METHOD_P(composited, 0);
|
||||
#endif
|
||||
RG_DEF_METHOD(root_window, 0);
|
||||
RG_DEF_METHOD(display, 0);
|
||||
RG_DEF_METHOD(number, 0);
|
||||
RG_DEF_METHOD(width, 0);
|
||||
RG_DEF_METHOD(height, 0);
|
||||
RG_DEF_METHOD(width_mm, 0);
|
||||
RG_DEF_METHOD(height_mm, 0);
|
||||
RG_DEF_METHOD(visuals, 0);
|
||||
RG_DEF_METHOD(toplevel_windows, 0);
|
||||
RG_DEF_METHOD(display_name, 0);
|
||||
RG_DEF_METHOD(n_monitors, 0);
|
||||
RG_DEF_METHOD(monitor_geometry, 1);
|
||||
RG_DEF_METHOD(get_monitor, -1);
|
||||
RG_DEF_METHOD(broadcast_client_message, 1);
|
||||
RG_DEF_METHOD(get_setting, -1);
|
||||
#if GTK_CHECK_VERSION(2,10,0)
|
||||
#ifdef HAVE_RB_CAIRO_H
|
||||
G_REPLACE_GET_PROPERTY(RG_TARGET_NAMESPACE, "font_options", gdkscreen_get_font_options, 0);
|
||||
G_REPLACE_SET_PROPERTY(RG_TARGET_NAMESPACE, "font_options", gdkscreen_set_font_options, 1);
|
||||
#endif
|
||||
RG_DEF_METHOD(active_window, 0);
|
||||
RG_DEF_METHOD(window_stack, 0);
|
||||
#endif
|
||||
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
RG_DEF_METHOD(spawn_on_screen, 4);
|
||||
RG_DEF_METHOD(spawn_on_screen_with_pipes, 4);
|
||||
RG_DEF_METHOD(spawn_command_line_on_screen, 1);
|
||||
#endif
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
RG_DEF_METHOD(xnumber, 0);
|
||||
RG_DEF_METHOD_P(supports_net_wm_hint, 0);
|
||||
RG_DEF_METHOD(window_manager_name, 0);
|
||||
RG_DEF_METHOD(screen_number, 0);
|
||||
#endif
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
G_DEF_CLASS3("GdkScreenX11", "ScreenX11", mGdk);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
160
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkselection.c
Normal file
160
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkselection.c
Normal file
@@ -0,0 +1,160 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002-2004 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE mSelection
|
||||
#define GATOM2RVAL(g) (BOXED2RVAL(g, GDK_TYPE_ATOM))
|
||||
|
||||
static VALUE
|
||||
rg_m_owner_set(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
VALUE owner, selection, time, send_event;
|
||||
int ret;
|
||||
|
||||
if (argc == 4){
|
||||
rb_scan_args(argc, argv, "40", &owner, &selection, &time, &send_event);
|
||||
ret = gdk_selection_owner_set(GDK_WINDOW(RVAL2GOBJ(owner)),
|
||||
RVAL2ATOM(selection),
|
||||
NUM2UINT(time), RVAL2CBOOL(send_event));
|
||||
} else {
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
VALUE display = Qnil;
|
||||
rb_scan_args(argc, argv, "50", &display, &owner, &selection, &time, &send_event);
|
||||
ret = gdk_selection_owner_set_for_display(GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)),
|
||||
GDK_WINDOW(RVAL2GOBJ(owner)),
|
||||
RVAL2ATOM(selection),
|
||||
NUM2UINT(time), RVAL2CBOOL(send_event));
|
||||
#else
|
||||
rb_raise(rb_eArgError, "Wrong number of arguments: %d", argc);
|
||||
#endif
|
||||
|
||||
}
|
||||
return CBOOL2RVAL(ret);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_owner_get(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
VALUE selection;
|
||||
|
||||
if (argc == 1) {
|
||||
rb_scan_args(argc, argv, "10", &selection);
|
||||
return GOBJ2RVAL(gdk_selection_owner_get(RVAL2ATOM(selection)));
|
||||
} else {
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
VALUE display = Qnil;
|
||||
rb_scan_args(argc, argv, "20", &display, &selection);
|
||||
return GOBJ2RVAL(gdk_selection_owner_get_for_display(GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)),
|
||||
RVAL2ATOM(selection)));
|
||||
#else
|
||||
rb_raise(rb_eArgError, "Wrong number of arguments: %d", argc);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_convert(VALUE self, VALUE requestor, VALUE selection, VALUE target, VALUE time)
|
||||
{
|
||||
gdk_selection_convert(GDK_WINDOW(RVAL2GOBJ(requestor)),
|
||||
RVAL2ATOM(selection),
|
||||
RVAL2ATOM(target), NUM2INT(time));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_property_get(G_GNUC_UNUSED VALUE self, VALUE requestor)
|
||||
{
|
||||
guchar *data;
|
||||
GdkAtom prop_type;
|
||||
gint prop_format;
|
||||
VALUE ary;
|
||||
|
||||
gdk_selection_property_get(GDK_WINDOW(RVAL2GOBJ(requestor)), &data,
|
||||
&prop_type, &prop_format);
|
||||
|
||||
ary = rb_ary_new3(3, CSTR2RVAL((const char*)data), GATOM2RVAL(prop_type),
|
||||
INT2NUM(prop_format));
|
||||
g_free(data);
|
||||
return ary;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_send_notify(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE requestor, selection, target, property, time;
|
||||
|
||||
if (argc == 5) {
|
||||
rb_scan_args(argc, argv, "50", &requestor, &selection, &target, &property, &time);
|
||||
gdk_selection_send_notify(RVAL2GDKNATIVEWINDOW(requestor), RVAL2ATOM(selection),
|
||||
RVAL2ATOM(target),
|
||||
NIL_P(property) ? GDK_NONE : RVAL2ATOM(property),
|
||||
NUM2INT(time));
|
||||
} else {
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
VALUE display = Qnil;
|
||||
rb_scan_args(argc, argv, "60", &display, &requestor, &selection, &target, &property, &time);
|
||||
gdk_selection_send_notify_for_display(GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)),
|
||||
RVAL2GDKNATIVEWINDOW(requestor), RVAL2ATOM(selection),
|
||||
RVAL2ATOM(target),
|
||||
NIL_P(property) ? GDK_NONE : RVAL2ATOM(property),
|
||||
NUM2INT(time));
|
||||
#else
|
||||
rb_raise(rb_eArgError, "Wrong number of arguments: %d", argc);
|
||||
#endif
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_gdk_selection(VALUE mGdk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGdk, "Selection");
|
||||
|
||||
RG_DEF_MODFUNC(owner_set, -1);
|
||||
RG_DEF_MODFUNC(owner_get, -1);
|
||||
RG_DEF_MODFUNC(convert, 4);
|
||||
RG_DEF_MODFUNC(property_get, 1);
|
||||
RG_DEF_MODFUNC(send_notify, -1);
|
||||
|
||||
/* Constants */
|
||||
rb_define_const(RG_TARGET_NAMESPACE, "PRIMARY", GATOM2RVAL(GDK_SELECTION_PRIMARY));
|
||||
rb_define_const(RG_TARGET_NAMESPACE, "SECONDARY", GATOM2RVAL(GDK_SELECTION_SECONDARY));
|
||||
rb_define_const(RG_TARGET_NAMESPACE, "CLIPBOARD", GATOM2RVAL(GDK_SELECTION_CLIPBOARD));
|
||||
|
||||
/* GdkSelectionType */
|
||||
rb_define_const(RG_TARGET_NAMESPACE, "TYPE_ATOM", GATOM2RVAL(GDK_SELECTION_TYPE_ATOM));
|
||||
rb_define_const(RG_TARGET_NAMESPACE, "TYPE_BITMAP", GATOM2RVAL(GDK_SELECTION_TYPE_BITMAP));
|
||||
rb_define_const(RG_TARGET_NAMESPACE, "TYPE_COLORMAP", GATOM2RVAL(GDK_SELECTION_TYPE_COLORMAP));
|
||||
rb_define_const(RG_TARGET_NAMESPACE, "TYPE_DRAWABLE", GATOM2RVAL(GDK_SELECTION_TYPE_DRAWABLE));
|
||||
rb_define_const(RG_TARGET_NAMESPACE, "TYPE_INTEGER", GATOM2RVAL(GDK_SELECTION_TYPE_INTEGER));
|
||||
rb_define_const(RG_TARGET_NAMESPACE, "TYPE_PIXMAP", GATOM2RVAL(GDK_SELECTION_TYPE_PIXMAP));
|
||||
rb_define_const(RG_TARGET_NAMESPACE, "TYPE_WINDOW", GATOM2RVAL(GDK_SELECTION_TYPE_WINDOW));
|
||||
rb_define_const(RG_TARGET_NAMESPACE, "TYPE_STRING", GATOM2RVAL(GDK_SELECTION_TYPE_STRING));
|
||||
|
||||
/* GdkTarget */
|
||||
rb_define_const(RG_TARGET_NAMESPACE, "TARGET_BITMAP", GATOM2RVAL(GDK_TARGET_BITMAP));
|
||||
rb_define_const(RG_TARGET_NAMESPACE, "TARGET_COLORMAP", GATOM2RVAL(GDK_TARGET_COLORMAP));
|
||||
rb_define_const(RG_TARGET_NAMESPACE, "TARGET_DRAWABLE", GATOM2RVAL(GDK_TARGET_DRAWABLE));
|
||||
rb_define_const(RG_TARGET_NAMESPACE, "TARGET_PIXMAP", GATOM2RVAL(GDK_TARGET_PIXMAP));
|
||||
rb_define_const(RG_TARGET_NAMESPACE, "TARGET_STRING", GATOM2RVAL(GDK_TARGET_STRING));
|
||||
|
||||
}
|
||||
77
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkthreads.c
Normal file
77
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkthreads.c
Normal file
@@ -0,0 +1,77 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2003-2005 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#ifdef G_THREADS_ENABLED
|
||||
|
||||
#define RG_TARGET_NAMESPACE mThreads
|
||||
|
||||
static VALUE
|
||||
rg_m_init(VALUE self)
|
||||
{
|
||||
#ifndef GDK_WINDOWING_WIN32
|
||||
if (!g_thread_supported()){
|
||||
g_thread_init(NULL);
|
||||
}
|
||||
gdk_threads_init();
|
||||
#endif
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_enter(VALUE self)
|
||||
{
|
||||
gdk_threads_enter();
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_leave(VALUE self)
|
||||
{
|
||||
gdk_threads_leave();
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_synchronize(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
VALUE func = rb_block_proc();
|
||||
gdk_threads_enter();
|
||||
func = rb_block_proc();
|
||||
rb_funcall(func, id_call, 0);
|
||||
gdk_threads_leave();
|
||||
return Qnil;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_gdk_threads(VALUE mGdk)
|
||||
{
|
||||
#ifdef G_THREADS_ENABLED
|
||||
VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGdk, "Threads");
|
||||
|
||||
RG_DEF_MODFUNC(init, 0);
|
||||
RG_DEF_MODFUNC(enter, 0);
|
||||
RG_DEF_MODFUNC(leave, 0);
|
||||
RG_DEF_MODFUNC(synchronize, 0);
|
||||
#endif
|
||||
}
|
||||
135
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdktimecoord.c
Normal file
135
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdktimecoord.c
Normal file
@@ -0,0 +1,135 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2003 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cTimeCoord
|
||||
#define _SELF(s) ((GdkTimeCoord*)RVAL2BOXED(s, GDK_TYPE_TIME_COORD))
|
||||
|
||||
/**********************************/
|
||||
static GdkTimeCoord*
|
||||
timecoord_copy(const GdkTimeCoord* val)
|
||||
{
|
||||
GdkTimeCoord* new_val;
|
||||
g_return_val_if_fail (val != NULL, NULL);
|
||||
new_val = g_new(GdkTimeCoord, 1);
|
||||
*new_val = *val;
|
||||
return new_val;
|
||||
}
|
||||
|
||||
GType
|
||||
gdk_timecoord_get_type(void)
|
||||
{
|
||||
static GType our_type = 0;
|
||||
|
||||
if (our_type == 0)
|
||||
our_type = g_boxed_type_register_static ("GdkTimeCoord",
|
||||
(GBoxedCopyFunc)timecoord_copy,
|
||||
(GBoxedFreeFunc)g_free);
|
||||
return our_type;
|
||||
}
|
||||
/**********************************/
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self, VALUE rbtime, VALUE rbaxes)
|
||||
{
|
||||
guint32 time = NUM2UINT(rbtime);
|
||||
long n;
|
||||
gdouble *axes = RVAL2GDOUBLES(rbaxes, n);
|
||||
GdkTimeCoord *coord;
|
||||
|
||||
if (n > GDK_MAX_TIMECOORD_AXES) {
|
||||
g_free(axes);
|
||||
|
||||
rb_raise(rb_eArgError,
|
||||
"axes out of range: %ld (0..%d)",
|
||||
n, GDK_MAX_TIMECOORD_AXES);
|
||||
}
|
||||
|
||||
coord = g_new(GdkTimeCoord, 1);
|
||||
coord->time = time;
|
||||
MEMCPY(coord->axes, axes, gdouble, n);
|
||||
|
||||
g_free(axes);
|
||||
|
||||
G_INITIALIZE(self, coord);
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_time(VALUE self)
|
||||
{
|
||||
return UINT2NUM(_SELF(self)->time);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_time(VALUE self, VALUE time)
|
||||
{
|
||||
_SELF(self)->time = NUM2UINT(time);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_axes(VALUE self)
|
||||
{
|
||||
VALUE ary = rb_ary_new();
|
||||
int i;
|
||||
for (i = 0; i < GDK_MAX_TIMECOORD_AXES; i++){
|
||||
rb_ary_push(ary, rb_float_new(_SELF(self)->axes[i]));
|
||||
}
|
||||
return ary;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_axes(VALUE self, VALUE rbaxes)
|
||||
{
|
||||
GdkTimeCoord *coord = _SELF(self);
|
||||
VALUE axes = rb_ary_to_ary(rbaxes);
|
||||
long i;
|
||||
long n = RARRAY_LEN(axes);
|
||||
|
||||
if (n < 0 || n > GDK_MAX_TIMECOORD_AXES)
|
||||
rb_raise(rb_eArgError,
|
||||
"axes out of range: %ld (0..%d)",
|
||||
n, GDK_MAX_TIMECOORD_AXES);
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
coord->axes[i] = NUM2DBL(RARRAY_PTR(axes)[i]);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_gdk_timecoord(VALUE mGdk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_TIME_COORD, "TimeCoord", mGdk);
|
||||
|
||||
RG_DEF_METHOD(initialize, 2);
|
||||
RG_DEF_METHOD(time, 0);
|
||||
RG_DEF_METHOD(set_time, 1);
|
||||
RG_DEF_METHOD(axes, 0);
|
||||
RG_DEF_METHOD(set_axes, 1);
|
||||
|
||||
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
||||
|
||||
rb_define_const(RG_TARGET_NAMESPACE, "MAX_AXES", INT2NUM(GDK_MAX_TIMECOORD_AXES));
|
||||
}
|
||||
256
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkvisual.c
Normal file
256
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkvisual.c
Normal file
@@ -0,0 +1,256 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002-2004 Masao Mutoh
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cVisual
|
||||
#define _SELF(self) (GDK_VISUAL(RVAL2GOBJ(self)))
|
||||
|
||||
static VALUE
|
||||
rg_s_query_depths(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
gint *depth;
|
||||
gint count;
|
||||
VALUE ary;
|
||||
int i;
|
||||
|
||||
gdk_query_depths(&depth, &count);
|
||||
ary = rb_ary_new2(count);
|
||||
for (i = 0; i < count; i++) {
|
||||
rb_ary_push(ary, INT2NUM((depth)[i]));
|
||||
}
|
||||
return ary;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_query_visual_types(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
GdkVisualType *visual_types;
|
||||
gint count;
|
||||
VALUE ary;
|
||||
int i;
|
||||
|
||||
gdk_query_visual_types(&visual_types, &count);
|
||||
ary = rb_ary_new2(count);
|
||||
for (i = 0; i < count; i++) {
|
||||
rb_ary_push(ary, GENUM2RVAL((visual_types)[i], GDK_TYPE_VISUAL_TYPE));
|
||||
}
|
||||
return ary;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_visuals(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
GList *list = gdk_list_visuals(), *cur;
|
||||
VALUE ary = rb_ary_new();
|
||||
|
||||
for (cur = list; cur != NULL; cur = cur->next) {
|
||||
rb_ary_push(ary, GOBJ2RVAL((GdkVisual *)cur->data));
|
||||
}
|
||||
g_list_free(list);
|
||||
return ary;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_best_depth(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return INT2NUM(gdk_visual_get_best_depth());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_best_type(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return INT2NUM(gdk_visual_get_best_type());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_system(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_visual_get_system());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_best(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_visual_get_best());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_best_with_depth(G_GNUC_UNUSED VALUE self, VALUE depth)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_visual_get_best_with_depth(NUM2INT(depth)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_best_with_type(G_GNUC_UNUSED VALUE self, VALUE type)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_visual_get_best_with_depth(
|
||||
(GdkVisualType)GENUM2RVAL(type, GDK_TYPE_VISUAL_TYPE)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_best_with_both(G_GNUC_UNUSED VALUE self, VALUE depth, VALUE type)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_visual_get_best_with_both(
|
||||
NUM2INT(depth),
|
||||
(GdkVisualType)RVAL2GENUM(type, GDK_TYPE_VISUAL_TYPE)));
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
static VALUE
|
||||
rg_screen(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gdk_visual_get_screen(_SELF(self)));
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Structure accessors */
|
||||
static VALUE
|
||||
rg_visual_type(VALUE self)
|
||||
{
|
||||
return GENUM2RVAL(_SELF(self)->type, GDK_TYPE_VISUAL_TYPE);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_depth(VALUE self)
|
||||
{
|
||||
return INT2FIX(_SELF(self)->depth);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_byte_order(VALUE self)
|
||||
{
|
||||
return GENUM2RVAL(_SELF(self)->byte_order, GDK_TYPE_BYTE_ORDER);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_colormap_size(VALUE self)
|
||||
{
|
||||
return INT2FIX(_SELF(self)->colormap_size);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_bits_per_rgb(VALUE self)
|
||||
{
|
||||
return INT2FIX(_SELF(self)->bits_per_rgb);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_red_mask(VALUE self)
|
||||
{
|
||||
return INT2FIX(_SELF(self)->red_mask);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_red_shift(VALUE self)
|
||||
{
|
||||
return INT2FIX(_SELF(self)->red_shift);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_red_prec(VALUE self)
|
||||
{
|
||||
return INT2FIX(_SELF(self)->red_prec);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_green_mask(VALUE self)
|
||||
{
|
||||
return INT2FIX(_SELF(self)->green_mask);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_green_shift(VALUE self)
|
||||
{
|
||||
return INT2FIX(_SELF(self)->green_shift);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_green_prec(VALUE self)
|
||||
{
|
||||
return INT2FIX(_SELF(self)->green_prec);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_blue_mask(VALUE self)
|
||||
{
|
||||
return INT2FIX(_SELF(self)->blue_mask);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_blue_shift(VALUE self)
|
||||
{
|
||||
return INT2FIX(_SELF(self)->blue_shift);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_blue_prec(VALUE self)
|
||||
{
|
||||
return INT2FIX(_SELF(self)->blue_prec);
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_gdk_visual(VALUE mGdk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_VISUAL, "Visual", mGdk);
|
||||
|
||||
/* class methods */
|
||||
RG_DEF_SMETHOD(query_depths, 0);
|
||||
RG_DEF_SMETHOD(query_visual_types, 0);
|
||||
RG_DEF_SMETHOD(visuals, 0);
|
||||
RG_DEF_SMETHOD(best_depth, 0);
|
||||
RG_DEF_SMETHOD(best_type, 0);
|
||||
RG_DEF_SMETHOD(system, 0);
|
||||
RG_DEF_SMETHOD(best, 0);
|
||||
RG_DEF_SMETHOD(best_with_depth, 1);
|
||||
RG_DEF_SMETHOD(best_with_type, 1);
|
||||
RG_DEF_SMETHOD(best_with_both, 2);
|
||||
|
||||
/* instance methods */
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
RG_DEF_METHOD(screen, 0);
|
||||
#endif
|
||||
RG_DEF_METHOD(visual_type, 0);
|
||||
RG_DEF_METHOD(depth, 0);
|
||||
RG_DEF_METHOD(byte_order, 0);
|
||||
RG_DEF_METHOD(colormap_size, 0);
|
||||
RG_DEF_METHOD(bits_per_rgb, 0);
|
||||
RG_DEF_METHOD(red_mask, 0);
|
||||
RG_DEF_METHOD(red_shift, 0);
|
||||
RG_DEF_METHOD(red_prec, 0);
|
||||
RG_DEF_METHOD(green_mask, 0);
|
||||
RG_DEF_METHOD(green_shift, 0);
|
||||
RG_DEF_METHOD(green_prec, 0);
|
||||
RG_DEF_METHOD(blue_mask, 0);
|
||||
RG_DEF_METHOD(blue_shift, 0);
|
||||
RG_DEF_METHOD(blue_prec, 0);
|
||||
|
||||
/* GdkVisualType */
|
||||
G_DEF_CLASS(GDK_TYPE_VISUAL_TYPE, "Type", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_VISUAL_TYPE, "GDK_VISUAL_");
|
||||
|
||||
/* GdkByteOrder */
|
||||
G_DEF_CLASS(GDK_TYPE_BYTE_ORDER, "ByteOrder", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_BYTE_ORDER, "GDK_");
|
||||
}
|
||||
1178
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkwindow.c
Normal file
1178
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkwindow.c
Normal file
File diff suppressed because it is too large
Load Diff
208
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkwindowattr.c
Normal file
208
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkwindowattr.c
Normal file
@@ -0,0 +1,208 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2003 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
/*****************************************/
|
||||
static GdkWindowAttr*
|
||||
attr_copy(const GdkWindowAttr* win)
|
||||
{
|
||||
GdkWindowAttr* new_win;
|
||||
g_return_val_if_fail (win != NULL, NULL);
|
||||
new_win = g_new(GdkWindowAttr, 1);
|
||||
*new_win = *win;
|
||||
return new_win;
|
||||
}
|
||||
|
||||
GType
|
||||
gdk_windowattr_get_type(void)
|
||||
{
|
||||
static GType our_type = 0;
|
||||
if (our_type == 0)
|
||||
our_type = g_boxed_type_register_static ("GdkWindowAttr",
|
||||
(GBoxedCopyFunc)attr_copy,
|
||||
(GBoxedFreeFunc)g_free);
|
||||
return our_type;
|
||||
}
|
||||
/*****************************************/
|
||||
|
||||
#define RG_TARGET_NAMESPACE cWindowAttr
|
||||
#define _SELF(w) ((GdkWindowAttr*)RVAL2BOXED(w, GDK_TYPE_WINDOW_ATTR))
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self, VALUE width, VALUE height, VALUE wclass,
|
||||
VALUE window_type)
|
||||
{
|
||||
GdkWindowAttr attribute;
|
||||
attribute.width = NUM2INT(width);
|
||||
attribute.height = NUM2INT(height);
|
||||
attribute.wclass = RVAL2GENUM(wclass, GDK_TYPE_WINDOW_CLASS);
|
||||
attribute.window_type = RVAL2GENUM(window_type, GDK_TYPE_WINDOW_TYPE);
|
||||
G_INITIALIZE(self, g_boxed_copy(GDK_TYPE_WINDOW_ATTR, &attribute));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
#define ATTR_STR(name)\
|
||||
static VALUE \
|
||||
attr_get_ ## name (VALUE self)\
|
||||
{\
|
||||
return CSTR2RVAL(_SELF(self)->name);\
|
||||
}\
|
||||
static VALUE \
|
||||
attr_set_ ## name (VALUE self, VALUE val)\
|
||||
{\
|
||||
_SELF(self)->name = (gchar *)RVAL2CSTR(val);\
|
||||
return self;\
|
||||
}
|
||||
|
||||
#define ATTR_INT(name)\
|
||||
static VALUE \
|
||||
attr_get_ ## name (VALUE self)\
|
||||
{\
|
||||
return INT2NUM(_SELF(self)->name);\
|
||||
}\
|
||||
static VALUE \
|
||||
attr_set_ ## name (VALUE self, VALUE val)\
|
||||
{\
|
||||
_SELF(self)->name = NUM2INT(val);\
|
||||
return self;\
|
||||
}
|
||||
|
||||
ATTR_STR(title);
|
||||
ATTR_INT(event_mask);
|
||||
ATTR_INT(x);
|
||||
ATTR_INT(y);
|
||||
ATTR_INT(width);
|
||||
ATTR_INT(height);
|
||||
|
||||
static VALUE
|
||||
rg_wclass(VALUE self)
|
||||
{
|
||||
return GENUM2RVAL(_SELF(self)->wclass, GDK_TYPE_WINDOW_CLASS);
|
||||
}
|
||||
static VALUE
|
||||
rg_set_wclass(VALUE self, VALUE val)
|
||||
{
|
||||
_SELF(self)->wclass = RVAL2GENUM(val, GDK_TYPE_WINDOW_CLASS);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_visual(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(_SELF(self)->visual);
|
||||
}
|
||||
static VALUE
|
||||
rg_set_visual(VALUE self, VALUE val)
|
||||
{
|
||||
_SELF(self)->visual = GDK_VISUAL(RVAL2GOBJ(val));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_colormap(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(_SELF(self)->colormap);
|
||||
}
|
||||
static VALUE
|
||||
rg_set_colormap(VALUE self, VALUE val)
|
||||
{
|
||||
_SELF(self)->colormap = GDK_COLORMAP(RVAL2GOBJ(val));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_window_type(VALUE self)
|
||||
{
|
||||
return GENUM2RVAL(_SELF(self)->window_type, GDK_TYPE_WINDOW_TYPE);
|
||||
}
|
||||
static VALUE
|
||||
rg_set_window_type(VALUE self, VALUE val)
|
||||
{
|
||||
_SELF(self)->window_type = RVAL2GENUM(val, GDK_TYPE_WINDOW_TYPE);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_cursor(VALUE self)
|
||||
{
|
||||
return BOXED2RVAL(_SELF(self)->cursor, GDK_TYPE_CURSOR);
|
||||
}
|
||||
static VALUE
|
||||
rg_set_cursor(VALUE self, VALUE val)
|
||||
{
|
||||
_SELF(self)->cursor = (GdkCursor*)(RVAL2BOXED(val, GDK_TYPE_CURSOR));
|
||||
return self;
|
||||
}
|
||||
|
||||
ATTR_STR(wmclass_name);
|
||||
ATTR_STR(wmclass_class);
|
||||
|
||||
static VALUE
|
||||
rg_override_redirect(VALUE self)
|
||||
{
|
||||
return CBOOL2RVAL(_SELF(self)->override_redirect);
|
||||
}
|
||||
static VALUE
|
||||
rg_set_override_redirect(VALUE self, VALUE val)
|
||||
{
|
||||
_SELF(self)->override_redirect = RVAL2CBOOL(val);
|
||||
return self;
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_gdk_windowattr(VALUE mGdk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_WINDOW_ATTR, "WindowAttr", mGdk);
|
||||
|
||||
RG_DEF_METHOD(initialize, 4);
|
||||
rb_define_method(RG_TARGET_NAMESPACE, "title", attr_get_title, 0);
|
||||
rb_define_method(RG_TARGET_NAMESPACE, "set_title", attr_set_title, 1);
|
||||
rb_define_method(RG_TARGET_NAMESPACE, "event_mask", attr_get_event_mask, 0);
|
||||
rb_define_method(RG_TARGET_NAMESPACE, "set_event_mask", attr_set_event_mask, 1);
|
||||
rb_define_method(RG_TARGET_NAMESPACE, "x", attr_get_x, 0);
|
||||
rb_define_method(RG_TARGET_NAMESPACE, "set_x", attr_set_x, 1);
|
||||
rb_define_method(RG_TARGET_NAMESPACE, "y", attr_get_y, 0);
|
||||
rb_define_method(RG_TARGET_NAMESPACE, "set_y", attr_set_y, 1);
|
||||
rb_define_method(RG_TARGET_NAMESPACE, "width", attr_get_width, 0);
|
||||
rb_define_method(RG_TARGET_NAMESPACE, "set_width", attr_set_width, 1);
|
||||
rb_define_method(RG_TARGET_NAMESPACE, "height", attr_get_height, 0);
|
||||
rb_define_method(RG_TARGET_NAMESPACE, "set_height", attr_set_height, 1);
|
||||
RG_DEF_METHOD(wclass, 0);
|
||||
RG_DEF_METHOD(set_wclass, 1);
|
||||
RG_DEF_METHOD(visual, 0);
|
||||
RG_DEF_METHOD(set_visual, 1);
|
||||
RG_DEF_METHOD(colormap, 0);
|
||||
RG_DEF_METHOD(set_colormap, 1);
|
||||
RG_DEF_METHOD(window_type, 0);
|
||||
RG_DEF_METHOD(set_window_type, 1);
|
||||
RG_DEF_METHOD(cursor, 0);
|
||||
RG_DEF_METHOD(set_cursor, 1);
|
||||
rb_define_method(RG_TARGET_NAMESPACE, "wmclass_name", attr_get_wmclass_name, 0);
|
||||
rb_define_method(RG_TARGET_NAMESPACE, "set_wmclass_name", attr_set_wmclass_name, 1);
|
||||
rb_define_method(RG_TARGET_NAMESPACE, "wmclass_class", attr_get_wmclass_class, 0);
|
||||
rb_define_method(RG_TARGET_NAMESPACE, "set_wmclass_class", attr_set_wmclass_class, 1);
|
||||
RG_DEF_METHOD(override_redirect, 0);
|
||||
RG_DEF_METHOD(set_override_redirect, 1);
|
||||
|
||||
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
||||
|
||||
}
|
||||
262
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkx11.c
Normal file
262
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgdkx11.c
Normal file
@@ -0,0 +1,262 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2005 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
|
||||
#define RG_TARGET_NAMESPACE mX11
|
||||
|
||||
/* Can't implement
|
||||
#define GDK_ROOT_WINDOW ()
|
||||
*/
|
||||
/* Deprecated.
|
||||
#define GDK_ROOT_PARENT ()
|
||||
*/
|
||||
/* Can't implement
|
||||
#define GDK_DISPLAY ()
|
||||
#define GDK_WINDOW_XDISPLAY (win)
|
||||
*/
|
||||
/* Use Gdk::Drawable#xid
|
||||
#define GDK_WINDOW_XID (win)
|
||||
*/
|
||||
/* Same as GDK_WINDOW_*
|
||||
#define GDK_PIXMAP_XDISPLAY (pix)
|
||||
#define GDK_PIXMAP_XID (pix)
|
||||
#define GDK_DISPLAY_XDISPLAY (display)
|
||||
#define GDK_DRAWABLE_XDISPLAY (win)
|
||||
#define GDK_DRAWABLE_XID (win)
|
||||
*/
|
||||
/* Can't implement
|
||||
#define GDK_IMAGE_XDISPLAY (image)
|
||||
#define GDK_IMAGE_XIMAGE (image)
|
||||
#define GDK_GC_XDISPLAY (gc)
|
||||
#define GDK_COLORMAP_XDISPLAY (cmap)
|
||||
#define GDK_COLORMAP_XCOLORMAP (cmap)
|
||||
#define GDK_SCREEN_XDISPLAY (screen)
|
||||
*/
|
||||
/* Implement at Gdk::Screen
|
||||
#define GDK_SCREEN_XNUMBER (screen)
|
||||
*/
|
||||
/* Can't implement
|
||||
#define GDK_SCREEN_XSCREEN (screen)
|
||||
#define GDK_VISUAL_XVISUAL (vis)
|
||||
*/
|
||||
/* Deprecated.
|
||||
#define GDK_FONT_XDISPLAY (font)
|
||||
#define GDK_FONT_XFONT (font)
|
||||
*/
|
||||
/* Can't implement.
|
||||
#define GDK_CURSOR_XCURSOR (cursor)
|
||||
#define GDK_CURSOR_XDISPLAY (cursor)
|
||||
#define GDK_GC_XGC (gc)
|
||||
#define GDK_GC_GET_XGC (gc)
|
||||
*/
|
||||
/* Don't need this.
|
||||
#define GDK_WINDOW_XWINDOW
|
||||
*/
|
||||
/* Can't implement.
|
||||
GdkVisual* gdkx_visual_get (VisualID xvisualid);
|
||||
GdkColormap* gdkx_colormap_get (Colormap xcolormap);
|
||||
*/
|
||||
/* Implement at Gdk::Pixmap.
|
||||
GdkPixmap* gdk_pixmap_foreign_new (GdkNativeWindow anid);
|
||||
GdkPixmap* gdk_pixmap_foreign_new_for_display
|
||||
(GdkDisplay *display,
|
||||
GdkNativeWindow anid);
|
||||
*/
|
||||
/* Implement at Gdk::Window.
|
||||
GdkWindow* gdk_window_foreign_new (GdkNativeWindow anid);
|
||||
GdkWindow* gdk_window_foreign_new_for_display
|
||||
(GdkDisplay *display,
|
||||
GdkNativeWindow anid);
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
rg_m_xid_table_lookup(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE arg[2];
|
||||
GdkPixmap* win = NULL;
|
||||
|
||||
rb_scan_args(argc, argv, "11", &arg[0], &arg[1]);
|
||||
|
||||
switch(argc)
|
||||
{
|
||||
case 1:
|
||||
win = gdk_xid_table_lookup(NUM2UINT(arg[0]));
|
||||
break;
|
||||
case 2:
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
win = gdk_xid_table_lookup_for_display(RVAL2GOBJ(arg[0]), NUM2UINT(arg[1]));
|
||||
#else
|
||||
win = gdk_xid_table_lookup(NUM2UINT(arg[1]));
|
||||
rb_warn("Not supported in GTK+-2.0.x.");
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
if (win == NULL)
|
||||
return Qnil;
|
||||
else {
|
||||
return GOBJ2RVAL(win);
|
||||
}
|
||||
}
|
||||
|
||||
/* Implement at Gdk::Window
|
||||
GdkWindow* gdk_window_lookup (GdkNativeWindow anid);
|
||||
GdkWindow* gdk_window_lookup_for_display (GdkDisplay *display,
|
||||
GdkNativeWindow anid);
|
||||
*/
|
||||
/* Implement at Gdk::Pixmap
|
||||
GdkPixmap* gdk_pixmap_lookup (GdkNativeWindow anid);
|
||||
GdkPixmap* gdk_pixmap_lookup_for_display (GdkDisplay *display,
|
||||
GdkNativeWindow anid);
|
||||
*/
|
||||
/* Deprecated.
|
||||
#define gdk_font_lookup (xid)
|
||||
#define gdk_font_lookup_for_display (display, xid)
|
||||
*/
|
||||
/* Can't implement.
|
||||
GdkDisplay* gdk_x11_lookup_xdisplay (Display *xdisplay);
|
||||
*/
|
||||
/* Implement at Gdk::Window
|
||||
guint32 gdk_x11_get_server_time (GdkWindow *window);
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
rg_m_net_wm_supports_p(VALUE self, VALUE property)
|
||||
{
|
||||
return CBOOL2RVAL(gdk_net_wm_supports(RVAL2ATOM(property)));
|
||||
}
|
||||
|
||||
/* Implement at Gdk::Screen
|
||||
gboolean gdk_x11_screen_supports_net_wm_hint
|
||||
(GdkScreen *screen,
|
||||
GdkAtom property);
|
||||
const char* gdk_x11_screen_get_window_manager_name
|
||||
(GdkScreen *screen);
|
||||
*/
|
||||
/* Can't implement
|
||||
GdkVisual* gdk_x11_screen_lookup_visual (GdkScreen *screen,
|
||||
VisualID xvisualid);
|
||||
GdkColormap* gdk_x11_colormap_foreign_new (GdkVisual *visual,
|
||||
Colormap xcolormap);
|
||||
Colormap gdk_x11_colormap_get_xcolormap (GdkColormap *colormap);
|
||||
Display* gdk_x11_colormap_get_xdisplay (GdkColormap *colormap);
|
||||
Cursor gdk_x11_cursor_get_xcursor (GdkCursor *cursor);
|
||||
Display* gdk_x11_cursor_get_xdisplay (GdkCursor *cursor);
|
||||
Display* gdk_x11_display_get_xdisplay (GdkDisplay *display);
|
||||
*/
|
||||
|
||||
/* Implement at Gdk::Display
|
||||
void gdk_x11_display_grab (GdkDisplay *display);
|
||||
void gdk_x11_display_ungrab (GdkDisplay *display);
|
||||
void gdk_x11_register_standard_event_type
|
||||
(GdkDisplay *display,
|
||||
gint event_base,
|
||||
gint n_events);
|
||||
*/
|
||||
/* Can't implement
|
||||
Display* gdk_x11_drawable_get_xdisplay (GdkDrawable *drawable);
|
||||
*/
|
||||
/* Use Gdk::Drawable#xid instead
|
||||
XID gdk_x11_drawable_get_xid (GdkDrawable *drawable);
|
||||
*/
|
||||
/* Deprecated
|
||||
G_CONST_RETURN char* gdk_x11_font_get_name (GdkFont *font);
|
||||
Display* gdk_x11_font_get_xdisplay (GdkFont *font);
|
||||
gpointer gdk_x11_font_get_xfont (GdkFont *font);
|
||||
*/
|
||||
/* Can't implement
|
||||
Display* gdk_x11_gc_get_xdisplay (GdkGC *gc);
|
||||
GC gdk_x11_gc_get_xgc (GdkGC *gc);
|
||||
Window gdk_x11_get_default_root_xwindow
|
||||
(void);
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
rg_m_default_screen(VALUE self)
|
||||
{
|
||||
return INT2NUM(gdk_x11_get_default_screen());
|
||||
}
|
||||
/* Can't implement
|
||||
Display* gdk_x11_get_default_xdisplay (void);
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
rg_m_grab_server(VALUE self)
|
||||
{
|
||||
gdk_x11_grab_server();
|
||||
return Qnil;
|
||||
}
|
||||
/* Can't implement
|
||||
Display* gdk_x11_image_get_xdisplay (GdkImage *image);
|
||||
XImage* gdk_x11_image_get_ximage (GdkImage *image);
|
||||
*/
|
||||
/* Implement at Gdk::Screen.
|
||||
int gdk_x11_screen_get_screen_number
|
||||
(GdkScreen *screen);
|
||||
*/
|
||||
/* Can't impelement
|
||||
Screen* gdk_x11_screen_get_xscreen (GdkScreen *screen);
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
rg_m_ungrab_server(VALUE self)
|
||||
{
|
||||
gdk_x11_ungrab_server();
|
||||
return Qnil;
|
||||
}
|
||||
/* Can't implement
|
||||
Visual* gdk_x11_visual_get_xvisual (GdkVisual *visual);
|
||||
|
||||
Atom gdk_x11_atom_to_xatom (GdkAtom atom);
|
||||
Atom gdk_x11_atom_to_xatom_for_display
|
||||
(GdkDisplay *display,
|
||||
GdkAtom atom);
|
||||
GdkAtom gdk_x11_xatom_to_atom (Atom xatom);
|
||||
GdkAtom gdk_x11_xatom_to_atom_for_display
|
||||
(GdkDisplay *display,
|
||||
Atom xatom);
|
||||
Atom gdk_x11_get_xatom_by_name (const gchar *atom_name);
|
||||
Atom gdk_x11_get_xatom_by_name_for_display
|
||||
(GdkDisplay *display,
|
||||
const gchar *atom_name);
|
||||
G_CONST_RETURN gchar* gdk_x11_get_xatom_name
|
||||
(Atom xatom);
|
||||
G_CONST_RETURN gchar* gdk_x11_get_xatom_name_for_display
|
||||
(GdkDisplay *display,
|
||||
Atom xatom);
|
||||
*/
|
||||
#endif
|
||||
void
|
||||
Init_gtk_gdk_x11(VALUE mGdk)
|
||||
{
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGdk, "X11");
|
||||
|
||||
RG_DEF_MODFUNC(xid_table_lookup, -1);
|
||||
RG_DEF_MODFUNC_P(net_wm_supports, 1);
|
||||
|
||||
RG_DEF_MODFUNC(default_screen, 0);
|
||||
RG_DEF_MODFUNC(grab_server, 0);
|
||||
|
||||
RG_DEF_MODFUNC(ungrab_server, 0);
|
||||
#endif
|
||||
}
|
||||
577
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtk.c
Normal file
577
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtk.c
Normal file
@@ -0,0 +1,577 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002-2006 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2001 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
#include <locale.h>
|
||||
|
||||
#define RG_TARGET_NAMESPACE mGtk
|
||||
|
||||
VALUE RG_TARGET_NAMESPACE;
|
||||
|
||||
static VALUE rbgtk_eGtkInitError;
|
||||
|
||||
ID id_relative_callbacks;
|
||||
ID id_call;
|
||||
static ID id__windows__;
|
||||
static ID id__quit_callbacks__, id__timeout_callbacks__;
|
||||
static ID id__idle_callbacks__, id__snooper_callbacks__;
|
||||
|
||||
typedef struct _callback_info_t
|
||||
{
|
||||
VALUE callback;
|
||||
ID key;
|
||||
guint id;
|
||||
} callback_info_t;
|
||||
|
||||
static void
|
||||
remove_from_windows(G_GNUC_UNUSED GtkWidget *window, VALUE obj)
|
||||
{
|
||||
VALUE klass, windows;
|
||||
|
||||
klass = rb_obj_class(obj);
|
||||
windows = rb_ivar_get(klass, id__windows__);
|
||||
if (!NIL_P(windows)) {
|
||||
rb_hash_delete(windows, obj);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
rbgtk_initialize_gtkobject(VALUE obj, GtkObject *gtkobj)
|
||||
{
|
||||
gtkobj = g_object_ref(gtkobj);
|
||||
gtk_object_sink(gtkobj);
|
||||
G_INITIALIZE(obj, gtkobj);
|
||||
|
||||
if (GTK_IS_WINDOW(gtkobj) || GTK_IS_MENU_SHELL(gtkobj)) {
|
||||
VALUE klass;
|
||||
klass = rb_obj_class(obj);
|
||||
if (rb_ivar_defined(klass, id__windows__) == Qfalse) {
|
||||
rb_ivar_set(klass, id__windows__, rb_hash_new());
|
||||
}
|
||||
rb_hash_aset(rb_ivar_get(klass, id__windows__), obj, Qnil);
|
||||
g_signal_connect_after(gtkobj, "destroy",
|
||||
G_CALLBACK(remove_from_windows),
|
||||
(gpointer)obj);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
exec_callback(GtkWidget *widget, gpointer proc)
|
||||
{
|
||||
rb_funcall((VALUE)proc, id_call, 1, GOBJ2RVAL(widget));
|
||||
}
|
||||
|
||||
/*
|
||||
* Gtk module
|
||||
*/
|
||||
|
||||
/* We can't use rbgtk_poll() on native Win32.
|
||||
Because GPollFD doesn't have file descriptor but HANDLE. */
|
||||
#define USE_POLL_FUNC
|
||||
|
||||
static VALUE
|
||||
rg_m_events_pending_p(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return CBOOL2RVAL(gtk_events_pending());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
gtk_m_function_body(VALUE data)
|
||||
{
|
||||
callback_info_t *info = (callback_info_t *)data;
|
||||
VALUE ret = rb_funcall(info->callback, id_call, 0);
|
||||
|
||||
if (info->key && !ret)
|
||||
G_REMOVE_RELATIVE(RG_TARGET_NAMESPACE, info->key, UINT2NUM(info->id));
|
||||
return ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_m_function(gpointer data)
|
||||
{
|
||||
return RVAL2CBOOL(G_PROTECT_CALLBACK(gtk_m_function_body, data));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
gtk_m_function2_body(gpointer proc)
|
||||
{
|
||||
rb_funcall((VALUE)proc, id_call, 0);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_m_function2(gpointer proc)
|
||||
{
|
||||
G_PROTECT_CALLBACK(gtk_m_function2_body, proc);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_set_locale(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return CSTR2RVAL(gtk_set_locale());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_disable_setlocale(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
gtk_disable_setlocale();
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_default_language(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return BOXED2RVAL(gtk_get_default_language(), PANGO_TYPE_LANGUAGE);
|
||||
}
|
||||
|
||||
typedef void (*SignalFunc) (int);
|
||||
|
||||
static gboolean _initialized = FALSE;
|
||||
|
||||
static VALUE
|
||||
rg_m_init(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
gint i, gargc;
|
||||
VALUE argary;
|
||||
char** gargv;
|
||||
VALUE progname;
|
||||
|
||||
if (_initialized)
|
||||
return self;
|
||||
else
|
||||
_initialized = TRUE;
|
||||
|
||||
rb_scan_args(argc, argv, "01", &argary);
|
||||
|
||||
if (NIL_P(argary)){
|
||||
argary = rb_const_get(rb_cObject, rb_intern("ARGV"));
|
||||
gargc = RARRAY_LEN(argary);
|
||||
} else {
|
||||
Check_Type(argary, T_ARRAY);
|
||||
gargc = RARRAY_LEN(argary);
|
||||
}
|
||||
|
||||
gargv = ALLOCA_N(char *, gargc + 1);
|
||||
progname = rb_gv_get("$0");
|
||||
gargv[0] = (char *)RVAL2CSTR(progname);
|
||||
|
||||
for (i = 0; i < gargc; i++)
|
||||
if (TYPE(RARRAY_PTR(argary)[i]) == T_STRING)
|
||||
gargv[i+1] = (char *)RVAL2CSTR(RARRAY_PTR(argary)[i]);
|
||||
else
|
||||
gargv[i+1] = (char *)"";
|
||||
gargc++;
|
||||
|
||||
{
|
||||
gboolean is_initialized;
|
||||
|
||||
is_initialized = gtk_init_check(&gargc, &gargv);
|
||||
if (! is_initialized) {
|
||||
const char *display_name_arg = gdk_get_display_arg_name();
|
||||
display_name_arg = display_name_arg ? display_name_arg : g_getenv("DISPLAY");
|
||||
rb_raise(rbgtk_eGtkInitError, "Cannot open display: %s",
|
||||
display_name_arg ? display_name_arg : " ");
|
||||
}
|
||||
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
/* We don't need them.
|
||||
gtk_init()
|
||||
gtk_exit()
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
rg_m_main(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
gtk_main();
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_main_level(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return INT2FIX(gtk_main_level());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_main_quit(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
gtk_main_quit();
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_main_iteration(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return CBOOL2RVAL(gtk_main_iteration());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_main_iteration_do(G_GNUC_UNUSED VALUE self, VALUE blocking)
|
||||
{
|
||||
return CBOOL2RVAL(gtk_main_iteration_do(RVAL2CBOOL(blocking)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_main_do_event(G_GNUC_UNUSED VALUE self, VALUE event)
|
||||
{
|
||||
gtk_main_do_event(RVAL2GEV(event));
|
||||
return event;
|
||||
}
|
||||
|
||||
/* We don't need them.
|
||||
gtk_true()
|
||||
gtk_false()
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
rg_m_grab_add(G_GNUC_UNUSED VALUE self, VALUE widget)
|
||||
{
|
||||
gtk_grab_add(GTK_WIDGET(RVAL2GOBJ(widget)));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_current(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gtk_grab_get_current());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_grab_remove(G_GNUC_UNUSED VALUE self, VALUE widget)
|
||||
{
|
||||
gtk_grab_remove(GTK_WIDGET(RVAL2GOBJ(widget)));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_init_add(VALUE self)
|
||||
{
|
||||
volatile VALUE func = rb_block_proc();
|
||||
|
||||
gtk_init_add((GtkFunction)gtk_m_function2, (gpointer)func);
|
||||
G_RELATIVE(self, func);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_quit_add(VALUE self, VALUE main_level)
|
||||
{
|
||||
volatile VALUE func = rb_block_proc();
|
||||
VALUE rb_id;
|
||||
callback_info_t *info;
|
||||
guint id;
|
||||
|
||||
info = ALLOC(callback_info_t);
|
||||
info->callback = func;
|
||||
info->key = id_relative_callbacks;
|
||||
id = gtk_quit_add_full(NUM2UINT(main_level), (GtkFunction)gtk_m_function,
|
||||
NULL, (gpointer)info, g_free);
|
||||
info->id = id;
|
||||
rb_id = UINT2NUM(id);
|
||||
G_RELATIVE2(self, func, id__quit_callbacks__, rb_id);
|
||||
return rb_id;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_quit_remove(VALUE self, VALUE quit_handler_id)
|
||||
{
|
||||
gtk_quit_remove(NUM2UINT(quit_handler_id));
|
||||
G_REMOVE_RELATIVE(self, id__quit_callbacks__, quit_handler_id);
|
||||
return quit_handler_id;
|
||||
}
|
||||
|
||||
/* We don't need this.
|
||||
gtk_quit_add_full ()
|
||||
gtk_quit_add_destroy()
|
||||
gtk_quit_remove_by_data()
|
||||
gtk_timeout_add_full()
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
rg_m_timeout_add(VALUE self, VALUE interval)
|
||||
{
|
||||
VALUE func, rb_id;
|
||||
callback_info_t *info;
|
||||
guint id;
|
||||
|
||||
func = rb_block_proc();
|
||||
info = ALLOC(callback_info_t);
|
||||
info->callback = func;
|
||||
info->key = id__timeout_callbacks__;
|
||||
id = gtk_timeout_add_full(NUM2UINT(interval), (GtkFunction)gtk_m_function,
|
||||
NULL, (gpointer)info, g_free);
|
||||
info->id = id;
|
||||
rb_id = UINT2NUM(id);
|
||||
G_RELATIVE2(self, func, id__timeout_callbacks__, rb_id);
|
||||
return rb_id;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_timeout_remove(VALUE self, VALUE id)
|
||||
{
|
||||
gtk_timeout_remove(NUM2UINT(id));
|
||||
G_REMOVE_RELATIVE(self, id__timeout_callbacks__, id);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_idle_add(VALUE self)
|
||||
{
|
||||
VALUE func, rb_id;
|
||||
callback_info_t *info;
|
||||
guint id;
|
||||
|
||||
func = rb_block_proc();
|
||||
info = ALLOC(callback_info_t);
|
||||
info->callback = func;
|
||||
info->key = id__idle_callbacks__;
|
||||
id = gtk_idle_add_full(G_PRIORITY_DEFAULT_IDLE,
|
||||
(GtkFunction)gtk_m_function, NULL,
|
||||
(gpointer)info, g_free);
|
||||
info->id = id;
|
||||
rb_id = UINT2NUM(id);
|
||||
G_RELATIVE2(self, func, id__idle_callbacks__, rb_id);
|
||||
return rb_id;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_idle_add_priority(VALUE self, VALUE priority)
|
||||
{
|
||||
VALUE func, rb_id;
|
||||
callback_info_t *info;
|
||||
guint id;
|
||||
|
||||
func = rb_block_proc();
|
||||
info = ALLOC(callback_info_t);
|
||||
info->callback = func;
|
||||
info->key = id__idle_callbacks__;
|
||||
id = gtk_idle_add_full(NUM2INT(priority), (GtkFunction)gtk_m_function,
|
||||
NULL, (gpointer)info, g_free);
|
||||
info->id = id;
|
||||
rb_id = UINT2NUM(id);
|
||||
G_RELATIVE2(self, func, id__idle_callbacks__, rb_id);
|
||||
return rb_id;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_idle_remove(VALUE self, VALUE id)
|
||||
{
|
||||
gtk_idle_remove(NUM2UINT(id));
|
||||
G_REMOVE_RELATIVE(self, id__idle_callbacks__, id);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
/* We don't need this.
|
||||
gtk_idle_remove_by_data()
|
||||
gtk_idle_add_full()
|
||||
|
||||
Use Gdk::Input.add, remove
|
||||
gtk_input_add_full()
|
||||
gtk_input_remove()
|
||||
*/
|
||||
|
||||
static gint
|
||||
gtk_m_key_snoop_func(GtkWidget *grab_widget, GdkEventKey *event, gpointer func)
|
||||
{
|
||||
VALUE ret = rb_funcall((VALUE)func, id_call, 2,
|
||||
GOBJ2RVAL(grab_widget),
|
||||
GEV2RVAL((GdkEvent*)event));
|
||||
return RVAL2CBOOL(ret);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_key_snooper_install(VALUE self)
|
||||
{
|
||||
VALUE func = rb_block_proc();
|
||||
VALUE id = INT2FIX(gtk_key_snooper_install(
|
||||
(GtkKeySnoopFunc)gtk_m_key_snoop_func,
|
||||
(gpointer)func));
|
||||
G_RELATIVE2(self, func, id__snooper_callbacks__, id);
|
||||
return id;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_key_snooper_remove(VALUE self, VALUE id)
|
||||
{
|
||||
gtk_key_snooper_remove(NUM2UINT(id));
|
||||
G_REMOVE_RELATIVE(self, id__snooper_callbacks__, id);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_current_event(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return GEV2RVAL(gtk_get_current_event());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_current_event_time(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return INT2NUM(gtk_get_current_event_time());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_current_event_state(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
GdkModifierType state;
|
||||
gboolean ret = gtk_get_current_event_state(&state);
|
||||
return ret ? GFLAGS2RVAL(state, GDK_TYPE_MODIFIER_TYPE) : Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_get_event_widget(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
VALUE event;
|
||||
rb_scan_args(argc, argv, "01", &event);
|
||||
|
||||
return GOBJ2RVAL(gtk_get_event_widget(NIL_P(event) ? NULL :RVAL2GEV(event)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_propagate_event(G_GNUC_UNUSED VALUE self, VALUE widget, VALUE event)
|
||||
{
|
||||
gtk_propagate_event(GTK_WIDGET(RVAL2GOBJ(widget)), RVAL2GEV(event));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
/* From Version Information */
|
||||
static VALUE
|
||||
rg_m_check_version(G_GNUC_UNUSED VALUE self, VALUE major, VALUE minor, VALUE micro)
|
||||
{
|
||||
const gchar *ret;
|
||||
ret = gtk_check_version(FIX2INT(major), FIX2INT(minor), FIX2INT(micro));
|
||||
return ret ? CSTR2RVAL(ret) : Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_check_version_p(G_GNUC_UNUSED VALUE self, VALUE major, VALUE minor, VALUE micro)
|
||||
{
|
||||
const gchar *ret;
|
||||
ret = gtk_check_version(FIX2INT(major), FIX2INT(minor), FIX2INT(micro));
|
||||
return CBOOL2RVAL(ret == NULL);
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,14,0)
|
||||
static VALUE
|
||||
rg_m_show_uri(G_GNUC_UNUSED VALUE self, VALUE rb_uri_or_options)
|
||||
{
|
||||
VALUE rb_screen = Qnil;
|
||||
VALUE rb_uri = Qnil;
|
||||
VALUE rb_timestamp = Qnil;
|
||||
GdkScreen *screen = NULL;
|
||||
const gchar *uri = NULL;
|
||||
guint32 timestamp = GDK_CURRENT_TIME;
|
||||
GError *error = NULL;
|
||||
|
||||
if (TYPE(rb_uri_or_options) == T_HASH) {
|
||||
rbg_scan_options(rb_uri_or_options,
|
||||
"screen", &rb_screen,
|
||||
"uri", &rb_uri,
|
||||
"timestamp", &rb_timestamp,
|
||||
NULL);
|
||||
} else {
|
||||
rb_uri = rb_uri_or_options;
|
||||
}
|
||||
|
||||
screen = RVAL2GOBJ(rb_screen);
|
||||
uri = StringValueCStr(rb_uri);
|
||||
if (!NIL_P(rb_timestamp)) {
|
||||
timestamp = NUM2UINT(rb_timestamp);
|
||||
}
|
||||
|
||||
if (!gtk_show_uri(screen, uri, timestamp, &error)) {
|
||||
RAISE_GERROR(error);
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Init
|
||||
*/
|
||||
void
|
||||
Init_gtk_gtk(void)
|
||||
{
|
||||
id_call = rb_intern("call");
|
||||
id__windows__ = rb_intern("__windows__");
|
||||
id__quit_callbacks__ = rb_intern("__quit_callbacks__");
|
||||
id__timeout_callbacks__ = rb_intern("__timeout_callbacks__");
|
||||
id__idle_callbacks__ = rb_intern("__idle_callbacks__");
|
||||
id__snooper_callbacks__ = rb_intern("__snooper_callbacks__");
|
||||
|
||||
RG_TARGET_NAMESPACE = rb_define_module("Gtk");
|
||||
rb_ivar_set(RG_TARGET_NAMESPACE, id_relative_callbacks, Qnil);
|
||||
|
||||
rbgtk_eGtkInitError = rb_define_class_under(RG_TARGET_NAMESPACE, "InitError",
|
||||
rb_eRuntimeError);
|
||||
|
||||
RG_DEF_MODFUNC_P(events_pending, 0);
|
||||
|
||||
RG_DEF_MODFUNC(set_locale, 0);
|
||||
RG_DEF_MODFUNC(disable_setlocale, 0);
|
||||
RG_DEF_MODFUNC(default_language, 0);
|
||||
RG_DEF_MODFUNC(init, -1);
|
||||
RG_DEF_MODFUNC(main, 0);
|
||||
RG_DEF_MODFUNC(main_level, 0);
|
||||
RG_DEF_MODFUNC(main_quit, 0);
|
||||
RG_DEF_MODFUNC(main_iteration, 0);
|
||||
RG_DEF_MODFUNC(main_iteration_do, 1);
|
||||
RG_DEF_MODFUNC(main_do_event, 1);
|
||||
RG_DEF_MODFUNC(grab_add, 1);
|
||||
RG_DEF_MODFUNC(current, 0);
|
||||
RG_DEF_MODFUNC(grab_remove, 1);
|
||||
RG_DEF_MODFUNC(init_add, 0);
|
||||
RG_DEF_MODFUNC(quit_add, 1);
|
||||
RG_DEF_MODFUNC(quit_remove, 1);
|
||||
|
||||
RG_DEF_MODFUNC(timeout_add, 1);
|
||||
RG_DEF_MODFUNC(timeout_remove, 1);
|
||||
RG_DEF_MODFUNC(idle_add, 0);
|
||||
RG_DEF_MODFUNC(idle_add_priority, 1);
|
||||
RG_DEF_MODFUNC(idle_remove, 1);
|
||||
RG_DEF_MODFUNC(key_snooper_install, 0);
|
||||
RG_DEF_MODFUNC(key_snooper_remove, 1);
|
||||
RG_DEF_MODFUNC(current_event, 0);
|
||||
RG_DEF_MODFUNC(current_event_time, 0);
|
||||
RG_DEF_MODFUNC(current_event_state, 0);
|
||||
RG_DEF_MODFUNC(get_event_widget, -1);
|
||||
RG_DEF_MODFUNC(propagate_event, 2);
|
||||
RG_DEF_MODFUNC(check_version, 3);
|
||||
RG_DEF_MODFUNC_P(check_version, 3);
|
||||
|
||||
#if GTK_CHECK_VERSION(2,14,0)
|
||||
RG_DEF_MODFUNC(show_uri, 1);
|
||||
#endif
|
||||
|
||||
rb_define_const(RG_TARGET_NAMESPACE, "PRIORITY_RESIZE", INT2FIX(GTK_PRIORITY_RESIZE));
|
||||
}
|
||||
132
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtk.h
Normal file
132
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtk.h
Normal file
@@ -0,0 +1,132 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2003-2006 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef _RBGTK_H
|
||||
#define _RBGTK_H
|
||||
|
||||
#include <rbgobject.h>
|
||||
#include <rbgtkmacros.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <rbgdk.h>
|
||||
#include <rbgtkconversions.h>
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#define RubyGtkContainerHookModule "RubyGtkContainerHook__"
|
||||
|
||||
#define RBGTK_INITIALIZE(obj,gtkobj)\
|
||||
(rbgtk_initialize_gtkobject(obj, GTK_OBJECT(gtkobj)))
|
||||
|
||||
#define GTK_TYPE_ALLOCATION (gtk_allocation_get_type())
|
||||
#define GTK_TYPE_ACCEL_KEY (gtk_accel_key_get_type())
|
||||
#define GTK_TYPE_ACCEL_GROUP_ENTRY (gtk_accel_group_entry_get_type())
|
||||
#define GTK_TYPE_BINDING_SET (gtk_bindingset_get_type())
|
||||
#define GTK_TYPE_TEXT_APPEARANCE (gtk_text_appearance_get_type())
|
||||
#define GTK_TYPE_RECENT_FILTER_INFO (gtk_recent_filter_info_get_type())
|
||||
#define GTK_TYPE_RECENT_DATA (gtk_recent_data_get_type())
|
||||
#ifndef GTK_TYPE_TARGET_LIST
|
||||
extern GType gtk_target_list_get_type();
|
||||
#define GTK_TYPE_TARGET_LIST (gtk_target_list_get_type())
|
||||
#endif
|
||||
|
||||
RUBY_GTK2_VAR VALUE mGtk;
|
||||
|
||||
/*
|
||||
* for gtk2.0/gtk2.2
|
||||
*/
|
||||
#ifndef GTK_TYPE_CLIPBOARD
|
||||
#define GTK_TYPE_CLIPBOARD (rbgtk_clipboard_get_type())
|
||||
#define RVAL2CLIPBOARD(obj) (rbgtk_get_clipboard(obj))
|
||||
#define CLIPBOARD2RVAL(val) (rbgtk_make_clipboard(val))
|
||||
extern GType rbgtk_clipboard_get_type();
|
||||
extern GtkClipboard* rbgtk_get_clipboard(VALUE obj);
|
||||
extern VALUE rbgtk_make_clipboard(GtkClipboard* gobj);
|
||||
#else
|
||||
#define RVAL2CLIPBOARD(obj) (GTK_CLIPBOARD(RVAL2GOBJ(obj)))
|
||||
#define CLIPBOARD2RVAL(val) (GOBJ2RVAL(val))
|
||||
#endif
|
||||
|
||||
#ifndef GTK_TYPE_TREE_ROW_REFERENCE
|
||||
#define GTK_TYPE_TREE_ROW_REFERENCE (rbgtk_tree_row_reference_get_type())
|
||||
#define RVAL2TREEROWREFERENCE(obj) (rbgtk_get_tree_row_reference(obj))
|
||||
extern GType rbgtk_tree_row_reference_get_type();
|
||||
extern GtkTreeRowReference* rbgtk_get_tree_row_reference(VALUE obj);
|
||||
#else
|
||||
#define RVAL2TREEROWREFERENCE(obj) ((GtkTreeRowReference*)(RVAL2BOXED(obj, GTK_TYPE_TREE_ROW_REFERENCE)))
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* for gtk
|
||||
*/
|
||||
extern void rbgtk_initialize_gtkobject(VALUE obj, GtkObject *gtkobj);
|
||||
extern void exec_callback(GtkWidget *widget, gpointer proc);
|
||||
extern GType gtk_allocation_get_type(void);
|
||||
extern GType gtk_accel_key_get_type(void);
|
||||
extern GType gtk_accel_group_entry_get_type(void);
|
||||
extern GType gtk_bindingset_get_type(void);
|
||||
extern GType gtk_text_appearance_get_type(void);
|
||||
extern GType gtk_recent_filter_info_get_type(void);
|
||||
extern GType gtk_recent_data_get_type(void);
|
||||
|
||||
/*
|
||||
* Gtk::TreeIter callback
|
||||
*/
|
||||
typedef void (*rbgtkiter_set_value_func)(void *model, GtkTreeIter *iter,
|
||||
gint column, GValue *value);
|
||||
extern void rbgtk_register_treeiter_set_value_func(GType, rbgtkiter_set_value_func);
|
||||
|
||||
/*
|
||||
* Gtk::SelectionData
|
||||
*/
|
||||
extern void rbgtk_atom2selectiondata(VALUE type, VALUE size, VALUE src, GdkAtom* gtype,
|
||||
void** data, gint* format, gint* length);
|
||||
extern void rbgtk_atom2selectiondata_free(GdkAtom gtype, void* data);
|
||||
|
||||
/*
|
||||
* Gtk::Drag
|
||||
*/
|
||||
#define RVAL2GTKTARGETENTRIES(value, n) rbgtk_rval2gtktargetentries(value, n)
|
||||
extern GtkTargetEntry *rbgtk_rval2gtktargetentries(VALUE value, long *n);
|
||||
#define RVAL2GTKTARGETENTRIES_ACCEPT_NIL(value, n) rbgtk_rval2gtktargetentries_accept_nil(value, n)
|
||||
GtkTargetEntry *rbgtk_rval2gtktargetentries_accept_nil(VALUE value, long *n);
|
||||
/* Only for backwards compatibility. */
|
||||
GtkTargetEntry *rbgtk_get_target_entry(VALUE targets);
|
||||
|
||||
/*
|
||||
* Gtk::Container
|
||||
*/
|
||||
extern void rbgtkcontainer_register_child_property_setter(GType gtype,
|
||||
const char* prop_name,
|
||||
RValueToGValueFunc func);
|
||||
extern void rbgtkcontainer_register_child_property_getter(GType gtype,
|
||||
const char* prop_name,
|
||||
GValueToRValueFunc func);
|
||||
|
||||
/*
|
||||
* Dialog
|
||||
*/
|
||||
extern VALUE rbgtk_dialog_add_buttons_internal(VALUE self, VALUE button_ary);
|
||||
|
||||
#endif /* _RBGTK_H */
|
||||
141
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkaboutdialog.c
Normal file
141
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkaboutdialog.c
Normal file
@@ -0,0 +1,141 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2005 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
|
||||
#define RG_TARGET_NAMESPACE cAboutDialog
|
||||
#define _SELF(self) (GTK_ABOUT_DIALOG(RVAL2GOBJ(self)))
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self)
|
||||
{
|
||||
RBGTK_INITIALIZE(self, gtk_about_dialog_new());
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void
|
||||
activate_link_func(GtkAboutDialog *about, const gchar *link, gpointer func)
|
||||
{
|
||||
rb_funcall((VALUE)func, id_call, 2, GOBJ2RVAL(about), CSTR2RVAL(link));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_set_email_hook(VALUE self)
|
||||
{
|
||||
VALUE func = rb_block_proc();
|
||||
G_RELATIVE(self, func);
|
||||
gtk_about_dialog_set_email_hook((GtkAboutDialogActivateLinkFunc)activate_link_func, (gpointer)func, (GDestroyNotify)NULL);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_set_url_hook(VALUE self)
|
||||
{
|
||||
VALUE func = rb_block_proc();
|
||||
G_RELATIVE(self, func);
|
||||
gtk_about_dialog_set_url_hook((GtkAboutDialogActivateLinkFunc)activate_link_func, (gpointer)func, (GDestroyNotify)NULL);
|
||||
return self;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
gpointer value;
|
||||
} prop_data;
|
||||
|
||||
#define ABOUT_PROP_NUM (15)
|
||||
|
||||
static VALUE
|
||||
rg_s_show(VALUE self, VALUE parent, VALUE props)
|
||||
{
|
||||
int i;
|
||||
VALUE ary;
|
||||
prop_data pd[ABOUT_PROP_NUM];
|
||||
|
||||
Check_Type(props, T_HASH);
|
||||
|
||||
ary = rb_funcall(props, rb_intern("to_a"), 0);
|
||||
|
||||
if (RARRAY_LEN(ary) > ABOUT_PROP_NUM)
|
||||
rb_raise(rb_eArgError, "Too many args.");
|
||||
|
||||
for (i = 0; i < ABOUT_PROP_NUM; i++){
|
||||
pd[i].name = (const char*)NULL;
|
||||
pd[i].value = (gpointer)NULL;
|
||||
}
|
||||
for (i = 0; i < RARRAY_LEN(ary); i++){
|
||||
if (TYPE(RARRAY_PTR(RARRAY_PTR(ary)[i])[0]) == T_SYMBOL){
|
||||
pd[i].name = rb_id2name(SYM2ID(RARRAY_PTR(RARRAY_PTR(ary)[i])[0]));
|
||||
} else {
|
||||
pd[i].name = RVAL2CSTR(RARRAY_PTR(RARRAY_PTR(ary)[i])[0]);
|
||||
}
|
||||
if (strncmp(pd[i].name, "artists", strlen("artists")) == 0||
|
||||
strncmp(pd[i].name, "authors", strlen("authors")) == 0||
|
||||
strncmp(pd[i].name, "documenters", strlen("documenters")) == 0){
|
||||
GValue gval = G_VALUE_INIT;
|
||||
g_value_init(&gval, G_TYPE_STRV);
|
||||
rbgobj_rvalue_to_gvalue(RARRAY_PTR(RARRAY_PTR(ary)[i])[1], &gval);
|
||||
|
||||
pd[i].value = g_boxed_copy(G_TYPE_STRV, g_value_get_boxed(&gval));
|
||||
} else if (strncmp(pd[i].name, "logo", strlen("logo")) == 0 &&
|
||||
strlen(pd[i].name) == strlen("logo")){
|
||||
pd[i].value = g_object_ref(RVAL2GOBJ(RARRAY_PTR(RARRAY_PTR(ary)[i])[1]));
|
||||
} else if (strncmp(pd[i].name, "wrap_license", strlen("wrap_license")) == 0){
|
||||
pd[i].value = GINT_TO_POINTER(RVAL2CBOOL(RARRAY_PTR(ary)[i]));
|
||||
} else {
|
||||
pd[i].value = g_strdup(RVAL2CSTR(RARRAY_PTR(RARRAY_PTR(ary)[i])[1]));
|
||||
}
|
||||
}
|
||||
|
||||
gtk_show_about_dialog(GTK_WINDOW(RVAL2GOBJ(parent)),
|
||||
pd[0].name, pd[0].value,
|
||||
pd[1].name, pd[1].value,
|
||||
pd[2].name, pd[2].value,
|
||||
pd[3].name, pd[3].value,
|
||||
pd[4].name, pd[4].value,
|
||||
pd[5].name, pd[5].value,
|
||||
pd[6].name, pd[6].value,
|
||||
pd[7].name, pd[7].value,
|
||||
pd[8].name, pd[8].value,
|
||||
pd[9].name, pd[9].value,
|
||||
pd[10].name, pd[10].value,
|
||||
pd[11].name, pd[11].value,
|
||||
pd[12].name, pd[12].value,
|
||||
pd[13].name, pd[13].value,
|
||||
pd[14].name, pd[14].value,
|
||||
NULL);
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_aboutdialog(VALUE mGtk)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_ABOUT_DIALOG, "AboutDialog", mGtk);
|
||||
RG_DEF_METHOD(initialize, 0);
|
||||
|
||||
RG_DEF_SMETHOD(set_email_hook, 0);
|
||||
RG_DEF_SMETHOD(set_url_hook, 0);
|
||||
RG_DEF_SMETHOD(show, 2);
|
||||
#endif
|
||||
}
|
||||
85
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkaccelerator.c
Normal file
85
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkaccelerator.c
Normal file
@@ -0,0 +1,85 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE mAccelerator
|
||||
|
||||
#define RVAL2MOD(mods) RVAL2GFLAGS(mods, GDK_TYPE_MODIFIER_TYPE)
|
||||
|
||||
static VALUE
|
||||
rg_s_valid(G_GNUC_UNUSED VALUE self, VALUE keyval, VALUE modifiers)
|
||||
{
|
||||
return CBOOL2RVAL(gtk_accelerator_valid(NUM2UINT(keyval), RVAL2MOD(modifiers)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_parse(G_GNUC_UNUSED VALUE self, VALUE accelerator)
|
||||
{
|
||||
guint key;
|
||||
GdkModifierType mods;
|
||||
gtk_accelerator_parse(RVAL2CSTR(accelerator), &key, &mods);
|
||||
return rb_ary_new3(2, UINT2NUM(key), GFLAGS2RVAL(mods, GDK_TYPE_MODIFIER_TYPE));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_to_name(G_GNUC_UNUSED VALUE self, VALUE key, VALUE mods)
|
||||
{
|
||||
return CSTR2RVAL(gtk_accelerator_name(NUM2UINT(key), RVAL2MOD(mods)));
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
static VALUE
|
||||
rg_s_get_label(G_GNUC_UNUSED VALUE self, VALUE key, VALUE mods)
|
||||
{
|
||||
return CSTR2RVAL(gtk_accelerator_get_label(NUM2UINT(key), RVAL2MOD(mods)));
|
||||
}
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
rg_s_set_default_mod_mask(VALUE self, VALUE default_mod_mask)
|
||||
{
|
||||
gtk_accelerator_set_default_mod_mask(RVAL2MOD(default_mod_mask));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_default_mod_mask(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return GFLAGS2RVAL(gtk_accelerator_get_default_mod_mask(), GDK_TYPE_MODIFIER_TYPE);
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_accelerator(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGtk, "Accelerator");
|
||||
|
||||
RG_DEF_SMETHOD(valid, 2);
|
||||
RG_DEF_SMETHOD(parse, 1);
|
||||
/* name is reserved by Ruby */
|
||||
RG_DEF_SMETHOD(to_name, 2);
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
RG_DEF_SMETHOD(get_label, 2);
|
||||
#endif
|
||||
RG_DEF_SMETHOD(set_default_mod_mask, 1);
|
||||
RG_DEF_SMETHOD(default_mod_mask, 0);
|
||||
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
||||
}
|
||||
208
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkaccelgroup.c
Normal file
208
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkaccelgroup.c
Normal file
@@ -0,0 +1,208 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cAccelGroup
|
||||
#define _SELF(w) GTK_ACCEL_GROUP(RVAL2GOBJ(w))
|
||||
#define RVAL2MOD(mods) (NIL_P(mods) ? 0 : RVAL2GFLAGS(mods, GDK_TYPE_MODIFIER_TYPE))
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self)
|
||||
{
|
||||
G_INITIALIZE(self, gtk_accel_group_new());
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_connect(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE key, mods, flags, path, closure;
|
||||
GClosure *rclosure;
|
||||
|
||||
if (argc > 2){
|
||||
rb_scan_args(argc, argv, "31", &key, &mods, &flags, &closure);
|
||||
if (NIL_P(closure)){
|
||||
rclosure = g_rclosure_new(rb_block_proc(), Qnil, NULL);
|
||||
} else {
|
||||
rclosure = (GClosure*)RVAL2BOXED(closure, G_TYPE_CLOSURE);
|
||||
}
|
||||
g_rclosure_attach(rclosure, self);
|
||||
gtk_accel_group_connect(_SELF(self), NUM2UINT(key),
|
||||
RVAL2MOD(mods),
|
||||
RVAL2GFLAGS(flags, GTK_TYPE_ACCEL_FLAGS),
|
||||
rclosure);
|
||||
} else {
|
||||
rb_scan_args(argc, argv, "11", &path, &closure);
|
||||
if (NIL_P(closure)){
|
||||
rclosure = g_rclosure_new(rb_block_proc(), Qnil, NULL);
|
||||
} else {
|
||||
rclosure = (GClosure*)RVAL2BOXED(closure, G_TYPE_CLOSURE);
|
||||
}
|
||||
g_rclosure_attach(rclosure, self);
|
||||
gtk_accel_group_connect_by_path(_SELF(self), RVAL2CSTR(path), rclosure);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_disconnect_key(VALUE self, VALUE key, VALUE mods)
|
||||
{
|
||||
return CBOOL2RVAL(gtk_accel_group_disconnect_key(_SELF(self), NUM2UINT(key),
|
||||
RVAL2MOD(mods)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_query(VALUE self, VALUE key, VALUE mods)
|
||||
{
|
||||
GtkAccelGroupEntry *entries;
|
||||
guint n_entries;
|
||||
guint cnt;
|
||||
VALUE result;
|
||||
|
||||
entries = gtk_accel_group_query(_SELF(self), NUM2UINT(key),
|
||||
RVAL2MOD(mods), &n_entries);
|
||||
if(n_entries == 0){
|
||||
return Qnil;
|
||||
}
|
||||
else{
|
||||
result = rb_ary_new2(n_entries);
|
||||
for(cnt=0; cnt<n_entries; cnt++, entries++)
|
||||
rb_ary_push(result, BOXED2RVAL(entries, GTK_TYPE_ACCEL_GROUP_ENTRY));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_disconnect(VALUE self, VALUE closure)
|
||||
{
|
||||
return CBOOL2RVAL(gtk_accel_group_disconnect(_SELF(self),
|
||||
(GClosure*)RVAL2BOXED(closure, G_TYPE_CLOSURE)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_from_accel_closure(G_GNUC_UNUSED VALUE self, VALUE closure)
|
||||
{
|
||||
return GOBJ2RVAL(gtk_accel_group_from_accel_closure(
|
||||
(GClosure*)RVAL2BOXED(closure, G_TYPE_CLOSURE)));
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
static gboolean
|
||||
gaccelgrp_find_func(GtkAccelKey *key, GClosure *closure, gpointer func)
|
||||
{
|
||||
return RVAL2CBOOL(rb_funcall((VALUE)func, id_call, 2,
|
||||
BOXED2RVAL(key, GTK_TYPE_ACCEL_KEY),
|
||||
BOXED2RVAL(closure, G_TYPE_CLOSURE)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_find(VALUE self)
|
||||
{
|
||||
GtkAccelKey *result;
|
||||
volatile VALUE func = rb_block_proc();
|
||||
|
||||
result = gtk_accel_group_find(_SELF(self),
|
||||
(GtkAccelGroupFindFunc)gaccelgrp_find_func,
|
||||
(gpointer)func);
|
||||
return BOXED2RVAL(result, GTK_TYPE_ACCEL_KEY);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
static VALUE
|
||||
rg_activate(VALUE self, VALUE accel_quark, VALUE acceleratable, VALUE accel_key, VALUE accel_mods)
|
||||
{
|
||||
GQuark quark = 0;
|
||||
if (TYPE(accel_quark) == T_STRING){
|
||||
quark = g_quark_from_string(RVAL2CSTR(accel_quark));
|
||||
} else {
|
||||
quark = NUM2UINT(quark);
|
||||
}
|
||||
return CBOOL2RVAL(gtk_accel_group_activate(_SELF(self), quark, RVAL2GOBJ(acceleratable),
|
||||
NUM2UINT(accel_key), RVAL2MOD(accel_mods)));
|
||||
}
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
_gaccelgrp_lock_ensure(VALUE self)
|
||||
{
|
||||
gtk_accel_group_unlock(_SELF(self));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_lock(VALUE self)
|
||||
{
|
||||
gtk_accel_group_lock(_SELF(self));
|
||||
if (rb_block_given_p()){
|
||||
rb_ensure(rb_yield, self, _gaccelgrp_lock_ensure , self);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_unlock(VALUE self)
|
||||
{
|
||||
gtk_accel_group_unlock(_SELF(self));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_activate(G_GNUC_UNUSED VALUE self, VALUE obj, VALUE key, VALUE modtype)
|
||||
{
|
||||
return CBOOL2RVAL(gtk_accel_groups_activate(G_OBJECT(RVAL2GOBJ(obj)),
|
||||
NUM2UINT(key),
|
||||
RVAL2MOD(modtype)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_from_object(G_GNUC_UNUSED VALUE self, VALUE object)
|
||||
{
|
||||
/* Owned by GTK+ */
|
||||
return GSLIST2ARY(gtk_accel_groups_from_object(RVAL2GOBJ(object)));
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_accel_group(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_ACCEL_GROUP, "AccelGroup", mGtk);
|
||||
|
||||
RG_DEF_SMETHOD(activate, 3);
|
||||
RG_DEF_SMETHOD(from_object, 1);
|
||||
RG_DEF_SMETHOD(from_accel_closure, 1);
|
||||
RG_DEF_METHOD(initialize, 0);
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
RG_DEF_METHOD(activate, 4);
|
||||
#endif
|
||||
RG_DEF_METHOD(lock, 0);
|
||||
RG_DEF_METHOD(unlock, 0);
|
||||
RG_DEF_METHOD(connect, -1);
|
||||
RG_DEF_METHOD(disconnect, 1);
|
||||
RG_DEF_METHOD(disconnect_key, 2);
|
||||
RG_DEF_METHOD(query, 2);
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
RG_DEF_METHOD(find, 0);
|
||||
#endif
|
||||
}
|
||||
94
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkaccelgroupentry.c
Normal file
94
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkaccelgroupentry.c
Normal file
@@ -0,0 +1,94 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 OGASAWARA, Takeshi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cAccelGroupEntry
|
||||
#define _SELF(s) ((GtkAccelGroupEntry*)RVAL2BOXED(s, GTK_TYPE_ACCEL_GROUP_ENTRY))
|
||||
|
||||
static GtkAccelGroupEntry *
|
||||
agentry_copy(const GtkAccelGroupEntry *agentry)
|
||||
{
|
||||
GtkAccelGroupEntry *new_agentry;
|
||||
g_return_val_if_fail (agentry != NULL, NULL);
|
||||
new_agentry = g_new(GtkAccelGroupEntry, 1);
|
||||
*new_agentry = *agentry;
|
||||
return new_agentry;
|
||||
}
|
||||
|
||||
GType
|
||||
gtk_accel_group_entry_get_type(void)
|
||||
{
|
||||
static GType our_type = 0;
|
||||
if(our_type == 0)
|
||||
our_type = g_boxed_type_register_static("GtkAccelGroupEntry",
|
||||
(GBoxedCopyFunc)agentry_copy,
|
||||
(GBoxedFreeFunc)g_free);
|
||||
return our_type;
|
||||
}
|
||||
|
||||
/*
|
||||
struct _GtkAccelGroupEntry
|
||||
{
|
||||
GtkAccelKey key;
|
||||
GClosure *closure;
|
||||
GQuark accel_path_quark;
|
||||
};
|
||||
*/
|
||||
static VALUE
|
||||
rg_initialize(VALUE self)
|
||||
{
|
||||
GtkAccelGroupEntry key;
|
||||
memset(&key, 0, sizeof(GtkAccelGroupEntry));
|
||||
G_INITIALIZE(self, g_boxed_copy(GTK_TYPE_ACCEL_GROUP_ENTRY, &key));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_accel_key(VALUE self)
|
||||
{
|
||||
return BOXED2RVAL(&_SELF(self)->key, GTK_TYPE_ACCEL_KEY);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_closure(VALUE self)
|
||||
{
|
||||
return BOXED2RVAL(_SELF(self)->closure, G_TYPE_CLOSURE);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_accel_path(VALUE self)
|
||||
{
|
||||
const gchar *quark_str = g_quark_to_string(_SELF(self)->accel_path_quark);
|
||||
return quark_str ? CSTR2RVAL(quark_str) : Qnil;
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_accel_group_entry(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_ACCEL_GROUP_ENTRY, "AccelGroupEntry", mGtk);
|
||||
|
||||
RG_DEF_METHOD(initialize, 0);
|
||||
|
||||
RG_DEF_METHOD(accel_key, 0);
|
||||
RG_DEF_METHOD(closure, 0);
|
||||
RG_DEF_METHOD(accel_path, 0);
|
||||
}
|
||||
122
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkaccelkey.c
Normal file
122
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkaccelkey.c
Normal file
@@ -0,0 +1,122 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 OGASAWARA, Takeshi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cAccelKey
|
||||
#define _SELF(s) ((GtkAccelKey*)RVAL2BOXED(s, GTK_TYPE_ACCEL_KEY))
|
||||
#define GTK_TYPE_ACCEL_KEY (gtk_accel_key_get_type())
|
||||
|
||||
static GtkAccelKey *
|
||||
accel_key_copy(const GtkAccelKey *key)
|
||||
{
|
||||
GtkAccelKey *new_key;
|
||||
g_return_val_if_fail (key != NULL, NULL);
|
||||
new_key = g_new(GtkAccelKey, 1);
|
||||
*new_key = *key;
|
||||
return new_key;
|
||||
}
|
||||
|
||||
GType
|
||||
gtk_accel_key_get_type(void)
|
||||
{
|
||||
static GType our_type = 0;
|
||||
if(our_type == 0)
|
||||
our_type = g_boxed_type_register_static("GtkAccelKey",
|
||||
(GBoxedCopyFunc)accel_key_copy,
|
||||
(GBoxedFreeFunc)g_free);
|
||||
return our_type;
|
||||
}
|
||||
|
||||
/*
|
||||
struct _GtkAccelKey
|
||||
{
|
||||
guint accel_key;
|
||||
GdkModifierType accel_mods;
|
||||
guint accel_flags : 16;
|
||||
};
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self)
|
||||
{
|
||||
GtkAccelKey key;
|
||||
memset(&key, 0, sizeof(GtkAccelKey));
|
||||
G_INITIALIZE(self, g_boxed_copy(GTK_TYPE_ACCEL_KEY, &key));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_key(VALUE self)
|
||||
{
|
||||
return UINT2NUM(_SELF(self)->accel_key);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_mods(VALUE self)
|
||||
{
|
||||
return GFLAGS2RVAL(_SELF(self)->accel_mods, GDK_TYPE_MODIFIER_TYPE);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_flags(VALUE self)
|
||||
{
|
||||
return INT2FIX(_SELF(self)->accel_flags);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_key(VALUE self, VALUE key)
|
||||
{
|
||||
_SELF(self)->accel_key = NUM2UINT(key);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_mods(VALUE self, VALUE mods)
|
||||
{
|
||||
_SELF(self)->accel_mods = RVAL2GFLAGS(mods, GDK_TYPE_MODIFIER_TYPE);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_flags(VALUE self, VALUE flags)
|
||||
{
|
||||
_SELF(self)->accel_flags = FIX2INT(flags);
|
||||
return self;
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_accel_key(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_ACCEL_KEY, "AccelKey", mGtk);
|
||||
|
||||
RG_DEF_METHOD(initialize, 0);
|
||||
|
||||
RG_DEF_METHOD(key, 0);
|
||||
RG_DEF_METHOD(mods, 0);
|
||||
RG_DEF_METHOD(flags, 0);
|
||||
|
||||
RG_DEF_METHOD(set_key, 1);
|
||||
RG_DEF_METHOD(set_mods, 1);
|
||||
RG_DEF_METHOD(set_flags, 1);
|
||||
|
||||
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
||||
}
|
||||
55
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkaccellabel.c
Normal file
55
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkaccellabel.c
Normal file
@@ -0,0 +1,55 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2001 Neil Conway
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cAccelLabel
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self, VALUE string)
|
||||
{
|
||||
RBGTK_INITIALIZE(self, gtk_accel_label_new(RVAL2CSTR(string)));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_accel_width(VALUE self)
|
||||
{
|
||||
return INT2NUM(gtk_accel_label_get_accel_width(GTK_ACCEL_LABEL(RVAL2GOBJ(self))));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_refetch(VALUE self)
|
||||
{
|
||||
gtk_accel_label_refetch(GTK_ACCEL_LABEL(RVAL2GOBJ(self)));
|
||||
return Qfalse; // always returns false
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_accel_label(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_ACCEL_LABEL, "AccelLabel", mGtk);
|
||||
|
||||
RG_DEF_METHOD(initialize, 1);
|
||||
RG_DEF_METHOD(accel_width, 0);
|
||||
RG_DEF_METHOD(refetch, 0);
|
||||
}
|
||||
159
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkaccelmap.c
Normal file
159
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkaccelmap.c
Normal file
@@ -0,0 +1,159 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 OGASAWARA, Takeshi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cAccelMap
|
||||
|
||||
#define RVAL2MOD(mods) (NIL_P(mods) ? 0 : RVAL2GFLAGS(mods, GDK_TYPE_MODIFIER_TYPE))
|
||||
|
||||
static VALUE
|
||||
rg_s_add_entry(VALUE self, VALUE path, VALUE key, VALUE mods)
|
||||
{
|
||||
gtk_accel_map_add_entry(RVAL2CSTR(path), NUM2UINT(key), RVAL2MOD(mods));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_lookup_entry(VALUE self, VALUE path)
|
||||
{
|
||||
GtkAccelKey key;
|
||||
if(gtk_accel_map_lookup_entry(RVAL2CSTR(path), &key))
|
||||
return BOXED2RVAL(&key, GTK_TYPE_ACCEL_KEY);
|
||||
else
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_change_entry(G_GNUC_UNUSED VALUE self, VALUE path, VALUE key, VALUE mods, VALUE replace)
|
||||
{
|
||||
return CBOOL2RVAL(gtk_accel_map_change_entry(RVAL2CSTR(path), NUM2UINT(key),
|
||||
RVAL2MOD(mods), RVAL2CBOOL(replace)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_load(VALUE self, VALUE filename)
|
||||
{
|
||||
gtk_accel_map_load(RVAL2CSTR(filename));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_save(VALUE self, VALUE filename)
|
||||
{
|
||||
gtk_accel_map_save(RVAL2CSTR(filename));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_add_filter(VALUE self, VALUE pattern)
|
||||
{
|
||||
gtk_accel_map_add_filter(RVAL2CSTR(pattern));
|
||||
return self;
|
||||
}
|
||||
|
||||
static void
|
||||
accel_map_foreach_func(gpointer func, const gchar *path, guint key, GdkModifierType mods, gboolean changed)
|
||||
{
|
||||
rb_funcall((VALUE)func, id_call, 4,
|
||||
CSTR2RVAL(path), UINT2NUM(key), GFLAGS2RVAL(mods, GDK_TYPE_MODIFIER_TYPE),
|
||||
CBOOL2RVAL(changed));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_each(VALUE self)
|
||||
{
|
||||
volatile VALUE func = rb_block_proc();
|
||||
gtk_accel_map_foreach((gpointer)func,
|
||||
(GtkAccelMapForeach)accel_map_foreach_func);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_each_unfilterd(VALUE self)
|
||||
{
|
||||
volatile VALUE func = rb_block_proc();
|
||||
gtk_accel_map_foreach_unfiltered((gpointer)func,
|
||||
(GtkAccelMapForeach)accel_map_foreach_func);
|
||||
return self;
|
||||
}
|
||||
|
||||
/*
|
||||
void gtk_accel_map_load_scanner (GScanner *scanner);
|
||||
*/
|
||||
|
||||
/* We don't need them.
|
||||
void gtk_accel_map_load_fd (gint fd);
|
||||
void gtk_accel_map_save_fd (gint fd);
|
||||
*/
|
||||
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
static VALUE
|
||||
rg_s_get(G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gtk_accel_map_get());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_lock_path(VALUE self, VALUE accel_path)
|
||||
{
|
||||
gtk_accel_map_lock_path(RVAL2CSTR(accel_path));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_unlock_path(VALUE self, VALUE accel_path)
|
||||
{
|
||||
gtk_accel_map_unlock_path(RVAL2CSTR(accel_path));
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_accel_map(VALUE mGtk)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_ACCEL_MAP, "AccelMap", mGtk);
|
||||
|
||||
RG_DEF_SMETHOD(add_entry, 3);
|
||||
RG_DEF_SMETHOD(lookup_entry, 1);
|
||||
RG_DEF_SMETHOD(change_entry, 4);
|
||||
RG_DEF_SMETHOD(load, 1);
|
||||
RG_DEF_SMETHOD(save, 1);
|
||||
RG_DEF_SMETHOD(add_filter, 1);
|
||||
RG_DEF_SMETHOD(each, 0);
|
||||
RG_DEF_SMETHOD(each_unfilterd, 0);
|
||||
RG_DEF_SMETHOD(get, 0);
|
||||
RG_DEF_SMETHOD(lock_path, 1);
|
||||
RG_DEF_SMETHOD(unlock_path, 1);
|
||||
#else
|
||||
VALUE mAccelMap = rb_define_module_under(mGtk, "AccelMap");
|
||||
|
||||
rb_define_module_function(mAccelMap, "add_entry", rg_s_add_entry, 3);
|
||||
rb_define_module_function(mAccelMap, "lookup_entry", rg_s_lookup_entry, 1);
|
||||
rb_define_module_function(mAccelMap, "change_entry", rg_s_change_entry, 4);
|
||||
rb_define_module_function(mAccelMap, "load", rg_s_load, 1);
|
||||
rb_define_module_function(mAccelMap, "save", rg_s_save, 1);
|
||||
rb_define_module_function(mAccelMap, "add_filter", rg_s_add_filter, 1);
|
||||
rb_define_module_function(mAccelMap, "each", rg_s_each, 0);
|
||||
rb_define_module_function(mAccelMap, "each_unfilterd", rg_s_each_unfilterd, 0);
|
||||
#endif
|
||||
}
|
||||
39
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkaccessible.c
Normal file
39
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkaccessible.c
Normal file
@@ -0,0 +1,39 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2003 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cAccessible
|
||||
|
||||
static VALUE
|
||||
rg_connect_widget_destroyed(VALUE self)
|
||||
{
|
||||
gtk_accessible_connect_widget_destroyed(GTK_ACCESSIBLE(RVAL2GOBJ(self)));
|
||||
return self;
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_accessible(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_ACCESSIBLE, "Accessible", mGtk);
|
||||
|
||||
RG_DEF_METHOD(connect_widget_destroyed, 0);
|
||||
}
|
||||
237
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkaction.c
Normal file
237
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkaction.c
Normal file
@@ -0,0 +1,237 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2004-2006 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
|
||||
#define RG_TARGET_NAMESPACE cAction
|
||||
#define _SELF(self) (GTK_ACTION(RVAL2GOBJ(self)))
|
||||
#define RVAL2WIDGET(w) (GTK_WIDGET(RVAL2GOBJ(w)))
|
||||
|
||||
static VALUE
|
||||
rg_initialize(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE name, label, tooltip, stock_id;
|
||||
const gchar *stock = NULL;
|
||||
|
||||
rb_scan_args(argc, argv, "22", &name, &label, &tooltip, &stock_id);
|
||||
|
||||
if (TYPE(stock_id) == T_SYMBOL) {
|
||||
stock = rb_id2name(SYM2ID(stock_id));
|
||||
} else if (TYPE(stock_id) == T_STRING){
|
||||
stock = RVAL2CSTR(stock_id);
|
||||
}
|
||||
|
||||
G_INITIALIZE(self, gtk_action_new(RVAL2CSTR(name), RVAL2CSTR(label),
|
||||
NIL_P(tooltip) ? NULL : RVAL2CSTR(tooltip),
|
||||
stock));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_is_sensitive_p(VALUE self)
|
||||
{
|
||||
return CBOOL2RVAL(gtk_action_is_sensitive(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_is_visible_p(VALUE self)
|
||||
{
|
||||
return CBOOL2RVAL(gtk_action_is_visible(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_activate(VALUE self)
|
||||
{
|
||||
gtk_action_activate(_SELF(self));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_create_icon(VALUE self, VALUE icon_size)
|
||||
{
|
||||
return GOBJ2RVAL(gtk_action_create_icon(_SELF(self),
|
||||
RVAL2GENUM(icon_size, GTK_TYPE_ICON_SIZE)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_create_menu_item(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gtk_action_create_menu_item(_SELF(self)));
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2, 12, 0)
|
||||
static VALUE
|
||||
rg_create_menu(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gtk_action_create_menu(_SELF(self)));
|
||||
}
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
rg_create_tool_item(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gtk_action_create_tool_item(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_connect_proxy(VALUE self, VALUE proxy)
|
||||
{
|
||||
gtk_action_connect_proxy(_SELF(self), RVAL2WIDGET(proxy));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_disconnect_proxy(VALUE self, VALUE proxy)
|
||||
{
|
||||
gtk_action_disconnect_proxy(_SELF(self), RVAL2WIDGET(proxy));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_proxies(VALUE self)
|
||||
{
|
||||
/* Owned by GTK+ */
|
||||
return GSLIST2ARY(gtk_action_get_proxies(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_connect_accelerator(VALUE self)
|
||||
{
|
||||
gtk_action_connect_accelerator(_SELF(self));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_disconnect_accelerator(VALUE self)
|
||||
{
|
||||
gtk_action_disconnect_accelerator(_SELF(self));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_block_activate_from(VALUE self, VALUE proxy)
|
||||
{
|
||||
gtk_action_block_activate_from(_SELF(self), RVAL2WIDGET(proxy));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_unblock_activate_from(VALUE self, VALUE proxy)
|
||||
{
|
||||
gtk_action_unblock_activate_from(_SELF(self), RVAL2WIDGET(proxy));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_accel_path(VALUE self, VALUE accel_path)
|
||||
{
|
||||
gtk_action_set_accel_path(_SELF(self), RVAL2CSTR(accel_path));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_accel_group(VALUE self, VALUE accel_group)
|
||||
{
|
||||
gtk_action_set_accel_group(_SELF(self), RVAL2GOBJ(accel_group));
|
||||
return self;
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
static VALUE
|
||||
rg_accel_path(VALUE self)
|
||||
{
|
||||
return CSTR2RVAL(gtk_action_get_accel_path(_SELF(self)));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GTK_CHECK_VERSION(2,8,0)
|
||||
static VALUE
|
||||
rg_accel_closure(VALUE self)
|
||||
{
|
||||
return BOXED2RVAL(gtk_action_get_accel_closure(_SELF(self)), G_TYPE_CLOSURE);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
action_mark(void *p)
|
||||
{
|
||||
GtkAction *action;
|
||||
GSList *node;
|
||||
|
||||
action = GTK_ACTION(p);
|
||||
for (node = gtk_action_get_proxies(action);
|
||||
node;
|
||||
node = g_slist_next(node)) {
|
||||
GtkWidget *proxy = node->data;
|
||||
rbgobj_gc_mark_instance(proxy);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_action(VALUE mGtk)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
VALUE RG_TARGET_NAMESPACE;
|
||||
|
||||
RG_TARGET_NAMESPACE = G_DEF_CLASS_WITH_GC_FUNC(GTK_TYPE_ACTION, "Action", mGtk,
|
||||
action_mark, NULL);
|
||||
|
||||
RG_DEF_METHOD(initialize, -1);
|
||||
/* (NOTICE) Gtk::Action#is_sensitive?, #is_visible are special.
|
||||
Because there are also Gtk::Action#sensitive?, #visible? as property
|
||||
accessors.
|
||||
Gtk::Action#is_sensitive?, #is_visible? check its associated
|
||||
action group.
|
||||
Gtk::Action#sensitive?, #visible? returns the value of the properties.
|
||||
*/
|
||||
RG_DEF_METHOD_P(is_sensitive, 0);
|
||||
RG_DEF_METHOD_P(is_visible, 0);
|
||||
RG_DEF_METHOD(activate, 0);
|
||||
RG_DEF_METHOD(create_icon, 1);
|
||||
RG_DEF_METHOD(create_menu_item, 0);
|
||||
#if GTK_CHECK_VERSION(2, 12, 0)
|
||||
RG_DEF_METHOD(create_menu, 0);
|
||||
#endif
|
||||
RG_DEF_METHOD(create_tool_item, 0);
|
||||
RG_DEF_METHOD(connect_proxy, 1);
|
||||
RG_DEF_METHOD(disconnect_proxy, 1);
|
||||
RG_DEF_METHOD(proxies, 0);
|
||||
RG_DEF_METHOD(connect_accelerator, 0);
|
||||
RG_DEF_METHOD(disconnect_accelerator, 0);
|
||||
RG_DEF_METHOD(block_activate_from, 1);
|
||||
RG_DEF_METHOD(unblock_activate_from, 1);
|
||||
RG_DEF_METHOD(set_accel_path, 1);
|
||||
G_DEF_SETTER(RG_TARGET_NAMESPACE, "accel_path");
|
||||
RG_DEF_METHOD(set_accel_group, 1);
|
||||
G_DEF_SETTER(RG_TARGET_NAMESPACE, "accel_group");
|
||||
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
RG_DEF_METHOD(accel_path, 0);
|
||||
#endif
|
||||
|
||||
#if GTK_CHECK_VERSION(2,8,0)
|
||||
RG_DEF_METHOD(accel_closure, 0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
477
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkactiongroup.c
Normal file
477
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkactiongroup.c
Normal file
@@ -0,0 +1,477 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2004-2006 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
|
||||
static ID id_action_procs;
|
||||
static ID id_toggle_action_procs;
|
||||
|
||||
#define RG_TARGET_NAMESPACE cActionGroup
|
||||
#define _SELF(self) (GTK_ACTION_GROUP(RVAL2GOBJ(self)))
|
||||
#define RVAL2WIDGET(w) (GTK_WIDGET(RVAL2GOBJ(w)))
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self, VALUE name)
|
||||
{
|
||||
G_INITIALIZE(self, gtk_action_group_new(RVAL2CSTR(name)));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_get_action(VALUE self, VALUE action_name)
|
||||
{
|
||||
return GOBJ2RVAL(gtk_action_group_get_action(_SELF(self), RVAL2CSTR(action_name)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_actions(VALUE self)
|
||||
{
|
||||
return GLIST2ARYF(gtk_action_group_list_actions(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_add_action(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE action, accelerator;
|
||||
|
||||
rb_scan_args(argc, argv, "11", &action, &accelerator);
|
||||
|
||||
gtk_action_group_add_action_with_accel(_SELF(self),
|
||||
GTK_ACTION(RVAL2GOBJ(action)),
|
||||
NIL_P(accelerator) ? NULL : RVAL2CSTR(accelerator));
|
||||
G_CHILD_ADD(self, action);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_remove_action(VALUE self, VALUE action)
|
||||
{
|
||||
gtk_action_group_remove_action(_SELF(self), GTK_ACTION(RVAL2GOBJ(action)));
|
||||
G_CHILD_REMOVE(self, action);
|
||||
return self;
|
||||
}
|
||||
|
||||
static void
|
||||
activate_action(GtkAction *action, VALUE self)
|
||||
{
|
||||
VALUE proc = rb_hash_aref(rb_ivar_get(self, id_action_procs),
|
||||
CSTR2RVAL(gtk_action_get_name(action)));
|
||||
|
||||
if (!NIL_P(proc))
|
||||
rb_funcall(proc, id_call, 2, self, GOBJ2RVAL(action));
|
||||
}
|
||||
|
||||
struct rbg_rval2gtkactionentries_args {
|
||||
VALUE ary;
|
||||
long n;
|
||||
GtkActionEntry *result;
|
||||
VALUE procs;
|
||||
};
|
||||
|
||||
static VALUE
|
||||
rbg_rval2gtkactionentries_body(VALUE value)
|
||||
{
|
||||
long i;
|
||||
struct rbg_rval2gtkactionentries_args *args = (struct rbg_rval2gtkactionentries_args *)value;
|
||||
|
||||
for (i = 0; i < args->n; i++) {
|
||||
VALUE entry;
|
||||
long n;
|
||||
|
||||
RARRAY_PTR(args->ary)[i] = rb_ary_dup(rb_ary_to_ary(RARRAY_PTR(args->ary)[i]));
|
||||
entry = RARRAY_PTR(args->ary)[i];
|
||||
n = RARRAY_LEN(entry);
|
||||
|
||||
args->result[i].callback = G_CALLBACK(activate_action);
|
||||
|
||||
if (n < 1 || n > 6)
|
||||
rb_raise(rb_eArgError, "entry does not contain right number of entries %ld (1..6)", n);
|
||||
|
||||
args->result[i].name = RVAL2CSTR_ACCEPT_NIL(RARRAY_PTR(entry)[0]);
|
||||
|
||||
switch (n) {
|
||||
case 6:
|
||||
/* TODO: Call #to_proc on entry 5? */
|
||||
rb_hash_aset(args->procs, RARRAY_PTR(entry)[0], RARRAY_PTR(entry)[5]);
|
||||
case 5:
|
||||
args->result[i].tooltip = RVAL2CSTR_ACCEPT_NIL(RARRAY_PTR(entry)[4]);
|
||||
case 4:
|
||||
args->result[i].accelerator = RVAL2CSTR_ACCEPT_NIL(RARRAY_PTR(entry)[3]);
|
||||
case 3:
|
||||
args->result[i].label = RVAL2CSTR_ACCEPT_NIL(RARRAY_PTR(entry)[2]);
|
||||
case 2:
|
||||
args->result[i].stock_id = RVAL2CSTR_ACCEPT_SYMBOL_ACCEPT_NIL(RARRAY_PTR(entry)[1]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static G_GNUC_NORETURN VALUE
|
||||
rbg_rval2gtkactionentries_rescue(VALUE value)
|
||||
{
|
||||
g_free(((struct rbg_rval2gtkactionentries_args *)value)->result);
|
||||
|
||||
rb_exc_raise(rb_errinfo());
|
||||
}
|
||||
|
||||
static GtkActionEntry *
|
||||
rbg_rval2gtkactionentries(volatile VALUE *value, long *n, VALUE procs)
|
||||
{
|
||||
struct rbg_rval2gtkactionentries_args args;
|
||||
|
||||
args.ary = *value = rb_ary_dup(rb_ary_to_ary(*value));
|
||||
args.n = RARRAY_LEN(args.ary);
|
||||
args.result = g_new0(GtkActionEntry, args.n + 1);
|
||||
args.procs = procs;
|
||||
|
||||
rb_rescue(rbg_rval2gtkactionentries_body, (VALUE)&args,
|
||||
rbg_rval2gtkactionentries_rescue, (VALUE)&args);
|
||||
|
||||
*n = args.n;
|
||||
|
||||
return args.result;
|
||||
}
|
||||
|
||||
#define RVAL2GTKACTIONENTRIES(value, n, procs) rbg_rval2gtkactionentries(&(value), &(n), procs)
|
||||
|
||||
static VALUE
|
||||
rg_add_actions(VALUE self, VALUE rbentries)
|
||||
{
|
||||
GtkActionGroup *group = _SELF(self);
|
||||
VALUE action_procs = rb_ivar_defined(self, id_action_procs) == Qtrue ?
|
||||
rb_ivar_get(self, id_action_procs) :
|
||||
rb_hash_new();
|
||||
long n;
|
||||
GtkActionEntry *entries = RVAL2GTKACTIONENTRIES(rbentries, n, action_procs);
|
||||
|
||||
rb_ivar_set(self, id_action_procs, action_procs);
|
||||
|
||||
gtk_action_group_add_actions(group, entries, n, (gpointer)self);
|
||||
|
||||
g_free(entries);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static void
|
||||
activate_toggle_action(GtkAction *action, VALUE self)
|
||||
{
|
||||
VALUE proc = rb_hash_aref(rb_ivar_get(self, id_toggle_action_procs),
|
||||
CSTR2RVAL(gtk_action_get_name(action)));
|
||||
|
||||
if (!NIL_P(proc))
|
||||
rb_funcall(proc, id_call, 2, self, GOBJ2RVAL(action));
|
||||
}
|
||||
|
||||
struct rbg_rval2gtktoggleactionentries_args {
|
||||
VALUE ary;
|
||||
long n;
|
||||
GtkToggleActionEntry *result;
|
||||
VALUE procs;
|
||||
};
|
||||
|
||||
static VALUE
|
||||
rbg_rval2gtktoggleactionentries_body(VALUE value)
|
||||
{
|
||||
long i;
|
||||
struct rbg_rval2gtktoggleactionentries_args *args = (struct rbg_rval2gtktoggleactionentries_args *)value;
|
||||
|
||||
for (i = 0; i < args->n; i++) {
|
||||
VALUE entry;
|
||||
long n;
|
||||
|
||||
RARRAY_PTR(args->ary)[i] = rb_ary_dup(rb_ary_to_ary(RARRAY_PTR(args->ary)[i]));
|
||||
entry = RARRAY_PTR(args->ary)[i];
|
||||
n = RARRAY_LEN(entry);
|
||||
|
||||
args->result[i].callback = G_CALLBACK(activate_toggle_action);
|
||||
|
||||
if (n < 1 || n > 7)
|
||||
rb_raise(rb_eArgError, "entry does not contain right number of entries %ld (1..7)", n);
|
||||
|
||||
args->result[i].name = RVAL2CSTR_ACCEPT_NIL(RARRAY_PTR(entry)[0]);
|
||||
|
||||
switch (n) {
|
||||
case 7:
|
||||
args->result[i].is_active = RVAL2CBOOL(RARRAY_PTR(entry)[6]);
|
||||
case 6:
|
||||
/* TODO: Call #to_proc on entry 5? */
|
||||
rb_hash_aset(args->procs, RARRAY_PTR(entry)[0], RARRAY_PTR(entry)[5]);
|
||||
case 5:
|
||||
args->result[i].tooltip = RVAL2CSTR_ACCEPT_NIL(RARRAY_PTR(entry)[4]);
|
||||
case 4:
|
||||
args->result[i].accelerator = RVAL2CSTR_ACCEPT_NIL(RARRAY_PTR(entry)[3]);
|
||||
case 3:
|
||||
args->result[i].label = RVAL2CSTR_ACCEPT_NIL(RARRAY_PTR(entry)[2]);
|
||||
case 2:
|
||||
args->result[i].stock_id = RVAL2CSTR_ACCEPT_SYMBOL_ACCEPT_NIL(RARRAY_PTR(entry)[1]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static G_GNUC_NORETURN VALUE
|
||||
rbg_rval2gtktoggleactionentries_rescue(VALUE value)
|
||||
{
|
||||
g_free(((struct rbg_rval2gtktoggleactionentries_args *)value)->result);
|
||||
|
||||
rb_exc_raise(rb_errinfo());
|
||||
}
|
||||
|
||||
static GtkToggleActionEntry *
|
||||
rbg_rval2gtktoggleactionentries(volatile VALUE *value, long *n, VALUE procs)
|
||||
{
|
||||
struct rbg_rval2gtktoggleactionentries_args args;
|
||||
|
||||
args.ary = *value = rb_ary_dup(rb_ary_to_ary(*value));
|
||||
args.n = RARRAY_LEN(args.ary);
|
||||
args.result = g_new0(GtkToggleActionEntry, args.n + 1);
|
||||
args.procs = procs;
|
||||
|
||||
rb_rescue(rbg_rval2gtktoggleactionentries_body, (VALUE)&args,
|
||||
rbg_rval2gtktoggleactionentries_rescue, (VALUE)&args);
|
||||
|
||||
*n = args.n;
|
||||
|
||||
return args.result;
|
||||
}
|
||||
|
||||
#define RVAL2GTKTOGGLEACTIONENTRIES(value, n, procs) rbg_rval2gtktoggleactionentries(&(value), &(n), procs)
|
||||
|
||||
static VALUE
|
||||
rg_add_toggle_actions(VALUE self, VALUE rbentries)
|
||||
{
|
||||
GtkActionGroup *group = _SELF(self);
|
||||
VALUE toggle_action_procs = rb_ivar_defined(self, id_toggle_action_procs) == Qtrue ?
|
||||
rb_ivar_get(self, id_toggle_action_procs) :
|
||||
rb_hash_new();
|
||||
long n;
|
||||
GtkToggleActionEntry *entries = RVAL2GTKTOGGLEACTIONENTRIES(rbentries, n, toggle_action_procs);
|
||||
|
||||
rb_ivar_set(self, id_toggle_action_procs, toggle_action_procs);
|
||||
|
||||
gtk_action_group_add_toggle_actions(group, entries, n, (gpointer)self);
|
||||
|
||||
g_free(entries);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static void
|
||||
activate_radio_action(GtkAction *action, GtkRadioAction *current, VALUE proc)
|
||||
{
|
||||
if (!NIL_P(proc))
|
||||
rb_funcall(proc, id_call, 2, GOBJ2RVAL(action), GOBJ2RVAL(current));
|
||||
}
|
||||
|
||||
struct rbg_rval2gtkradioactionentries_args {
|
||||
VALUE ary;
|
||||
long n;
|
||||
GtkRadioActionEntry *result;
|
||||
};
|
||||
|
||||
static VALUE
|
||||
rbg_rval2gtkradioactionentries_body(VALUE value)
|
||||
{
|
||||
long i;
|
||||
struct rbg_rval2gtkradioactionentries_args *args = (struct rbg_rval2gtkradioactionentries_args *)value;
|
||||
|
||||
for (i = 0; i < args->n; i++) {
|
||||
VALUE entry;
|
||||
long n;
|
||||
|
||||
RARRAY_PTR(args->ary)[i] = rb_ary_dup(rb_ary_to_ary(RARRAY_PTR(args->ary)[i]));
|
||||
entry = RARRAY_PTR(args->ary)[i];
|
||||
n = RARRAY_LEN(entry);
|
||||
|
||||
switch (n) {
|
||||
case 6:
|
||||
args->result[i].value = NUM2INT(RARRAY_PTR(entry)[5]);
|
||||
case 5:
|
||||
args->result[i].tooltip = RVAL2CSTR_ACCEPT_NIL(RARRAY_PTR(entry)[4]);
|
||||
case 4:
|
||||
args->result[i].accelerator = RVAL2CSTR_ACCEPT_NIL(RARRAY_PTR(entry)[3]);
|
||||
case 3:
|
||||
args->result[i].label = RVAL2CSTR_ACCEPT_NIL(RARRAY_PTR(entry)[2]);
|
||||
case 2:
|
||||
args->result[i].stock_id = RVAL2CSTR_ACCEPT_SYMBOL_ACCEPT_NIL(RARRAY_PTR(entry)[1]);
|
||||
case 1:
|
||||
args->result[i].name = RVAL2CSTR_ACCEPT_NIL(RARRAY_PTR(entry)[0]);
|
||||
break;
|
||||
default:
|
||||
rb_raise(rb_eArgError, "entry does not contain right number of entries %ld (1..6)", n);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static G_GNUC_NORETURN VALUE
|
||||
rbg_rval2gtkradioactionentries_rescue(VALUE value)
|
||||
{
|
||||
g_free(((struct rbg_rval2gtkradioactionentries_args *)value)->result);
|
||||
|
||||
rb_exc_raise(rb_errinfo());
|
||||
}
|
||||
|
||||
static GtkRadioActionEntry *
|
||||
rbg_rval2gtkradioactionentries(volatile VALUE *value, long *n)
|
||||
{
|
||||
struct rbg_rval2gtkradioactionentries_args args;
|
||||
|
||||
args.ary = *value = rb_ary_dup(rb_ary_to_ary(*value));
|
||||
args.n = RARRAY_LEN(args.ary);
|
||||
args.result = g_new0(GtkRadioActionEntry, args.n + 1);
|
||||
|
||||
rb_rescue(rbg_rval2gtkradioactionentries_body, (VALUE)&args,
|
||||
rbg_rval2gtkradioactionentries_rescue, (VALUE)&args);
|
||||
|
||||
*n = args.n;
|
||||
|
||||
return args.result;
|
||||
}
|
||||
|
||||
#define RVAL2GTKRADIOACTIONENTRIES(value, n) rbg_rval2gtkradioactionentries(&(value), &(n))
|
||||
|
||||
static VALUE
|
||||
rg_add_radio_actions(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
GtkActionGroup *group = _SELF(self);
|
||||
VALUE rbentries, rbvalue, proc;
|
||||
long n;
|
||||
GtkRadioActionEntry *entries;
|
||||
gint value;
|
||||
|
||||
rb_scan_args(argc, argv, "12", &rbentries, &rbvalue, &proc);
|
||||
|
||||
value = NIL_P(rbvalue) ? -1 : NUM2INT(rbvalue);
|
||||
|
||||
if (NIL_P(proc) && rb_block_given_p()) {
|
||||
proc = rb_block_proc();
|
||||
/* TODO: How do we remove this proc when all the radio actions passed
|
||||
* have been removed? */
|
||||
G_RELATIVE(self, proc);
|
||||
}
|
||||
|
||||
entries = RVAL2GTKRADIOACTIONENTRIES(rbentries, n);
|
||||
|
||||
gtk_action_group_add_radio_actions(group,
|
||||
entries,
|
||||
n,
|
||||
value,
|
||||
G_CALLBACK(activate_radio_action),
|
||||
(gpointer)proc);
|
||||
|
||||
g_free(entries);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static gchar *
|
||||
translate_func(const gchar *path, gpointer func)
|
||||
{
|
||||
VALUE ret = rb_funcall((VALUE)func, id_call, 1, CSTR2RVAL(path));
|
||||
return (gchar *)RVAL2CSTR(ret);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_translate_func(VALUE self)
|
||||
{
|
||||
VALUE func = rb_block_proc();
|
||||
G_RELATIVE(self, func);
|
||||
gtk_action_group_set_translate_func(_SELF(self),
|
||||
(GtkTranslateFunc)translate_func,
|
||||
(gpointer)func, NULL);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_translation_domain(VALUE self, VALUE domain)
|
||||
{
|
||||
gtk_action_group_set_translation_domain(_SELF(self),
|
||||
NIL_P(domain) ? (const gchar*)NULL : RVAL2CSTR(domain));
|
||||
return self;
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
static VALUE
|
||||
rg_translate_string(VALUE self, VALUE str)
|
||||
{
|
||||
return CSTR2RVAL(gtk_action_group_translate_string(_SELF(self), RVAL2CSTR(str)));
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
action_group_mark(void *p)
|
||||
{
|
||||
GtkActionGroup *group;
|
||||
GList *actions, *node;
|
||||
|
||||
group = GTK_ACTION_GROUP(p);
|
||||
actions = gtk_action_group_list_actions(group);
|
||||
for (node = actions; node; node = g_list_next(node)) {
|
||||
GtkWidget *action = node->data;
|
||||
rbgobj_gc_mark_instance(action);
|
||||
}
|
||||
g_list_free(actions);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_actiongroup(VALUE mGtk)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
VALUE RG_TARGET_NAMESPACE;
|
||||
|
||||
RG_TARGET_NAMESPACE = G_DEF_CLASS_WITH_GC_FUNC(GTK_TYPE_ACTION_GROUP, "ActionGroup",
|
||||
mGtk, action_group_mark, NULL);
|
||||
|
||||
id_action_procs = rb_intern("@action_procs");
|
||||
id_toggle_action_procs = rb_intern("@toggle_action_procs");
|
||||
|
||||
RG_DEF_METHOD(initialize, 1);
|
||||
RG_DEF_METHOD(get_action, 1);
|
||||
RG_DEF_METHOD(actions, 0);
|
||||
RG_DEF_METHOD(add_action, -1);
|
||||
RG_DEF_METHOD(remove_action, 1);
|
||||
RG_DEF_METHOD(add_actions, 1);
|
||||
RG_DEF_METHOD(add_toggle_actions, 1);
|
||||
RG_DEF_METHOD(add_radio_actions, -1);
|
||||
RG_DEF_METHOD(set_translate_func, 0);
|
||||
RG_DEF_METHOD(set_translation_domain, 1);
|
||||
G_DEF_SETTER(RG_TARGET_NAMESPACE, "translation_domain");
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
RG_DEF_METHOD(translate_string, 1);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
72
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkadjustment.c
Normal file
72
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkadjustment.c
Normal file
@@ -0,0 +1,72 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Masao Mutoh
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cAdjustment
|
||||
#define _SELF(self) (GTK_ADJUSTMENT(RVAL2GOBJ(self)))
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self, VALUE value, VALUE lower, VALUE upper, VALUE step_inc, VALUE page_inc, VALUE page_size)
|
||||
{
|
||||
RBGTK_INITIALIZE(self, gtk_adjustment_new(NUM2DBL(value),
|
||||
NUM2DBL(lower),
|
||||
NUM2DBL(upper),
|
||||
NUM2DBL(step_inc),
|
||||
NUM2DBL(page_inc),
|
||||
NUM2DBL(page_size)));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_clamp_page(VALUE self, VALUE lower, VALUE upper)
|
||||
{
|
||||
gtk_adjustment_clamp_page(_SELF(self), NUM2DBL(lower), NUM2DBL(upper));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_changed(VALUE self)
|
||||
{
|
||||
gtk_adjustment_changed(_SELF(self));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_value_changed(VALUE self)
|
||||
{
|
||||
gtk_adjustment_value_changed(_SELF(self));
|
||||
return self;
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_adjustment(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_ADJUSTMENT, "Adjustment", mGtk);
|
||||
|
||||
RG_DEF_METHOD(initialize, 6);
|
||||
RG_DEF_METHOD(clamp_page, 2);
|
||||
RG_DEF_METHOD(changed, 0);
|
||||
RG_DEF_METHOD(value_changed, 0);
|
||||
}
|
||||
79
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkalignment.c
Normal file
79
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkalignment.c
Normal file
@@ -0,0 +1,79 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002-2004 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cAlignment
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self, VALUE xalign, VALUE yalign, VALUE xscale, VALUE yscale)
|
||||
{
|
||||
RBGTK_INITIALIZE(self, gtk_alignment_new(NUM2DBL(xalign),
|
||||
NUM2DBL(yalign),
|
||||
NUM2DBL(xscale),
|
||||
NUM2DBL(yscale)));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set(VALUE self, VALUE xalign, VALUE yalign, VALUE xscale, VALUE yscale)
|
||||
{
|
||||
gtk_alignment_set(GTK_ALIGNMENT(RVAL2GOBJ(self)),
|
||||
NUM2DBL(xalign), NUM2DBL(yalign),
|
||||
NUM2DBL(xscale), NUM2DBL(yscale));
|
||||
return self;
|
||||
}
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
static VALUE
|
||||
rg_padding(VALUE self)
|
||||
{
|
||||
guint top, bottom, left, right;
|
||||
gtk_alignment_get_padding(GTK_ALIGNMENT(RVAL2GOBJ(self)),
|
||||
&top, &bottom, &left, &right);
|
||||
return rb_ary_new3(4, UINT2NUM(top), UINT2NUM(bottom),
|
||||
UINT2NUM(left), UINT2NUM(right));
|
||||
}
|
||||
static VALUE
|
||||
rg_set_padding(VALUE self, VALUE top, VALUE bottom, VALUE left, VALUE right)
|
||||
{
|
||||
gtk_alignment_set_padding(GTK_ALIGNMENT(RVAL2GOBJ(self)),
|
||||
NUM2UINT(top), NUM2UINT(bottom),
|
||||
NUM2UINT(left), NUM2UINT(right));
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_alignment(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_ALIGNMENT, "Alignment", mGtk);
|
||||
|
||||
RG_DEF_METHOD(initialize, 4);
|
||||
RG_DEF_METHOD(set, 4);
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
RG_DEF_METHOD(padding, 0);
|
||||
RG_DEF_METHOD(set_padding, 4);
|
||||
#endif
|
||||
|
||||
}
|
||||
168
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkallocation.c
Normal file
168
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkallocation.c
Normal file
@@ -0,0 +1,168 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002-2004 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
static GtkAllocation *
|
||||
gtk_allocation_copy(const GtkAllocation *alloc)
|
||||
{
|
||||
GtkAllocation *result = g_new (GtkAllocation, 1);
|
||||
*result = *alloc;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
GType
|
||||
gtk_allocation_get_type(void)
|
||||
{
|
||||
static GType our_type = 0;
|
||||
if (our_type == 0)
|
||||
our_type = g_boxed_type_register_static ("GtkAllocation",
|
||||
(GBoxedCopyFunc)gtk_allocation_copy,
|
||||
(GBoxedFreeFunc)g_free);
|
||||
return our_type;
|
||||
}
|
||||
|
||||
#define RG_TARGET_NAMESPACE cAllocation
|
||||
#define _SELF(r) ((GtkAllocation*)RVAL2BOXED(r, GTK_TYPE_ALLOCATION))
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self, VALUE x, VALUE y, VALUE width, VALUE height)
|
||||
{
|
||||
GtkAllocation allocation;
|
||||
|
||||
allocation.x = NUM2INT(x);
|
||||
allocation.y = NUM2INT(y);
|
||||
allocation.width = NUM2INT(width);
|
||||
allocation.height = NUM2INT(height);
|
||||
|
||||
G_INITIALIZE(self, g_boxed_copy(GTK_TYPE_ALLOCATION, &allocation));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_intersect(VALUE self, VALUE other)
|
||||
{
|
||||
GtkAllocation dest;
|
||||
gboolean ret = gdk_rectangle_intersect(_SELF(self), _SELF(other), &dest);
|
||||
return ret ? BOXED2RVAL(&dest, GTK_TYPE_ALLOCATION) : Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_union(VALUE self, VALUE other)
|
||||
{
|
||||
GtkAllocation dest;
|
||||
gdk_rectangle_union(_SELF(self), _SELF(other), &dest);
|
||||
return BOXED2RVAL(&dest, GTK_TYPE_ALLOCATION);
|
||||
}
|
||||
|
||||
/* Struct accessors */
|
||||
static VALUE
|
||||
rg_x(VALUE self)
|
||||
{
|
||||
return INT2NUM(_SELF(self)->x);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_y(VALUE self)
|
||||
{
|
||||
return INT2NUM(_SELF(self)->y);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_width(VALUE self)
|
||||
{
|
||||
return INT2NUM(_SELF(self)->width);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_height(VALUE self)
|
||||
{
|
||||
return INT2NUM(_SELF(self)->height);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_x(VALUE self, VALUE x)
|
||||
{
|
||||
_SELF(self)->x = NUM2INT(x);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_y(VALUE self, VALUE y)
|
||||
{
|
||||
_SELF(self)->y = NUM2INT(y);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_width(VALUE self, VALUE width)
|
||||
{
|
||||
_SELF(self)->width = NUM2INT(width);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_height(VALUE self, VALUE height)
|
||||
{
|
||||
_SELF(self)->height = NUM2INT(height);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_to_a(VALUE self)
|
||||
{
|
||||
GtkAllocation* a = _SELF(self);
|
||||
return rb_ary_new3(4, INT2FIX(a->x), INT2FIX(a->y),
|
||||
INT2FIX(a->width), INT2FIX(a->height));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_to_rect(VALUE self)
|
||||
{
|
||||
return BOXED2RVAL(_SELF(self), GDK_TYPE_RECTANGLE);
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_allocation(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE;
|
||||
|
||||
RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_ALLOCATION, "Allocation", mGtk);
|
||||
|
||||
RG_DEF_METHOD(initialize, 4);
|
||||
RG_DEF_METHOD(intersect, 1);
|
||||
RG_DEF_ALIAS("&", "intersect");
|
||||
RG_DEF_METHOD(union, 1);
|
||||
RG_DEF_ALIAS("|", "union");
|
||||
RG_DEF_METHOD(x, 0);
|
||||
RG_DEF_METHOD(y, 0);
|
||||
RG_DEF_METHOD(width, 0);
|
||||
RG_DEF_METHOD(height, 0);
|
||||
RG_DEF_METHOD(set_x, 1);
|
||||
RG_DEF_METHOD(set_y, 1);
|
||||
RG_DEF_METHOD(set_width, 1);
|
||||
RG_DEF_METHOD(set_height, 1);
|
||||
RG_DEF_METHOD(to_a, 0);
|
||||
RG_DEF_METHOD(to_rect, 0);
|
||||
|
||||
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
||||
}
|
||||
57
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkarrow.c
Normal file
57
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkarrow.c
Normal file
@@ -0,0 +1,57 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cArrow
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self, VALUE arrow_t, VALUE shadow_t)
|
||||
{
|
||||
RBGTK_INITIALIZE(self, gtk_arrow_new(RVAL2GENUM(arrow_t, GTK_TYPE_ARROW_TYPE),
|
||||
RVAL2GENUM(shadow_t, GTK_TYPE_SHADOW_TYPE)));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set(VALUE self, VALUE arrow_t, VALUE shadow_t)
|
||||
{
|
||||
gtk_arrow_set(GTK_ARROW(RVAL2GOBJ(self)),
|
||||
RVAL2GENUM(arrow_t, GTK_TYPE_ARROW_TYPE),
|
||||
RVAL2GENUM(shadow_t, GTK_TYPE_SHADOW_TYPE));
|
||||
return self;
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_arrow(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_ARROW, "Arrow", mGtk);
|
||||
|
||||
RG_DEF_METHOD(initialize, 2);
|
||||
RG_DEF_METHOD(set, 2);
|
||||
|
||||
/* GtkArrowType (from General constants) */
|
||||
G_DEF_CLASS(GTK_TYPE_ARROW_TYPE, "Type", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_ARROW_TYPE, "GTK_ARROW_");
|
||||
}
|
||||
56
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkaspectframe.c
Normal file
56
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkaspectframe.c
Normal file
@@ -0,0 +1,56 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cAspectFrame
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self, VALUE label, VALUE xalign, VALUE yalign, VALUE ratio, VALUE obey_child)
|
||||
{
|
||||
RBGTK_INITIALIZE(self, gtk_aspect_frame_new(NIL_P(label)?NULL:RVAL2CSTR(label),
|
||||
NUM2DBL(xalign),
|
||||
NUM2DBL(yalign),
|
||||
NUM2DBL(ratio),
|
||||
RVAL2CBOOL(obey_child)));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set(VALUE self, VALUE xalign, VALUE yalign, VALUE ratio, VALUE obey_child)
|
||||
{
|
||||
gtk_aspect_frame_set(GTK_ASPECT_FRAME(RVAL2GOBJ(self)),
|
||||
NUM2DBL(xalign), NUM2DBL(yalign),
|
||||
NUM2DBL(ratio), RVAL2CBOOL(obey_child));
|
||||
return self;
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_aspect_frame(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_ASPECT_FRAME, "AspectFrame", mGtk);
|
||||
|
||||
RG_DEF_METHOD(initialize, 5);
|
||||
RG_DEF_METHOD(set, 4);
|
||||
}
|
||||
226
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkassistant.c
Normal file
226
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkassistant.c
Normal file
@@ -0,0 +1,226 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2006 Ruby-GNOME2 Project Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#if GTK_CHECK_VERSION(2,10,0)
|
||||
|
||||
#define RG_TARGET_NAMESPACE cAssistant
|
||||
#define _SELF(s) (GTK_ASSISTANT(RVAL2GOBJ(s)))
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self)
|
||||
{
|
||||
RBGTK_INITIALIZE(self, gtk_assistant_new());
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_current_page(VALUE self)
|
||||
{
|
||||
return INT2NUM(gtk_assistant_get_current_page(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_current_page(VALUE self, VALUE page_num)
|
||||
{
|
||||
gtk_assistant_set_current_page(_SELF(self), NUM2INT(page_num));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_n_pages(VALUE self)
|
||||
{
|
||||
return INT2NUM(gtk_assistant_get_n_pages(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_get_nth_page(VALUE self, VALUE page_num)
|
||||
{
|
||||
return GOBJ2RVAL(gtk_assistant_get_nth_page(_SELF(self), NUM2INT(page_num)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_prepend_page(VALUE self, VALUE page)
|
||||
{
|
||||
return INT2NUM(gtk_assistant_prepend_page(_SELF(self), GTK_WIDGET(RVAL2GOBJ(page))));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_append_page(VALUE self, VALUE page)
|
||||
{
|
||||
return INT2NUM(gtk_assistant_append_page(_SELF(self), GTK_WIDGET(RVAL2GOBJ(page))));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_insert_page(VALUE self, VALUE page, VALUE position)
|
||||
{
|
||||
return INT2NUM(gtk_assistant_insert_page(_SELF(self), GTK_WIDGET(RVAL2GOBJ(page)), NUM2INT(position)));
|
||||
}
|
||||
|
||||
static gint
|
||||
ass_page_func(gint current_page, gpointer func)
|
||||
{
|
||||
return NUM2INT(rb_funcall((VALUE)func, id_call, 1, INT2NUM(current_page)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_forward_page_func(VALUE self)
|
||||
{
|
||||
VALUE func = rb_block_proc();
|
||||
G_RELATIVE(self, func);
|
||||
gtk_assistant_set_forward_page_func(_SELF(self), (GtkAssistantPageFunc)ass_page_func, (gpointer)func, NULL);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_page_type(VALUE self, VALUE page, VALUE type)
|
||||
{
|
||||
gtk_assistant_set_page_type(_SELF(self), GTK_WIDGET(RVAL2GOBJ(page)), RVAL2GENUM(type, GTK_TYPE_ASSISTANT_PAGE_TYPE));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_get_page_type(VALUE self, VALUE page)
|
||||
{
|
||||
return GENUM2RVAL(gtk_assistant_get_page_type(_SELF(self), GTK_WIDGET(RVAL2GOBJ(page))), GTK_TYPE_ASSISTANT_PAGE_TYPE);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_page_title(VALUE self, VALUE page, VALUE title)
|
||||
{
|
||||
gtk_assistant_set_page_title(_SELF(self), GTK_WIDGET(RVAL2GOBJ(page)), RVAL2CSTR(title));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_get_page_title(VALUE self, VALUE page)
|
||||
{
|
||||
return CSTR2RVAL(gtk_assistant_get_page_title(_SELF(self), GTK_WIDGET(RVAL2GOBJ(page))));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_page_header_image(VALUE self, VALUE page, VALUE header_image)
|
||||
{
|
||||
gtk_assistant_set_page_header_image(_SELF(self), GTK_WIDGET(RVAL2GOBJ(page)), GDK_PIXBUF(RVAL2GOBJ(header_image)));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_get_page_header_image(VALUE self, VALUE page)
|
||||
{
|
||||
return GOBJ2RVAL(gtk_assistant_get_page_header_image(_SELF(self), GTK_WIDGET(RVAL2GOBJ(page))));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_page_side_image(VALUE self, VALUE page, VALUE side_image)
|
||||
{
|
||||
gtk_assistant_set_page_side_image(_SELF(self), GTK_WIDGET(RVAL2GOBJ(page)), GDK_PIXBUF(RVAL2GOBJ(side_image)));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_get_page_side_image(VALUE self, VALUE page)
|
||||
{
|
||||
return GOBJ2RVAL(gtk_assistant_get_page_side_image(_SELF(self), GTK_WIDGET(RVAL2GOBJ(page))));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_page_complete(VALUE self, VALUE page, VALUE complete)
|
||||
{
|
||||
gtk_assistant_set_page_complete(_SELF(self), GTK_WIDGET(RVAL2GOBJ(page)), RVAL2CBOOL(complete));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_get_page_complete(VALUE self, VALUE page)
|
||||
{
|
||||
return CBOOL2RVAL(gtk_assistant_get_page_complete(_SELF(self), GTK_WIDGET(RVAL2GOBJ(page))));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_add_action_widget(VALUE self, VALUE child)
|
||||
{
|
||||
gtk_assistant_add_action_widget(_SELF(self), GTK_WIDGET(RVAL2GOBJ(child)));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_remove_action_widget(VALUE self, VALUE child)
|
||||
{
|
||||
gtk_assistant_remove_action_widget(_SELF(self), GTK_WIDGET(RVAL2GOBJ(child)));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_update_buttons_state(VALUE self)
|
||||
{
|
||||
gtk_assistant_update_buttons_state(_SELF(self));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_commit(VALUE self)
|
||||
{
|
||||
gtk_assistant_commit(_SELF(self));
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_assistant(VALUE mGtk)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(2,10,0)
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_ASSISTANT, "Assistant", mGtk);
|
||||
RG_DEF_METHOD(initialize, 0);
|
||||
|
||||
RG_DEF_METHOD(current_page, 0);
|
||||
RG_DEF_METHOD(set_current_page, 1);
|
||||
RG_DEF_METHOD(n_pages, 0);
|
||||
RG_DEF_METHOD(get_nth_page, 1);
|
||||
RG_DEF_METHOD(prepend_page, 1);
|
||||
RG_DEF_METHOD(append_page, 1);
|
||||
RG_DEF_METHOD(insert_page, 2);
|
||||
RG_DEF_METHOD(set_forward_page_func, 0);
|
||||
RG_DEF_METHOD(set_page_type, 2);
|
||||
RG_DEF_METHOD(get_page_type, 1);
|
||||
RG_DEF_METHOD(set_page_title, 2);
|
||||
RG_DEF_METHOD(get_page_title, 1);
|
||||
RG_DEF_METHOD(set_page_header_image, 2);
|
||||
RG_DEF_METHOD(get_page_header_image, 1);
|
||||
RG_DEF_METHOD(set_page_side_image, 2);
|
||||
RG_DEF_METHOD(get_page_side_image, 1);
|
||||
RG_DEF_METHOD(set_page_complete, 2);
|
||||
RG_DEF_METHOD(get_page_complete, 1);
|
||||
RG_DEF_METHOD(add_action_widget, 1);
|
||||
RG_DEF_METHOD(remove_action_widget, 1);
|
||||
RG_DEF_METHOD(update_buttons_state, 0);
|
||||
RG_DEF_METHOD(commit, 0);
|
||||
|
||||
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
||||
|
||||
/* GtkAssistantPageType */
|
||||
G_DEF_CLASS(GTK_TYPE_ASSISTANT_PAGE_TYPE, "PageType", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_ASSISTANT_PAGE_TYPE, "GTK_ASSISTANT_");
|
||||
#endif
|
||||
}
|
||||
57
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkbbox.c
Normal file
57
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkbbox.c
Normal file
@@ -0,0 +1,57 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cButtonBox
|
||||
|
||||
static VALUE
|
||||
rg_set_child_secondary(VALUE self, VALUE child, VALUE is_secondary)
|
||||
{
|
||||
gtk_button_box_set_child_secondary(GTK_BUTTON_BOX(RVAL2GOBJ(self)),
|
||||
GTK_WIDGET(RVAL2GOBJ(child)),
|
||||
RVAL2CBOOL(is_secondary));
|
||||
return self;
|
||||
}
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
static VALUE
|
||||
rg_get_child_secondary(VALUE self, VALUE child)
|
||||
{
|
||||
return CBOOL2RVAL(gtk_button_box_get_child_secondary(GTK_BUTTON_BOX(RVAL2GOBJ(self)),
|
||||
GTK_WIDGET(RVAL2GOBJ(child))));
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_button_box(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_BUTTON_BOX, "ButtonBox", mGtk);
|
||||
RG_DEF_METHOD(set_child_secondary, 2);
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
RG_DEF_METHOD(get_child_secondary, 1);
|
||||
#endif
|
||||
/* GtkButtonBoxStyle(General constants) */
|
||||
G_DEF_CLASS(GTK_TYPE_BUTTON_BOX_STYLE, "Style", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_BUTTON_BOX_STYLE, "GTK_BUTTONBOX_");
|
||||
}
|
||||
42
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkbin.c
Normal file
42
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkbin.c
Normal file
@@ -0,0 +1,42 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cBin
|
||||
|
||||
static VALUE
|
||||
rg_child(VALUE self)
|
||||
{
|
||||
GtkWidget *child = gtk_bin_get_child(RVAL2GOBJ(self));
|
||||
return child ? GOBJ2RVAL(child) : Qnil;
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_bin(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_BIN, "Bin", mGtk);
|
||||
|
||||
RG_DEF_METHOD(child, 0);
|
||||
}
|
||||
189
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkbindingset.c
Normal file
189
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkbindingset.c
Normal file
@@ -0,0 +1,189 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2003 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
NOTE:
|
||||
- gtk_bindings_activate() is mapped to
|
||||
Gtk::Object#bindings_activate.
|
||||
|
||||
- gtk_binding_set_by_class() is mapped to
|
||||
Gtk::Object.binding_set
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RVAL2MOD(mods) RVAL2GFLAGS(mods, GDK_TYPE_MODIFIER_TYPE)
|
||||
|
||||
/*****************************************/
|
||||
static GtkBindingSet*
|
||||
gtk_bindingset_copy(const GtkBindingSet* bin)
|
||||
{
|
||||
/* GtkBindingSet should not be copied */
|
||||
return (GtkBindingSet*)bin;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_bindingset_free(G_GNUC_UNUSED GtkBindingSet* bin)
|
||||
{
|
||||
/* GtkBindingSet should not be freed */
|
||||
}
|
||||
|
||||
GType
|
||||
gtk_bindingset_get_type(void)
|
||||
{
|
||||
static GType our_type = 0;
|
||||
if (our_type == 0)
|
||||
our_type = g_boxed_type_register_static ("GtkBindingSet",
|
||||
(GBoxedCopyFunc)gtk_bindingset_copy,
|
||||
(GBoxedFreeFunc)gtk_bindingset_free);
|
||||
return our_type;
|
||||
}
|
||||
/*****************************************/
|
||||
|
||||
#define RG_TARGET_NAMESPACE cBindingSet
|
||||
#define _SELF(s) (GtkBindingSet*)(RVAL2BOXED(s, GTK_TYPE_BINDING_SET))
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self, VALUE set_name)
|
||||
{
|
||||
G_INITIALIZE(self, gtk_binding_set_new(RVAL2CSTR(set_name)));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_find(G_GNUC_UNUSED VALUE self, VALUE set_name)
|
||||
{
|
||||
return BOXED2RVAL(gtk_binding_set_find(RVAL2CSTR(set_name)),
|
||||
GTK_TYPE_BINDING_SET);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_activate(VALUE self, VALUE keyval, VALUE modifiers, VALUE object)
|
||||
{
|
||||
return CBOOL2RVAL(gtk_binding_set_activate(_SELF(self), NUM2UINT(keyval),
|
||||
RVAL2MOD(modifiers),
|
||||
GTK_OBJECT(RVAL2GOBJ(object))));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_entry_clear(VALUE self, VALUE keyval, VALUE modifiers)
|
||||
{
|
||||
gtk_binding_entry_clear(_SELF(self), NUM2UINT(keyval),
|
||||
RVAL2MOD(modifiers));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_add_signal(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE keyval, modifiers, signame, rest;
|
||||
long i;
|
||||
VALUE param;
|
||||
GSList *slist, *free_slist;
|
||||
|
||||
slist = NULL;
|
||||
|
||||
rb_scan_args(argc, argv, "3*", &keyval, &modifiers, &signame, &rest);
|
||||
|
||||
for (i = 0; i < RARRAY_LEN(rest); i++) {
|
||||
GtkBindingArg *arg;
|
||||
|
||||
arg = g_new0 (GtkBindingArg, 1);
|
||||
slist = g_slist_prepend (slist, arg);
|
||||
|
||||
param = RARRAY_PTR(rest)[i];
|
||||
if (TYPE(param) == T_FLOAT) {
|
||||
arg->arg_type = G_TYPE_DOUBLE;
|
||||
arg->d.double_data = NUM2DBL(param);
|
||||
} else if (rb_respond_to (param, rb_intern("to_int"))) {
|
||||
arg->arg_type = G_TYPE_LONG;
|
||||
arg->d.long_data = NUM2LONG(param);
|
||||
} else if (param == Qfalse) {
|
||||
arg->arg_type = G_TYPE_LONG;
|
||||
arg->d.long_data = 0;
|
||||
} else if (param == Qtrue) {
|
||||
arg->arg_type = G_TYPE_LONG;
|
||||
arg->d.long_data = 1;
|
||||
} else if (rb_respond_to (param, rb_intern("to_str"))) {
|
||||
arg->arg_type = G_TYPE_STRING;
|
||||
arg->d.string_data = (gchar *)RVAL2CSTR(param);
|
||||
} else {
|
||||
rb_raise(rb_eTypeError,
|
||||
"can not convert %s into String, Numeric, "
|
||||
"GLib::Enum/GLib::Flags or true/false",
|
||||
rb_class2name(CLASS_OF(param)));
|
||||
|
||||
}
|
||||
}
|
||||
slist = g_slist_reverse (slist);
|
||||
gtk_binding_entry_add_signall (_SELF(self), NUM2UINT(keyval), RVAL2MOD(modifiers),
|
||||
RVAL2CSTR(signame), slist);
|
||||
free_slist = slist;
|
||||
while (slist) {
|
||||
g_free (slist->data);
|
||||
slist = slist->next;
|
||||
}
|
||||
g_slist_free (free_slist);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_add_path(VALUE self, VALUE path_type, VALUE path_pattern, VALUE priority)
|
||||
{
|
||||
gtk_binding_set_add_path(_SELF(self), RVAL2GENUM(path_type, GTK_TYPE_PATH_TYPE),
|
||||
RVAL2CSTR(path_pattern),
|
||||
RVAL2GENUM(priority, GTK_TYPE_PATH_PRIORITY_TYPE));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_entry_remove(VALUE self, VALUE keyval, VALUE modifiers)
|
||||
{
|
||||
gtk_binding_entry_remove(_SELF(self), NUM2UINT(keyval), RVAL2MOD(modifiers));
|
||||
return self;
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,12,0)
|
||||
static VALUE
|
||||
rg_entry_skip(VALUE self, VALUE keyval, VALUE modifiers)
|
||||
{
|
||||
gtk_binding_entry_skip(_SELF(self), NUM2UINT(keyval), RVAL2MOD(modifiers));
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_bindings(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_BINDING_SET, "BindingSet", mGtk);
|
||||
RG_DEF_METHOD(initialize, 1);
|
||||
RG_DEF_SMETHOD(find, 1);
|
||||
RG_DEF_METHOD(activate, 3);
|
||||
RG_DEF_METHOD(entry_clear, 2);
|
||||
RG_DEF_METHOD(add_signal, -1);
|
||||
RG_DEF_ALIAS("entry_add_signal", "add_signal");
|
||||
RG_DEF_METHOD(add_path, 3);
|
||||
RG_DEF_METHOD(entry_remove, 2);
|
||||
#if GTK_CHECK_VERSION(2,12,0)
|
||||
RG_DEF_METHOD(entry_skip, 2);
|
||||
#endif
|
||||
}
|
||||
87
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkborder.c
Normal file
87
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkborder.c
Normal file
@@ -0,0 +1,87 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002-2004 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cBorder
|
||||
#define _SELF(self) ((GtkBorder*)RVAL2BOXED(self, GTK_TYPE_BORDER))
|
||||
|
||||
#define ATTR_INT(name)\
|
||||
static VALUE \
|
||||
border_int_ ## name (VALUE self)\
|
||||
{\
|
||||
return INT2NUM(_SELF(self)->name);\
|
||||
}\
|
||||
static VALUE \
|
||||
border_int_set_ ## name (VALUE self, VALUE val)\
|
||||
{\
|
||||
_SELF(self)->name = NUM2INT(val); \
|
||||
return self;\
|
||||
}
|
||||
|
||||
ATTR_INT(left);
|
||||
ATTR_INT(right);
|
||||
ATTR_INT(top);
|
||||
ATTR_INT(bottom);
|
||||
|
||||
#define DEFINE_ACCESSOR(gt, type, name) \
|
||||
rb_define_method(gt, G_STRINGIFY(name), border_ ## type ## _## name, 0);\
|
||||
rb_define_method(gt, G_STRINGIFY(set_ ## name), border_ ## type ## _set_## name, 1);
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self, VALUE left, VALUE right, VALUE top, VALUE bottom)
|
||||
{
|
||||
GtkBorder border;
|
||||
border.left = NUM2INT(left);
|
||||
border.right = NUM2INT(right);
|
||||
border.top = NUM2INT(top);
|
||||
border.bottom = NUM2INT(bottom);
|
||||
|
||||
G_INITIALIZE(self, g_boxed_copy(GTK_TYPE_BORDER, &border));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_to_a(VALUE self)
|
||||
{
|
||||
GtkBorder* border = _SELF(self);
|
||||
return rb_ary_new3(4, INT2NUM(border->left), INT2NUM(border->right),
|
||||
INT2NUM(border->top), INT2NUM(border->bottom));
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_border(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_BORDER, "Border", mGtk);
|
||||
|
||||
RG_DEF_METHOD(initialize, 4);
|
||||
RG_DEF_METHOD(to_a, 0);
|
||||
|
||||
DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, int, left);
|
||||
DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, int, right);
|
||||
DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, int, top);
|
||||
DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, int, bottom);
|
||||
|
||||
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
||||
}
|
||||
138
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkbox.c
Normal file
138
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkbox.c
Normal file
@@ -0,0 +1,138 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002-2005 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cBox
|
||||
#define _SELF(self) (GTK_BOX(RVAL2GOBJ(self)))
|
||||
#define RVAL2WIDGET(w) (GTK_WIDGET(RVAL2GOBJ(w)))
|
||||
|
||||
static void
|
||||
box_pack_start_or_end(int argc, VALUE *argv, VALUE self, int start)
|
||||
{
|
||||
VALUE arg0, arg1, arg2, arg3;
|
||||
gint expand, fill, padding;
|
||||
GtkWidget *widget, *child;
|
||||
|
||||
expand = fill = Qtrue; padding = 0;
|
||||
switch (rb_scan_args(argc, argv, "13", &arg0, &arg1, &arg2, &arg3)) {
|
||||
case 4:
|
||||
padding = NUM2INT(arg3);
|
||||
case 3:
|
||||
fill = RVAL2CBOOL(arg2);
|
||||
case 2:
|
||||
expand = RVAL2CBOOL(arg1);
|
||||
default:
|
||||
child = GTK_WIDGET(RVAL2GOBJ(arg0));
|
||||
G_CHILD_ADD(self, arg0);
|
||||
break;
|
||||
}
|
||||
widget = GTK_WIDGET(RVAL2GOBJ(self));
|
||||
|
||||
if (start)
|
||||
gtk_box_pack_start(_SELF(self), child, expand, fill, padding);
|
||||
else
|
||||
gtk_box_pack_end(_SELF(self), child, expand, fill, padding);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_pack_start(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
box_pack_start_or_end(argc, argv, self, 1);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_pack_end(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
box_pack_start_or_end(argc, argv, self, 0);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_pack_start_defaults(VALUE self, VALUE widget)
|
||||
{
|
||||
gtk_box_pack_start_defaults(_SELF(self), RVAL2WIDGET(widget));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_pack_end_defaults(VALUE self, VALUE widget)
|
||||
{
|
||||
gtk_box_pack_end_defaults(_SELF(self), RVAL2WIDGET(widget));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_reorder_child(VALUE self, VALUE child, VALUE pos)
|
||||
{
|
||||
gtk_box_reorder_child(_SELF(self),
|
||||
RVAL2WIDGET(child), NUM2INT(pos));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_query_child_packing(VALUE self, VALUE child)
|
||||
{
|
||||
gboolean expand, fill;
|
||||
guint padding;
|
||||
GtkPackType pack_type;
|
||||
VALUE ary;
|
||||
|
||||
gtk_box_query_child_packing(_SELF(self),
|
||||
RVAL2WIDGET(child),
|
||||
&expand, &fill, &padding, &pack_type);
|
||||
|
||||
ary = rb_ary_new2(4);
|
||||
rb_ary_push(ary, expand == FALSE ? Qfalse : Qtrue);
|
||||
rb_ary_push(ary, fill == FALSE ? Qfalse : Qtrue);
|
||||
rb_ary_push(ary, INT2NUM(padding));
|
||||
rb_ary_push(ary, GENUM2RVAL(pack_type, GTK_TYPE_PACK_TYPE));
|
||||
|
||||
return ary;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_child_packing(VALUE self, VALUE child, VALUE expand, VALUE fill, VALUE padding, VALUE pack_type)
|
||||
{
|
||||
gtk_box_set_child_packing(_SELF(self),
|
||||
RVAL2WIDGET(child),
|
||||
RVAL2CBOOL(expand), RVAL2CBOOL(fill),
|
||||
NUM2UINT(padding), RVAL2GENUM(pack_type, GTK_TYPE_PACK_TYPE));
|
||||
return self;
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_box(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_BOX, "Box", mGtk);
|
||||
|
||||
RG_DEF_METHOD(pack_start, -1);
|
||||
RG_DEF_METHOD(pack_end, -1);
|
||||
RG_DEF_METHOD(pack_start_defaults, 1);
|
||||
RG_DEF_METHOD(pack_end_defaults, 1);
|
||||
RG_DEF_METHOD(reorder_child, 2);
|
||||
RG_DEF_METHOD(query_child_packing, 1);
|
||||
RG_DEF_METHOD(set_child_packing, 5);
|
||||
}
|
||||
127
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkbuildable.c
Normal file
127
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkbuildable.c
Normal file
@@ -0,0 +1,127 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2008 Ruby-GNOME2 Project Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#if GTK_CHECK_VERSION(2, 12, 0)
|
||||
|
||||
#define RG_TARGET_NAMESPACE cBuildable
|
||||
#define _SELF(self) (GTK_BUILDABLE(RVAL2GOBJ(self)))
|
||||
#define RVAL2BUILDER(obj) (GTK_BUILDER(RVAL2GOBJ(obj)))
|
||||
|
||||
static VALUE
|
||||
rg_builder_name(VALUE self)
|
||||
{
|
||||
return CSTR2RVAL(gtk_buildable_get_name(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_builder_name(VALUE self, VALUE name)
|
||||
{
|
||||
gtk_buildable_set_name(_SELF(self), RVAL2CSTR(name));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_add_child(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE builder, child, type;
|
||||
|
||||
rb_scan_args(argc, argv, "21", &builder, &child, &type);
|
||||
gtk_buildable_add_child(_SELF(self), RVAL2BUILDER(builder), RVAL2GOBJ(child),
|
||||
RVAL2CSTR_ACCEPT_NIL(type));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_buildable_property(VALUE self, VALUE rb_builder,
|
||||
VALUE rb_name, VALUE rb_value)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
const gchar *name;
|
||||
GValue value = G_VALUE_INIT;
|
||||
|
||||
builder = RVAL2BUILDER(rb_builder);
|
||||
name = RVAL2CSTR(rb_name);
|
||||
rbgobj_initialize_gvalue(&value, rb_value);
|
||||
gtk_buildable_set_buildable_property(_SELF(self), builder, name, &value);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_construct_child(VALUE self, VALUE builder, VALUE name)
|
||||
{
|
||||
return GOBJ2RVAL(gtk_buildable_construct_child(_SELF(self),
|
||||
RVAL2BUILDER(builder),
|
||||
RVAL2CSTR(name)));
|
||||
}
|
||||
|
||||
/*
|
||||
customized buildable is not supported yet.
|
||||
|
||||
gboolean gtk_buildable_custom_tag_start (GtkBuildable *buildable,
|
||||
GtkBuilder *builder,
|
||||
GObject *child,
|
||||
const gchar *tagname,
|
||||
GMarkupParser *parser,
|
||||
gpointer *data);
|
||||
void gtk_buildable_custom_tag_end (GtkBuildable *buildable,
|
||||
GtkBuilder *builder,
|
||||
GObject *child,
|
||||
const gchar *tagname,
|
||||
gpointer *data);
|
||||
void gtk_buildable_custom_finished (GtkBuildable *buildable,
|
||||
GtkBuilder *builder,
|
||||
GObject *child,
|
||||
const gchar *tagname,
|
||||
gpointer data);
|
||||
void gtk_buildable_parser_finished (GtkBuildable *buildable,
|
||||
GtkBuilder *builder);
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
rg_get_internal_child(VALUE self, VALUE builder, VALUE child_name)
|
||||
{
|
||||
return GOBJ2RVAL(gtk_buildable_get_internal_child(_SELF(self),
|
||||
RVAL2BUILDER(builder),
|
||||
RVAL2CSTR(child_name)));
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_buildable(VALUE mGtk)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(2, 12, 0)
|
||||
VALUE RG_TARGET_NAMESPACE;
|
||||
|
||||
RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_BUILDABLE, "Buildable", mGtk);
|
||||
|
||||
RG_DEF_METHOD(builder_name, 0);
|
||||
RG_DEF_METHOD(set_builder_name, 1);
|
||||
RG_DEF_METHOD(add_child, -1);
|
||||
RG_DEF_METHOD(set_buildable_property, 3);
|
||||
RG_DEF_METHOD(construct_child, 2);
|
||||
RG_DEF_METHOD(get_internal_child, 2);
|
||||
|
||||
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
||||
#endif
|
||||
}
|
||||
170
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkbuilder.c
Normal file
170
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkbuilder.c
Normal file
@@ -0,0 +1,170 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2008 Ruby-GNOME2 Project Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
#include <glib-enum-types.h> /* From Ruby/GLib2 */
|
||||
|
||||
#if GTK_CHECK_VERSION(2, 12, 0)
|
||||
|
||||
#define RG_TARGET_NAMESPACE cBuilder
|
||||
#define _SELF(self) (GTK_BUILDER(RVAL2GOBJ(self)))
|
||||
|
||||
static ID id___connect_signals__;
|
||||
|
||||
static void
|
||||
builder_mark(gpointer object)
|
||||
{
|
||||
GtkBuilder *builder = object;
|
||||
GSList *objects;
|
||||
|
||||
objects = gtk_builder_get_objects(builder);
|
||||
g_slist_foreach(objects, (GFunc)rbgobj_gc_mark_instance, NULL);
|
||||
g_slist_free(objects);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
|
||||
builder = gtk_builder_new();
|
||||
G_INITIALIZE(self, builder);
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_add_from_file(VALUE self, VALUE filename)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (gtk_builder_add_from_file(_SELF(self),
|
||||
RVAL2CSTR(filename),
|
||||
&error) == 0)
|
||||
RAISE_GERROR(error);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_add_from_string(VALUE self, VALUE string)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
StringValue(string);
|
||||
if (gtk_builder_add_from_string(_SELF(self),
|
||||
RSTRING_PTR(string),
|
||||
RSTRING_LEN(string),
|
||||
&error) == 0)
|
||||
RAISE_GERROR(error);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_add(VALUE self, VALUE filename_or_xml)
|
||||
{
|
||||
const char xml_detect_re_str[] = "(?:\\A<|[\\r\\n])";
|
||||
VALUE xml_detect_re;
|
||||
|
||||
xml_detect_re = rb_reg_new(xml_detect_re_str, strlen(xml_detect_re_str), 0);
|
||||
if (NIL_P(rb_reg_match(xml_detect_re, filename_or_xml)))
|
||||
return rg_add_from_file(self, filename_or_xml);
|
||||
else
|
||||
return rg_add_from_string(self, filename_or_xml);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_get_object(VALUE self, VALUE name)
|
||||
{
|
||||
return GOBJ2RVAL(gtk_builder_get_object(_SELF(self), RVAL2CSTR(name)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_objects(VALUE self)
|
||||
{
|
||||
return GSLIST2ARY_FREE(gtk_builder_get_objects(_SELF(self)));
|
||||
}
|
||||
|
||||
static void
|
||||
connect_signals(GtkBuilder *builder, GObject *object, const gchar *signal_name,
|
||||
const gchar *handler_name, GObject *connect_object,
|
||||
GConnectFlags flags, gpointer user_data)
|
||||
{
|
||||
VALUE signal_connector = (VALUE)user_data;
|
||||
|
||||
rb_funcall(GOBJ2RVAL(builder), id___connect_signals__, 6,
|
||||
signal_connector, GOBJ2RVAL(object), CSTR2RVAL(signal_name),
|
||||
CSTR2RVAL(handler_name), GOBJ2RVAL(connect_object),
|
||||
GFLAGS2RVAL(flags, G_TYPE_CONNECT_FLAGS));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_connect_signals(VALUE self)
|
||||
{
|
||||
VALUE signal_connector;
|
||||
|
||||
signal_connector = rb_block_proc();
|
||||
G_CHILD_ADD(self, signal_connector);
|
||||
gtk_builder_connect_signals_full(_SELF(self), connect_signals,
|
||||
(gpointer)signal_connector);
|
||||
G_CHILD_REMOVE(self, signal_connector);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_get_type(VALUE self, VALUE name)
|
||||
{
|
||||
return GTYPE2CLASS(gtk_builder_get_type_from_name(_SELF(self),
|
||||
RVAL2CSTR(name)));
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_builder(VALUE mGtk)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(2, 12, 0)
|
||||
VALUE RG_TARGET_NAMESPACE;
|
||||
|
||||
id___connect_signals__ = rb_intern("__connect_signals__");
|
||||
|
||||
RG_TARGET_NAMESPACE = G_DEF_CLASS_WITH_GC_FUNC(GTK_TYPE_BUILDER, "Builder", mGtk,
|
||||
builder_mark, NULL);
|
||||
|
||||
G_DEF_CLASS(GTK_TYPE_BUILDER_ERROR, "BuilderError", mGtk);
|
||||
|
||||
RG_DEF_METHOD(initialize, 0);
|
||||
|
||||
RG_DEF_METHOD(add_from_file, 1);
|
||||
RG_DEF_METHOD(add_from_string, 1);
|
||||
RG_DEF_METHOD(add, 1);
|
||||
RG_DEF_ALIAS("<<", "add");
|
||||
|
||||
RG_DEF_METHOD(get_object, 1);
|
||||
RG_DEF_ALIAS("[]", "get_object");
|
||||
RG_DEF_METHOD(objects, 0);
|
||||
|
||||
RG_DEF_METHOD(connect_signals, 0);
|
||||
|
||||
RG_DEF_METHOD(get_type, 1);
|
||||
#endif
|
||||
}
|
||||
119
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkbutton.c
Normal file
119
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkbutton.c
Normal file
@@ -0,0 +1,119 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002-2004 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cButton
|
||||
#define _SELF(self) (GTK_BUTTON(RVAL2GOBJ(self)))
|
||||
|
||||
static VALUE
|
||||
rg_initialize(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE label, use_underline;
|
||||
GtkWidget *widget = NULL;
|
||||
|
||||
if (rb_scan_args(argc, argv, "02", &label, &use_underline) > 0) {
|
||||
if (TYPE(label) == T_STRING){
|
||||
if (NIL_P(use_underline) || RVAL2CBOOL(use_underline)){
|
||||
widget = gtk_button_new_with_mnemonic(RVAL2CSTR(label));
|
||||
} else {
|
||||
widget = gtk_button_new_with_label(RVAL2CSTR(label));
|
||||
}
|
||||
} else if (TYPE(label) == T_SYMBOL){
|
||||
widget = gtk_button_new_from_stock(rb_id2name(SYM2ID(label)));
|
||||
} else {
|
||||
rb_raise(rb_eArgError, "invalid argument %s (expect Symbol(Gtk::Stock constants) or String)",
|
||||
rb_class2name(CLASS_OF(label)));
|
||||
}
|
||||
} else {
|
||||
widget = gtk_button_new();
|
||||
}
|
||||
|
||||
RBGTK_INITIALIZE(self, widget);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_pressed(VALUE self)
|
||||
{
|
||||
gtk_button_pressed(GTK_BUTTON(RVAL2GOBJ(self)));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_released(VALUE self)
|
||||
{
|
||||
gtk_button_released(_SELF(self));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_enter(VALUE self)
|
||||
{
|
||||
gtk_button_enter(_SELF(self));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_leave(VALUE self)
|
||||
{
|
||||
gtk_button_leave(_SELF(self));
|
||||
return self;
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
static VALUE
|
||||
rg_set_alignment(VALUE self, VALUE xalign, VALUE yalign)
|
||||
{
|
||||
gtk_button_set_alignment(_SELF(self), NUM2DBL(xalign), NUM2DBL(yalign));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_alignment(VALUE self)
|
||||
{
|
||||
gfloat xalign, yalign;
|
||||
gtk_button_get_alignment(_SELF(self), &xalign, &yalign);
|
||||
|
||||
return rb_assoc_new(rb_float_new(xalign), rb_float_new(yalign));
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_button(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_BUTTON, "Button", mGtk);
|
||||
|
||||
RG_DEF_METHOD(initialize, -1);
|
||||
RG_DEF_METHOD(pressed, 0);
|
||||
RG_DEF_METHOD(released, 0);
|
||||
RG_DEF_METHOD(enter, 0);
|
||||
RG_DEF_METHOD(leave, 0);
|
||||
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
RG_DEF_METHOD(set_alignment, 2);
|
||||
G_DEF_SETTER(RG_TARGET_NAMESPACE, "alignment");
|
||||
RG_DEF_METHOD(alignment, 0);
|
||||
#endif
|
||||
}
|
||||
157
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcalendar.c
Normal file
157
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcalendar.c
Normal file
@@ -0,0 +1,157 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002-2004 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cCalendar
|
||||
#define _SELF(self) (GTK_CALENDAR(RVAL2GOBJ(self)))
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self)
|
||||
{
|
||||
RBGTK_INITIALIZE(self, gtk_calendar_new());
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_select_month(VALUE self, VALUE month, VALUE year)
|
||||
{
|
||||
gint ret = gtk_calendar_select_month(_SELF(self),
|
||||
NUM2INT(month)-1,
|
||||
NUM2INT(year));
|
||||
return INT2FIX(ret);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_select_day(VALUE self, VALUE day)
|
||||
{
|
||||
gtk_calendar_select_day(_SELF(self), NUM2INT(day));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_mark_day(VALUE self, VALUE day)
|
||||
{
|
||||
gtk_calendar_mark_day(_SELF(self), NUM2INT(day));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_unmark_day(VALUE self, VALUE day)
|
||||
{
|
||||
gtk_calendar_unmark_day(_SELF(self), NUM2INT(day));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_clear_marks(VALUE self)
|
||||
{
|
||||
gtk_calendar_clear_marks(_SELF(self));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_date(VALUE self)
|
||||
{
|
||||
VALUE ret;
|
||||
guint year, month, day;
|
||||
|
||||
gtk_calendar_get_date(_SELF(self), &year, &month, &day);
|
||||
ret = rb_ary_new();
|
||||
rb_ary_push(ret, INT2FIX(year));
|
||||
rb_ary_push(ret, INT2FIX(month+1));
|
||||
rb_ary_push(ret, INT2FIX(day));
|
||||
return ret;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_freeze(VALUE self)
|
||||
{
|
||||
gtk_calendar_freeze(_SELF(self));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_thaw(VALUE self)
|
||||
{
|
||||
gtk_calendar_thaw(_SELF(self));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_display_options(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE flags;
|
||||
rb_scan_args(argc, argv, "01", &flags);
|
||||
|
||||
if (NIL_P(flags)){
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
return GFLAGS2RVAL(gtk_calendar_get_display_options(_SELF(self)),
|
||||
GTK_TYPE_CALENDAR_DISPLAY_OPTIONS);
|
||||
#else
|
||||
rb_warn("Gtk::Calendar#display_options has supported since GTK+-2.4.");
|
||||
#endif
|
||||
} else {
|
||||
/* This is for backward compatibility. */
|
||||
rb_warning("Gtk::Calendar#display_options(flags) has been deprecated. Use Gtk::Calendar#set_display_options(flags).");
|
||||
gtk_calendar_display_options(_SELF(self),
|
||||
RVAL2GFLAGS(flags, GTK_TYPE_CALENDAR_DISPLAY_OPTIONS));
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
static VALUE
|
||||
rg_set_display_options(VALUE self, VALUE flags)
|
||||
{
|
||||
gtk_calendar_set_display_options(_SELF(self),
|
||||
RVAL2GFLAGS(flags,
|
||||
GTK_TYPE_CALENDAR_DISPLAY_OPTIONS));
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_calendar(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_CALENDAR, "Calendar", mGtk);
|
||||
|
||||
RG_DEF_METHOD(initialize, 0);
|
||||
RG_DEF_METHOD(select_month, 2);
|
||||
RG_DEF_METHOD(select_day, 1);
|
||||
RG_DEF_METHOD(mark_day, 1);
|
||||
RG_DEF_METHOD(unmark_day, 1);
|
||||
RG_DEF_METHOD(clear_marks, 0);
|
||||
RG_DEF_METHOD(date, 0);
|
||||
RG_DEF_METHOD(freeze, 0);
|
||||
RG_DEF_METHOD(thaw, 0);
|
||||
RG_DEF_METHOD(display_options, -1);
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
RG_DEF_METHOD(set_display_options, 1);
|
||||
G_DEF_SETTER(RG_TARGET_NAMESPACE, "display_options");
|
||||
#endif
|
||||
|
||||
G_DEF_CLASS(GTK_TYPE_CALENDAR_DISPLAY_OPTIONS, "DisplayOptions", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_CALENDAR_DISPLAY_OPTIONS, "GTK_CALENDAR_");
|
||||
}
|
||||
57
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcelleditable.c
Normal file
57
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcelleditable.c
Normal file
@@ -0,0 +1,57 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE mCellEditable
|
||||
#define _SELF(s) (GTK_CELL_EDITABLE(RVAL2GOBJ(s)))
|
||||
|
||||
static VALUE
|
||||
rg_start_editing(VALUE self, VALUE event)
|
||||
{
|
||||
gtk_cell_editable_start_editing(_SELF(self),
|
||||
NIL_P(event) ? NULL : RVAL2GEV(event));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_editing_done(VALUE self)
|
||||
{
|
||||
gtk_cell_editable_editing_done(_SELF(self));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_remove_widget(VALUE self)
|
||||
{
|
||||
gtk_cell_editable_remove_widget(_SELF(self));
|
||||
return self;
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_celleditable(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(GTK_TYPE_CELL_EDITABLE, "CellEditable", mGtk);
|
||||
|
||||
RG_DEF_METHOD(start_editing, 1);
|
||||
RG_DEF_METHOD(editing_done, 0);
|
||||
RG_DEF_METHOD(remove_widget, 0);
|
||||
}
|
||||
142
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcelllayout.c
Normal file
142
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcelllayout.c
Normal file
@@ -0,0 +1,142 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2004 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
|
||||
#define RG_TARGET_NAMESPACE mCellLayout
|
||||
#define _SELF(s) (GTK_CELL_LAYOUT(RVAL2GOBJ(s)))
|
||||
#define RVAL2RENDERER(s) (GTK_CELL_RENDERER(RVAL2GOBJ(s)))
|
||||
|
||||
static VALUE
|
||||
rg_pack_start(VALUE self, VALUE cell, VALUE expand)
|
||||
{
|
||||
gtk_cell_layout_pack_start(_SELF(self), RVAL2RENDERER(cell),
|
||||
RVAL2CBOOL(expand));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_pack_end(VALUE self, VALUE cell, VALUE expand)
|
||||
{
|
||||
gtk_cell_layout_pack_end(_SELF(self), RVAL2RENDERER(cell),
|
||||
RVAL2CBOOL(expand));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_reorder(VALUE self, VALUE cell, VALUE position)
|
||||
{
|
||||
gtk_cell_layout_reorder(_SELF(self), RVAL2RENDERER(cell),
|
||||
NUM2INT(position));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_clear(VALUE self)
|
||||
{
|
||||
gtk_cell_layout_clear(_SELF(self));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_add_attribute(VALUE self, VALUE cell, VALUE attribute, VALUE column)
|
||||
{
|
||||
const gchar *name;
|
||||
|
||||
if (SYMBOL_P(attribute)) {
|
||||
name = rb_id2name(SYM2ID(attribute));
|
||||
} else {
|
||||
name = RVAL2CSTR(attribute);
|
||||
}
|
||||
|
||||
gtk_cell_layout_add_attribute(_SELF(self), RVAL2RENDERER(cell),
|
||||
name, NUM2INT(column));
|
||||
return self;
|
||||
}
|
||||
|
||||
static void
|
||||
layout_data_func(GtkCellLayout *layout, GtkCellRenderer *cell, GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer func)
|
||||
{
|
||||
iter->user_data3 = tree_model;
|
||||
rb_funcall((VALUE)func, id_call, 4, GOBJ2RVAL(layout), GOBJ2RVAL(cell),
|
||||
GOBJ2RVAL(tree_model), GTKTREEITER2RVAL(iter));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_cell_data_func(VALUE self, VALUE cell)
|
||||
{
|
||||
if (rb_block_given_p()) {
|
||||
VALUE func = rb_block_proc();
|
||||
G_RELATIVE(self, func);
|
||||
gtk_cell_layout_set_cell_data_func(_SELF(self), RVAL2RENDERER(cell),
|
||||
(GtkCellLayoutDataFunc)layout_data_func,
|
||||
(gpointer)func, NULL);
|
||||
} else {
|
||||
gtk_cell_layout_set_cell_data_func(_SELF(self), RVAL2RENDERER(cell),
|
||||
NULL, (gpointer)NULL, NULL);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_clear_attributes(VALUE self, VALUE cell)
|
||||
{
|
||||
gtk_cell_layout_clear_attributes(_SELF(self), RVAL2RENDERER(cell));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_attributes(VALUE self, VALUE cell, VALUE attrs)
|
||||
{
|
||||
gint i;
|
||||
VALUE ary;
|
||||
Check_Type(attrs, T_HASH);
|
||||
|
||||
rg_clear_attributes(self, cell);
|
||||
|
||||
ary = rb_funcall(attrs, rb_intern("to_a"), 0);
|
||||
for (i = 0; i < RARRAY_LEN(ary); i++){
|
||||
rg_add_attribute(self, cell,
|
||||
RARRAY_PTR(RARRAY_PTR(ary)[i])[0],
|
||||
RARRAY_PTR(RARRAY_PTR(ary)[i])[1]);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_celllayout(VALUE mGtk)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(GTK_TYPE_CELL_LAYOUT, "CellLayout", mGtk);
|
||||
|
||||
RG_DEF_METHOD(pack_start, 2);
|
||||
RG_DEF_METHOD(pack_end, 2);
|
||||
RG_DEF_METHOD(reorder, 2);
|
||||
RG_DEF_METHOD(clear, 0);
|
||||
RG_DEF_METHOD(add_attribute, 3);
|
||||
RG_DEF_METHOD(set_cell_data_func, 1);
|
||||
RG_DEF_METHOD(clear_attributes, 1);
|
||||
RG_DEF_METHOD(set_attributes, 2);
|
||||
#endif
|
||||
}
|
||||
139
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcellrenderer.c
Normal file
139
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcellrenderer.c
Normal file
@@ -0,0 +1,139 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002-2005 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cCellRenderer
|
||||
#define _SELF(s) (GTK_CELL_RENDERER(RVAL2GOBJ(s)))
|
||||
#define RVAL2RECT(r) ((GdkRectangle*)RVAL2BOXED(r, GDK_TYPE_RECTANGLE))
|
||||
#define RECT2RVAL(r) (BOXED2RVAL(r, GDK_TYPE_RECTANGLE))
|
||||
|
||||
static VALUE
|
||||
rg_get_size(VALUE self, VALUE widget, VALUE cell_area)
|
||||
{
|
||||
GdkRectangle ret;
|
||||
|
||||
gtk_cell_renderer_get_size(_SELF(self), GTK_WIDGET(RVAL2GOBJ(widget)),
|
||||
RVAL2RECT(cell_area),
|
||||
&ret.x, &ret.y, &ret.width, &ret.height);
|
||||
return RECT2RVAL(&ret);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_render(VALUE self, VALUE window, VALUE widget, VALUE background_area, VALUE cell_area, VALUE expose_area, VALUE flags)
|
||||
{
|
||||
gtk_cell_renderer_render(_SELF(self), GDK_WINDOW(RVAL2GOBJ(window)),
|
||||
GTK_WIDGET(RVAL2GOBJ(widget)),
|
||||
RVAL2RECT(background_area),
|
||||
RVAL2RECT(cell_area),
|
||||
RVAL2RECT(expose_area),
|
||||
RVAL2GFLAGS(flags, GTK_TYPE_CELL_RENDERER_STATE));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_activate(VALUE self, VALUE event, VALUE widget, VALUE path, VALUE background_area, VALUE cell_area, VALUE flags)
|
||||
{
|
||||
gboolean ret =
|
||||
gtk_cell_renderer_activate(_SELF(self), (GdkEvent*)RVAL2GEV(event),
|
||||
GTK_WIDGET(RVAL2GOBJ(widget)),
|
||||
RVAL2CSTR(path), RVAL2RECT(background_area),
|
||||
RVAL2RECT(cell_area),
|
||||
RVAL2GFLAGS(flags, GTK_TYPE_CELL_RENDERER_STATE));
|
||||
return CBOOL2RVAL(ret);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_start_editing(VALUE self, VALUE event, VALUE widget, VALUE path, VALUE background_area, VALUE cell_area, VALUE flags)
|
||||
{
|
||||
GtkCellEditable* edit =
|
||||
gtk_cell_renderer_start_editing(_SELF(self), (GdkEvent*)RVAL2GEV(event),
|
||||
GTK_WIDGET(RVAL2GOBJ(widget)),
|
||||
RVAL2CSTR(path), RVAL2RECT(background_area),
|
||||
RVAL2RECT(cell_area),
|
||||
RVAL2GFLAGS(flags, GTK_TYPE_CELL_RENDERER_STATE));
|
||||
return edit ? GOBJ2RVAL(edit) : Qnil;
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
#ifndef GTK_DISABLE_DEPRECATED
|
||||
static VALUE
|
||||
rg_editing_canceled(VALUE self)
|
||||
{
|
||||
gtk_cell_renderer_editing_canceled(_SELF(self));
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
static VALUE
|
||||
rg_stop_editing(VALUE self, VALUE canceled)
|
||||
{
|
||||
gtk_cell_renderer_stop_editing(_SELF(self), RVAL2CBOOL(canceled));
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
rg_fixed_size(VALUE self)
|
||||
{
|
||||
int width, height;
|
||||
gtk_cell_renderer_get_fixed_size(_SELF(self), &width, &height);
|
||||
return rb_ary_new3(2, INT2NUM(width), INT2NUM(height));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_fixed_size(VALUE self, VALUE width, VALUE height)
|
||||
{
|
||||
gtk_cell_renderer_set_fixed_size(_SELF(self), NUM2INT(width),
|
||||
NUM2INT(height));
|
||||
return self;
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_cellrenderer(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_CELL_RENDERER, "CellRenderer", mGtk);
|
||||
|
||||
RG_DEF_METHOD(get_size, 2);
|
||||
RG_DEF_METHOD(render, 6);
|
||||
RG_DEF_METHOD(activate, 6);
|
||||
RG_DEF_METHOD(start_editing, 6);
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
#ifndef GTK_DISABLE_DEPRECATED
|
||||
RG_DEF_METHOD(editing_canceled, 0);
|
||||
#endif
|
||||
#endif
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
RG_DEF_METHOD(stop_editing, 1);
|
||||
#endif
|
||||
RG_DEF_METHOD(fixed_size, 0);
|
||||
RG_DEF_METHOD(set_fixed_size, 2);
|
||||
|
||||
/* GtkCellRendererState */
|
||||
G_DEF_CLASS(GTK_TYPE_CELL_RENDERER_STATE, "State", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_CELL_RENDERER_STATE, "GTK_CELL_RENDERER_");
|
||||
|
||||
/* GtkCellRendererMode */
|
||||
G_DEF_CLASS(GTK_TYPE_CELL_RENDERER_MODE, "Mode", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_CELL_RENDERER_MODE, "GTK_CELL_RENDERER_");
|
||||
}
|
||||
49
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcellrendereraccel.c
Normal file
49
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcellrendereraccel.c
Normal file
@@ -0,0 +1,49 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2006 Ruby-GNOME2 Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#if GTK_CHECK_VERSION(2,10,0)
|
||||
|
||||
#define RG_TARGET_NAMESPACE cCellRendererAccel
|
||||
#define _SELF(s) (GTK_CELL_RENDERER_ACCEL(RVAL2GOBJ(s)))
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self)
|
||||
{
|
||||
RBGTK_INITIALIZE(self, gtk_cell_renderer_accel_new());
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_cellrendereraccel(VALUE mGtk)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(2,10,0)
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_CELL_RENDERER_ACCEL, "CellRendererAccel", mGtk);
|
||||
RG_DEF_METHOD(initialize, 0);
|
||||
|
||||
/* GtkCellRendererAccelMode */
|
||||
G_DEF_CLASS(GTK_TYPE_CELL_RENDERER_ACCEL_MODE, "Mode", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_CELL_RENDERER_ACCEL_MODE, "GTK_CELL_RENDERER_ACCEL_");
|
||||
#endif
|
||||
}
|
||||
44
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcellrenderercombo.c
Normal file
44
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcellrenderercombo.c
Normal file
@@ -0,0 +1,44 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2004 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
|
||||
#define RG_TARGET_NAMESPACE cCellRendererCombo
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self)
|
||||
{
|
||||
RBGTK_INITIALIZE(self, gtk_cell_renderer_combo_new());
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_cellrenderercombo(VALUE mGtk)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_CELL_RENDERER_COMBO, "CellRendererCombo", mGtk);
|
||||
RG_DEF_METHOD(initialize, 0);
|
||||
#endif
|
||||
}
|
||||
39
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcellrendererpixbuf.c
Normal file
39
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcellrendererpixbuf.c
Normal file
@@ -0,0 +1,39 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cCellRendererPixbuf
|
||||
#define _SELF(s) (GTK_CELL_RENDERER_PIXBUF(RVAL2GOBJ(s)))
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self)
|
||||
{
|
||||
RBGTK_INITIALIZE(self, gtk_cell_renderer_pixbuf_new());
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_cellrendererpixbuf(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_CELL_RENDERER_PIXBUF, "CellRendererPixbuf", mGtk);
|
||||
RG_DEF_METHOD(initialize, 0);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2004 Darren Willis
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
|
||||
#define RG_TARGET_NAMESPACE cCellRendererProgress
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self)
|
||||
{
|
||||
RBGTK_INITIALIZE(self, gtk_cell_renderer_progress_new());
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_cellrendererprogress(VALUE mGtk)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_CELL_RENDERER_PROGRESS, "CellRendererProgress", mGtk);
|
||||
RG_DEF_METHOD(initialize, 0);
|
||||
#endif
|
||||
}
|
||||
45
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcellrendererspin.c
Normal file
45
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcellrendererspin.c
Normal file
@@ -0,0 +1,45 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2006 Ruby-GNOME2 Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#if GTK_CHECK_VERSION(2,10,0)
|
||||
|
||||
#define RG_TARGET_NAMESPACE cCellRendererSpin
|
||||
#define _SELF(s) (GTK_CELL_RENDERER_SPIN(RVAL2GOBJ(s)))
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self)
|
||||
{
|
||||
RBGTK_INITIALIZE(self, gtk_cell_renderer_spin_new());
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_cellrendererspin(VALUE mGtk)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(2,10,0)
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_CELL_RENDERER_SPIN, "CellRendererSpin", mGtk);
|
||||
RG_DEF_METHOD(initialize, 0);
|
||||
#endif
|
||||
}
|
||||
44
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcellrendererspinner.c
Normal file
44
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcellrendererspinner.c
Normal file
@@ -0,0 +1,44 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#if GTK_CHECK_VERSION(2,20,0)
|
||||
|
||||
#define RG_TARGET_NAMESPACE cCellRendererSpinner
|
||||
#define _SELF(s) (GTK_CELL_RENDERER_SPINNER(RVAL2GOBJ(s)))
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self)
|
||||
{
|
||||
RBGTK_INITIALIZE(self, gtk_cell_renderer_spinner_new());
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_cellrendererspinner(VALUE mGtk)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(2,20,0)
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_CELL_RENDERER_SPINNER, "CellRendererSpinner", mGtk);
|
||||
RG_DEF_METHOD(initialize, 0);
|
||||
#endif
|
||||
}
|
||||
49
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcellrenderertext.c
Normal file
49
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcellrenderertext.c
Normal file
@@ -0,0 +1,49 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cCellRendererText
|
||||
#define _SELF(s) (GTK_CELL_RENDERER_TEXT(RVAL2GOBJ(s)))
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self)
|
||||
{
|
||||
RBGTK_INITIALIZE(self, gtk_cell_renderer_text_new());
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_fixed_height_from_font(VALUE self, VALUE number_of_rows)
|
||||
{
|
||||
gtk_cell_renderer_text_set_fixed_height_from_font(_SELF(self), NUM2INT(number_of_rows));
|
||||
return self;
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_cellrenderertext(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_CELL_RENDERER_TEXT, "CellRendererText", mGtk);
|
||||
|
||||
RG_DEF_METHOD(initialize, 0);
|
||||
RG_DEF_METHOD(set_fixed_height_from_font, 1);
|
||||
G_DEF_SETTER(RG_TARGET_NAMESPACE, "fixed_height_from_font");
|
||||
}
|
||||
39
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcellrenderertoggle.c
Normal file
39
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcellrenderertoggle.c
Normal file
@@ -0,0 +1,39 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cCellRendererToggle
|
||||
#define _SELF(s) (GTK_CELL_RENDERER_TOGGLE(RVAL2GOBJ(s)))
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self)
|
||||
{
|
||||
RBGTK_INITIALIZE(self, gtk_cell_renderer_toggle_new());
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_cellrenderertoggle(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_CELL_RENDERER_TOGGLE, "CellRendererToggle", mGtk);
|
||||
RG_DEF_METHOD(initialize, 0);
|
||||
}
|
||||
122
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcellview.c
Normal file
122
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcellview.c
Normal file
@@ -0,0 +1,122 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2005,2006 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
|
||||
#define RG_TARGET_NAMESPACE cCellView
|
||||
#define _SELF(self) (GTK_CELL_VIEW(RVAL2GOBJ(self)))
|
||||
|
||||
static ID id_model;
|
||||
static ID id_text;
|
||||
|
||||
static VALUE
|
||||
rg_initialize(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE text;
|
||||
VALUE with_markup = Qnil;
|
||||
GtkWidget *widget = NULL;
|
||||
|
||||
rb_scan_args(argc, argv, "02", &text, &with_markup);
|
||||
|
||||
if (NIL_P(text)) {
|
||||
widget = gtk_cell_view_new();
|
||||
} else {
|
||||
G_CHILD_SET(self, id_text, text);
|
||||
if (TYPE(text) == T_STRING){
|
||||
if (NIL_P(with_markup) || RVAL2CBOOL(with_markup)){
|
||||
widget = gtk_cell_view_new_with_markup(RVAL2CSTR(text));
|
||||
} else {
|
||||
widget = gtk_cell_view_new_with_text(RVAL2CSTR(text));
|
||||
}
|
||||
} else if (rb_obj_is_kind_of(text, GTYPE2CLASS(GDK_TYPE_PIXBUF))){
|
||||
widget = gtk_cell_view_new_with_pixbuf(GDK_PIXBUF(RVAL2GOBJ(text)));
|
||||
} else {
|
||||
rb_raise(rb_eArgError,
|
||||
"invalid argument %s (expect String or Gdk::Pixbuf)",
|
||||
rb_class2name(CLASS_OF(text)));
|
||||
}
|
||||
}
|
||||
|
||||
RBGTK_INITIALIZE(self, widget);
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_displayed_row(VALUE self, VALUE path)
|
||||
{
|
||||
gtk_cell_view_set_displayed_row(_SELF(self),
|
||||
NIL_P(path) ? (GtkTreePath*)NULL :
|
||||
RVAL2GTKTREEPATH(path));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_displayed_row(VALUE self)
|
||||
{
|
||||
return GTKTREEPATH2RVAL(gtk_cell_view_get_displayed_row(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_get_size_of_row(VALUE self, VALUE path)
|
||||
{
|
||||
GtkRequisition req;
|
||||
gboolean ret = gtk_cell_view_get_size_of_row(_SELF(self),
|
||||
RVAL2GTKTREEPATH(path),
|
||||
&req);
|
||||
if (! ret)
|
||||
rb_raise(rb_eRuntimeError, "Can't get the value");
|
||||
|
||||
return rb_ary_assoc(INT2NUM(req.width), INT2NUM(req.height));
|
||||
}
|
||||
|
||||
/* Use Gtk::CellView#background_gdk(Gdk::Color) instead.
|
||||
void gtk_cell_view_set_background_color
|
||||
(GtkCellView *cell_view,
|
||||
const GdkColor *color);
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
rg_cell_renderers(VALUE self)
|
||||
{
|
||||
return GLIST2ARYF(gtk_cell_view_get_cell_renderers(_SELF(self)));
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_cellview(VALUE mGtk)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_CELL_VIEW, "CellView", mGtk);
|
||||
|
||||
id_model = rb_intern("model");
|
||||
id_text = rb_intern("text");
|
||||
|
||||
RG_DEF_METHOD(initialize, -1);
|
||||
RG_DEF_METHOD(set_displayed_row, 1);
|
||||
G_DEF_SETTER(RG_TARGET_NAMESPACE, "displayed_row");
|
||||
RG_DEF_METHOD(displayed_row, 0);
|
||||
RG_DEF_METHOD(get_size_of_row, 1);
|
||||
RG_DEF_METHOD(cell_renderers, 0);
|
||||
#endif
|
||||
}
|
||||
64
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcheckbutton.c
Normal file
64
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcheckbutton.c
Normal file
@@ -0,0 +1,64 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cCheckButton
|
||||
|
||||
static VALUE
|
||||
rg_initialize(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE label, use_underline;
|
||||
GtkWidget *widget;
|
||||
|
||||
if (rb_scan_args(argc, argv, "02", &label, &use_underline) > 0) {
|
||||
if (TYPE(label) == T_STRING){
|
||||
if (NIL_P(use_underline) || RVAL2CBOOL(use_underline)){
|
||||
widget = gtk_check_button_new_with_mnemonic(RVAL2CSTR(label));
|
||||
} else {
|
||||
widget = gtk_check_button_new_with_label(RVAL2CSTR(label));
|
||||
}
|
||||
} else if (TYPE(label) == T_SYMBOL){
|
||||
widget = gtk_check_button_new_with_label(rb_id2name(SYM2ID(label)));
|
||||
gtk_button_set_use_stock(GTK_BUTTON(widget), TRUE);
|
||||
} else {
|
||||
rb_raise(rb_eArgError, "invalid argument %s (expect Symbol(Gtk::Stock constants) or String)",
|
||||
rb_class2name(CLASS_OF(label)));
|
||||
}
|
||||
}
|
||||
else {
|
||||
widget = gtk_check_button_new();
|
||||
}
|
||||
|
||||
RBGTK_INITIALIZE(self, widget);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_check_button(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_CHECK_BUTTON, "CheckButton", mGtk);
|
||||
|
||||
RG_DEF_METHOD(initialize, -1);
|
||||
}
|
||||
64
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcheckmenuitem.c
Normal file
64
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcheckmenuitem.c
Normal file
@@ -0,0 +1,64 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cCheckMenuItem
|
||||
|
||||
static VALUE
|
||||
rg_initialize(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE label, use_underline;
|
||||
GtkWidget *widget = NULL;
|
||||
|
||||
if (rb_scan_args(argc, argv, "02", &label, &use_underline) > 0) {
|
||||
if (NIL_P(use_underline) || RVAL2CBOOL(use_underline)){
|
||||
widget = gtk_check_menu_item_new_with_mnemonic(RVAL2CSTR(label));
|
||||
} else {
|
||||
widget = gtk_check_menu_item_new_with_label(RVAL2CSTR(label));
|
||||
}
|
||||
}
|
||||
else {
|
||||
widget = gtk_check_menu_item_new();
|
||||
}
|
||||
|
||||
RBGTK_INITIALIZE(self, widget);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_toggled(VALUE self)
|
||||
{
|
||||
gtk_check_menu_item_toggled(GTK_CHECK_MENU_ITEM(RVAL2GOBJ(self)));
|
||||
return self;
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_check_menu_item(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_CHECK_MENU_ITEM, "CheckMenuItem", mGtk);
|
||||
|
||||
RG_DEF_METHOD(initialize, -1);
|
||||
RG_DEF_METHOD(toggled, 0);
|
||||
}
|
||||
473
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkclipboard.c
Normal file
473
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkclipboard.c
Normal file
@@ -0,0 +1,473 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2004,2006 Ruby-GNOME2 Project
|
||||
* Copyright (C) 2002,2003 OGASAWARA, Takeshi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cClipboard
|
||||
#define _SELF(s) RVAL2CLIPBOARD(s)
|
||||
|
||||
#ifndef GTK_TYPE_CLIPBOARD
|
||||
static GtkClipboard*
|
||||
clipboard_copy(const GtkClipboard *clipboard)
|
||||
{
|
||||
/* I don't know how to copy this object ... */
|
||||
return (GtkClipboard*)clipboard;
|
||||
}
|
||||
|
||||
GType
|
||||
rbgtk_clipboard_get_type()
|
||||
{
|
||||
static GType our_type = 0;
|
||||
if(our_type == 0)
|
||||
our_type = g_boxed_type_register_static("GtkClipboard",
|
||||
(GBoxedCopyFunc)clipboard_copy,
|
||||
(GBoxedFreeFunc)g_free);
|
||||
return our_type;
|
||||
}
|
||||
|
||||
GtkClipboard*
|
||||
rbgtk_get_clipboard(VALUE obj)
|
||||
{
|
||||
return GTK_CLIPBOARD(RVAL2GOBJ(obj));
|
||||
}
|
||||
|
||||
VALUE
|
||||
rbgtk_make_clipboard(GtkClipboard *gobj)
|
||||
{
|
||||
return GOBJ2RVAL(gobj);
|
||||
}
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
rg_s_get(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
GtkClipboard *clipboard;
|
||||
|
||||
if (argc == 1){
|
||||
VALUE selection;
|
||||
rb_scan_args(argc, argv, "10", &selection);
|
||||
clipboard = gtk_clipboard_get(RVAL2ATOM(selection));
|
||||
} else {
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
VALUE display, selection;
|
||||
rb_scan_args(argc, argv, "20", &display, &selection);
|
||||
clipboard = gtk_clipboard_get_for_display(GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)),
|
||||
RVAL2ATOM(selection));
|
||||
#else
|
||||
rb_raise(rb_eArgError, "Wrong number of arguments: %d", argc);
|
||||
#endif
|
||||
}
|
||||
return CLIPBOARD2RVAL(clipboard);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_display(VALUE self)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
return GOBJ2RVAL(gtk_clipboard_get_display(_SELF(self)));
|
||||
#else
|
||||
return Qnil;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
clipboard_get_func(GtkClipboard *clipboard, GtkSelectionData *selection_data, G_GNUC_UNUSED guint info, gpointer func)
|
||||
{
|
||||
rb_funcall((VALUE)func, id_call, 2, CLIPBOARD2RVAL(clipboard),
|
||||
BOXED2RVAL(selection_data, GTK_TYPE_SELECTION_DATA));
|
||||
}
|
||||
|
||||
struct clipboard_set_args {
|
||||
VALUE self;
|
||||
VALUE targets;
|
||||
VALUE func;
|
||||
};
|
||||
|
||||
static VALUE
|
||||
clipboard_set_body(VALUE value)
|
||||
{
|
||||
struct clipboard_set_args *args = (struct clipboard_set_args *)value;
|
||||
GtkClipboard *clipboard = _SELF(args->self);
|
||||
long n;
|
||||
GtkTargetEntry *targets = RVAL2GTKTARGETENTRIES(args->targets, &n);
|
||||
gboolean result = gtk_clipboard_set_with_data(clipboard,
|
||||
targets,
|
||||
n,
|
||||
(GtkClipboardGetFunc)clipboard_get_func,
|
||||
(GtkClipboardClearFunc)NULL,
|
||||
(gpointer)args->func);
|
||||
|
||||
g_free(targets);
|
||||
|
||||
return CBOOL2RVAL(result);
|
||||
}
|
||||
|
||||
static G_GNUC_NORETURN VALUE
|
||||
clipboard_set_rescue(VALUE value)
|
||||
{
|
||||
struct clipboard_set_args *args = (struct clipboard_set_args *)value;
|
||||
|
||||
G_CHILD_REMOVE(args->self, args->func);
|
||||
|
||||
rb_exc_raise(rb_errinfo());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set(VALUE self, VALUE targets)
|
||||
{
|
||||
struct clipboard_set_args args = { self, targets, rb_block_proc() };
|
||||
|
||||
G_CHILD_ADD(self, args.func);
|
||||
|
||||
return rb_rescue(clipboard_set_body, (VALUE)&args,
|
||||
clipboard_set_rescue, (VALUE)&args);
|
||||
}
|
||||
|
||||
/*
|
||||
Do not implement this. Use Gtk::Clipboard#set_with_data instead.
|
||||
gboolean gtk_clipboard_set_with_owner (GtkClipboard *clipboard,
|
||||
const GtkTargetEntry *targets,
|
||||
guint n_targets,
|
||||
GtkClipboardGetFunc get_func,
|
||||
GtkClipboardClearFunc clear_func,
|
||||
GObject *owner);
|
||||
|
||||
static VALUE
|
||||
rg_owner(VALUE self)
|
||||
{
|
||||
GObject *gobj;
|
||||
gobj = gtk_clipboard_get_owner(_SELF(self));
|
||||
return gobj ? GOBJ2RVAL(gobj) : Qnil;
|
||||
}
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
rg_clear(VALUE self)
|
||||
{
|
||||
gtk_clipboard_clear(_SELF(self));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_text(VALUE self, VALUE text)
|
||||
{
|
||||
StringValue(text);
|
||||
gtk_clipboard_set_text(_SELF(self), RVAL2CSTR(text), RSTRING_LEN(text));
|
||||
return self;
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
static VALUE
|
||||
rg_set_image(VALUE self, VALUE pixbuf)
|
||||
{
|
||||
gtk_clipboard_set_image(_SELF(self), GDK_PIXBUF(RVAL2GOBJ(pixbuf)));
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
clipboard_received_func(GtkClipboard *clipboard, GtkSelectionData *selection_data, gpointer func)
|
||||
{
|
||||
rb_funcall((VALUE)func, id_call, 2, CLIPBOARD2RVAL(clipboard),
|
||||
BOXED2RVAL(selection_data, GTK_TYPE_SELECTION_DATA));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_request_contents(VALUE self, VALUE target)
|
||||
{
|
||||
VALUE func = rb_block_proc();
|
||||
G_RELATIVE(self, func);
|
||||
gtk_clipboard_request_contents(_SELF(self), RVAL2ATOM(target),
|
||||
(GtkClipboardReceivedFunc)clipboard_received_func,
|
||||
(gpointer)func);
|
||||
return self;
|
||||
}
|
||||
|
||||
static void
|
||||
clipboard_text_received_func(GtkClipboard *clipboard, const gchar *text,
|
||||
gpointer func)
|
||||
{
|
||||
VALUE vtext = Qnil;
|
||||
if (text) {
|
||||
vtext = CSTR2RVAL(text);
|
||||
}
|
||||
|
||||
rb_funcall((VALUE)func, id_call, 2, CLIPBOARD2RVAL(clipboard), vtext);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_request_text(VALUE self)
|
||||
{
|
||||
VALUE func = rb_block_proc();
|
||||
G_RELATIVE(self, func);
|
||||
gtk_clipboard_request_text(_SELF(self),
|
||||
(GtkClipboardTextReceivedFunc)clipboard_text_received_func,
|
||||
(gpointer)func);
|
||||
return self;
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
static void
|
||||
clipboard_image_received_func(GtkClipboard *clipboard, GdkPixbuf *pixbuf, gpointer func)
|
||||
{
|
||||
rb_funcall((VALUE)func, id_call, 2, CLIPBOARD2RVAL(clipboard),
|
||||
GOBJ2RVAL(pixbuf));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_request_image(VALUE self)
|
||||
{
|
||||
VALUE func = rb_block_proc();
|
||||
G_RELATIVE(self, func);
|
||||
gtk_clipboard_request_image(_SELF(self),
|
||||
(GtkClipboardImageReceivedFunc)clipboard_image_received_func,
|
||||
(gpointer)func);
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
static void
|
||||
clipboard_target_received_func(GtkClipboard *clipboard, GdkAtom *atoms, gint n_atoms, gpointer func)
|
||||
{
|
||||
gint i;
|
||||
VALUE ary = rb_ary_new();
|
||||
for (i = 0; i < n_atoms; i++){
|
||||
rb_ary_push(ary, BOXED2RVAL(atoms[i], GDK_TYPE_ATOM));
|
||||
}
|
||||
|
||||
rb_funcall((VALUE)func, id_call, 2, CLIPBOARD2RVAL(clipboard), ary);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_request_targets(VALUE self)
|
||||
{
|
||||
VALUE func = rb_block_proc();
|
||||
G_RELATIVE(self, func);
|
||||
|
||||
gtk_clipboard_request_targets(_SELF(self),
|
||||
(GtkClipboardTargetsReceivedFunc)clipboard_target_received_func,
|
||||
(gpointer)func);
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GTK_CHECK_VERSION(2,10,0)
|
||||
static void
|
||||
clipboard_rich_text_received_func(GtkClipboard *clipboard, GdkAtom format, const guint8 *text, gsize length, gpointer func)
|
||||
{
|
||||
rb_funcall((VALUE)func, id_call, 3, CLIPBOARD2RVAL(clipboard),
|
||||
BOXED2RVAL(format, GDK_TYPE_ATOM), rb_str_new((char*)text, length));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_request_rich_text(VALUE self, VALUE buffer)
|
||||
{
|
||||
VALUE func = rb_block_proc();
|
||||
G_RELATIVE(self, func);
|
||||
|
||||
gtk_clipboard_request_rich_text(_SELF(self), GTK_TEXT_BUFFER(RVAL2GOBJ(buffer)),
|
||||
(GtkClipboardRichTextReceivedFunc)clipboard_rich_text_received_func,
|
||||
(gpointer)func);
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
rg_wait_for_contents(VALUE self, VALUE target)
|
||||
{
|
||||
return BOXED2RVAL(gtk_clipboard_wait_for_contents(
|
||||
_SELF(self),
|
||||
RVAL2ATOM(target)),
|
||||
GTK_TYPE_SELECTION_DATA);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_wait_for_text(VALUE self)
|
||||
{
|
||||
gchar *str;
|
||||
str = gtk_clipboard_wait_for_text(_SELF(self));
|
||||
return str ? CSTR2RVAL(str) : Qnil;
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
static VALUE
|
||||
rg_wait_for_image(VALUE self)
|
||||
{
|
||||
GdkPixbuf* pixbuf = gtk_clipboard_wait_for_image(_SELF(self));
|
||||
return GOBJ2RVAL(pixbuf);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GTK_CHECK_VERSION(2,10,0)
|
||||
static VALUE
|
||||
rg_wait_for_rich_text(VALUE self, VALUE buffer)
|
||||
{
|
||||
GdkAtom format;
|
||||
gsize length;
|
||||
guint8* data = gtk_clipboard_wait_for_rich_text(_SELF(self),
|
||||
GTK_TEXT_BUFFER(RVAL2GOBJ(buffer)),
|
||||
&format, &length);
|
||||
if (data){
|
||||
VALUE str = rb_str_new((char*)data, length);
|
||||
g_free(data);
|
||||
return rb_assoc_new(str, BOXED2RVAL(format, GDK_TYPE_ATOM));
|
||||
} else {
|
||||
return rb_assoc_new(Qnil, BOXED2RVAL(format, GDK_TYPE_ATOM));
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
rg_wait_is_text_available_p(VALUE self)
|
||||
{
|
||||
return CBOOL2RVAL(gtk_clipboard_wait_is_text_available(_SELF(self)));
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
static VALUE
|
||||
rg_wait_is_image_available_p(VALUE self)
|
||||
{
|
||||
return CBOOL2RVAL(gtk_clipboard_wait_is_image_available(_SELF(self)));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GTK_CHECK_VERSION(2,10,0)
|
||||
static VALUE
|
||||
rg_wait_is_rich_text_available_p(VALUE self, VALUE buffer)
|
||||
{
|
||||
return CBOOL2RVAL(gtk_clipboard_wait_is_rich_text_available(_SELF(self), GTK_TEXT_BUFFER(RVAL2GOBJ(buffer))));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
static VALUE
|
||||
rg_wait_for_targets(VALUE self)
|
||||
{
|
||||
gint i;
|
||||
VALUE ary = Qnil;
|
||||
GdkAtom* targets;
|
||||
gint n_targets = 0;
|
||||
gboolean ret = gtk_clipboard_wait_for_targets(_SELF(self), &targets, &n_targets);
|
||||
|
||||
if (ret){
|
||||
ary = rb_ary_new();
|
||||
for (i = 0; i < n_targets; i++){
|
||||
if ((GdkAtom)targets == (GdkAtom)GDK_NONE){
|
||||
rb_ary_push(ary, rb_eval_string("Gdk::Atom::NONE"));
|
||||
}
|
||||
else
|
||||
rb_ary_push(ary, BOXED2RVAL(targets, GDK_TYPE_ATOM));
|
||||
targets++;
|
||||
}
|
||||
/* How can I this ?
|
||||
g_free(&o_targets);
|
||||
*/
|
||||
}
|
||||
return ary;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
static VALUE
|
||||
rg_wait_is_target_available_p(VALUE self, VALUE target)
|
||||
{
|
||||
return CBOOL2RVAL(gtk_clipboard_wait_is_target_available(_SELF(self), RVAL2ATOM(target)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_can_store(VALUE self, VALUE rbtargets)
|
||||
{
|
||||
GtkClipboard *clipboard = _SELF(self);
|
||||
long n = 0;
|
||||
GtkTargetEntry *targets = RVAL2GTKTARGETENTRIES_ACCEPT_NIL(rbtargets, &n);
|
||||
|
||||
gtk_clipboard_set_can_store(clipboard, targets, n);
|
||||
|
||||
g_free(targets);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_store(VALUE self)
|
||||
{
|
||||
gtk_clipboard_store(_SELF(self));
|
||||
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_clipboard(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_CLIPBOARD, "Clipboard", mGtk);
|
||||
|
||||
RG_DEF_SMETHOD(get, -1);
|
||||
RG_DEF_METHOD(display, 0);
|
||||
RG_DEF_METHOD(set, 1);
|
||||
/*
|
||||
RG_DEF_METHOD(owner, 0);
|
||||
*/
|
||||
RG_DEF_METHOD(clear, 0);
|
||||
RG_DEF_METHOD(set_text, 1);
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
RG_DEF_METHOD(set_image, 1);
|
||||
#endif
|
||||
RG_DEF_METHOD(request_contents, 1);
|
||||
RG_DEF_METHOD(request_text, 0);
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
RG_DEF_METHOD(request_image, 0);
|
||||
#endif
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
RG_DEF_METHOD(request_targets, 0);
|
||||
#endif
|
||||
#if GTK_CHECK_VERSION(2,10,0)
|
||||
RG_DEF_METHOD(request_rich_text, 1);
|
||||
#endif
|
||||
RG_DEF_METHOD(wait_for_contents, 1);
|
||||
RG_DEF_METHOD(wait_for_text, 0);
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
RG_DEF_METHOD(wait_for_image, 0);
|
||||
#endif
|
||||
#if GTK_CHECK_VERSION(2,10,0)
|
||||
RG_DEF_METHOD(wait_for_rich_text, 1);
|
||||
#endif
|
||||
RG_DEF_METHOD_P(wait_is_text_available, 0);
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
RG_DEF_METHOD_P(wait_is_image_available, 0);
|
||||
#endif
|
||||
#if GTK_CHECK_VERSION(2,10,0)
|
||||
RG_DEF_METHOD_P(wait_is_rich_text_available, 1);
|
||||
#endif
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
RG_DEF_METHOD(wait_for_targets, 0);
|
||||
#endif
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
RG_DEF_METHOD_P(wait_is_target_available, 1);
|
||||
RG_DEF_METHOD(set_can_store, 1);
|
||||
RG_DEF_METHOD(store, 0);
|
||||
#endif
|
||||
|
||||
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
||||
}
|
||||
55
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcolorbutton.c
Normal file
55
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcolorbutton.c
Normal file
@@ -0,0 +1,55 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2004 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
|
||||
#define RG_TARGET_NAMESPACE cColorButton
|
||||
|
||||
static VALUE
|
||||
rg_initialize(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE color;
|
||||
GtkWidget* widget;
|
||||
|
||||
rb_scan_args(argc, argv, "01", &color);
|
||||
|
||||
if (NIL_P(color)){
|
||||
widget = gtk_color_button_new();
|
||||
} else {
|
||||
widget = gtk_color_button_new_with_color(RVAL2GDKCOLOR(color));
|
||||
}
|
||||
|
||||
RBGTK_INITIALIZE(self, widget);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_colorbutton(VALUE mGtk)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_COLOR_BUTTON, "ColorButton", mGtk);
|
||||
RG_DEF_METHOD(initialize, -1);
|
||||
#endif
|
||||
}
|
||||
215
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcolorsel.c
Normal file
215
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcolorsel.c
Normal file
@@ -0,0 +1,215 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cColorSelection
|
||||
#define _SELF(s) (GTK_COLOR_SELECTION(RVAL2GOBJ(self)))
|
||||
|
||||
static VALUE RG_TARGET_NAMESPACE;
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self)
|
||||
{
|
||||
RBGTK_INITIALIZE(self, gtk_color_selection_new());
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_previous_alpha(VALUE self)
|
||||
{
|
||||
return INT2NUM(gtk_color_selection_get_previous_alpha(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_previous_alpha(VALUE self, VALUE alpha)
|
||||
{
|
||||
gtk_color_selection_set_previous_alpha(_SELF(self), NUM2INT(alpha));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_previous_color(VALUE self, VALUE color)
|
||||
{
|
||||
gtk_color_selection_set_previous_color(_SELF(self), RVAL2GDKCOLOR(color));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_previous_color(VALUE self)
|
||||
{
|
||||
GdkColor color;
|
||||
gtk_color_selection_get_previous_color(_SELF(self), &color);
|
||||
return GDKCOLOR2RVAL(&color);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_adjusting_p(VALUE self)
|
||||
{
|
||||
return CBOOL2RVAL(gtk_color_selection_is_adjusting(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_palette_from_string(G_GNUC_UNUSED VALUE self, VALUE str)
|
||||
{
|
||||
GdkColor* gcolors;
|
||||
gint i, n_colors;
|
||||
VALUE ary = Qnil;
|
||||
gboolean ret = gtk_color_selection_palette_from_string(RVAL2CSTR(str),
|
||||
&gcolors, &n_colors);
|
||||
|
||||
if (ret) {
|
||||
ary = rb_ary_new();
|
||||
for (i = 0; i < n_colors; i++) {
|
||||
rb_ary_push(ary, GDKCOLOR2RVAL(&gcolors[i]));
|
||||
}
|
||||
}
|
||||
|
||||
return ary;
|
||||
}
|
||||
|
||||
struct rbgdk_rval2gdkcolors_args {
|
||||
VALUE ary;
|
||||
long n;
|
||||
GdkColor *result;
|
||||
};
|
||||
|
||||
static VALUE
|
||||
rbgdk_rval2gdkcolors_body(VALUE value)
|
||||
{
|
||||
long i;
|
||||
struct rbgdk_rval2gdkcolors_args *args = (struct rbgdk_rval2gdkcolors_args *)value;
|
||||
|
||||
for (i = 0; i < args->n; i++)
|
||||
args->result[i] = *RVAL2GDKCOLOR(RARRAY_PTR(args->ary)[i]);
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static G_GNUC_NORETURN VALUE
|
||||
rbgdk_rval2gdkcolors_rescue(VALUE value)
|
||||
{
|
||||
g_free(((struct rbgdk_rval2gdkcolors_args *)value)->result);
|
||||
|
||||
rb_exc_raise(rb_errinfo());
|
||||
}
|
||||
|
||||
static GdkColor *
|
||||
rbgdk_rval2gdkcolors(VALUE value, long *n)
|
||||
{
|
||||
struct rbgdk_rval2gdkcolors_args args;
|
||||
|
||||
args.ary = rb_ary_to_ary(value);
|
||||
args.n = RARRAY_LEN(args.ary);
|
||||
args.result = g_new(GdkColor, args.n + 1);
|
||||
|
||||
rb_rescue(rbgdk_rval2gdkcolors_body, (VALUE)&args,
|
||||
rbgdk_rval2gdkcolors_rescue, (VALUE)&args);
|
||||
|
||||
if (n != NULL)
|
||||
*n = args.n;
|
||||
|
||||
return args.result;
|
||||
}
|
||||
|
||||
#define RVAL2GDKCOLORS(value, n) rbgdk_rval2gdkcolors(value, n)
|
||||
|
||||
static VALUE
|
||||
rg_s_palette_to_string(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
VALUE rbcolors;
|
||||
long n;
|
||||
GdkColor *colors;
|
||||
gchar *palette;
|
||||
|
||||
if (argc > 1)
|
||||
rb_scan_args(argc, argv, "*", &rbcolors);
|
||||
else
|
||||
rb_scan_args(argc, argv, "10", &rbcolors);
|
||||
|
||||
colors = RVAL2GDKCOLORS(rbcolors, &n);
|
||||
|
||||
palette = gtk_color_selection_palette_to_string(colors, n);
|
||||
|
||||
g_free(colors);
|
||||
|
||||
return CSTR2RVAL_FREE(palette);
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
static void
|
||||
screen_func(GdkScreen *screen, const GdkColor *colors, gint n_colors)
|
||||
{
|
||||
int i;
|
||||
VALUE func = rb_cvar_get(RG_TARGET_NAMESPACE, rb_intern("__palette_proc__"));
|
||||
VALUE ary = rb_ary_new();
|
||||
for (i = 0; i < n_colors; i++){
|
||||
ary = rb_ary_push(ary, GDKCOLOR2RVAL((GdkColor *)&colors[i]));
|
||||
}
|
||||
if (! NIL_P(func))
|
||||
rb_funcall(func, id_call, 2, GOBJ2RVAL(screen), ary);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_set_change_palette_hook(VALUE self)
|
||||
{
|
||||
VALUE func = rb_block_proc();
|
||||
|
||||
rb_cv_set(RG_TARGET_NAMESPACE, "__palette_proc__", func);
|
||||
gtk_color_selection_set_change_palette_with_screen_hook(
|
||||
(GtkColorSelectionChangePaletteWithScreenFunc)screen_func);
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Don't implement them.
|
||||
GtkColorSelectionChangePaletteFunc gtk_color_selection_set_change_palette_hook
|
||||
(GtkColorSelectionChangePaletteFunc func);
|
||||
void (*GtkColorSelectionChangePaletteWithScreenFunc)
|
||||
(GdkScreen *screen,
|
||||
const GdkColor *colors,
|
||||
gint n_colors);
|
||||
*/
|
||||
|
||||
void
|
||||
Init_gtk_color_selection(VALUE mGtk)
|
||||
{
|
||||
RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_COLOR_SELECTION, "ColorSelection", mGtk);
|
||||
|
||||
RG_DEF_METHOD(initialize, 0);
|
||||
RG_DEF_METHOD(previous_alpha, 0);
|
||||
RG_DEF_METHOD(set_previous_alpha, 1);
|
||||
RG_DEF_METHOD(set_previous_color, 1);
|
||||
RG_DEF_METHOD(previous_color, 0);
|
||||
RG_DEF_METHOD_P(adjusting, 0);
|
||||
|
||||
RG_DEF_SMETHOD(palette_to_string, -1);
|
||||
RG_DEF_SMETHOD(palette_from_string, 1);
|
||||
|
||||
#if GTK_CHECK_VERSION(2,2,0)
|
||||
RG_DEF_SMETHOD(set_change_palette_hook, 0);
|
||||
#endif
|
||||
|
||||
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Masao Mutoh
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cColorSelectionDialog
|
||||
#define _SELF(s) (GTK_COLOR_SELECTION_DIALOG(RVAL2GOBJ(s)))
|
||||
|
||||
static VALUE
|
||||
rg_initialize(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE title;
|
||||
rb_scan_args(argc, argv, "01", &title);
|
||||
RBGTK_INITIALIZE(self, gtk_color_selection_dialog_new(NIL_P(title) ? NULL : RVAL2CSTR(title)));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_color_selection_dialog(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_COLOR_SELECTION_DIALOG,
|
||||
"ColorSelectionDialog", mGtk);
|
||||
|
||||
RG_DEF_METHOD(initialize, -1);
|
||||
#if GTK_CHECK_VERSION(2, 14, 0)
|
||||
/* NOTE: Backward compatibility */
|
||||
RG_DEF_ALIAS("colorsel", "color_selection");
|
||||
#endif
|
||||
}
|
||||
119
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcombo.c
Normal file
119
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcombo.c
Normal file
@@ -0,0 +1,119 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#ifndef GTK_DISABLE_DEPRECATED /* Since 2.4 */
|
||||
|
||||
#define RG_TARGET_NAMESPACE cCombo
|
||||
|
||||
static VALUE
|
||||
rg_set_popdown_strings(VALUE self, VALUE ary)
|
||||
{
|
||||
int i;
|
||||
GList *glist = NULL;
|
||||
|
||||
Check_Type(ary, T_ARRAY);
|
||||
for (i=0; i<RARRAY_LEN(ary); i++) {
|
||||
glist = g_list_append(glist, (gpointer)RVAL2CSTR(RARRAY_PTR(ary)[i]));
|
||||
}
|
||||
gtk_combo_set_popdown_strings(GTK_COMBO(RVAL2GOBJ(self)), glist);
|
||||
g_list_free(glist);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_initialize(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE ary;
|
||||
GtkWidget* widget = NULL;
|
||||
|
||||
rb_scan_args(argc, argv, "01", &ary);
|
||||
widget = gtk_combo_new();
|
||||
|
||||
RBGTK_INITIALIZE(self, widget);
|
||||
|
||||
if (! NIL_P(ary)){
|
||||
rg_set_popdown_strings(self, ary);
|
||||
}
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
combo_set_val_in_list(VALUE self, VALUE val, VALUE ok)
|
||||
{
|
||||
gtk_combo_set_value_in_list(GTK_COMBO(RVAL2GOBJ(self)),
|
||||
RVAL2CBOOL(val), RVAL2CBOOL(ok));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_use_arrows(VALUE self, VALUE val)
|
||||
{
|
||||
gtk_combo_set_use_arrows(GTK_COMBO(RVAL2GOBJ(self)),
|
||||
RVAL2CBOOL(val));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_use_arrows_always(VALUE self, VALUE val)
|
||||
{
|
||||
gtk_combo_set_use_arrows_always(GTK_COMBO(RVAL2GOBJ(self)),
|
||||
RVAL2CBOOL(val));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_disable_activate(VALUE self)
|
||||
{
|
||||
gtk_combo_disable_activate(GTK_COMBO(RVAL2GOBJ(self)));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_entry(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(GTK_COMBO(RVAL2GOBJ(self))->entry);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_combo(VALUE mGtk)
|
||||
{
|
||||
#ifndef GTK_DISABLE_DEPRECATED /* Since 2.4 */
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_COMBO, "Combo", mGtk);
|
||||
|
||||
RG_DEF_METHOD(initialize, -1);
|
||||
G_REPLACE_SET_PROPERTY(RG_TARGET_NAMESPACE, "value_in_list", combo_set_val_in_list, 2);
|
||||
RG_DEF_METHOD(set_use_arrows, 1);
|
||||
RG_DEF_METHOD(set_use_arrows_always, 1);
|
||||
RG_DEF_METHOD(set_popdown_strings, 1);
|
||||
RG_DEF_METHOD(disable_activate, 0);
|
||||
|
||||
RG_DEF_METHOD(entry, 0);
|
||||
|
||||
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
||||
#endif
|
||||
}
|
||||
163
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcombobox.c
Normal file
163
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcombobox.c
Normal file
@@ -0,0 +1,163 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2004 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
|
||||
#define RG_TARGET_NAMESPACE cComboBox
|
||||
#define _SELF(self) (GTK_COMBO_BOX(RVAL2GOBJ(self)))
|
||||
#define RVAL2WIDGET(w) (GTK_WIDGET(RVAL2GOBJ(w)))
|
||||
|
||||
static VALUE
|
||||
rg_initialize(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE model_or_false;
|
||||
GtkWidget* widget;
|
||||
|
||||
rb_scan_args(argc, argv, "01", &model_or_false);
|
||||
|
||||
if (rb_obj_is_kind_of(model_or_false, GTYPE2CLASS(GTK_TYPE_TREE_MODEL))){
|
||||
widget = gtk_combo_box_new_with_model(GTK_TREE_MODEL(RVAL2GOBJ(model_or_false)));
|
||||
} else if (NIL_P(model_or_false) || TYPE(model_or_false) == T_TRUE){
|
||||
widget = gtk_combo_box_new_text();
|
||||
} else if (TYPE(model_or_false) == T_FALSE){
|
||||
widget = gtk_combo_box_new();
|
||||
} else {
|
||||
rb_raise(rb_eArgError, "invalid 2nd argument %s (except true/false or Gtk::TreeModel)",
|
||||
rb_class2name(CLASS_OF(model_or_false)));
|
||||
}
|
||||
|
||||
RBGTK_INITIALIZE(self, widget);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_active_iter(VALUE self)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
VALUE val = Qnil;
|
||||
gboolean ret = gtk_combo_box_get_active_iter(_SELF(self), &iter);
|
||||
if (ret){
|
||||
iter.user_data3 = (gpointer)gtk_combo_box_get_model(_SELF(self));
|
||||
val = BOXED2RVAL(&iter, GTK_TYPE_TREE_ITER);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_active_iter(VALUE self, VALUE iter)
|
||||
{
|
||||
gtk_combo_box_set_active_iter(_SELF(self), RVAL2GTKTREEITER(iter));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_append_text(VALUE self, VALUE text)
|
||||
{
|
||||
gtk_combo_box_append_text(_SELF(self), RVAL2CSTR(text));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_insert_text(VALUE self, VALUE position, VALUE text)
|
||||
{
|
||||
gtk_combo_box_insert_text(_SELF(self), NUM2INT(position), RVAL2CSTR(text));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_prepend_text(VALUE self, VALUE text)
|
||||
{
|
||||
gtk_combo_box_prepend_text(_SELF(self), RVAL2CSTR(text));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_remove_text(VALUE self, VALUE position)
|
||||
{
|
||||
gtk_combo_box_remove_text(_SELF(self), NUM2INT(position));
|
||||
return self;
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
|
||||
static VALUE
|
||||
rg_active_text(VALUE self)
|
||||
{
|
||||
return CSTR2RVAL_FREE(gtk_combo_box_get_active_text(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_popup_accessible(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gtk_combo_box_get_popup_accessible(_SELF(self)));
|
||||
}
|
||||
|
||||
/* How can I implement this?
|
||||
GtkTreeViewRowSeparatorFunc gtk_combo_box_get_row_separator_func
|
||||
(GtkComboBox *combo_box);
|
||||
*/
|
||||
|
||||
static gboolean
|
||||
row_separator_func(GtkTreeModel *model, GtkTreeIter *iter, gpointer *func)
|
||||
{
|
||||
iter->user_data3 = model;
|
||||
return RVAL2CBOOL(rb_funcall((VALUE)func, id_call, 2, GOBJ2RVAL(model),
|
||||
GTKTREEITER2RVAL(iter)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_row_separator_func(VALUE self)
|
||||
{
|
||||
VALUE func = rb_block_proc();
|
||||
G_RELATIVE(self, func);
|
||||
gtk_combo_box_set_row_separator_func(_SELF(self),
|
||||
(GtkTreeViewRowSeparatorFunc)row_separator_func,
|
||||
(gpointer)func, NULL);
|
||||
return self;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_combobox(VALUE mGtk)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_COMBO_BOX, "ComboBox", mGtk);
|
||||
|
||||
RG_DEF_METHOD(initialize, -1);
|
||||
RG_DEF_METHOD(active_iter, 0);
|
||||
RG_DEF_METHOD(set_active_iter, 1);
|
||||
G_DEF_SETTER(RG_TARGET_NAMESPACE, "active_iter");
|
||||
RG_DEF_METHOD(append_text, 1);
|
||||
RG_DEF_METHOD(insert_text, 2);
|
||||
RG_DEF_METHOD(prepend_text, 1);
|
||||
RG_DEF_METHOD(remove_text, 1);
|
||||
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
RG_DEF_METHOD(active_text, 0);
|
||||
RG_DEF_METHOD(popup_accessible, 0);
|
||||
RG_DEF_METHOD(set_row_separator_func, 0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
62
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcomboboxentry.c
Normal file
62
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcomboboxentry.c
Normal file
@@ -0,0 +1,62 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2004 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
|
||||
#define RG_TARGET_NAMESPACE cComboBoxEntry
|
||||
|
||||
static VALUE
|
||||
rg_initialize(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE model_or_false, text_column;
|
||||
GtkWidget* widget;
|
||||
|
||||
rb_scan_args(argc, argv, "02", &model_or_false, &text_column);
|
||||
|
||||
if (rb_obj_is_kind_of(model_or_false, GTYPE2CLASS(GTK_TYPE_TREE_MODEL))){
|
||||
widget = gtk_combo_box_entry_new_with_model(
|
||||
GTK_TREE_MODEL(RVAL2GOBJ(model_or_false)),
|
||||
NUM2INT(text_column));
|
||||
} else if (NIL_P(model_or_false) || TYPE(model_or_false) == T_TRUE){
|
||||
widget = gtk_combo_box_entry_new_text();
|
||||
} else if (TYPE(model_or_false) == T_FALSE){
|
||||
widget = gtk_combo_box_entry_new();
|
||||
} else {
|
||||
rb_raise(rb_eArgError, "invalid 2nd argument %s (except true/false or Gtk::TreeModel)",
|
||||
rb_class2name(CLASS_OF(model_or_false)));
|
||||
}
|
||||
|
||||
RBGTK_INITIALIZE(self, widget);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_comboboxentry(VALUE mGtk)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_COMBO_BOX_ENTRY, "ComboBoxEntry", mGtk);
|
||||
RG_DEF_METHOD(initialize, -1);
|
||||
#endif
|
||||
}
|
||||
181
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkconst.c
Normal file
181
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkconst.c
Normal file
@@ -0,0 +1,181 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
/*
|
||||
* constants
|
||||
*/
|
||||
void
|
||||
Init_gtk_const(VALUE mGtk)
|
||||
{
|
||||
/*
|
||||
* version information
|
||||
*/
|
||||
rb_define_const(mGtk, "BINDING_VERSION",
|
||||
rb_ary_new3(3, INT2FIX(RBGTK_MAJOR_VERSION),
|
||||
INT2FIX(RBGTK_MINOR_VERSION),
|
||||
INT2FIX(RBGTK_MICRO_VERSION)));
|
||||
|
||||
rb_define_const(mGtk, "BUILD_VERSION",
|
||||
rb_ary_new3(3, INT2FIX(GTK_MAJOR_VERSION),
|
||||
INT2FIX(GTK_MINOR_VERSION),
|
||||
INT2FIX(GTK_MICRO_VERSION)));
|
||||
|
||||
rb_define_const(mGtk, "VERSION",
|
||||
rb_ary_new3(3, INT2FIX(gtk_major_version),
|
||||
INT2FIX(gtk_minor_version),
|
||||
INT2FIX(gtk_micro_version)));
|
||||
rb_define_const(mGtk, "MAJOR_VERSION", INT2FIX(gtk_major_version));
|
||||
rb_define_const(mGtk, "MINOR_VERSION", INT2FIX(gtk_minor_version));
|
||||
rb_define_const(mGtk, "MICRO_VERSION", INT2FIX(gtk_micro_version));
|
||||
rb_define_const(mGtk, "BINARY_AGE", INT2FIX(gtk_binary_age));
|
||||
rb_define_const(mGtk, "INTERFACE_AGE", INT2FIX(gtk_interface_age));
|
||||
|
||||
/*
|
||||
* standard enumeration
|
||||
*/
|
||||
|
||||
/* GtkAccelFlags */
|
||||
G_DEF_CLASS(GTK_TYPE_ACCEL_FLAGS, "AccelFlags", mGtk);
|
||||
G_DEF_CONSTANTS(mGtk, GTK_TYPE_ACCEL_FLAGS, "GTK_");
|
||||
|
||||
/* GtkAnchorType */
|
||||
G_DEF_CLASS(GTK_TYPE_ANCHOR_TYPE, "AnchorType", mGtk);
|
||||
G_DEF_CONSTANTS(mGtk, GTK_TYPE_ANCHOR_TYPE, "GTK_");
|
||||
|
||||
/* GtkAttachOptions */
|
||||
G_DEF_CLASS(GTK_TYPE_ATTACH_OPTIONS, "AttachOptions", mGtk);
|
||||
G_DEF_CONSTANTS(mGtk, GTK_TYPE_ATTACH_OPTIONS, "GTK_");
|
||||
|
||||
/* GtkCornerType */
|
||||
G_DEF_CLASS(GTK_TYPE_CORNER_TYPE, "CornerType", mGtk);
|
||||
G_DEF_CONSTANTS(mGtk, GTK_TYPE_CORNER_TYPE, "GTK_");
|
||||
|
||||
/* GtkDeleteType */
|
||||
G_DEF_CLASS(GTK_TYPE_DELETE_TYPE, "DeleteType", mGtk);
|
||||
G_DEF_CONSTANTS(mGtk, GTK_TYPE_DELETE_TYPE, "GTK_");
|
||||
|
||||
/* GtkDirectionType */
|
||||
G_DEF_CLASS(GTK_TYPE_DIRECTION_TYPE, "DirectionType", mGtk);
|
||||
G_DEF_CONSTANTS(mGtk, GTK_TYPE_DIRECTION_TYPE, "GTK_");
|
||||
|
||||
/* GtkExpanderStyle */
|
||||
G_DEF_CLASS(GTK_TYPE_EXPANDER_STYLE, "ExpanderStyle", mGtk);
|
||||
G_DEF_CONSTANTS(mGtk, GTK_TYPE_EXPANDER_STYLE, "GTK_");
|
||||
|
||||
/* GtkJustification */
|
||||
G_DEF_CLASS(GTK_TYPE_JUSTIFICATION, "Justification", mGtk);
|
||||
G_DEF_CONSTANTS(mGtk, GTK_TYPE_JUSTIFICATION, "GTK_");
|
||||
|
||||
/* GtkMessageType */
|
||||
G_DEF_CLASS(GTK_TYPE_MESSAGE_TYPE, "MessageType", mGtk);
|
||||
G_DEF_CONSTANTS(mGtk, GTK_TYPE_MESSAGE_TYPE, "GTK_MESSAGE_");
|
||||
|
||||
/* GtkMetricType */
|
||||
G_DEF_CLASS(GTK_TYPE_METRIC_TYPE, "MetricType", mGtk);
|
||||
G_DEF_CONSTANTS(mGtk, GTK_TYPE_METRIC_TYPE, "GTK_");
|
||||
|
||||
/* GtkMovementStep */
|
||||
G_DEF_CLASS(GTK_TYPE_MOVEMENT_STEP, "MovementStep", mGtk);
|
||||
G_DEF_CONSTANTS(mGtk, GTK_TYPE_MOVEMENT_STEP, "GTK_");
|
||||
|
||||
/* GtkOrientation */
|
||||
G_DEF_CLASS(GTK_TYPE_ORIENTATION, "Orientation", mGtk);
|
||||
G_DEF_CONSTANTS(mGtk, GTK_TYPE_ORIENTATION, "GTK_");
|
||||
|
||||
/* GtkPackType */
|
||||
G_DEF_CLASS(GTK_TYPE_PACK_TYPE, "PackType", mGtk);
|
||||
G_DEF_CONSTANTS(mGtk, GTK_TYPE_PACK_TYPE, "GTK_");
|
||||
|
||||
/* GtkPathPriorityType */
|
||||
G_DEF_CLASS(GTK_TYPE_PATH_PRIORITY_TYPE, "PathPriorityType", mGtk);
|
||||
G_DEF_CONSTANTS(mGtk, GTK_TYPE_PATH_PRIORITY_TYPE, "GTK_");
|
||||
|
||||
/* GtkPathType */
|
||||
G_DEF_CLASS(GTK_TYPE_PATH_TYPE, "PathType", mGtk);
|
||||
G_DEF_CONSTANTS(mGtk, GTK_TYPE_PATH_TYPE, "GTK_");
|
||||
|
||||
/* GtkPolicyType */
|
||||
G_DEF_CLASS(GTK_TYPE_POLICY_TYPE, "PolicyType", mGtk);
|
||||
G_DEF_CONSTANTS(mGtk, GTK_TYPE_POLICY_TYPE, "GTK_");
|
||||
|
||||
/* GtkPositionType */
|
||||
G_DEF_CLASS(GTK_TYPE_POSITION_TYPE, "PositionType", mGtk);
|
||||
G_DEF_CONSTANTS(mGtk, GTK_TYPE_POSITION_TYPE, "GTK_");
|
||||
|
||||
/* GtkReliefStyle */
|
||||
G_DEF_CLASS(GTK_TYPE_RELIEF_STYLE, "ReliefStyle", mGtk);
|
||||
G_DEF_CONSTANTS(mGtk, GTK_TYPE_RELIEF_STYLE, "GTK_");
|
||||
|
||||
/* GtkResizeMode */
|
||||
G_DEF_CLASS(GTK_TYPE_RESIZE_MODE, "ResizeMode", mGtk);
|
||||
G_DEF_CONSTANTS(mGtk, GTK_TYPE_RESIZE_MODE, "GTK_");
|
||||
|
||||
/* GtkResponseType */
|
||||
G_DEF_CLASS(GTK_TYPE_RESPONSE_TYPE, "ResponseType", mGtk);
|
||||
G_DEF_CONSTANTS(mGtk, GTK_TYPE_RESPONSE_TYPE, "GTK_");
|
||||
|
||||
/* GtkScrollStep */
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
G_DEF_CLASS(GTK_TYPE_SCROLL_STEP, "ScrollStep", mGtk);
|
||||
G_DEF_CONSTANTS(mGtk, GTK_TYPE_SCROLL_STEP, "GTK_");
|
||||
#endif
|
||||
|
||||
/* GtkScrollType */
|
||||
G_DEF_CLASS(GTK_TYPE_SCROLL_TYPE, "ScrollType", mGtk);
|
||||
G_DEF_CONSTANTS(mGtk, GTK_TYPE_SCROLL_TYPE, "GTK_");
|
||||
|
||||
/* GtkSelectionMode */
|
||||
G_DEF_CLASS(GTK_TYPE_SELECTION_MODE, "SelectionMode", mGtk);
|
||||
G_DEF_CONSTANTS(mGtk, GTK_TYPE_SELECTION_MODE, "GTK_");
|
||||
|
||||
/* GtkShadowType */
|
||||
G_DEF_CLASS(GTK_TYPE_SHADOW_TYPE, "ShadowType", mGtk);
|
||||
G_DEF_CONSTANTS(mGtk, GTK_TYPE_SHADOW_TYPE, "GTK_");
|
||||
|
||||
/* GtkStateType */
|
||||
G_DEF_CLASS(GTK_TYPE_STATE_TYPE, "StateType", mGtk);
|
||||
G_DEF_CONSTANTS(mGtk, GTK_TYPE_STATE_TYPE, "GTK_");
|
||||
|
||||
/* GtkSubmenuDirection */
|
||||
G_DEF_CLASS(GTK_TYPE_SUBMENU_DIRECTION, "SubmenuDirection", mGtk);
|
||||
G_DEF_CONSTANTS(mGtk, GTK_TYPE_SUBMENU_DIRECTION, "GTK_");
|
||||
|
||||
/* GtkSubmenuPlacement */
|
||||
G_DEF_CLASS(GTK_TYPE_SUBMENU_PLACEMENT, "SubmenuPlacement", mGtk);
|
||||
G_DEF_CONSTANTS(mGtk, GTK_TYPE_SUBMENU_PLACEMENT, "GTK_");
|
||||
|
||||
/* GtkUpdateType */
|
||||
G_DEF_CLASS(GTK_TYPE_UPDATE_TYPE, "UpdateType", mGtk);
|
||||
G_DEF_CONSTANTS(mGtk, GTK_TYPE_UPDATE_TYPE, "GTK_");
|
||||
|
||||
/* GtkVisibility */
|
||||
G_DEF_CLASS(GTK_TYPE_VISIBILITY, "Visibility", mGtk);
|
||||
G_DEF_CONSTANTS(mGtk, GTK_TYPE_VISIBILITY, "GTK_");
|
||||
|
||||
/* GtkSortType */
|
||||
G_DEF_CLASS(GTK_TYPE_SORT_TYPE, "SortType", mGtk);
|
||||
G_DEF_CONSTANTS(mGtk, GTK_TYPE_SORT_TYPE, "GTK_");
|
||||
}
|
||||
783
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcontainer.c
Normal file
783
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcontainer.c
Normal file
@@ -0,0 +1,783 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002-2006 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cContainer
|
||||
#define _SELF(s) (GTK_CONTAINER(RVAL2GOBJ(self)))
|
||||
|
||||
/*
|
||||
We don't need this.
|
||||
#define GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID(object, property_id, pspec)
|
||||
*/
|
||||
|
||||
static VALUE type_to_prop_setter_table;
|
||||
static VALUE type_to_prop_getter_table;
|
||||
|
||||
static VALUE
|
||||
rg_resize_container_p(VALUE self)
|
||||
{
|
||||
return CBOOL2RVAL(GTK_IS_RESIZE_CONTAINER(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_remove(VALUE self, VALUE other)
|
||||
{
|
||||
G_CHILD_REMOVE(self, other);
|
||||
gtk_container_remove(_SELF(self), GTK_WIDGET(RVAL2GOBJ(other)));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_check_resize(VALUE self)
|
||||
{
|
||||
gtk_container_check_resize(_SELF(self));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_each(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE callback;
|
||||
|
||||
rb_scan_args(argc, argv, "01", &callback);
|
||||
if (NIL_P(callback)) {
|
||||
callback = rb_block_proc();
|
||||
}
|
||||
gtk_container_foreach(_SELF(self), exec_callback, (gpointer)callback);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_each_forall(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE callback;
|
||||
|
||||
rb_scan_args(argc, argv, "01", &callback);
|
||||
if (NIL_P(callback)) {
|
||||
callback = rb_block_proc();
|
||||
}
|
||||
gtk_container_forall(_SELF(self), exec_callback, (gpointer)callback);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_children(VALUE self)
|
||||
{
|
||||
return GLIST2ARYF(gtk_container_get_children(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_reallocate_redraws(VALUE self, VALUE needs_redraws)
|
||||
{
|
||||
gtk_container_set_reallocate_redraws(_SELF(self), RVAL2CBOOL(needs_redraws));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_focus_child(VALUE self, VALUE child)
|
||||
{
|
||||
gtk_container_set_focus_child(_SELF(self), GTK_WIDGET(RVAL2GOBJ(child)));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_focus_vadjustment(VALUE self, VALUE adjustment)
|
||||
{
|
||||
gtk_container_set_focus_vadjustment(_SELF(self),
|
||||
NIL_P(adjustment) ? NULL : GTK_ADJUSTMENT(RVAL2GOBJ(adjustment)));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_focus_hadjustment(VALUE self, VALUE adjustment)
|
||||
{
|
||||
gtk_container_set_focus_hadjustment(_SELF(self),
|
||||
NIL_P(adjustment) ? NULL : GTK_ADJUSTMENT(RVAL2GOBJ(adjustment)));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_focus_vadjustment(VALUE self)
|
||||
{
|
||||
GtkAdjustment* adj = gtk_container_get_focus_vadjustment(_SELF(self));
|
||||
return adj ? GOBJ2RVAL(adj) : Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_focus_hadjustment(VALUE self)
|
||||
{
|
||||
GtkAdjustment* adj = gtk_container_get_focus_hadjustment(_SELF(self));
|
||||
return adj ? GOBJ2RVAL(adj) : Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_resize_children(VALUE self)
|
||||
{
|
||||
gtk_container_resize_children(_SELF(self));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_child_type(VALUE self)
|
||||
{
|
||||
return GTYPE2CLASS(gtk_container_child_type(_SELF(self)));
|
||||
}
|
||||
|
||||
/*
|
||||
void gtk_container_child_get (GtkContainer *container,
|
||||
GtkWidget *child,
|
||||
const gchar *first_prop_name,
|
||||
...);
|
||||
void gtk_container_child_set (GtkContainer *container,
|
||||
GtkWidget *child,
|
||||
const gchar *first_prop_name,
|
||||
...);
|
||||
*/
|
||||
|
||||
void
|
||||
rbgtkcontainer_register_child_property_setter(GType gtype, const char *name, RValueToGValueFunc func)
|
||||
{
|
||||
GObjectClass* oclass;
|
||||
GParamSpec* pspec;
|
||||
|
||||
VALUE table = rb_hash_aref(type_to_prop_setter_table, INT2FIX(gtype));
|
||||
if (NIL_P(table)){
|
||||
table = rb_hash_new();
|
||||
rb_hash_aset(type_to_prop_setter_table, INT2FIX(gtype), table);
|
||||
}
|
||||
|
||||
oclass = g_type_class_ref(gtype);
|
||||
pspec = gtk_container_class_find_child_property(oclass, name);
|
||||
|
||||
rb_hash_aset(table, rb_intern(g_param_spec_get_name(pspec)),
|
||||
Data_Wrap_Struct(rb_cData, NULL, NULL, func));
|
||||
|
||||
g_type_class_unref(oclass);
|
||||
}
|
||||
|
||||
void
|
||||
rbgtkcontainer_register_child_property_getter(GType gtype, const char *name, GValueToRValueFunc func)
|
||||
{
|
||||
GObjectClass* oclass;
|
||||
GParamSpec* pspec;
|
||||
|
||||
VALUE table = rb_hash_aref(type_to_prop_getter_table, INT2FIX(gtype));
|
||||
if (NIL_P(table)){
|
||||
table = rb_hash_new();
|
||||
rb_hash_aset(type_to_prop_getter_table, INT2FIX(gtype), table);
|
||||
}
|
||||
|
||||
oclass = g_type_class_ref(gtype);
|
||||
pspec = gtk_container_class_find_child_property(oclass, name);
|
||||
|
||||
rb_hash_aset(table, rb_intern(g_param_spec_get_name(pspec)),
|
||||
Data_Wrap_Struct(rb_cData, NULL, NULL, func));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_child_get_property(VALUE self, VALUE child, VALUE prop_name)
|
||||
{
|
||||
GParamSpec* pspec;
|
||||
const char* name;
|
||||
|
||||
if (SYMBOL_P(prop_name)) {
|
||||
name = rb_id2name(SYM2ID(prop_name));
|
||||
} else {
|
||||
name = RVAL2CSTR(prop_name);
|
||||
}
|
||||
|
||||
pspec = gtk_container_class_find_child_property(
|
||||
G_OBJECT_GET_CLASS(RVAL2GOBJ(self)), name);
|
||||
|
||||
if (!pspec)
|
||||
rb_raise(rb_eArgError, "No such property: %s", name);
|
||||
else {
|
||||
GValueToRValueFunc getter = NULL;
|
||||
GValue gval = G_VALUE_INIT;
|
||||
VALUE ret;
|
||||
|
||||
{
|
||||
VALUE table = rb_hash_aref(type_to_prop_getter_table,
|
||||
INT2FIX(pspec->owner_type));
|
||||
if (!NIL_P(table)){
|
||||
VALUE obj = rb_hash_aref(table, rb_intern(g_param_spec_get_name(pspec)));
|
||||
if (!NIL_P(obj))
|
||||
Data_Get_Struct(obj, void, getter);
|
||||
}
|
||||
}
|
||||
g_value_init(&gval, G_PARAM_SPEC_VALUE_TYPE(pspec));
|
||||
gtk_container_child_get_property(GTK_CONTAINER(RVAL2GOBJ(self)),
|
||||
GTK_WIDGET(RVAL2GOBJ(child)),
|
||||
name , &gval);
|
||||
ret = getter ? getter(&gval) : GVAL2RVAL(&gval);
|
||||
|
||||
G_CHILD_ADD(child, ret);
|
||||
|
||||
g_value_unset(&gval);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_child_set_property(VALUE self, VALUE child, VALUE prop_name, VALUE val)
|
||||
{
|
||||
GParamSpec* pspec;
|
||||
const char* name;
|
||||
|
||||
if (SYMBOL_P(prop_name)) {
|
||||
name = rb_id2name(SYM2ID(prop_name));
|
||||
} else {
|
||||
name = RVAL2CSTR(prop_name);
|
||||
}
|
||||
|
||||
pspec = gtk_container_class_find_child_property(
|
||||
G_OBJECT_GET_CLASS(RVAL2GOBJ(self)), name);
|
||||
|
||||
if (!pspec)
|
||||
rb_raise(rb_eArgError, "No such property: %s", name);
|
||||
else {
|
||||
RValueToGValueFunc setter = NULL;
|
||||
GValue gval = G_VALUE_INIT;
|
||||
g_value_init(&gval, G_PARAM_SPEC_VALUE_TYPE(pspec));
|
||||
|
||||
{
|
||||
VALUE table = rb_hash_aref(type_to_prop_setter_table,
|
||||
INT2FIX(pspec->owner_type));
|
||||
if (!NIL_P(table)){
|
||||
VALUE obj = rb_hash_aref(table, rb_intern(g_param_spec_get_name(pspec)));
|
||||
if (!NIL_P(obj))
|
||||
Data_Get_Struct(obj, void, setter);
|
||||
}
|
||||
}
|
||||
|
||||
if (setter)
|
||||
setter(val, &gval);
|
||||
else {
|
||||
if (!NIL_P(val))
|
||||
rbgobj_rvalue_to_gvalue(val, &gval);
|
||||
}
|
||||
|
||||
G_CHILD_ADD(child, val);
|
||||
|
||||
gtk_container_child_set_property(GTK_CONTAINER(RVAL2GOBJ(self)),
|
||||
GTK_WIDGET(RVAL2GOBJ(child)), name, &gval);
|
||||
|
||||
g_value_unset(&gval);
|
||||
return self;
|
||||
}
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_add(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE other, properties;
|
||||
GtkWidget *child;
|
||||
|
||||
rb_scan_args(argc, argv, "11", &other, &properties);
|
||||
|
||||
child = GTK_WIDGET(RVAL2GOBJ(other));
|
||||
gtk_widget_freeze_child_notify(child);
|
||||
gtk_container_add(_SELF(self), child);
|
||||
|
||||
G_CHILD_ADD(self, other);
|
||||
|
||||
if (child->parent && (! NIL_P(properties))){
|
||||
int i;
|
||||
VALUE ary;
|
||||
GObject* obj;
|
||||
|
||||
Check_Type(properties, T_HASH);
|
||||
ary = rb_funcall(properties, rb_intern("to_a"), 0);
|
||||
obj = RVAL2GOBJ(self);
|
||||
|
||||
for (i = 0; i < RARRAY_LEN(ary); i++) {
|
||||
rg_child_set_property(self, other,
|
||||
RARRAY_PTR(RARRAY_PTR(ary)[i])[0],
|
||||
RARRAY_PTR(RARRAY_PTR(ary)[i])[1]);
|
||||
}
|
||||
}
|
||||
gtk_widget_thaw_child_notify(child);
|
||||
return self;
|
||||
}
|
||||
|
||||
/*
|
||||
void gtk_container_child_get_valist (GtkContainer *container,
|
||||
GtkWidget *child,
|
||||
const gchar *first_property_name,
|
||||
va_list var_args);
|
||||
void gtk_container_child_set_valist (GtkContainer *container,
|
||||
GtkWidget *child,
|
||||
const gchar *first_property_name,
|
||||
va_list var_args);
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
rg_propagate_expose(VALUE self, VALUE child, VALUE event)
|
||||
{
|
||||
gtk_container_propagate_expose(_SELF(self), GTK_WIDGET(RVAL2GOBJ(child)),
|
||||
(GdkEventExpose *)RVAL2GEV(event));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_focus_chain(VALUE self)
|
||||
{
|
||||
gboolean ret;
|
||||
GList *glist = NULL;
|
||||
ret = gtk_container_get_focus_chain(_SELF(self), &glist);
|
||||
return GLIST2ARYF(glist);
|
||||
}
|
||||
|
||||
struct rval2gtkwidgetglist_args {
|
||||
VALUE ary;
|
||||
long n;
|
||||
GList *result;
|
||||
};
|
||||
|
||||
static VALUE
|
||||
rbg_rval2gtkwidgetglist_body(VALUE value)
|
||||
{
|
||||
long i;
|
||||
struct rval2gtkwidgetglist_args *args = (struct rval2gtkwidgetglist_args *)value;
|
||||
|
||||
for (i = 0; i < args->n; i++)
|
||||
args->result = g_list_append(args->result, GTK_WIDGET(RVAL2GOBJ(RARRAY_PTR(args->ary)[i])));
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static G_GNUC_NORETURN VALUE
|
||||
rbg_rval2gtkwidgetglist_rescue(VALUE value)
|
||||
{
|
||||
g_list_free(((struct rval2gtkwidgetglist_args *)value)->result);
|
||||
|
||||
rb_exc_raise(rb_errinfo());
|
||||
}
|
||||
|
||||
static GList *
|
||||
rbg_rval2gtkwidgetglist(VALUE value)
|
||||
{
|
||||
struct rval2gtkwidgetglist_args args;
|
||||
|
||||
args.ary = rb_ary_to_ary(value);
|
||||
args.n = RARRAY_LEN(args.ary);
|
||||
args.result = NULL;
|
||||
|
||||
rb_rescue(rbg_rval2gtkwidgetglist_body, (VALUE)&args,
|
||||
rbg_rval2gtkwidgetglist_rescue, (VALUE)&args);
|
||||
|
||||
return args.result;
|
||||
}
|
||||
|
||||
#define RVAL2GTKWIDGETGLIST(value) rbg_rval2gtkwidgetglist(value)
|
||||
|
||||
static VALUE
|
||||
rg_set_focus_chain(VALUE self, VALUE rbfocusable_widgets)
|
||||
{
|
||||
GtkContainer *container = _SELF(self);
|
||||
GList *focusable_widgets = RVAL2GTKWIDGETGLIST(rbfocusable_widgets);
|
||||
|
||||
gtk_container_set_focus_chain(container, focusable_widgets);
|
||||
|
||||
g_list_free(focusable_widgets);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_unset_focus_chain(VALUE self)
|
||||
{
|
||||
gtk_container_unset_focus_chain(_SELF(self));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_child_property(VALUE self, VALUE property_name)
|
||||
{
|
||||
GObjectClass* oclass;
|
||||
const char* name;
|
||||
GParamSpec* prop;
|
||||
VALUE result;
|
||||
|
||||
if (SYMBOL_P(property_name)) {
|
||||
name = rb_id2name(SYM2ID(property_name));
|
||||
} else {
|
||||
name = RVAL2CSTR(property_name);
|
||||
}
|
||||
|
||||
oclass = g_type_class_ref(CLASS2GTYPE(self));
|
||||
|
||||
prop = gtk_container_class_find_child_property(oclass, name);
|
||||
if (!prop){
|
||||
g_type_class_unref(oclass);
|
||||
rb_raise(rb_eNameError, "no such property: %s", name);
|
||||
}
|
||||
|
||||
result = GOBJ2RVAL(prop);
|
||||
g_type_class_unref(oclass);
|
||||
return result;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_install_child_property(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
const RGObjClassInfo* cinfo = rbgobj_lookup_class(self);
|
||||
GtkContainerClass* gclass;
|
||||
VALUE spec, prop_id;
|
||||
GParamSpec* pspec;
|
||||
|
||||
rb_scan_args(argc, argv, "11", &spec, &prop_id);
|
||||
|
||||
pspec = G_PARAM_SPEC(RVAL2GOBJ(spec));
|
||||
|
||||
if (cinfo->klass != self)
|
||||
rb_raise(rb_eTypeError, "%s isn't registerd class",
|
||||
rb_class2name(self));
|
||||
|
||||
gclass = GTK_CONTAINER_CLASS(g_type_class_ref(cinfo->gtype));
|
||||
gtk_container_class_install_child_property(gclass,
|
||||
NIL_P(prop_id) ? 1 : NUM2UINT(prop_id),
|
||||
pspec);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_child_properties(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
GObjectClass* oclass = g_type_class_ref(CLASS2GTYPE(self));
|
||||
guint n_properties;
|
||||
GParamSpec** props;
|
||||
VALUE inherited_too;
|
||||
VALUE ary;
|
||||
guint i;
|
||||
|
||||
if (rb_scan_args(argc, argv, "01", &inherited_too) == 0)
|
||||
inherited_too = Qtrue;
|
||||
|
||||
props = gtk_container_class_list_child_properties(oclass, &n_properties);
|
||||
|
||||
ary = rb_ary_new();
|
||||
for (i = 0; i < n_properties; i++){
|
||||
if (RVAL2CBOOL(inherited_too)
|
||||
|| GTYPE2CLASS(props[i]->owner_type) == self)
|
||||
rb_ary_push(ary, CSTR2RVAL(props[i]->name));
|
||||
}
|
||||
g_free(props);
|
||||
g_type_class_unref(oclass);
|
||||
return ary;
|
||||
}
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
static VALUE proc_mod_eval;
|
||||
static GQuark q_ruby_setter;
|
||||
static GQuark q_ruby_getter;
|
||||
|
||||
static VALUE
|
||||
cont_initialize(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE params_hash;
|
||||
GObject* gobj;
|
||||
|
||||
rb_scan_args(argc, argv, "01", ¶ms_hash);
|
||||
|
||||
if (!NIL_P(params_hash))
|
||||
Check_Type(params_hash, T_HASH);
|
||||
|
||||
gobj = rbgobj_gobject_new(RVAL2GTYPE(self), params_hash);
|
||||
|
||||
RBGTK_INITIALIZE(self, gobj);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
// FIXME: use rb_protect
|
||||
static void
|
||||
get_prop_func(GObject* object,
|
||||
G_GNUC_UNUSED guint property_id,
|
||||
GValue* value,
|
||||
GParamSpec* pspec)
|
||||
{
|
||||
ID ruby_getter = (ID)g_param_spec_get_qdata(pspec, q_ruby_getter);
|
||||
if (!ruby_getter) {
|
||||
gchar* name = g_strdup(g_param_spec_get_name(pspec));
|
||||
gchar* p;
|
||||
for (p = name; *p; p++) {
|
||||
if (*p == '-')
|
||||
*p = '_';
|
||||
}
|
||||
ruby_getter = rb_intern(name);
|
||||
g_param_spec_set_qdata(pspec, q_ruby_getter, (gpointer)ruby_getter);
|
||||
g_free(name);
|
||||
}
|
||||
|
||||
{
|
||||
VALUE ret = rb_funcall(GOBJ2RVAL(object), ruby_getter, 0);
|
||||
rbgobj_rvalue_to_gvalue(ret, value);
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: use rb_protect
|
||||
static void
|
||||
set_prop_func(GObject* object,
|
||||
G_GNUC_UNUSED guint property_id,
|
||||
const GValue* value,
|
||||
GParamSpec* pspec)
|
||||
{
|
||||
ID ruby_setter = (ID)g_param_spec_get_qdata(pspec, q_ruby_setter);
|
||||
if (!ruby_setter) {
|
||||
gchar* name = g_strconcat(g_param_spec_get_name(pspec), "=", NULL);
|
||||
gchar* p;
|
||||
for (p = name; *p; p++) {
|
||||
if (*p == '-')
|
||||
*p = '_';
|
||||
}
|
||||
ruby_setter = rb_intern(name);
|
||||
g_param_spec_set_qdata(pspec, q_ruby_setter, (gpointer)ruby_setter);
|
||||
g_free(name);
|
||||
}
|
||||
|
||||
rb_funcall(GOBJ2RVAL(object), ruby_setter, 1, GVAL2RVAL(value));
|
||||
}
|
||||
|
||||
// FIXME: use rb_protect
|
||||
static void
|
||||
get_child_prop_func(GtkContainer *container,
|
||||
GtkWidget *child,
|
||||
G_GNUC_UNUSED guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ID ruby_getter = (ID)g_param_spec_get_qdata(pspec, q_ruby_getter);
|
||||
if (!ruby_getter) {
|
||||
gchar* name = g_strconcat("get_", g_param_spec_get_name(pspec), NULL);
|
||||
gchar* p;
|
||||
for (p = name; *p; p++) {
|
||||
if (*p == '-')
|
||||
*p = '_';
|
||||
}
|
||||
ruby_getter = rb_intern(name);
|
||||
g_param_spec_set_qdata(pspec, q_ruby_getter, (gpointer)ruby_getter);
|
||||
g_free(name);
|
||||
}
|
||||
|
||||
{
|
||||
VALUE ret = rb_funcall(GOBJ2RVAL(container), ruby_getter, 1, GOBJ2RVAL(child));
|
||||
rbgobj_rvalue_to_gvalue(ret, value);
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: use rb_protect
|
||||
static void
|
||||
set_child_prop_func(GtkContainer *container,
|
||||
GtkWidget *child,
|
||||
G_GNUC_UNUSED guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ID ruby_setter = (ID)g_param_spec_get_qdata(pspec, q_ruby_setter);
|
||||
if (!ruby_setter) {
|
||||
gchar* name = g_strconcat("set_", g_param_spec_get_name(pspec), NULL);
|
||||
gchar* p;
|
||||
for (p = name; *p; p++) {
|
||||
if (*p == '-')
|
||||
*p = '_';
|
||||
}
|
||||
ruby_setter = rb_intern(name);
|
||||
g_param_spec_set_qdata(pspec, q_ruby_setter, (gpointer)ruby_setter);
|
||||
g_free(name);
|
||||
}
|
||||
|
||||
rb_funcall(GOBJ2RVAL(container), ruby_setter, 2, GOBJ2RVAL(child), GVAL2RVAL(value));
|
||||
}
|
||||
|
||||
// FIXME: use rb_protect
|
||||
static void
|
||||
class_init_func(gpointer g_class, G_GNUC_UNUSED gpointer class_data)
|
||||
{
|
||||
GObjectClass* g_class1 = G_OBJECT_CLASS(g_class);
|
||||
GtkContainerClass* g_class2 = GTK_CONTAINER_CLASS(g_class);
|
||||
|
||||
g_class1->set_property = set_prop_func;
|
||||
g_class1->get_property = get_prop_func;
|
||||
|
||||
g_class2->set_child_property = set_child_prop_func;
|
||||
g_class2->get_child_property = get_child_prop_func;
|
||||
|
||||
#if 0
|
||||
VALUE class_init_proc = (VALUE)class_data;
|
||||
rb_funcall(proc_mod_eval, rb_intern("call"), 2,
|
||||
GTYPE2CLASS(G_TYPE_FROM_CLASS(g_class)), class_init_proc);
|
||||
#endif
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_s_type_register(int argc, VALUE* argv, VALUE self)
|
||||
{
|
||||
VALUE type_name, flags;
|
||||
volatile VALUE class_init_proc = Qnil;
|
||||
GType parent_type;
|
||||
GTypeInfo* info;
|
||||
|
||||
rb_scan_args(argc, argv, "03", &type_name, &info, &flags);
|
||||
|
||||
/* TODO: Replace this copy-paste job with the real thing in glib2. */
|
||||
{
|
||||
const RGObjClassInfo* cinfo = rbgobj_lookup_class(self);
|
||||
if (cinfo->klass == self)
|
||||
rb_raise(rb_eTypeError, "already registered");
|
||||
}
|
||||
|
||||
{
|
||||
VALUE superclass = rb_funcall(self, rb_intern("superclass"), 0);
|
||||
const RGObjClassInfo* cinfo = CLASS2CINFO(superclass);
|
||||
if (cinfo->klass != superclass)
|
||||
rb_raise(rb_eTypeError, "super class must be registered to GLib");
|
||||
parent_type = cinfo->gtype;
|
||||
}
|
||||
|
||||
if (NIL_P(type_name)){
|
||||
VALUE s = rb_funcall(self, rb_intern("name"), 0);
|
||||
|
||||
if (strlen(StringValuePtr(s)) == 0)
|
||||
rb_raise(rb_eTypeError, "can't determine type name");
|
||||
|
||||
type_name = rb_funcall(
|
||||
rb_eval_string("lambda{|x| x.gsub(/::/,'') }"),
|
||||
rb_intern("call"), 1, s);
|
||||
}
|
||||
|
||||
{
|
||||
GTypeQuery query;
|
||||
g_type_query(parent_type, &query);
|
||||
|
||||
/* TODO: This should not require a new GTypeInfo, as GLib doesn't
|
||||
* retain a copy. */
|
||||
info = g_new0(GTypeInfo, 1);
|
||||
info->class_size = query.class_size;
|
||||
info->base_init = NULL;
|
||||
info->base_finalize = NULL;
|
||||
info->class_init = class_init_func;
|
||||
info->class_finalize = NULL;
|
||||
info->class_data = (gpointer)class_init_proc;
|
||||
info->instance_size = query.instance_size;
|
||||
info->n_preallocs = 0;
|
||||
info->instance_init = NULL;
|
||||
info->value_table = NULL;
|
||||
}
|
||||
|
||||
{
|
||||
GType type = g_type_register_static(parent_type,
|
||||
StringValuePtr(type_name),
|
||||
info,
|
||||
NIL_P(flags) ? 0 : NUM2INT(flags));
|
||||
G_RELATIVE(self, class_init_proc);
|
||||
|
||||
rbgobj_register_class(self, type, TRUE, TRUE);
|
||||
|
||||
{
|
||||
RGObjClassInfo* cinfo = (RGObjClassInfo*)rbgobj_lookup_class(self);
|
||||
cinfo->flags |= RBGOBJ_DEFINED_BY_RUBY;
|
||||
}
|
||||
|
||||
{
|
||||
GType parent = g_type_parent(type);
|
||||
const RGObjClassInfo* cinfo = GTYPE2CINFO(parent);
|
||||
VALUE m = rb_define_module_under(self, RubyGtkContainerHookModule);
|
||||
|
||||
if (! (cinfo->flags & RBGOBJ_DEFINED_BY_RUBY)) {
|
||||
rb_define_method(m, "initialize", cont_initialize, -1);
|
||||
}
|
||||
|
||||
rb_include_module(self, m);
|
||||
}
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
}
|
||||
/**********************************************************************/
|
||||
|
||||
static void
|
||||
cont_mark_callback(GtkWidget *w, G_GNUC_UNUSED gpointer data)
|
||||
{
|
||||
rbgobj_gc_mark_instance(w);
|
||||
}
|
||||
|
||||
static void
|
||||
cont_mark(void* p)
|
||||
{
|
||||
gtk_container_forall(GTK_CONTAINER(p), cont_mark_callback, NULL);
|
||||
}
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
void
|
||||
Init_gtk_container(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE;
|
||||
|
||||
RG_TARGET_NAMESPACE = G_DEF_CLASS_WITH_GC_FUNC(GTK_TYPE_CONTAINER, "Container",
|
||||
mGtk, cont_mark, NULL);
|
||||
RG_DEF_METHOD_P(resize_container, 0);
|
||||
RG_DEF_METHOD(add, -1);
|
||||
RG_DEF_ALIAS("<<", "add");
|
||||
RG_DEF_METHOD(remove, 1);
|
||||
RG_DEF_METHOD(check_resize, 0);
|
||||
RG_DEF_METHOD(each, -1);
|
||||
RG_DEF_METHOD(each_forall, -1);
|
||||
RG_DEF_METHOD(children, 0);
|
||||
RG_DEF_METHOD(set_reallocate_redraws, 1);
|
||||
RG_DEF_METHOD(set_focus_child, 1);
|
||||
RG_DEF_METHOD(set_focus_vadjustment, 1);
|
||||
RG_DEF_METHOD(set_focus_hadjustment, 1);
|
||||
RG_DEF_METHOD(focus_vadjustment, 0);
|
||||
RG_DEF_METHOD(focus_hadjustment, 0);
|
||||
RG_DEF_METHOD(resize_children, 0);
|
||||
RG_DEF_METHOD(child_type, 0);
|
||||
RG_DEF_METHOD(child_get_property, 2);
|
||||
RG_DEF_METHOD(child_set_property, 3);
|
||||
RG_DEF_METHOD(propagate_expose, 2);
|
||||
RG_DEF_METHOD(focus_chain, 0);
|
||||
RG_DEF_METHOD(set_focus_chain, 1);
|
||||
RG_DEF_METHOD(unset_focus_chain, 0);
|
||||
RG_DEF_SMETHOD(child_property, 1);
|
||||
RG_DEF_SMETHOD(child_properties, -1);
|
||||
RG_DEF_SMETHOD(install_child_property, -1);
|
||||
|
||||
q_ruby_getter = g_quark_from_static_string("__ruby_getter");
|
||||
q_ruby_setter = g_quark_from_static_string("__ruby_setter");
|
||||
|
||||
RG_DEF_SMETHOD(type_register, -1);
|
||||
|
||||
rb_global_variable(&proc_mod_eval);
|
||||
proc_mod_eval = rb_eval_string("lambda{|obj,proc| obj.module_eval(&proc)}");
|
||||
|
||||
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
||||
|
||||
rb_global_variable(&type_to_prop_setter_table);
|
||||
rb_global_variable(&type_to_prop_getter_table);
|
||||
type_to_prop_setter_table = rb_hash_new();
|
||||
type_to_prop_getter_table = rb_hash_new();
|
||||
}
|
||||
39
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkconversions.h
Normal file
39
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkconversions.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2008 Ruby-GNOME2 Project Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef _RBGTKCONVERSIONS_H
|
||||
#define _RBGTKCONVERSIONS_H
|
||||
|
||||
#include <rbgobject.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include <rbgdkconversions.h>
|
||||
|
||||
#define GTKTREEPATH2RVAL(t) (BOXED2RVAL(t, GTK_TYPE_TREE_PATH))
|
||||
#define RVAL2GTKTREEPATH(t) ((GtkTreePath *)RVAL2BOXED(t, GTK_TYPE_TREE_PATH))
|
||||
#define GTKTREEITER2RVAL(i) (BOXED2RVAL(i, GTK_TYPE_TREE_ITER))
|
||||
#define RVAL2GTKTREEITER(i) ((GtkTreeIter *)RVAL2BOXED(i, GTK_TYPE_TREE_ITER))
|
||||
|
||||
#define RVAL2GTKSTATETYPE(type) (RVAL2GENUM(type, GTK_TYPE_STATE_TYPE))
|
||||
#define GTKRCFLAGS2RVAL(flags) (GFLAGS2RVAL(flags, GTK_TYPE_RC_FLAGS))
|
||||
#define RVAL2GTKRCFLAGS(flags) (RVAL2GFLAGS(flags, GTK_TYPE_RC_FLAGS))
|
||||
|
||||
#endif /* _RBGTKCONVERSIONS_H */
|
||||
111
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcurve.c
Normal file
111
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkcurve.c
Normal file
@@ -0,0 +1,111 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cCurve
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self)
|
||||
{
|
||||
RBGTK_INITIALIZE(self, gtk_curve_new());
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_reset(VALUE self)
|
||||
{
|
||||
gtk_curve_reset(GTK_CURVE(RVAL2GOBJ(self)));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_gamma(VALUE self, VALUE gamma)
|
||||
{
|
||||
gtk_curve_set_gamma(GTK_CURVE(RVAL2GOBJ(self)), NUM2DBL(gamma));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_range(VALUE self, VALUE min_x, VALUE max_x, VALUE min_y, VALUE max_y)
|
||||
{
|
||||
gtk_curve_set_range(GTK_CURVE(RVAL2GOBJ(self)),
|
||||
NUM2DBL(min_x), NUM2DBL(max_x),
|
||||
NUM2DBL(min_y), NUM2DBL(max_y));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_vector(VALUE self, VALUE length, VALUE vector)
|
||||
{
|
||||
gint len = NUM2INT(length);
|
||||
gfloat *c_vec;
|
||||
gint i;
|
||||
|
||||
c_vec = ALLOCA_N(gfloat, len);
|
||||
for (i = 0; i < len; i++)
|
||||
c_vec[i] = NUM2DBL(RARRAY_PTR(vector)[i]);
|
||||
|
||||
gtk_curve_set_vector(GTK_CURVE(RVAL2GOBJ(self)), len, c_vec);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_get_vector(VALUE self, VALUE length)
|
||||
{
|
||||
gint len = NUM2INT(length);
|
||||
gfloat *c_vec;
|
||||
gint i;
|
||||
VALUE vector = rb_ary_new2(len);
|
||||
|
||||
c_vec = ALLOCA_N(gfloat, len);
|
||||
gtk_curve_get_vector(GTK_CURVE(RVAL2GOBJ(self)), len, c_vec);
|
||||
for (i = 0; i < len; i++)
|
||||
rb_ary_push(vector, rb_float_new(c_vec[i]));
|
||||
|
||||
return vector;
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_curve(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_CURVE, "Curve", mGtk);
|
||||
|
||||
RG_DEF_METHOD(initialize, 0);
|
||||
RG_DEF_METHOD(reset, 0);
|
||||
RG_DEF_METHOD(set_gamma, 1);
|
||||
G_DEF_SETTER(RG_TARGET_NAMESPACE, "gamma");
|
||||
RG_DEF_METHOD(set_range, 4);
|
||||
RG_DEF_METHOD(set_vector, 2);
|
||||
G_DEF_SETTER(RG_TARGET_NAMESPACE, "vector");
|
||||
/* NOTE: For backwards compatability. */
|
||||
RG_DEF_METHOD(get_vector, 1);
|
||||
RG_DEF_ALIAS("vector", "get_vector");
|
||||
|
||||
/* GtkCurveType(from standard constants) */
|
||||
|
||||
G_DEF_CLASS(GTK_TYPE_CURVE_TYPE, "Type", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_CURVE_TYPE, "GTK_CURVE_");
|
||||
}
|
||||
259
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkdialog.c
Normal file
259
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkdialog.c
Normal file
@@ -0,0 +1,259 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002-2005 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cDialog
|
||||
#define _SELF(self) (GTK_DIALOG(RVAL2GOBJ(self)))
|
||||
|
||||
static ID id_to_a;
|
||||
|
||||
static VALUE
|
||||
rg_add_button(VALUE self, VALUE button_text, VALUE response_id)
|
||||
{
|
||||
const gchar *name;
|
||||
if (SYMBOL_P(button_text)) {
|
||||
name = rb_id2name(SYM2ID(button_text));
|
||||
} else {
|
||||
name = RVAL2CSTR(button_text);
|
||||
}
|
||||
return GOBJ2RVAL(gtk_dialog_add_button(_SELF(self), name,
|
||||
RVAL2GENUM(response_id, GTK_TYPE_RESPONSE_TYPE)));
|
||||
}
|
||||
|
||||
struct rbgtk_dialog_add_buttons_internal_args {
|
||||
VALUE self;
|
||||
VALUE buttons;
|
||||
};
|
||||
|
||||
static VALUE
|
||||
rbgtk_dialog_add_buttons_internal_body(VALUE value)
|
||||
{
|
||||
struct rbgtk_dialog_add_buttons_internal_args *args = (struct rbgtk_dialog_add_buttons_internal_args *)value;
|
||||
long i;
|
||||
long n = RARRAY_LEN(args->buttons);
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
VALUE button = rb_ary_to_ary(RARRAY_PTR(args->buttons)[i]);
|
||||
|
||||
rg_add_button(args->self, RARRAY_PTR(button)[0], RARRAY_PTR(button)[1]);
|
||||
}
|
||||
|
||||
return args->self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rbgtk_dialog_add_buttons_internal_ensure(VALUE value)
|
||||
{
|
||||
g_object_thaw_notify(RVAL2GOBJ(((struct rbgtk_dialog_add_buttons_internal_args *)value)->self));
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
VALUE
|
||||
rbgtk_dialog_add_buttons_internal(VALUE self, VALUE buttons)
|
||||
{
|
||||
struct rbgtk_dialog_add_buttons_internal_args args = { self, buttons };
|
||||
|
||||
if (NIL_P(RARRAY_PTR(buttons)[0]))
|
||||
return self;
|
||||
|
||||
g_object_freeze_notify(RVAL2GOBJ(self));
|
||||
|
||||
return rb_ensure(rbgtk_dialog_add_buttons_internal_body, (VALUE)&args,
|
||||
rbgtk_dialog_add_buttons_internal_ensure, (VALUE)&args);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_add_buttons(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE button_ary;
|
||||
rb_scan_args(argc, argv, "*", &button_ary);
|
||||
rbgtk_dialog_add_buttons_internal(self, button_ary);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_initialize(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE title, parent, flags, button_ary;
|
||||
rb_scan_args(argc, argv, "03*", &title, &parent, &flags, &button_ary);
|
||||
|
||||
if (argc == 0){
|
||||
RBGTK_INITIALIZE(self, gtk_dialog_new());
|
||||
} else if (argc > 0){
|
||||
GtkDialog* dialog = GTK_DIALOG(g_object_new(GTK_TYPE_DIALOG, NULL));
|
||||
GtkDialogFlags gflags = NIL_P(flags) ? 0 : RVAL2GFLAGS(flags, GTK_TYPE_DIALOG_FLAGS);
|
||||
if (! NIL_P(title))
|
||||
gtk_window_set_title(GTK_WINDOW(dialog), RVAL2CSTR(title));
|
||||
if (! NIL_P(parent))
|
||||
gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(RVAL2GOBJ(parent)));
|
||||
|
||||
if (gflags & GTK_DIALOG_MODAL)
|
||||
gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
|
||||
if (gflags & GTK_DIALOG_DESTROY_WITH_PARENT)
|
||||
gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE);
|
||||
if (gflags & GTK_DIALOG_NO_SEPARATOR)
|
||||
gtk_dialog_set_has_separator(dialog, FALSE);
|
||||
|
||||
RBGTK_INITIALIZE(self, dialog);
|
||||
if (! NIL_P(button_ary))
|
||||
rbgtk_dialog_add_buttons_internal(self, button_ary);
|
||||
} else {
|
||||
rb_raise(rb_eArgError, "invalid argument number");
|
||||
}
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_run(VALUE self)
|
||||
{
|
||||
if (rb_block_given_p()){
|
||||
VALUE ret = INT2NUM(gtk_dialog_run(_SELF(self)));
|
||||
rb_yield(ret);
|
||||
return ret;
|
||||
} else {
|
||||
return INT2NUM(gtk_dialog_run(_SELF(self)));
|
||||
}
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_response(VALUE self, VALUE response_id)
|
||||
{
|
||||
gtk_dialog_response(_SELF(self), NUM2INT(response_id));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_add_action_widget(VALUE self, VALUE child, VALUE response_id)
|
||||
{
|
||||
gtk_dialog_add_action_widget(_SELF(self), GTK_WIDGET(RVAL2GOBJ(child)),
|
||||
NUM2INT(response_id));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_default_response(VALUE self, VALUE response_id)
|
||||
{
|
||||
gtk_dialog_set_default_response(_SELF(self), NUM2INT(response_id));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_response_sensitive(VALUE self, VALUE response_id, VALUE setting)
|
||||
{
|
||||
gtk_dialog_set_response_sensitive(_SELF(self), NUM2INT(response_id), RVAL2CBOOL(setting));
|
||||
return self;
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
static VALUE
|
||||
rg_s_alternative_dialog_button_order_p(G_GNUC_UNUSED VALUE self, VALUE screen)
|
||||
{
|
||||
gboolean ret = gtk_alternative_dialog_button_order(NIL_P(screen) ? NULL :
|
||||
GDK_SCREEN(RVAL2GOBJ(screen)));
|
||||
return CBOOL2RVAL(ret);
|
||||
}
|
||||
|
||||
/* Use gtk_dialog_set_alternative_button_order_from_array() instead.
|
||||
void gtk_dialog_set_alternative_button_order
|
||||
(GtkDialog *dialog,
|
||||
gint first_response_id,
|
||||
...);
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
rg_set_alternative_button_order(VALUE self, VALUE rbnew_order)
|
||||
{
|
||||
GtkDialog *dialog = _SELF(self);
|
||||
long n;
|
||||
gint *new_order = RVAL2GINTS(rbnew_order, n);
|
||||
|
||||
gtk_dialog_set_alternative_button_order_from_array(dialog, n, new_order);
|
||||
|
||||
g_free(new_order);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
rg_vbox(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(_SELF(self)->vbox);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_action_area(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(_SELF(self)->action_area);
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,8,0)
|
||||
static VALUE
|
||||
rg_get_response(VALUE self, VALUE widget)
|
||||
{
|
||||
return INT2NUM(gtk_dialog_get_response_for_widget(_SELF(self), RVAL2GOBJ(widget)));
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_dialog(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_DIALOG, "Dialog", mGtk);
|
||||
|
||||
id_to_a = rb_intern("to_a");
|
||||
|
||||
RG_DEF_METHOD(initialize, -1);
|
||||
RG_DEF_METHOD(run, 0);
|
||||
RG_DEF_METHOD(response, 1);
|
||||
RG_DEF_METHOD(add_button, 2);
|
||||
RG_DEF_METHOD(add_buttons, -1);
|
||||
RG_DEF_METHOD(add_action_widget, 2);
|
||||
RG_DEF_METHOD(set_default_response, 1);
|
||||
G_DEF_SETTER(RG_TARGET_NAMESPACE, "default_response");
|
||||
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
RG_DEF_SMETHOD_P(alternative_dialog_button_order, 1);
|
||||
RG_DEF_METHOD(set_alternative_button_order, 1);
|
||||
#endif
|
||||
|
||||
RG_DEF_METHOD(set_response_sensitive, 2);
|
||||
RG_DEF_METHOD(vbox, 0);
|
||||
RG_DEF_METHOD(action_area, 0);
|
||||
|
||||
#if GTK_CHECK_VERSION(2,8,0)
|
||||
RG_DEF_METHOD(get_response, 1);
|
||||
RG_DEF_ALIAS("get_response_for_widget", "get_response");
|
||||
#endif
|
||||
|
||||
/* GtkDialogFlags */
|
||||
G_DEF_CLASS(GTK_TYPE_DIALOG_FLAGS, "Flags", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_DIALOG_FLAGS, "GTK_DIALOG_");
|
||||
|
||||
/* GtkResponseType */
|
||||
G_DEF_CLASS(GTK_TYPE_RESPONSE_TYPE, "ResponseType", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_RESPONSE_TYPE, "GTK_");
|
||||
}
|
||||
451
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkdrag.c
Normal file
451
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkdrag.c
Normal file
@@ -0,0 +1,451 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002-2006 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE mDrag
|
||||
|
||||
#define RVAL2DC(c) (GDK_DRAG_CONTEXT(RVAL2GOBJ(c)))
|
||||
#define RVAL2WIDGET(w) (GTK_WIDGET(RVAL2GOBJ(w)))
|
||||
|
||||
struct rbgtk_rval2gtktargetentries_args {
|
||||
VALUE ary;
|
||||
long n;
|
||||
GtkTargetEntry *result;
|
||||
};
|
||||
|
||||
static VALUE
|
||||
rbgtk_rval2gtktargetentries_body(VALUE value)
|
||||
{
|
||||
long i;
|
||||
struct rbgtk_rval2gtktargetentries_args *args = (struct rbgtk_rval2gtktargetentries_args *)value;
|
||||
|
||||
for (i = 0; i < args->n; i++) {
|
||||
VALUE entry = rb_ary_to_ary(RARRAY_PTR(args->ary)[i]);
|
||||
VALUE flags = RARRAY_PTR(entry)[1];
|
||||
VALUE info = RARRAY_PTR(entry)[2];
|
||||
|
||||
args->result[i].target = (gchar *)RVAL2CSTR_ACCEPT_NIL(RARRAY_PTR(entry)[0]);
|
||||
args->result[i].flags = NIL_P(flags) ? 0 : RVAL2GFLAGS(flags, GTK_TYPE_TARGET_FLAGS);
|
||||
args->result[i].info = NIL_P(info) ? 0 : NUM2INT(info);
|
||||
}
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static G_GNUC_NORETURN VALUE
|
||||
rbgtk_rval2gtktargetentries_rescue(VALUE value)
|
||||
{
|
||||
g_free(((struct rbgtk_rval2gtktargetentries_args *)value)->result);
|
||||
|
||||
rb_exc_raise(rb_errinfo());
|
||||
}
|
||||
|
||||
GtkTargetEntry *
|
||||
rbgtk_rval2gtktargetentries(VALUE value, long *n)
|
||||
{
|
||||
struct rbgtk_rval2gtktargetentries_args args;
|
||||
|
||||
args.ary = rb_ary_to_ary(value);
|
||||
args.n = RARRAY_LEN(args.ary);
|
||||
args.result = g_new(GtkTargetEntry, args.n + 1);
|
||||
|
||||
rb_rescue(rbgtk_rval2gtktargetentries_body, (VALUE)&args,
|
||||
rbgtk_rval2gtktargetentries_rescue, (VALUE)&args);
|
||||
|
||||
*n = args.n;
|
||||
|
||||
return args.result;
|
||||
}
|
||||
|
||||
GtkTargetEntry *
|
||||
rbgtk_rval2gtktargetentries_accept_nil(VALUE value, long *n)
|
||||
{
|
||||
if (!NIL_P(value))
|
||||
return rbgtk_rval2gtktargetentries(value, n);
|
||||
|
||||
*n = 0;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GtkTargetEntry *
|
||||
rbgtk_get_target_entry(VALUE targets)
|
||||
{
|
||||
long n;
|
||||
|
||||
return RVAL2GTKTARGETENTRIES(targets, &n);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_dest_set(VALUE self, VALUE rbwidget, VALUE rbflags, VALUE rbtargets, VALUE rbactions)
|
||||
{
|
||||
GtkWidget *widget = RVAL2WIDGET(rbwidget);
|
||||
GtkDestDefaults flags = RVAL2GFLAGS(rbflags, GTK_TYPE_DEST_DEFAULTS);
|
||||
GdkDragAction actions = RVAL2GFLAGS(rbactions, GDK_TYPE_DRAG_ACTION);
|
||||
long n;
|
||||
GtkTargetEntry *targets = RVAL2GTKTARGETENTRIES_ACCEPT_NIL(rbtargets, &n);
|
||||
|
||||
gtk_drag_dest_set(widget, flags, targets, n, actions);
|
||||
|
||||
g_free(targets);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_dest_set_proxy(VALUE self, VALUE widget, VALUE proxy_window, VALUE protocol, VALUE use_coordinates)
|
||||
{
|
||||
gtk_drag_dest_set_proxy(RVAL2WIDGET(widget),
|
||||
GDK_WINDOW(RVAL2GOBJ(proxy_window)),
|
||||
RVAL2GENUM(protocol, GDK_TYPE_DRAG_PROTOCOL),
|
||||
RVAL2CBOOL(use_coordinates));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_dest_unset(VALUE self, VALUE widget)
|
||||
{
|
||||
gtk_drag_dest_unset(RVAL2WIDGET(widget));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_dest_find_target(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
||||
{
|
||||
VALUE widget, context, target_list;
|
||||
GdkAtom ret;
|
||||
rb_scan_args(argc, argv, "21", &widget, &context, &target_list);
|
||||
|
||||
ret = gtk_drag_dest_find_target(
|
||||
RVAL2WIDGET(widget), RVAL2DC(context),
|
||||
NIL_P(target_list) ? NULL : RVAL2BOXED(target_list, GTK_TYPE_TARGET_LIST));
|
||||
|
||||
return BOXED2RVAL(ret, GDK_TYPE_ATOM);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_dest_get_target_list(G_GNUC_UNUSED VALUE self, VALUE widget)
|
||||
{
|
||||
GtkTargetList* list = gtk_drag_dest_get_target_list(RVAL2WIDGET(widget));
|
||||
return BOXED2RVAL(list, GTK_TYPE_TARGET_LIST);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_dest_set_target_list(VALUE self, VALUE widget, VALUE target_list)
|
||||
{
|
||||
gtk_drag_dest_set_target_list(
|
||||
RVAL2WIDGET(widget),
|
||||
NIL_P(target_list) ? NULL : RVAL2BOXED(target_list, GTK_TYPE_TARGET_LIST));
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
static VALUE
|
||||
rg_m_dest_add_text_targets(VALUE self, VALUE widget)
|
||||
{
|
||||
gtk_drag_dest_add_text_targets(RVAL2WIDGET(widget));
|
||||
return self;
|
||||
}
|
||||
static VALUE
|
||||
rg_m_dest_add_image_targets(VALUE self, VALUE widget)
|
||||
{
|
||||
gtk_drag_dest_add_image_targets(RVAL2WIDGET(widget));
|
||||
return self;
|
||||
}
|
||||
static VALUE
|
||||
rg_m_dest_add_uri_targets(VALUE self, VALUE widget)
|
||||
{
|
||||
gtk_drag_dest_add_uri_targets(RVAL2WIDGET(widget));
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GTK_CHECK_VERSION(2,10,0)
|
||||
static VALUE
|
||||
rg_m_dest_set_track_motion(VALUE self, VALUE widget, VALUE track_motion)
|
||||
{
|
||||
gtk_drag_dest_set_track_motion(RVAL2WIDGET(widget), RVAL2CBOOL(track_motion));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_dest_get_track_motion(G_GNUC_UNUSED VALUE self, VALUE widget)
|
||||
{
|
||||
return CBOOL2RVAL(gtk_drag_dest_get_track_motion(RVAL2WIDGET(widget)));
|
||||
}
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
rg_m_finish(VALUE self, VALUE context, VALUE success, VALUE del, VALUE time)
|
||||
{
|
||||
gtk_drag_finish(RVAL2DC(context), RVAL2CBOOL(success),
|
||||
RVAL2CBOOL(del), NUM2UINT(time));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_get_data(VALUE self, VALUE widget, VALUE context, VALUE target, VALUE time)
|
||||
{
|
||||
gtk_drag_get_data(RVAL2WIDGET(widget), RVAL2DC(context), RVAL2ATOM(target),
|
||||
NUM2UINT(time));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_get_source_widget(G_GNUC_UNUSED VALUE self, VALUE context)
|
||||
{
|
||||
return GOBJ2RVAL(gtk_drag_get_source_widget(RVAL2DC(context)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_highlight(VALUE self, VALUE widget)
|
||||
{
|
||||
gtk_drag_highlight(RVAL2WIDGET(widget));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_unhighlight(VALUE self, VALUE widget)
|
||||
{
|
||||
gtk_drag_unhighlight(RVAL2WIDGET(widget));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_begin(G_GNUC_UNUSED VALUE self, VALUE widget, VALUE target_list, VALUE actions, VALUE button, VALUE event)
|
||||
{
|
||||
return GOBJ2RVAL(gtk_drag_begin(RVAL2WIDGET(widget),
|
||||
RVAL2BOXED(target_list, GTK_TYPE_TARGET_LIST),
|
||||
RVAL2GFLAGS(actions, GDK_TYPE_DRAG_ACTION),
|
||||
NUM2INT(button),
|
||||
RVAL2GEV(event)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_set_icon(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE context, obj, pixmap = Qnil, mask = Qnil, hot_x, hot_y;
|
||||
|
||||
if (argc == 6) {
|
||||
rb_scan_args(argc, argv, "60", &context, &obj, &pixmap, &mask, &hot_x, &hot_y);
|
||||
gtk_drag_set_icon_pixmap(RVAL2DC(context),
|
||||
GDK_COLORMAP(RVAL2GOBJ(obj)),
|
||||
GDK_PIXMAP(RVAL2GOBJ(pixmap)),
|
||||
GDK_BITMAP(RVAL2GOBJ(mask)),
|
||||
NUM2INT(hot_x), NUM2INT(hot_y));
|
||||
} else {
|
||||
rb_scan_args(argc, argv, "40", &context, &obj, &hot_x, &hot_y);
|
||||
|
||||
if (TYPE(obj) == T_SYMBOL){
|
||||
gtk_drag_set_icon_stock(RVAL2DC(context), rb_id2name(SYM2ID(obj)),
|
||||
NUM2INT(hot_x), NUM2INT(hot_y));
|
||||
} else if (rb_obj_is_kind_of(obj, GTYPE2CLASS(GTK_TYPE_WIDGET))){
|
||||
gtk_drag_set_icon_widget(RVAL2DC(context), RVAL2WIDGET(obj),
|
||||
NUM2INT(hot_x), NUM2INT(hot_y));
|
||||
} else if (rb_obj_is_kind_of(obj, GTYPE2CLASS(GDK_TYPE_PIXBUF))){
|
||||
gtk_drag_set_icon_pixbuf(RVAL2DC(context),
|
||||
GDK_PIXBUF(RVAL2GOBJ(obj)),
|
||||
NUM2INT(hot_x), NUM2INT(hot_y));
|
||||
} else {
|
||||
rb_raise(rb_eArgError, "invalid argument %s", rb_class2name(CLASS_OF(obj)));
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,8,0)
|
||||
static VALUE
|
||||
rg_m_set_icon_name(VALUE self, VALUE context, VALUE name, VALUE hot_x, VALUE hot_y)
|
||||
{
|
||||
gtk_drag_set_icon_name(RVAL2DC(context), RVAL2CSTR(name), NUM2INT(hot_x), NUM2INT(hot_y));
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
rg_m_set_icon_default(VALUE self, VALUE context)
|
||||
{
|
||||
gtk_drag_set_icon_default(RVAL2DC(context));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_threshold_p(G_GNUC_UNUSED VALUE self, VALUE widget, VALUE start_x, VALUE start_y, VALUE current_x, VALUE current_y)
|
||||
{
|
||||
return CBOOL2RVAL(gtk_drag_check_threshold(RVAL2WIDGET(widget),
|
||||
NUM2INT(start_x), NUM2INT(start_y),
|
||||
NUM2INT(current_x), NUM2INT(current_y)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_source_set(VALUE self, VALUE rbwidget, VALUE rbstart_button_mask, VALUE rbtargets, VALUE rbactions)
|
||||
{
|
||||
GtkWidget *widget = RVAL2WIDGET(rbwidget);
|
||||
GdkModifierType start_button_mask = RVAL2GFLAGS(rbstart_button_mask, GDK_TYPE_MODIFIER_TYPE);
|
||||
GdkDragAction actions = RVAL2GFLAGS(rbactions, GDK_TYPE_DRAG_ACTION);
|
||||
long n;
|
||||
GtkTargetEntry *targets = RVAL2GTKTARGETENTRIES(rbtargets, &n);
|
||||
|
||||
gtk_drag_source_set(widget, start_button_mask, targets, n, actions);
|
||||
|
||||
g_free(targets);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_source_set_icon(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE widget, obj, pixmap = Qnil, mask = Qnil;
|
||||
|
||||
rb_scan_args(argc, argv, "22", &widget, &obj, &pixmap, &mask);
|
||||
if (argc == 4){
|
||||
gtk_drag_source_set_icon(RVAL2WIDGET(widget), GDK_COLORMAP(RVAL2GOBJ(obj)),
|
||||
GDK_PIXMAP(RVAL2GOBJ(pixmap)),
|
||||
GDK_BITMAP(RVAL2GOBJ(mask)));
|
||||
} else if (argc == 2){
|
||||
if (TYPE(obj) == T_SYMBOL){
|
||||
gtk_drag_source_set_icon_stock(RVAL2WIDGET(widget), rb_id2name(SYM2ID(obj)));
|
||||
} else {
|
||||
gtk_drag_source_set_icon_pixbuf(RVAL2WIDGET(widget), GDK_PIXBUF(RVAL2GOBJ(obj)));
|
||||
}
|
||||
} else {
|
||||
rb_raise(rb_eArgError, "need 2 or 4 arguments");
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,8,0)
|
||||
static VALUE
|
||||
rg_m_source_set_icon_name(VALUE self, VALUE widget, VALUE icon_name)
|
||||
{
|
||||
gtk_drag_source_set_icon_name(RVAL2WIDGET(widget), RVAL2CSTR(icon_name));
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
rg_m_source_unset(VALUE self, VALUE widget)
|
||||
{
|
||||
gtk_drag_source_unset(RVAL2WIDGET(widget));
|
||||
return self;
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
static VALUE
|
||||
rg_m_source_set_target_list(VALUE self, VALUE widget, VALUE targetlist)
|
||||
{
|
||||
GtkTargetList* tlist = NULL;
|
||||
if (! NIL_P(targetlist))
|
||||
tlist = (GtkTargetList*)RVAL2BOXED(targetlist, GTK_TYPE_TARGET_LIST);
|
||||
|
||||
gtk_drag_source_set_target_list(RVAL2WIDGET(widget),tlist);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_m_source_get_target_list(G_GNUC_UNUSED VALUE self, VALUE widget)
|
||||
{
|
||||
GtkTargetList* ret = gtk_drag_source_get_target_list(RVAL2WIDGET(widget));
|
||||
return NIL_P(ret) ? Qnil : BOXED2RVAL(ret, GTK_TYPE_TARGET_LIST);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
static VALUE
|
||||
rg_m_source_add_text_targets(VALUE self, VALUE widget)
|
||||
{
|
||||
gtk_drag_source_add_text_targets(RVAL2WIDGET(widget));
|
||||
return self;
|
||||
}
|
||||
static VALUE
|
||||
rg_m_source_add_image_targets(VALUE self, VALUE widget)
|
||||
{
|
||||
gtk_drag_source_add_image_targets(RVAL2WIDGET(widget));
|
||||
return self;
|
||||
}
|
||||
static VALUE
|
||||
rg_m_source_add_uri_targets(VALUE self, VALUE widget)
|
||||
{
|
||||
gtk_drag_source_add_uri_targets(RVAL2WIDGET(widget));
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_drag(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGtk, "Drag");
|
||||
|
||||
RG_DEF_MODFUNC(dest_set, 4);
|
||||
RG_DEF_MODFUNC(dest_set_proxy, 4);
|
||||
RG_DEF_MODFUNC(dest_unset, 1);
|
||||
RG_DEF_MODFUNC(dest_find_target, -1);
|
||||
RG_DEF_MODFUNC(dest_get_target_list, 1);
|
||||
RG_DEF_MODFUNC(dest_set_target_list, 2);
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
RG_DEF_MODFUNC(dest_add_text_targets, 1);
|
||||
RG_DEF_MODFUNC(dest_add_image_targets, 1);
|
||||
RG_DEF_MODFUNC(dest_add_uri_targets, 1);
|
||||
#endif
|
||||
#if GTK_CHECK_VERSION(2,10,0)
|
||||
RG_DEF_MODFUNC(dest_set_track_motion, 2);
|
||||
RG_DEF_MODFUNC(dest_get_track_motion, 1);
|
||||
#endif
|
||||
RG_DEF_MODFUNC(finish, 4);
|
||||
RG_DEF_MODFUNC(get_data, 4);
|
||||
RG_DEF_MODFUNC(get_source_widget, 1);
|
||||
RG_DEF_MODFUNC(highlight, 1);
|
||||
RG_DEF_MODFUNC(unhighlight, 1);
|
||||
RG_DEF_MODFUNC(begin, 5);
|
||||
RG_DEF_MODFUNC_P(threshold, 5);
|
||||
RG_DEF_MODFUNC(set_icon, -1);
|
||||
#if GTK_CHECK_VERSION(2,8,0)
|
||||
RG_DEF_MODFUNC(set_icon_name, 4);
|
||||
#endif
|
||||
RG_DEF_MODFUNC(set_icon_default, 1);
|
||||
RG_DEF_MODFUNC(source_set, 4);
|
||||
RG_DEF_MODFUNC(source_set_icon, -1);
|
||||
#if GTK_CHECK_VERSION(2,8,0)
|
||||
RG_DEF_MODFUNC(source_set_icon_name, 2);
|
||||
#endif
|
||||
RG_DEF_MODFUNC(source_unset, 1);
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
RG_DEF_MODFUNC(source_set_target_list, 2);
|
||||
RG_DEF_MODFUNC(source_get_target_list, 1);
|
||||
#endif
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
RG_DEF_MODFUNC(source_add_text_targets, 1);
|
||||
RG_DEF_MODFUNC(source_add_image_targets, 1);
|
||||
RG_DEF_MODFUNC(source_add_uri_targets, 1);
|
||||
#endif
|
||||
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
||||
|
||||
/* GtkDestDefaults */
|
||||
G_DEF_CLASS(GTK_TYPE_DEST_DEFAULTS, "DestDefaults", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_DEST_DEFAULTS, "GTK_");
|
||||
|
||||
/* GtkTargetFlags */
|
||||
G_DEF_CLASS(GTK_TYPE_TARGET_FLAGS, "TargetFlags", RG_TARGET_NAMESPACE);
|
||||
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_TARGET_FLAGS, "GTK_");
|
||||
}
|
||||
42
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkdrawingarea.c
Normal file
42
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkdrawingarea.c
Normal file
@@ -0,0 +1,42 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cDrawingArea
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self)
|
||||
{
|
||||
RBGTK_INITIALIZE(self, gtk_drawing_area_new());
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_drawing_area(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_DRAWING_AREA, "DrawingArea", mGtk);
|
||||
|
||||
RG_DEF_METHOD(initialize, 0);
|
||||
}
|
||||
151
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkeditable.c
Normal file
151
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkeditable.c
Normal file
@@ -0,0 +1,151 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE mEditable
|
||||
|
||||
static VALUE
|
||||
rg_select_region(VALUE self, VALUE start, VALUE end)
|
||||
{
|
||||
gtk_editable_select_region(GTK_EDITABLE(RVAL2GOBJ(self)),
|
||||
NUM2INT(start), NUM2INT(end));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_selection_bounds(VALUE self)
|
||||
{
|
||||
gint start, end;
|
||||
gboolean ret;
|
||||
ret = gtk_editable_get_selection_bounds(GTK_EDITABLE(RVAL2GOBJ(self)),
|
||||
&start, &end);
|
||||
return ret ? rb_ary_new3(2, INT2NUM(start), INT2NUM(end)) : Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_insert_text(VALUE self, VALUE new_text, VALUE pos)
|
||||
{
|
||||
gint p = NUM2INT(pos);
|
||||
|
||||
StringValue(new_text);
|
||||
gtk_editable_insert_text(GTK_EDITABLE(RVAL2GOBJ(self)),
|
||||
RSTRING_PTR(new_text),
|
||||
RSTRING_LEN(new_text),
|
||||
&p);
|
||||
return INT2NUM(p);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_delete_text(VALUE self, VALUE start, VALUE end)
|
||||
{
|
||||
gtk_editable_delete_text(GTK_EDITABLE(RVAL2GOBJ(self)),
|
||||
NUM2INT(start), NUM2INT(end));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_get_chars(VALUE self, VALUE start, VALUE end)
|
||||
{
|
||||
return CSTR2RVAL_FREE(
|
||||
gtk_editable_get_chars(GTK_EDITABLE(RVAL2GOBJ(self)), /* check s */
|
||||
NUM2INT(start), NUM2INT(end))); /* check start,end */
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_delete_selection(VALUE self)
|
||||
{
|
||||
gtk_editable_delete_selection(GTK_EDITABLE(RVAL2GOBJ(self)));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_position(VALUE self)
|
||||
{
|
||||
return INT2NUM(gtk_editable_get_position(GTK_EDITABLE(RVAL2GOBJ(self))));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_position(VALUE self, VALUE position)
|
||||
{
|
||||
gtk_editable_set_position(GTK_EDITABLE(RVAL2GOBJ(self)),
|
||||
NUM2INT(position));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_editable(VALUE self, VALUE editable)
|
||||
{
|
||||
gtk_editable_set_editable(GTK_EDITABLE(RVAL2GOBJ(self)), RVAL2CBOOL(editable));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_editable_p(VALUE self)
|
||||
{
|
||||
return CBOOL2RVAL(gtk_editable_get_editable(GTK_EDITABLE(RVAL2GOBJ(self))));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_cut_clipboard(VALUE self)
|
||||
{
|
||||
gtk_editable_cut_clipboard(GTK_EDITABLE(RVAL2GOBJ(self)));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_copy_clipboard(VALUE self)
|
||||
{
|
||||
gtk_editable_copy_clipboard(GTK_EDITABLE(RVAL2GOBJ(self)));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_paste_clipboard(VALUE self)
|
||||
{
|
||||
gtk_editable_paste_clipboard(GTK_EDITABLE(RVAL2GOBJ(self)));
|
||||
return self;
|
||||
}
|
||||
|
||||
void
|
||||
Init_gtk_editable(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(GTK_TYPE_EDITABLE, "Editable", mGtk);
|
||||
|
||||
RG_DEF_METHOD(select_region, 2);
|
||||
RG_DEF_METHOD(selection_bounds, 0);
|
||||
RG_DEF_METHOD(insert_text, 2);
|
||||
RG_DEF_METHOD(delete_text, 2);
|
||||
RG_DEF_METHOD(get_chars, 2);
|
||||
RG_DEF_METHOD(delete_selection, 0);
|
||||
RG_DEF_METHOD(position, 0);
|
||||
RG_DEF_METHOD(set_position, 1);
|
||||
RG_DEF_METHOD(set_editable, 1);
|
||||
RG_DEF_METHOD_P(editable, 0);
|
||||
RG_DEF_METHOD(copy_clipboard, 0);
|
||||
RG_DEF_METHOD(cut_clipboard, 0);
|
||||
RG_DEF_METHOD(paste_clipboard, 0);
|
||||
|
||||
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
||||
}
|
||||
117
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkentry.c
Normal file
117
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkentry.c
Normal file
@@ -0,0 +1,117 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2002-2004 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
||||
* Daisuke Kanda,
|
||||
* Hiroshi Igarashi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define RG_TARGET_NAMESPACE cEntry
|
||||
#define _SELF(self) (GTK_ENTRY(RVAL2GOBJ(self)))
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self)
|
||||
{
|
||||
RBGTK_INITIALIZE(self, gtk_entry_new());
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_layout(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gtk_entry_get_layout(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_layout_offsets(VALUE self)
|
||||
{
|
||||
int x, y;
|
||||
gtk_entry_get_layout_offsets(_SELF(self), &x, &y);
|
||||
return rb_ary_new3(2, INT2NUM(x), INT2NUM(y));
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
static VALUE
|
||||
rg_set_completion(VALUE self, VALUE completion)
|
||||
{
|
||||
gtk_entry_set_completion(_SELF(self), GTK_ENTRY_COMPLETION(RVAL2GOBJ(completion)));
|
||||
|
||||
G_CHILD_SET(self, rb_intern("completion"), completion);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_completion(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gtk_entry_get_completion(_SELF(self)));
|
||||
}
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
rg_layout_index_to_text_index(VALUE self, VALUE layout_index)
|
||||
{
|
||||
return INT2NUM(gtk_entry_layout_index_to_text_index(_SELF(self), NUM2INT(layout_index)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_text_index_to_layout_index(VALUE self, VALUE text_index)
|
||||
{
|
||||
return INT2NUM(gtk_entry_text_index_to_layout_index(_SELF(self), NUM2INT(text_index)));
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2, 12, 0)
|
||||
static VALUE
|
||||
rg_cursor_hadjustment(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gtk_entry_get_cursor_hadjustment(_SELF(self)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_cursor_hadjustment(VALUE self, VALUE adjustment)
|
||||
{
|
||||
gtk_entry_set_cursor_hadjustment(_SELF(self), RVAL2GOBJ(adjustment));
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_entry(VALUE mGtk)
|
||||
{
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_ENTRY, "Entry", mGtk);
|
||||
|
||||
RG_DEF_METHOD(initialize, 0);
|
||||
RG_DEF_METHOD(layout, 0);
|
||||
RG_DEF_METHOD(layout_offsets, 0);
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
RG_DEF_METHOD(set_completion, 1);
|
||||
G_DEF_SETTER(RG_TARGET_NAMESPACE, "completion");
|
||||
RG_DEF_METHOD(completion, 0);
|
||||
#endif
|
||||
RG_DEF_METHOD(layout_index_to_text_index, 1);
|
||||
RG_DEF_METHOD(text_index_to_layout_index, 1);
|
||||
|
||||
#if GTK_CHECK_VERSION(2, 12, 0)
|
||||
RG_DEF_METHOD(cursor_hadjustment, 0);
|
||||
RG_DEF_METHOD(set_cursor_hadjustment, 1);
|
||||
G_DEF_SETTER(RG_TARGET_NAMESPACE, "cursor_hadjustment");
|
||||
#endif
|
||||
}
|
||||
138
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkentrycompletion.c
Normal file
138
lib/ruby-gtk2-2.0.2/gtk2/ext/gtk2/rbgtkentrycompletion.c
Normal file
@@ -0,0 +1,138 @@
|
||||
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
||||
* Copyright (C) 2004,2005 Masao Mutoh
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
|
||||
#define RG_TARGET_NAMESPACE cEntryCompletion
|
||||
#define _SELF(self) (GTK_ENTRY_COMPLETION(RVAL2GOBJ(self)))
|
||||
|
||||
static VALUE
|
||||
rg_initialize(VALUE self)
|
||||
{
|
||||
G_INITIALIZE(self, gtk_entry_completion_new());
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_entry(VALUE self)
|
||||
{
|
||||
return GOBJ2RVAL(gtk_entry_completion_get_entry(_SELF(self)));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
entryc_match_func(GtkEntryCompletion *completion, const gchar *key, GtkTreeIter *iter, gpointer func)
|
||||
{
|
||||
iter->user_data3 = gtk_entry_completion_get_model(completion);
|
||||
return RVAL2CBOOL(rb_funcall((VALUE)func, id_call, 3, GOBJ2RVAL(completion),
|
||||
CSTR2RVAL(key), GTKTREEITER2RVAL(iter)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_set_match_func(VALUE self)
|
||||
{
|
||||
VALUE func = rb_block_proc();
|
||||
G_RELATIVE(self, func);
|
||||
gtk_entry_completion_set_match_func(_SELF(self),
|
||||
(GtkEntryCompletionMatchFunc)entryc_match_func,
|
||||
(gpointer)func, NULL);
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_complete(VALUE self)
|
||||
{
|
||||
gtk_entry_completion_complete(_SELF(self));
|
||||
return self;
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
static VALUE
|
||||
rg_insert_prefix(VALUE self)
|
||||
{
|
||||
gtk_entry_completion_insert_prefix(_SELF(self));
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
rg_insert_action_text(VALUE self, VALUE index, VALUE text)
|
||||
{
|
||||
gtk_entry_completion_insert_action_text(_SELF(self), NUM2INT(index), RVAL2CSTR(text));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_insert_action_markup(VALUE self, VALUE index, VALUE markup)
|
||||
{
|
||||
gtk_entry_completion_insert_action_markup(_SELF(self), NUM2INT(index), RVAL2CSTR(markup));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rg_delete_action(VALUE self, VALUE index)
|
||||
{
|
||||
gtk_entry_completion_delete_action(_SELF(self), NUM2INT(index));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
entryc_set_text_column(VALUE self, VALUE column)
|
||||
{
|
||||
gtk_entry_completion_set_text_column(_SELF(self), NUM2INT(column));
|
||||
return self;
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(2, 12, 0)
|
||||
static VALUE
|
||||
rg_completion_prefix(VALUE self)
|
||||
{
|
||||
return CSTR2RVAL(gtk_entry_completion_get_completion_prefix(_SELF(self)));
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_gtk_entry_completion(VALUE mGtk)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(2,4,0)
|
||||
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_ENTRY_COMPLETION, "EntryCompletion", mGtk);
|
||||
|
||||
RG_DEF_METHOD(initialize, 0);
|
||||
RG_DEF_METHOD(entry, 0);
|
||||
RG_DEF_METHOD(set_match_func, 0);
|
||||
RG_DEF_METHOD(complete, 0);
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
RG_DEF_METHOD(insert_prefix, 0);
|
||||
#endif
|
||||
RG_DEF_METHOD(insert_action_text, 2);
|
||||
RG_DEF_METHOD(insert_action_markup, 2);
|
||||
RG_DEF_METHOD(delete_action, 1);
|
||||
|
||||
G_REPLACE_SET_PROPERTY(RG_TARGET_NAMESPACE, "text_column", entryc_set_text_column, 1);
|
||||
|
||||
#if GTK_CHECK_VERSION(2, 12, 0)
|
||||
RG_DEF_METHOD(completion_prefix, 0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user